unittest confirms multiple keyboards just werk
parent
1a80e70fc4
commit
c4e1c525d1
|
|
@ -9,11 +9,28 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func TestTwoKeyboards(t *testing.T) {
|
||||||
|
kb1 := output.NewKeyboard()
|
||||||
|
t.Cleanup(kb1.Close)
|
||||||
|
kb2 := output.NewKeyboard()
|
||||||
|
t.Cleanup(kb2.Close)
|
||||||
|
|
||||||
|
kb1.Press(key.D)
|
||||||
|
kb2.Press(key.W)
|
||||||
|
t.Log("pressing 'w' and 'd' over 2 keyboards for 5 seconds")
|
||||||
|
for i := 0; i < 5; i++ {
|
||||||
|
t.Logf("\t%d...", 5-i)
|
||||||
|
time.Sleep(time.Second)
|
||||||
|
}
|
||||||
|
t.Logf("releasing")
|
||||||
|
kb1.Press()
|
||||||
|
kb2.Press()
|
||||||
|
}
|
||||||
|
|
||||||
func TestKeyboardIntegration(t *testing.T) {
|
func TestKeyboardIntegration(t *testing.T) {
|
||||||
kb := output.NewKeyboard()
|
kb := output.NewKeyboard()
|
||||||
t.Cleanup(kb.Close)
|
t.Cleanup(kb.Close)
|
||||||
|
|
||||||
t.Run("hold d", func(t *testing.T) {
|
|
||||||
t.Log("pressing 'd' for 5 seconds")
|
t.Log("pressing 'd' for 5 seconds")
|
||||||
kb.Press(key.D)
|
kb.Press(key.D)
|
||||||
for i := 0; i < 5; i++ {
|
for i := 0; i < 5; i++ {
|
||||||
|
|
@ -22,5 +39,4 @@ func TestKeyboardIntegration(t *testing.T) {
|
||||||
}
|
}
|
||||||
t.Logf("releasing")
|
t.Logf("releasing")
|
||||||
kb.Press()
|
kb.Press()
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue