//go:build integration

package output_test

import (
	"mayhem-party/src/device/output"
	"mayhem-party/src/device/output/key"
	"testing"
	"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) {
	kb := output.NewKeyboard()
	t.Cleanup(kb.Close)

	t.Log("pressing 'd' for 5 seconds")
	kb.Press(key.D)
	for i := 0; i < 5; i++ {
		t.Logf("\t%d...", 5-i)
		time.Sleep(time.Second)
	}
	t.Logf("releasing")
	kb.Press()
}
