You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.1 KiB
53 lines
1.1 KiB
#include <catch2/catch_test_macros.hpp>
|
|
#include "animation.hpp"
|
|
#include "dinkyecs.hpp"
|
|
#include "config.hpp"
|
|
#include <iostream>
|
|
|
|
using namespace components;
|
|
using namespace textures;
|
|
|
|
TEST_CASE("animation easing tests", "[animation]") {
|
|
Animation anim;
|
|
|
|
anim.easing = ease::NONE;
|
|
float res = anim.twitching();
|
|
REQUIRE(res == 0.0);
|
|
|
|
anim.easing = ease::SINE;
|
|
anim.subframe = 1.0f;
|
|
res = anim.twitching();
|
|
REQUIRE(!std::isnan(res));
|
|
|
|
anim.easing = ease::OUT_CIRC;
|
|
res = anim.twitching();
|
|
REQUIRE(!std::isnan(res));
|
|
|
|
anim.easing = ease::OUT_BOUNCE;
|
|
res = anim.twitching();
|
|
REQUIRE(!std::isnan(res));
|
|
|
|
anim.easing = ease::IN_OUT_BACK;
|
|
res = anim.twitching();
|
|
REQUIRE(!std::isnan(res));
|
|
|
|
anim.easing = ease::FUCKFACE;
|
|
bool throws = false;
|
|
try { anim.twitching(); } catch(...) { throws = true; }
|
|
REQUIRE(throws);
|
|
}
|
|
|
|
|
|
TEST_CASE("animation utility API", "[animation]") {
|
|
textures::init();
|
|
animation::init();
|
|
|
|
auto blanket = textures::get("ritual_crafting_area");
|
|
auto anim = animation::load("ritual_blanket");
|
|
|
|
anim.play();
|
|
|
|
while(animation::apply(anim, blanket)) {
|
|
fmt::println("animation: {}", anim.subframe);
|
|
}
|
|
}
|
|
|