test(input): a Winlator range past 128 entries is never dropped silently

This commit is contained in:
Kurt Himebauch committed 2026-12-04 15:25:45 -05:00
1 parent 56ac92de85
commit fdcef6c3e5
1 file changed
+10
@@ -149,6 +149,16 @@ class WinlatorLayoutsTest {
assertEquals(1, WinlatorLayouts.import(fits, "x", InputLayoutScreen.MAIN, 1920, 1080)!!.first.elements.size)
}
@Test fun aRangeAfter128EntriesIsNotDroppedSilently() {
val bound = (0 until 64).joinToString(",") { """{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_A"],"scale":0.5,"x":0.5,"y":0.5}""" }
val empty = (0 until 64).joinToString(",") { """{"type":"BUTTON","bindings":["NONE"],"x":0.5,"y":0.5}""" }
val range = """{"type":"RANGE_BUTTON","bindings":["NONE","NONE","NONE","NONE"],"scale":1,"x":0.5,"y":0.1,"range":"FROM_F1_TO_F12"}"""
assertNull(WinlatorLayouts.import("""{"cursorSpeed":1,"elements":[$bound,$empty,$range]}""", "x", InputLayoutScreen.MAIN, 1920, 1080))
val fewer = (0 until 40).joinToString(",") { """{"type":"BUTTON","shape":"CIRCLE","bindings":["KEY_A"],"scale":0.5,"x":0.5,"y":0.5}""" }
val (layout, _) = WinlatorLayouts.import("""{"cursorSpeed":1,"elements":[$fewer,$empty,$range]}""", "x", InputLayoutScreen.MAIN, 1920, 1080)!!
assertEquals(52, layout.elements.size)
}
@Test fun aKeyboardTrackpadKeepsItsKeys() {
val raw = """{"cursorSpeed":1,"elements":[{"type":"TRACKPAD","shape":"CIRCLE","bindings":["KEY_W","KEY_D","KEY_S","KEY_A"],"scale":1,"x":0.5,"y":0.5}]}"""
val (layout, bindings) = WinlatorLayouts.import(raw, "x", InputLayoutScreen.MAIN, 1920, 1080)!!