Fix up the animation test so that it works with random timings even if the example has a timing.
This commit is contained in:
parent
dea0607901
commit
bdfc2397e2
4 changed files with 16 additions and 15 deletions
|
|
@ -45,6 +45,7 @@ TEST_CASE("new animation system", "[animation-new]") {
|
|||
textures::init();
|
||||
|
||||
auto anim = animate2::load("assets/animate2.json", "rat_king_boss");
|
||||
anim.sequence.durations = {Random::milliseconds(5, 33), Random::milliseconds(5, 33)};
|
||||
PLAY_TEST(anim);
|
||||
|
||||
bool onLoop_ran = false;
|
||||
|
|
@ -110,7 +111,7 @@ TEST_CASE("confirm frame sequencing works", "[animation-new]") {
|
|||
|
||||
while(anim.playing) {
|
||||
anim.update();
|
||||
// NOTE: possibly find a way to only run apply on frame change?
|
||||
FAKE_RENDER();
|
||||
}
|
||||
|
||||
REQUIRE(loop_ran == true);
|
||||
|
|
@ -139,8 +140,7 @@ TEST_CASE("confirm transition changes work", "[animation-new]") {
|
|||
while(anim.playing) {
|
||||
anim.update();
|
||||
anim.motion(sprite, pos, scale);
|
||||
|
||||
std::this_thread::sleep_for(10ms);
|
||||
FAKE_RENDER();
|
||||
}
|
||||
|
||||
REQUIRE(anim.playing == false);
|
||||
|
|
@ -155,6 +155,6 @@ TEST_CASE("playing with delta time", "[animation-new]") {
|
|||
for(int i = 0; i < 20; i++) {
|
||||
FAKE_RENDER();
|
||||
auto [tick_count, alpha] = timer.commit();
|
||||
fmt::println("tick: {}, alpha: {}", tick_count, alpha);
|
||||
// fmt::println("tick: {}, alpha: {}", tick_count, alpha);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue