Reset master to testing content
This commit is contained in:
1 parent
0f2587b719
commit
42afa2a56c
1483 files changed
+145308
-938069
No files matched your search
@@ -0,0 +1,27 @@
|
||||
package preferences
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"git.stormux.org/storm/cthulhu/internal/config"
|
||||
"git.stormux.org/storm/cthulhu/internal/input"
|
||||
)
|
||||
|
||||
func TestSpeechInterruptionValuesRoundTrip(t *testing.T) {
|
||||
settings := config.DefaultSettings()
|
||||
values := FromSettings(settings)
|
||||
values.SpeechInterruption = input.InterruptionSettings{Mode: input.InterruptCustomKeys, Keys: []string{"Tab", "Return"}}
|
||||
merged, err := values.Merge(settings)
|
||||
if err != nil || !reflect.DeepEqual(FromSettings(merged), values) {
|
||||
t.Fatalf("interruption values did not round trip: %+v, %v", merged.SpeechInterruption, err)
|
||||
}
|
||||
values.SpeechInterruption.Keys[0] = "Escape"
|
||||
if merged.SpeechInterruption.Keys[0] != "Tab" {
|
||||
t.Fatal("merged settings share the UI's mutable keys")
|
||||
}
|
||||
values.SpeechInterruption.Keys = nil
|
||||
if _, err := values.Merge(settings); err == nil {
|
||||
t.Fatal("accepted custom mode without keys")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user