diff options
author | RĂ©mi Verschelde <remi@verschelde.fr> | 2022-08-31 08:37:12 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-08-31 08:37:12 +0200 |
commit | 96b470b28ed2e3c7294368506dae95dee0b1f288 (patch) | |
tree | a81d0d7cf431421fc7365cdf5406252da3f9ccfe /tests | |
parent | 9d2e2c97c0887c2aec110f82a8a55b57525452cb (diff) | |
parent | ae18928748047413db4d405a5d79a4bbfca05aca (diff) |
Merge pull request #63394 from Calinou/curve-gradient-rename-interpolate
Rename Curve/Curve2D/Curve3D/Gradient `interpolate()` to `sample()`
Diffstat (limited to 'tests')
-rw-r--r-- | tests/scene/test_curve.h | 74 |
1 files changed, 37 insertions, 37 deletions
diff --git a/tests/scene/test_curve.h b/tests/scene/test_curve.h index 0370ab15fd..ad7625ddc5 100644 --- a/tests/scene/test_curve.h +++ b/tests/scene/test_curve.h @@ -44,13 +44,13 @@ TEST_CASE("[Curve] Default curve") { curve->get_point_count() == 0, "Default curve should contain the expected number of points."); CHECK_MESSAGE( - Math::is_zero_approx(curve->interpolate(0)), + Math::is_zero_approx(curve->sample(0)), "Default curve should return the expected value at offset 0.0."); CHECK_MESSAGE( - Math::is_zero_approx(curve->interpolate(0.5)), + Math::is_zero_approx(curve->sample(0.5)), "Default curve should return the expected value at offset 0.5."); CHECK_MESSAGE( - Math::is_zero_approx(curve->interpolate(1)), + Math::is_zero_approx(curve->sample(1)), "Default curve should return the expected value at offset 1.0."); } @@ -80,57 +80,57 @@ TEST_CASE("[Curve] Custom curve with free tangents") { "Custom free curve should contain the expected number of points."); CHECK_MESSAGE( - Math::is_zero_approx(curve->interpolate(-0.1)), + Math::is_zero_approx(curve->sample(-0.1)), "Custom free curve should return the expected value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(0.1), (real_t)0.352), + Math::is_equal_approx(curve->sample(0.1), (real_t)0.352), "Custom free curve should return the expected value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(0.4), (real_t)0.352), + Math::is_equal_approx(curve->sample(0.4), (real_t)0.352), "Custom free curve should return the expected value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(0.7), (real_t)0.896), + Math::is_equal_approx(curve->sample(0.7), (real_t)0.896), "Custom free curve should return the expected value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(1), 1), + Math::is_equal_approx(curve->sample(1), 1), "Custom free curve should return the expected value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(2), 1), + Math::is_equal_approx(curve->sample(2), 1), "Custom free curve should return the expected value at offset 0.1."); CHECK_MESSAGE( - Math::is_zero_approx(curve->interpolate_baked(-0.1)), + Math::is_zero_approx(curve->sample_baked(-0.1)), "Custom free curve should return the expected baked value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(0.1), (real_t)0.352), + Math::is_equal_approx(curve->sample_baked(0.1), (real_t)0.352), "Custom free curve should return the expected baked value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(0.4), (real_t)0.352), + Math::is_equal_approx(curve->sample_baked(0.4), (real_t)0.352), "Custom free curve should return the expected baked value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(0.7), (real_t)0.896), + Math::is_equal_approx(curve->sample_baked(0.7), (real_t)0.896), "Custom free curve should return the expected baked value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(1), 1), + Math::is_equal_approx(curve->sample_baked(1), 1), "Custom free curve should return the expected baked value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(2), 1), + Math::is_equal_approx(curve->sample_baked(2), 1), "Custom free curve should return the expected baked value at offset 0.1."); curve->remove_point(1); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(0.1), 0), + Math::is_equal_approx(curve->sample(0.1), 0), "Custom free curve should return the expected value at offset 0.1 after removing point at index 1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(0.1), 0), + Math::is_equal_approx(curve->sample_baked(0.1), 0), "Custom free curve should return the expected baked value at offset 0.1 after removing point at index 1."); curve->clear_points(); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(0.6), 0), + Math::is_equal_approx(curve->sample(0.6), 0), "Custom free curve should return the expected value at offset 0.6 after clearing all points."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(0.6), 0), + Math::is_equal_approx(curve->sample_baked(0.6), 0), "Custom free curve should return the expected baked value at offset 0.6 after clearing all points."); } @@ -169,51 +169,51 @@ TEST_CASE("[Curve] Custom curve with linear tangents") { "Custom linear curve should contain the expected number of points."); CHECK_MESSAGE( - Math::is_zero_approx(curve->interpolate(-0.1)), + Math::is_zero_approx(curve->sample(-0.1)), "Custom linear curve should return the expected value at offset -0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(0.1), (real_t)0.4), + Math::is_equal_approx(curve->sample(0.1), (real_t)0.4), "Custom linear curve should return the expected value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(0.4), (real_t)0.4), + Math::is_equal_approx(curve->sample(0.4), (real_t)0.4), "Custom linear curve should return the expected value at offset 0.4."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(0.7), (real_t)0.8), + Math::is_equal_approx(curve->sample(0.7), (real_t)0.8), "Custom linear curve should return the expected value at offset 0.7."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(1), 1), + Math::is_equal_approx(curve->sample(1), 1), "Custom linear curve should return the expected value at offset 1.0."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(2), 1), + Math::is_equal_approx(curve->sample(2), 1), "Custom linear curve should return the expected value at offset 2.0."); CHECK_MESSAGE( - Math::is_zero_approx(curve->interpolate_baked(-0.1)), + Math::is_zero_approx(curve->sample_baked(-0.1)), "Custom linear curve should return the expected baked value at offset -0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(0.1), (real_t)0.4), + Math::is_equal_approx(curve->sample_baked(0.1), (real_t)0.4), "Custom linear curve should return the expected baked value at offset 0.1."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(0.4), (real_t)0.4), + Math::is_equal_approx(curve->sample_baked(0.4), (real_t)0.4), "Custom linear curve should return the expected baked value at offset 0.4."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(0.7), (real_t)0.8), + Math::is_equal_approx(curve->sample_baked(0.7), (real_t)0.8), "Custom linear curve should return the expected baked value at offset 0.7."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(1), 1), + Math::is_equal_approx(curve->sample_baked(1), 1), "Custom linear curve should return the expected baked value at offset 1.0."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(2), 1), + Math::is_equal_approx(curve->sample_baked(2), 1), "Custom linear curve should return the expected baked value at offset 2.0."); ERR_PRINT_OFF; curve->remove_point(10); ERR_PRINT_ON; CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate(0.7), (real_t)0.8), + Math::is_equal_approx(curve->sample(0.7), (real_t)0.8), "Custom free curve should return the expected value at offset 0.7 after removing point at invalid index 10."); CHECK_MESSAGE( - Math::is_equal_approx(curve->interpolate_baked(0.7), (real_t)0.8), + Math::is_equal_approx(curve->sample_baked(0.7), (real_t)0.8), "Custom free curve should return the expected baked value at offset 0.7 after removing point at invalid index 10."); } @@ -228,8 +228,8 @@ TEST_CASE("[Curve2D] Linear sampling should return exact value") { CHECK(len == baked_length); for (int i = 0; i < len; i++) { - Vector2 pos = curve->interpolate_baked(i); - CHECK_MESSAGE(pos.x == i, "interpolate_baked should return exact value"); + Vector2 pos = curve->sample_baked(i); + CHECK_MESSAGE(pos.x == i, "sample_baked should return exact value"); } } @@ -244,8 +244,8 @@ TEST_CASE("[Curve3D] Linear sampling should return exact value") { CHECK(len == baked_length); for (int i = 0; i < len; i++) { - Vector3 pos = curve->interpolate_baked(i); - CHECK_MESSAGE(pos.x == i, "interpolate_baked should return exact value"); + Vector3 pos = curve->sample_baked(i); + CHECK_MESSAGE(pos.x == i, "sample_baked should return exact value"); } } |