Files

38 lines
1.0 KiB
Go

// Fenrir console screen reader.
// Copyright (c) 2026 Storm Dragon
// SPDX-License-Identifier: GPL-3.0-or-later
package input
import (
"testing"
"git.stormux.org/storm/fenrir/internal/command"
)
func TestEmojiChordBothLayoutsAndReleaseOrders(t *testing.T) {
for _, layout := range []string{"desktop", "laptop"} {
bindings, _, err := Load_bindings([]string{"../../config/keyboard/" + layout + ".toml"})
if err != nil {
t.Fatal(err)
}
for _, release := range [][]uint16{{KeyInsert, KeyCtrl, 18}, {18, KeyCtrl, KeyInsert}} {
router, err := New_router(bindings)
if err != nil {
t.Fatal(err)
}
router.Key(0, KeyInsert, 1, false, false)
router.Key(0, KeyCtrl, 1, false, false)
if got := router.Key(0, 18, 1, false, false); got.Command != command.EmojiMenu || got.Forward {
t.Fatal(layout, got)
}
router.Capture(true)
for _, code := range release {
if got := router.Key(0, code, 0, false, false); got.Forward || got.UI != nil {
t.Fatal("opening chord leaked", layout, got)
}
}
}
}
}