diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2021-12-02 00:17:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 00:17:47 +0100 |
commit | 3b9de26fec42ba99153717f89afd849f77a60a89 (patch) | |
tree | d106a051bc97030bf856f876c07a370a512419fc /tests/scene/test_curve.h | |
parent | 213ee89ae8424ea9a203312472866ccc76c2e511 (diff) | |
parent | 129911f61af35fa2aed03349368f7e94772b682e (diff) |
Merge pull request #53868 from aaronfranke/curve
Diffstat (limited to 'tests/scene/test_curve.h')
-rw-r--r-- | tests/scene/test_curve.h | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/tests/scene/test_curve.h b/tests/scene/test_curve.h index 60eafad460..4ee1a1c15c 100644 --- a/tests/scene/test_curve.h +++ b/tests/scene/test_curve.h @@ -219,35 +219,33 @@ TEST_CASE("[Curve] Custom curve with linear tangents") { TEST_CASE("[Curve2D] Linear sampling should return exact value") { Ref<Curve2D> curve = memnew(Curve2D); - int len = 2048; + real_t len = 2048.0; curve->add_point(Vector2(0, 0)); - curve->add_point(Vector2((float)len, 0)); + curve->add_point(Vector2(len, 0)); - float baked_length = curve->get_baked_length(); - CHECK((float)len == baked_length); + real_t baked_length = curve->get_baked_length(); + CHECK(len == baked_length); for (int i = 0; i < len; i++) { - float expected = (float)i; - Vector2 pos = curve->interpolate_baked(expected); - CHECK_MESSAGE(pos.x == expected, "interpolate_baked should return exact value"); + Vector2 pos = curve->interpolate_baked(i); + CHECK_MESSAGE(pos.x == i, "interpolate_baked should return exact value"); } } TEST_CASE("[Curve3D] Linear sampling should return exact value") { Ref<Curve3D> curve = memnew(Curve3D); - int len = 2048; + real_t len = 2048.0; curve->add_point(Vector3(0, 0, 0)); - curve->add_point(Vector3((float)len, 0, 0)); + curve->add_point(Vector3(len, 0, 0)); - float baked_length = curve->get_baked_length(); - CHECK((float)len == baked_length); + real_t baked_length = curve->get_baked_length(); + CHECK(len == baked_length); for (int i = 0; i < len; i++) { - float expected = (float)i; - Vector3 pos = curve->interpolate_baked(expected); - CHECK_MESSAGE(pos.x == expected, "interpolate_baked should return exact value"); + Vector3 pos = curve->interpolate_baked(i); + CHECK_MESSAGE(pos.x == i, "interpolate_baked should return exact value"); } } |