mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-20 05:16:01 +00:00
fix(input): release a mouse Back right click on focus loss and pass nav Back through
Address review: a navigation-bar Back that arrives while an injected mouse Back is held now stays Back instead of releasing the right button early. A held right button is released on pause, focus loss and input-device removal, like the other held Back handling. While the session is suspended or still loading, Back is no longer sent to the guest.
This commit is contained in:
1 parent
57b3623a9a
commit
abb28792e8
3 files changed
+32
-3
No files matched your search
@@ -67,6 +67,24 @@ class MouseBackInputTest {
|
||||
assertTrue(presses.isEmpty())
|
||||
}
|
||||
|
||||
@Test fun navigationBarBackWhileAnInjectedBackIsHeldStaysBack() {
|
||||
input.onKeyEvent(injected(KeyEvent.ACTION_DOWN), toGuest = true)
|
||||
assertFalse(input.onKeyEvent(navigationBar(KeyEvent.ACTION_DOWN), toGuest = true))
|
||||
assertFalse(input.onKeyEvent(navigationBar(KeyEvent.ACTION_UP), toGuest = true))
|
||||
assertEquals(listOf(true), presses)
|
||||
assertTrue(input.onKeyEvent(injected(KeyEvent.ACTION_UP), toGuest = true))
|
||||
assertEquals(listOf(true, false), presses)
|
||||
}
|
||||
|
||||
@Test fun cancelReleasesAHeldPressOnce() {
|
||||
input.onKeyEvent(injected(KeyEvent.ACTION_DOWN), toGuest = true)
|
||||
input.cancel()
|
||||
assertEquals(listOf(true, false), presses)
|
||||
input.onKeyEvent(injected(KeyEvent.ACTION_UP), toGuest = true)
|
||||
input.cancel()
|
||||
assertEquals(listOf(true, false), presses)
|
||||
}
|
||||
|
||||
@Test fun controllerBackStaysBack() {
|
||||
val source = InputDevice.SOURCE_GAMEPAD or InputDevice.SOURCE_KEYBOARD
|
||||
assertFalse(input.onKeyEvent(key(KeyEvent.ACTION_DOWN, source = source), toGuest = true))
|
||||
|
||||
Reference in new issue
Block a user