test(sidecar): unknown animation state must not read as idle

This commit is contained in:
pj committed 2026-08-15 21:23:45 +05:30
1 parent 9ff82b1565
commit 07e8abb9ef
1 file changed
+10 -4
@@ -21,11 +21,17 @@ class IdleDetectionTest {
assertFalse(StubDriverBackend.isAnimationCountIdle("3\n"))
}
@Test fun idleWhenOutputEmpty() {
assertTrue(StubDriverBackend.isAnimationCountIdle(""))
// A dumpsys that said nothing does not say the device is still. Reading
// absence as idle is how a settle returns instantly on a degraded link and
// hands the runner a screen caught mid-animation; the caller bounds its own
// wait, so the cost of being wrong the other way is a wait it already
// budgeted for. The exception path of the same probe already answers false.
@Test fun unreadableOutputIsNotIdle() {
assertFalse(StubDriverBackend.isAnimationCountIdle(""))
assertFalse(StubDriverBackend.isAnimationCountIdle(" \n"))
}
@Test fun idleWhenOutputIsNotANumber() {
assertTrue(StubDriverBackend.isAnimationCountIdle("error: no service"))
@Test fun unparseableOutputIsNotIdle() {
assertFalse(StubDriverBackend.isAnimationCountIdle("error: no service"))
}
}