fix(input): save per-game copies with the edit, keep failed choices visible and grips clear of the d-pad

This commit is contained in:
Kurt Himebauch committed 2026-11-19 00:11:01 -05:00
1 parent 885c4f0a44
commit 10b21321b7
7 files changed
+45 -18

No files matched your search

@@ -184,4 +184,12 @@ class GamepadGeometryTest {
for ((slot, box) in b) assertTrue("${panel.name}: $slot", box.top >= -.5f && box.bottom <= panel.controlsHeight + .5f)
}
}
@Test fun gripsNeverOverlapTheClustersOnSmallTallPanels() {
for ((w, h) in listOf(360f to 296f, 480f to 300f, 640f to 420f, 900f to 520f)) {
val b = GamepadGeometry.layout(w, h, 1f, grips = true)
for (g in grips.filter { it in b }) for ((slot, box) in b) if (slot != g)
assertFalse("$w x $h: $g overlaps $slot", b.getValue(g).overlaps(box))
}
}
}
@@ -190,9 +190,9 @@ class InputSettingsTest {
compose.setContent { DroidDeckTheme { InputSurfaceDialog("game", { closed = true }, {}, role = InputRole.PRIMARY,
layoutId = layout.id, bindingsId = library.profile("game").binding(InputRole.PRIMARY),
scope = context.getString(R.string.osc_scope_default, layout.name),
split = InputEditorSplit(context.getString(R.string.osc_just_this_game), "Gamepad · saved for Castle Crashers") {
ControlsChoice.newForGame(context, 7, "Castle Crashers", desktop = false)
}) } }
split = InputEditorSplit(context.getString(R.string.osc_just_this_game), "Gamepad · saved for Castle Crashers",
{ lib, layoutId, bindingsId -> ControlsChoice.copyForGame(context, lib, 7, "Castle Crashers", false, layoutId, bindingsId) },
{ bindingsId -> ControlsChoice.useForGame(context, 7, "Castle Crashers", bindingsId) }) ) } }
compose.onNodeWithTag("input-editor-split").performClick()
compose.onNodeWithText("Gamepad · saved for Castle Crashers").assertExists()
compose.onNodeWithTag("input-editor-split").assertDoesNotExist()