mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-05 20:45:43 +00:00
test(input): cover the Nintendo layout swap being its own inverse
This commit is contained in:
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)) {
|
||||
|
||||
Reference in new issue
Block a user