Add mnemonic mute controls

This commit is contained in:
Storm Dragon
2026-09-05 00:57:37 -04:00
parent ef19a558d2
commit 97fcde7e96
13 changed files with 232 additions and 17 deletions
+36
View File
@@ -20,6 +20,42 @@ func TestMatchesVolumeResetKeyAcceptsBothTerminalBackspaces(t *testing.T) {
}
}
func TestTreeMuteDefaultMatchesLowerAndUpperM(t *testing.T) {
configured := uiterm.KeyM
for _, ch := range []rune{'m', 'M'} {
if !matchesCharacterHotkey(&configured, ch) {
t.Errorf("%q did not match tree mute binding", ch)
}
}
}
func TestTreeItemDistinguishesMuteKinds(t *testing.T) {
tests := []struct {
name string
user func() *gumble.User
want string
}{
{
name: "local mute",
user: func() *gumble.User {
u := &gumble.User{Name: "Username"}
u.SetLocallyMuted(true)
return u
},
want: "[LOCALLY MUTED] Username",
},
{name: "server mute", user: func() *gumble.User { return &gumble.User{Name: "Username", Muted: true} }, want: "[SERVER MUTED] Username"},
{name: "self mute", user: func() *gumble.User { return &gumble.User{Name: "Username", SelfMuted: true} }, want: "[SELF MUTED] Username"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if got := (TreeItem{User: tt.user()}).String(); got != tt.want {
t.Fatalf("display = %q, want %q", got, tt.want)
}
})
}
}
// Regression: rebuilding the channel tree ranged protocol-owned maps without
// Client.Do while TCP handlers could add or remove users/channels.
func TestTreeItemBuildReadsMapsUnderClientSnapshot(t *testing.T) {