AnimTestbed/tests/SyncTrackTests.cc

46 lines
1.3 KiB
C++

//
// Created by martin on 16.11.21.
//
#include "catch.hpp"
#include "SkinnedMesh.h"
TEST_CASE("SyncTrackBlendSimple", "[SyncTrackBlend]") {
SyncTrack track_A;
track_A.m_num_intervals = 2;
track_A.m_duration = 1.0;
track_A.m_interval_durations[0] = 0.8;
track_A.m_interval_durations[1] = 0.2;
SyncTrack track_B;
track_B.m_num_intervals = 2;
track_B.m_duration = 2.0;
track_B.m_interval_durations[0] = 0.1;
track_B.m_interval_durations[1] = 0.9;
WHEN("Blending two synctracks with weight 0.") {
SyncTrack blended = SyncTrack::Blend(0.f, track_A, track_B);
THEN ("Result must equal track_A") {
REQUIRE(blended.m_duration == track_A.m_duration);
REQUIRE(
blended.m_interval_durations[0] == track_A.m_interval_durations[0]);
REQUIRE(
blended.m_interval_durations[1] == track_A.m_interval_durations[1]);
}
}
WHEN("Blending two synctracks with weight 1.") {
SyncTrack blended = SyncTrack::Blend(1.f, track_A, track_B);
THEN ("Result must equal track_B") {
REQUIRE(blended.m_duration == track_B.m_duration);
REQUIRE(
blended.m_interval_durations[0] == track_B.m_interval_durations[0]);
REQUIRE(
blended.m_interval_durations[1] == track_B.m_interval_durations[1]);
}
}
}