Simple sync track blending tests.

AnimGraphEditor
Martin Felis 2021-11-16 18:23:04 +01:00
parent 3e1c150345
commit fbac21cf14
2 changed files with 42 additions and 1 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.13) cmake_minimum_required(VERSION 3.13)
cmake_policy(SET CMP0077 NEW) set(CMAKE_POLICY_DEFAULT_CMP0077 NEW)
project(AnimTestbed project(AnimTestbed
VERSION 0.0.1 VERSION 0.0.1
@ -83,6 +83,7 @@ add_executable(runtests)
target_sources(runtests PRIVATE tests/main.cc tests/SyncTrackTests.cc) target_sources(runtests PRIVATE tests/main.cc tests/SyncTrackTests.cc)
target_include_directories( target_include_directories(
runtests runtests
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
${ThirdPartyIncludeDeps} ${ThirdPartyIncludeDeps}
) )

View File

@ -3,3 +3,43 @@
// //
#include "catch.hpp" #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]);
}
}
}