mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-06 04:55:44 +00:00
fix(input): keep layout frame edits, bound community downloads and keep DroidDeck exports on their importer
This commit is contained in:
1 parent
d6d47d379f
commit
f94d5179c3
6 files changed
+45
-3
No files matched your search
@@ -107,6 +107,15 @@ class InputLibraryGamesTest {
|
||||
assertEquals(1, hidden.gameChanges(false, "620", InputRole.PRIMARY))
|
||||
}
|
||||
|
||||
@Test fun scaleAndOtherOrientationEditsInAGamesLayoutCount() {
|
||||
val forked = library().withGamePart(false, "620", "Portal 2", InputRole.PRIMARY)
|
||||
val layout = forked.activeLayout(false, InputRole.PRIMARY, "620")!!
|
||||
if (!layout.editable) return
|
||||
assertEquals(1, forked.withLayout(layout.copy(scale = layout.scale * 1.1f)).gameChanges(false, "620", InputRole.PRIMARY))
|
||||
val rotated = layout.copy(rotated = layout.elements.take(1), rotatedAspect = .5f)
|
||||
assertEquals(1, forked.withLayout(rotated).gameChanges(false, "620", InputRole.PRIMARY))
|
||||
}
|
||||
|
||||
@Test fun aGamesCopiesCantBeDeletedFromUnderIt() {
|
||||
val forked = library().withGamePart(false, "620", "Portal 2", InputRole.PHYSICAL)
|
||||
val id = forked.activePart(false, InputRole.PHYSICAL, "620").bindings
|
||||
|
||||
@@ -86,6 +86,15 @@ class WinlatorLayoutsTest {
|
||||
assertEquals("Ctrl l+C", layout.elements[0].name)
|
||||
}
|
||||
|
||||
@Test fun keyOnlyFilesLikeDroidDecksOwnExportsKeepTheirImporter() {
|
||||
assertTrue(WinlatorLayouts.needsConversion(profile))
|
||||
val keysOnly = """{"id":0,"name":"Mine","cursorSpeed":1.5,"elements":[
|
||||
{"type":"BUTTON","shape":"CIRCLE","customColor":0,"bindings":["KEY_SPACE"],"scale":1,"x":0.5,"y":0.5,"swipeable":false},
|
||||
{"type":"D_PAD","shape":"CIRCLE","bindings":["KEY_W","KEY_D","KEY_S","KEY_A"],"scale":1,"x":0.2,"y":0.5}]}"""
|
||||
assertFalse(WinlatorLayouts.needsConversion(keysOnly))
|
||||
assertTrue(WinlatorLayouts.needsConversion("""{"cursorSpeed":1,"elements":[{"type":"TRACKPAD","bindings":["MOUSE_MOVE_UP"]}]}"""))
|
||||
}
|
||||
|
||||
@Test fun rejectsAFileWithNothingToPlace() {
|
||||
assertNull(WinlatorLayouts.import("""{"cursorSpeed":1,"elements":[]}""", "x", InputLayoutScreen.MAIN, 100, 100))
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user