30 lines
902 B
Go
30 lines
902 B
Go
// Copyright (c) 2026 Storm Dragon
|
|
// Authors: Storm Dragon, Angus Kola
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package input
|
|
|
|
import "testing"
|
|
|
|
func TestReadAllBindings(t *testing.T) {
|
|
for _, browse := range []bool{false, true} {
|
|
for _, layout := range []KeyboardLayout{DesktopKeyboardLayout, LaptopKeyboardLayout} {
|
|
bindings := DefaultCommandBindings(layout)
|
|
if browse {
|
|
bindings = BrowseCommandBindings(layout)
|
|
}
|
|
symbol := uint32(0xffab)
|
|
modifier := layout == LaptopKeyboardLayout
|
|
if modifier {
|
|
symbol = ';'
|
|
}
|
|
if got := bindings[CommandChord{Symbol: symbol, CthulhuModifier: modifier}]; got != ReadAll {
|
|
t.Fatalf("layout %d browse %v: %q", layout, browse, got)
|
|
}
|
|
if bindings[CommandChord{Symbol: symbol, Modifiers: controlModifier, CthulhuModifier: modifier}] != "" {
|
|
t.Fatal("read all intercepted modified application shortcut")
|
|
}
|
|
}
|
|
}
|
|
}
|