test(input): cover the Nintendo layout swap being its own inverse

This commit is contained in:
Kurt Himebauch committed 2026-11-10 19:42:47 +00:00
1 parent 213b2f850f
commit 8a01432313
1 file changed
+8
@@ -36,6 +36,14 @@ class NintendoLayoutTest {
assertEquals(2, PadBridge.faceButton(KeyEvent.KEYCODE_BUTTON_Y, true))
}
@Test fun theSwapIsItsOwnInverseSoAnOutsideSwapRestoresTheDevicePositions() {
val keys = listOf(KeyEvent.KEYCODE_BUTTON_A, KeyEvent.KEYCODE_BUTTON_B, KeyEvent.KEYCODE_BUTTON_X, KeyEvent.KEYCODE_BUTTON_Y)
val positional = keys.map { PadBridge.faceButton(it, false) }
val swapped = keys.map { PadBridge.faceButton(it, true) }
assertEquals(listOf(1, 0, 3, 2), swapped)
assertEquals(positional, swapped.map { swapped[it] })
}
@Test fun otherButtonsAreNotFaceButtons() {
for (nintendo in listOf(false, true)) {
for (key in listOf(KeyEvent.KEYCODE_BUTTON_L1, KeyEvent.KEYCODE_BUTTON_START, KeyEvent.KEYCODE_DPAD_UP, KeyEvent.KEYCODE_BUTTON_MODE)) {