Стабилизировать ранние сценарии после этапа 3

This commit is contained in:
2026-08-18 17:33:05 +03:00
parent f07d1cf830
commit f06467fcfa
2 changed files with 29 additions and 5 deletions
@@ -49,13 +49,31 @@ public final class GameLifecycleTest {
GameView.AutomationSnapshot resumed = snapshot(instrumentation, view[0]);
assertFalse("Back from the visible pause screen must resume the puzzle", resumed.visiblyPaused());
runOnGame(instrumentation, view[0], false, false, true, false);
sleep(250L);
GameView.AutomationSnapshot moving = waitForMovement(
instrumentation, view[0], resumed.playerX(), 10_000L);
runOnGame(instrumentation, view[0], false, false, false, false);
GameView.AutomationSnapshot moving = snapshot(instrumentation, view[0]);
assertTrue("The resumed simulation must accept movement", moving.playerX() > resumed.playerX() + 20f);
}
}
private static GameView.AutomationSnapshot waitForMovement(
Instrumentation instrumentation, GameView gameView, float startX, long timeoutMillis) {
long deadline = System.currentTimeMillis() + timeoutMillis;
GameView.AutomationSnapshot current = snapshot(instrumentation, gameView);
while (System.currentTimeMillis() < deadline) {
if (current.playerX() > startX + 20f) return current;
sleep(24L);
current = snapshot(instrumentation, gameView);
}
throw new AssertionError(
"The resumed simulation did not move within " + timeoutMillis
+ "ms; startX=" + startX
+ ", finalX=" + current.playerX()
+ ", alive=" + current.playerAlive()
+ ", paused=" + current.visiblyPaused()
+ ", inputActive=" + current.inputActive());
}
private static void createRetainedCorpse(Instrumentation instrumentation, GameView gameView) {
runOnGame(instrumentation, gameView, true, false, true, false);
long deadline = System.currentTimeMillis() + 8_000L;