-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix PathFollow tests, Add PathFollow3D forward test #51372
Fix PathFollow tests, Add PathFollow3D forward test #51372
Conversation
For the |
56a8a10
to
c7aa737
Compare
The tests are failing because I get I tried to reduce the |
You can use |
I'm using The difference between |
Yes, that should be investigated. |
c2890be
to
77c5543
Compare
dc92f64
to
7cd48c3
Compare
After investigating I reached the conclusion that the The points that are added to the curve are not baked so the cached points go from I've modified the |
tests/test_path_follow_2d.h
Outdated
@@ -122,15 +128,16 @@ TEST_CASE("[PathFollow2D] Sampling with offset") { | |||
memdelete(path); | |||
} | |||
|
|||
TEST_CASE("[PathFollow2D] Removal of a point in curve") { | |||
const Ref<Curve2D> &curve = memnew(Curve2D()); | |||
TEST_CASE("[SceneTree][PathFollow2D] Removal of a point in curve") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test won't pass because PathFollow currently does not listen to changes in the curve and AFAIK the PathFollow nodes never had this behavior.
Also, this test uses the unit offset but the PathFollow actually stores the offset. This test assumes that removing the middle point will update the transform to be at the interpolated point between the start and end points because that'd be the new 0.5. However, since PathFollow stored the offset it won't be equivalent to 0.5 anymore.
Same thing in the 3D version.
EDIT: I've commented these tests for now
7cd48c3
to
4ddda01
Compare
1628ed6
to
f1c1678
Compare
f1c1678
to
176052b
Compare
Whats the status of this? |
It's done but not sure what to do about the last 2 commits:
When those questions are resolved I have to squash the commits and rebase. |
3a980d7
to
e5fdd84
Compare
This probably needs at least some changes after the recent PathFollow changes regarding forward direction. |
|
Could you do a quick rebase? |
tests/scene/test_path_follow_2d.h
Outdated
path->set_curve(curve); | ||
const PathFollow2D *path_follow_2d = memnew(PathFollow2D); | ||
path->add_child(path_follow_2d); | ||
// TEST_CASE("[SceneTree][PathFollow2D] Removal of a point in curve") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// TEST_CASE("[SceneTree][PathFollow2D] Removal of a point in curve") { | |
//TEST_CASE("[SceneTree][PathFollow2D] Removal of a point in curve") { |
No space before commented out code, for all
I'd suggest using a block comment though and explaining why the test is inactive
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've commented these tests because of #51372 (comment). I don't think the behavior these tests intended to test was ever implemented in PathFollow{2D,3D}
so we may want to remove these tests instead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the following adjustments it passes. We need to do the same immediate update as for the other test cases, and after the curve length has changed, the absolute progress value is outdated (and doesn't represent the ratio of 0.5 anymore).
path_follow_3d->set_progress_ratio(0.5);
path_follow_3d->update_transform(true);
CHECK(is_equal_approx(Vector3(100, 0, 0), path_follow_3d->get_transform().get_origin()));
curve->remove_point(1);
path_follow_3d->set_progress_ratio(0.5);
path_follow_3d->update_transform(true);
CHECK_MESSAGE(
is_equal_approx(Vector3(50, 50, 0), path_follow_3d->get_transform().get_origin()),
"Path follow's position should be updated after removing a point from the curve");
e5fdd84
to
22d0086
Compare
Rebased. Also added It seems #80233 also broke the forward vector test and I'm not sure if the new behavior is correct. I also get a bunch of |
22d0086
to
40ecac6
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me!
We could refactor the checks to use doctest::Approx
, but I'm working on a better way to integrate Godot's types with doctest, so I guess it's fine to merge this now.
Seems good to me too. Let's squash and merge, and fine tune things in follow up PRs. |
40ecac6
to
871a451
Compare
871a451
to
c3a054f
Compare
Thanks! |
PathFollow2D
andPathFollow3D
so they compile and add them totest_main.cpp
because they weren't being used before.PathFollow3D
to prevent regressions like Path follow 3D returning different vectors in new beta build snapshot. #51342 in the future.NOTE: I've marked this PR ready for review since the CI passes but I'd like to know what to do with the remove point test and if the custom
is_equal_approx
is acceptable, then I'll squash the commits.