diff options
author | Silc Renew <tokage.it.lab@gmail.com> | 2023-02-21 11:26:23 +0900 |
---|---|---|
committer | Silc Lizard (Tokage) Renew <61938263+TokageItLab@users.noreply.github.com> | 2023-04-25 01:45:14 +0900 |
commit | fac8a918f97e831de6070377e7f3475071d4ed84 (patch) | |
tree | aa592b2fb0aec86657ee0b5acd92de35a21fb563 /tests | |
parent | 14c582bca81046fdde35e16088ddfd5df0136d56 (diff) | |
download | redot-engine-fac8a918f97e831de6070377e7f3475071d4ed84.tar.gz |
Expose interpolation methods for 3D track in Animation class
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scene/test_animation.h | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/tests/scene/test_animation.h b/tests/scene/test_animation.h index 0e16fc104c..89bf296815 100644 --- a/tests/scene/test_animation.h +++ b/tests/scene/test_animation.h @@ -82,11 +82,11 @@ TEST_CASE("[Animation] Create value track") { CHECK(animation->track_get_key_transition(1, 0) == doctest::Approx(real_t(-1.0))); // This is a value track, so the methods below should return errors. - CHECK(animation->position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); CHECK(animation->bezier_track_interpolate(0, 0.0) == doctest::Approx(0.0)); - CHECK(animation->blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); ERR_PRINT_ON; } @@ -104,22 +104,22 @@ TEST_CASE("[Animation] Create 3D position track") { Vector3 r_interpolation; - CHECK(animation->position_track_interpolate(0, -0.2, &r_interpolation) == OK); + CHECK(animation->try_position_track_interpolate(0, -0.2, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(0, 1, 2))); - CHECK(animation->position_track_interpolate(0, 0.0, &r_interpolation) == OK); + CHECK(animation->try_position_track_interpolate(0, 0.0, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(0, 1, 2))); - CHECK(animation->position_track_interpolate(0, 0.2, &r_interpolation) == OK); + CHECK(animation->try_position_track_interpolate(0, 0.2, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(1.4, 2.2, 3.2))); - CHECK(animation->position_track_interpolate(0, 0.4, &r_interpolation) == OK); + CHECK(animation->try_position_track_interpolate(0, 0.4, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(2.8, 3.4, 4.4))); - CHECK(animation->position_track_interpolate(0, 0.5, &r_interpolation) == OK); + CHECK(animation->try_position_track_interpolate(0, 0.5, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(3.5, 4, 5))); - CHECK(animation->position_track_interpolate(0, 0.6, &r_interpolation) == OK); + CHECK(animation->try_position_track_interpolate(0, 0.6, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(3.5, 4, 5))); // 3D position tracks always use linear interpolation for performance reasons. @@ -129,10 +129,10 @@ TEST_CASE("[Animation] Create 3D position track") { // This is a 3D position track, so the methods below should return errors. ERR_PRINT_OFF; CHECK(animation->value_track_interpolate(0, 0.0).is_null()); - CHECK(animation->rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); CHECK(animation->bezier_track_interpolate(0, 0.0) == doctest::Approx(0.0)); - CHECK(animation->blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); ERR_PRINT_ON; } @@ -150,22 +150,22 @@ TEST_CASE("[Animation] Create 3D rotation track") { Quaternion r_interpolation; - CHECK(animation->rotation_track_interpolate(0, -0.2, &r_interpolation) == OK); + CHECK(animation->try_rotation_track_interpolate(0, -0.2, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Quaternion(0.403423, 0.259035, 0.73846, 0.47416))); - CHECK(animation->rotation_track_interpolate(0, 0.0, &r_interpolation) == OK); + CHECK(animation->try_rotation_track_interpolate(0, 0.0, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Quaternion(0.403423, 0.259035, 0.73846, 0.47416))); - CHECK(animation->rotation_track_interpolate(0, 0.2, &r_interpolation) == OK); + CHECK(animation->try_rotation_track_interpolate(0, 0.2, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Quaternion(0.336182, 0.30704, 0.751515, 0.477425))); - CHECK(animation->rotation_track_interpolate(0, 0.4, &r_interpolation) == OK); + CHECK(animation->try_rotation_track_interpolate(0, 0.4, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Quaternion(0.266585, 0.352893, 0.759303, 0.477344))); - CHECK(animation->rotation_track_interpolate(0, 0.5, &r_interpolation) == OK); + CHECK(animation->try_rotation_track_interpolate(0, 0.5, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Quaternion(0.231055, 0.374912, 0.761204, 0.476048))); - CHECK(animation->rotation_track_interpolate(0, 0.6, &r_interpolation) == OK); + CHECK(animation->try_rotation_track_interpolate(0, 0.6, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Quaternion(0.231055, 0.374912, 0.761204, 0.476048))); // 3D rotation tracks always use linear interpolation for performance reasons. @@ -175,10 +175,10 @@ TEST_CASE("[Animation] Create 3D rotation track") { // This is a 3D rotation track, so the methods below should return errors. ERR_PRINT_OFF; CHECK(animation->value_track_interpolate(0, 0.0).is_null()); - CHECK(animation->position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); CHECK(animation->bezier_track_interpolate(0, 0.0) == doctest::Approx(real_t(0.0))); - CHECK(animation->blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); ERR_PRINT_ON; } @@ -196,22 +196,22 @@ TEST_CASE("[Animation] Create 3D scale track") { Vector3 r_interpolation; - CHECK(animation->scale_track_interpolate(0, -0.2, &r_interpolation) == OK); + CHECK(animation->try_scale_track_interpolate(0, -0.2, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(0, 1, 2))); - CHECK(animation->scale_track_interpolate(0, 0.0, &r_interpolation) == OK); + CHECK(animation->try_scale_track_interpolate(0, 0.0, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(0, 1, 2))); - CHECK(animation->scale_track_interpolate(0, 0.2, &r_interpolation) == OK); + CHECK(animation->try_scale_track_interpolate(0, 0.2, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(1.4, 2.2, 3.2))); - CHECK(animation->scale_track_interpolate(0, 0.4, &r_interpolation) == OK); + CHECK(animation->try_scale_track_interpolate(0, 0.4, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(2.8, 3.4, 4.4))); - CHECK(animation->scale_track_interpolate(0, 0.5, &r_interpolation) == OK); + CHECK(animation->try_scale_track_interpolate(0, 0.5, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(3.5, 4, 5))); - CHECK(animation->scale_track_interpolate(0, 0.6, &r_interpolation) == OK); + CHECK(animation->try_scale_track_interpolate(0, 0.6, &r_interpolation) == OK); CHECK(r_interpolation.is_equal_approx(Vector3(3.5, 4, 5))); // 3D scale tracks always use linear interpolation for performance reasons. @@ -221,10 +221,10 @@ TEST_CASE("[Animation] Create 3D scale track") { // This is a 3D scale track, so the methods below should return errors. ERR_PRINT_OFF; CHECK(animation->value_track_interpolate(0, 0.0).is_null()); - CHECK(animation->position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); CHECK(animation->bezier_track_interpolate(0, 0.0) == doctest::Approx(0.0)); - CHECK(animation->blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); ERR_PRINT_ON; } @@ -247,22 +247,22 @@ TEST_CASE("[Animation] Create blend shape track") { CHECK(animation->blend_shape_track_get_key(0, 1, &r_blend) == OK); CHECK(r_blend == doctest::Approx(1.0f)); - CHECK(animation->blend_shape_track_interpolate(0, -0.2, &r_blend) == OK); + CHECK(animation->try_blend_shape_track_interpolate(0, -0.2, &r_blend) == OK); CHECK(r_blend == doctest::Approx(-1.0f)); - CHECK(animation->blend_shape_track_interpolate(0, 0.0, &r_blend) == OK); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.0, &r_blend) == OK); CHECK(r_blend == doctest::Approx(-1.0f)); - CHECK(animation->blend_shape_track_interpolate(0, 0.2, &r_blend) == OK); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.2, &r_blend) == OK); CHECK(r_blend == doctest::Approx(-0.2f)); - CHECK(animation->blend_shape_track_interpolate(0, 0.4, &r_blend) == OK); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.4, &r_blend) == OK); CHECK(r_blend == doctest::Approx(0.6f)); - CHECK(animation->blend_shape_track_interpolate(0, 0.5, &r_blend) == OK); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.5, &r_blend) == OK); CHECK(r_blend == doctest::Approx(1.0f)); - CHECK(animation->blend_shape_track_interpolate(0, 0.6, &r_blend) == OK); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.6, &r_blend) == OK); CHECK(r_blend == doctest::Approx(1.0f)); // Blend shape tracks always use linear interpolation for performance reasons. @@ -272,9 +272,9 @@ TEST_CASE("[Animation] Create blend shape track") { // This is a blend shape track, so the methods below should return errors. ERR_PRINT_OFF; CHECK(animation->value_track_interpolate(0, 0.0).is_null()); - CHECK(animation->position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); CHECK(animation->bezier_track_interpolate(0, 0.0) == doctest::Approx(0.0)); ERR_PRINT_ON; } @@ -302,10 +302,10 @@ TEST_CASE("[Animation] Create Bezier track") { // This is a bezier track, so the methods below should return errors. ERR_PRINT_OFF; CHECK(animation->value_track_interpolate(0, 0.0).is_null()); - CHECK(animation->position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); - CHECK(animation->blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_position_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_rotation_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_scale_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); + CHECK(animation->try_blend_shape_track_interpolate(0, 0.0, nullptr) == ERR_INVALID_PARAMETER); ERR_PRINT_ON; } |