Reset master to testing content

This commit is contained in:
Storm Dragon committed 2026-10-25 01:57:54 -04:00
1 parent 0f2587b719
commit 42afa2a56c
1483 files changed
+145308 -938069

No files matched your search

+42
View File
@@ -0,0 +1,42 @@
package input
import "testing"
func TestWindowTitleBindings(t *testing.T) {
for _, layout := range []KeyboardLayout{DesktopKeyboardLayout, LaptopKeyboardLayout} {
for _, modifierFirst := range []bool{false, true} {
symbol, code := keypadEnterKeySymbol, uint16(104)
if layout == LaptopKeyboardLayout {
symbol, code = '/', 61
}
bindings, err := ResolveCommandBindings(layout, true, nil)
if err != nil {
t.Fatal(err)
}
router := NewCommandRouter([]uint32{0xff63}, bindings)
router.Handle(0xff63, 118, 0, true)
if consumed, command := router.Handle(symbol, code, 0, true); !consumed || command != PresentWindowTitle {
t.Fatalf("layout %v title press = %v %q", layout, consumed, command)
}
if consumed, command := router.Handle(symbol, code, 0, true); !consumed || command != "" {
t.Fatalf("title repeat = %v %q", consumed, command)
}
keys := []struct {
symbol uint32
code uint16
}{{symbol, code}, {0xff63, 118}}
if modifierFirst {
keys[0], keys[1] = keys[1], keys[0]
}
for _, key := range keys {
if consumed, command := router.Handle(key.symbol, key.code, 0, false); !consumed || command != "" {
t.Fatalf("title release = %v %q", consumed, command)
}
}
// The command remains available through the preferences binding editor.
if err := ValidateBindingOverrides([]BindingOverride{{Layout: layout, Scope: "global", Command: PresentWindowTitle, Keys: []string{"Cthulhu+Ctrl+t"}}}); err != nil {
t.Fatal(err)
}
}
}
}