On Thu, 11 May 2023 12:00:59 GMT, Karthik P K <[email protected]> wrote:
>> The test was failing on the first run and then it was not failing. Cause for
>> the failure looked to be the UI state not getting updated. Hence added call
>> to `Toolkit` `firePulse` method.
>>
>> Able to run the test consistently without failure in Linux after the fix.
>
> Karthik P K has updated the pull request incrementally with one additional
> commit since the last revision:
>
> Add latch for tooltip hide and mouse move events
It still fails the first time I run it. I ran it on a physical machine, and I
now know why. I can make it fail every time by moving the mouse away from the
center of the screen (so that it is outside of where the window will appear).
The problem is that the tooltip will not show up on Linux if you directly move
the cursor with Robot to be over the control without it ever having been
somewhere else in the window first. So the only reason it works on subsequent
runs is that the mouse is left in a position such that it will be over the
window when the test is run the next time.
In general, it's also a good idea to click in the window to ensure that it is
activated. The only other robot-based test that shows a Tooltip first moves
the mouse to the upper-left corner of the scene and then does a mouse click.
Adding that code to your patch causes it to work.
So I recommend adding the following to the test (in addition to the changes you
already made, which look good).
diff --git
a/tests/system/src/test/java/test/robot/javafx/scene/SliderTooltipNPETest.java
b/tests/system/src/test/java/test/robot/javafx/scene/SliderTooltipNPETest.java
---
a/tests/system/src/test/java/test/robot/javafx/scene/SliderTooltipNPETest.java
+++
b/tests/system/src/test/java/test/robot/javafx/scene/SliderTooltipNPETest.java
@@ -88,6 +88,13 @@ public class SliderTooltipNPETest {
}
private void dragSliderAfterTooltipDisplayed(int dragDistance) throws
Exception {
+ Util.runAndWait(() -> {
+ // Click somewhere in the Stage to ensure that it is active
+ robot.mouseMove((int)(scene.getWindow().getX() + scene.getX()),
+ (int)(scene.getWindow().getY() + scene.getY()));
+ robot.mouseClick(MouseButton.PRIMARY);
+ });
+
Thread.sleep(1000); // Wait for slider to layout
Util.runAndWait(() -> {
-------------
Changes requested by kcr (Lead).
PR Review: https://git.openjdk.org/jfx/pull/1119#pullrequestreview-1475859562