mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-18 20:36:04 +00:00
fix(input): stop controller rumble when the device sleeps (#1668)
This commit is contained in:
1 parent
f07dd5eb97
commit
ef9866e423
3 files changed
+26
-1
No files matched your search
@@ -115,6 +115,22 @@ class RumbleComponentTest {
|
||||
assertFalse(pad.vibrating)
|
||||
}
|
||||
|
||||
@Test fun quietingStopsAHeldEffectAndDropsEffectsUntilLifted() {
|
||||
val pad = FakeMotors()
|
||||
rumble.controllerMotors = { pad }
|
||||
activeController(PAD_ID)
|
||||
effect(strong = 40000, weak = 20000, ms = RumbleComponent.HOLD_MS)
|
||||
rumble.quiet(true)
|
||||
assertFalse(pad.vibrating)
|
||||
idle(RumbleComponent.KEEPALIVE_MS * 4 + 100)
|
||||
assertEquals("the keepalive restarted the motors while quiet", 1, pad.played.size)
|
||||
effect(strong = 40000, weak = 20000)
|
||||
assertFalse("an effect played while quiet", pad.vibrating)
|
||||
rumble.quiet(false)
|
||||
effect(strong = 40000, weak = 20000)
|
||||
assertTrue(pad.vibrating)
|
||||
}
|
||||
|
||||
@Test fun aHeldEffectFollowsTheGamesNewStrength() {
|
||||
val pad = FakeMotors()
|
||||
rumble.controllerMotors = { pad }
|
||||
|
||||
Reference in new issue
Block a user