On Mon, 12 Jun 2023 21:35:46 GMT, Kevin Rushforth <[email protected]> wrote:

>> 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(() -> {

Thanks for the suggestion @kevinrushforth. Made changes according to your 
comments. Please check.

-------------

PR Comment: https://git.openjdk.org/jfx/pull/1119#issuecomment-1588586326

Reply via email to