feat: add play mode pause resume and step controls

This commit is contained in:
2026-04-02 19:56:07 +08:00
parent fb15d60be9
commit 1f29dfd611
11 changed files with 270 additions and 3 deletions

View File

@@ -131,4 +131,25 @@ TEST_F(RuntimeLoopTest, PauseSkipsAutomaticTicksUntilStepFrameIsRequested) {
EXPECT_TRUE(loop.IsPaused());
}
TEST_F(RuntimeLoopTest, ResumeRestoresAutomaticTickProgressionAfterPause) {
RuntimeLoop loop({0.02f, 0.1f, 4});
Scene* scene = CreateScene();
GameObject* host = scene->CreateGameObject("Host");
host->AddComponent<RuntimeLoopObserverComponent>(&counters);
loop.Start(scene);
loop.Pause();
loop.Tick(0.025f);
EXPECT_EQ(counters.updateCount, 0);
loop.Resume();
EXPECT_FALSE(loop.IsPaused());
loop.Tick(0.025f);
EXPECT_EQ(counters.startCount, 1);
EXPECT_EQ(counters.fixedUpdateCount, 1);
EXPECT_EQ(counters.updateCount, 1);
EXPECT_EQ(counters.lateUpdateCount, 1);
}
} // namespace