38 lines
895 B
Go
38 lines
895 B
Go
// 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 TestNotificationBindingsInBothLayouts(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 _, trial := range []struct {
|
|
ctrl bool
|
|
id command.ID
|
|
}{
|
|
{false, command.LastNotification}, {true, command.NotificationHistory},
|
|
} {
|
|
router, err := New_router(bindings)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
router.Key(0, KeyInsert, 1, false, false)
|
|
if trial.ctrl {
|
|
router.Key(0, KeyCtrl, 1, false, false)
|
|
}
|
|
if got := router.Key(0, 49, 1, false, false); got.Command != trial.id || got.Forward {
|
|
t.Fatal(layout, trial, got)
|
|
}
|
|
}
|
|
}
|
|
}
|