mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
fix: Steam Touch labels no longer corrupt the controller config (#1017)
This commit is contained in:
1 parent
4f8a7c5596
commit
385af59e9f
3 files changed
+23
-4
No files matched your search
@@ -115,4 +115,20 @@ class SteamTouchBindingsTest {
|
||||
assertEquals("Jump", SteamTouchBindings.bindingAt(reparsed, ref)!!.label)
|
||||
assertNull(SteamTouchBindings.rewrite(config, SteamTouchBindings.Ref("5", "button_a")) { it })
|
||||
}
|
||||
|
||||
@Test
|
||||
fun labelsDropQuotesBackslashesCommasAndControls() {
|
||||
assertEquals("a b c d e", SteamTouchBindings.cleanLabel("a\"b\\c,d\n e"))
|
||||
assertEquals(32, SteamTouchBindings.cleanLabel("x".repeat(40)).length)
|
||||
val b = SteamTouchBindings.Binding("key_press SPACE", "Ju\"mp", "", "", "")
|
||||
assertEquals("Ju mp", SteamTouchBindings.parse(b.compose()).label)
|
||||
val comma = SteamTouchBindings.Binding("key_press SPACE", "Jump,Run", "icon", "#FFFFFF", "")
|
||||
assertEquals(SteamTouchBindings.Binding("key_press SPACE", "Jump Run", "icon", "#FFFFFF", ""), SteamTouchBindings.parse(comma.compose()))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun labelsAreCutAtACharacterBoundary() {
|
||||
val label = SteamTouchBindings.cleanLabel("a".repeat(31) + "🎮" + "b")
|
||||
assertEquals("a".repeat(31) + "🎮", label)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user