diff options
author | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-08 17:32:11 +0100 |
---|---|---|
committer | WBoerenkamps <wrj.boerenkamps@student.avans.nl> | 2024-12-08 17:32:11 +0100 |
commit | cc1b36f4f0a20695bcfc5c16c853cb32312fe70c (patch) | |
tree | 17c68e571f80d7d2ce39da99002608fff35f6f5a /src/test/LoopManagerTest.cpp | |
parent | 3467c96eff775fccb24a6ecd7c15a7f42660a7ff (diff) |
added scaled fixed delta time
Diffstat (limited to 'src/test/LoopManagerTest.cpp')
-rw-r--r-- | src/test/LoopManagerTest.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/test/LoopManagerTest.cpp b/src/test/LoopManagerTest.cpp index f73605e..55ccbb3 100644 --- a/src/test/LoopManagerTest.cpp +++ b/src/test/LoopManagerTest.cpp @@ -45,6 +45,28 @@ TEST_F(LoopManagerTest, FixedUpdate) { // Test finished } +TEST_F(LoopManagerTest, ScaledFixedUpdate) { + // Arrange + test_loop.loop_timer.set_target_fps(60); + + // Set expectations for the mock calls + EXPECT_CALL(test_loop, render).Times(::testing::Exactly(60)); + EXPECT_CALL(test_loop, update).Times(::testing::Exactly(60)); + EXPECT_CALL(test_loop, fixed_update).Times(::testing::Exactly(50)); + + // Start the loop in a separate thread + std::thread loop_thread([&]() { test_loop.start(); }); + + // Let the loop run for exactly 1 second + std::this_thread::sleep_for(std::chrono::seconds(1)); + + // Stop the game loop + test_loop.game_running = false; + // Wait for the loop thread to finish + loop_thread.join(); + + // Test finished +} TEST_F(LoopManagerTest, ShutDown) { // Arrange test_loop.loop_timer.set_target_fps(60); |