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
(feature) Introduce the concept of motion. #363
Conversation
07049d9
to
3926fb1
Compare
Allow the user to explicitly request a certain type of motion using the API. Automatically detect when certain types of motion should be used and if the user has not explicitly requested a type of motion use the most appropriate one. For example when moving to a MenuItem the mouse should move vertically (along the y-axis) first and the horizontally so that adjacent menus are not activated. Fixes TestFX#305.
Note: This changes parts of TestFX's public API. |
I like the idea of having different types of motions (like euclidean/direct and manhattan/horizontal/vertical) to solve this problem. I think it's great to customize the mouse motion/movement. However I tend to be against changing the method signatures. We might instead maybe introduce a moveTo("File")
.motionTo("Export", VERTICAL_FIRST)
.motionTo("XML format", HORIZONTAL_FIRST")
.click() or moveTo("File")
.motion(VERTICAL_FIRST).moveTo("Export")
.motion(HORIZONTAL_FIRST).moveTo("XML format")
.motion(DIRECT).click() |
private void moveMouseStepwiseBetween(
Point2D sourcePoint,
Point2D targetPoint
Motion motion
) We could possibly make this even more customizable by changing the method signature to private void moveMouseBetween(
Point2D sourcePoint,
Point2D targetPoint
Interpolator2D interpolator
) |
An alternative solution for the menu movement problem is to directly jump to the target position without interpolation. |
Thank you very much for taking the time to review this thoughtfully, it is much appreciated. Given that TestFX 4 is "alpha", IMO we don't need to be overly concerned about changing the public API. However even in this case the API is not changed in the sense that it will break anyone's existing code. In fact, with these changes things will behave exactly in the same way as before. The only thing that has changed from a public API perspective is more possible arguments (via overloading) to the I thought about taking an approach similar the one you listed above wherein we would have a separate, chainable, 1.) Inherent in the concept of These two points are to show that I am not inflexible in this regard, but did at least want to put my thoughts on the matter out there for more consideration. In regards to the second point about the |
@hastebrot please merge. +1 |
I think this is okay to merge. I have thought a lot about this API change and I think using default methods is a good solution to this problem. |
Allow the user to explicitly request a certain type of motion
using the API. Automatically detect when certain types of motion
should be used and if the user has not explicitly requested a type
of motion use the most appropriate one.
For example when moving to a MenuItem the mouse should move vertically
(along the y-axis) first and the horizontally so that adjacent menus
are not activated.
Fixes #305.