RFR: 8348423: [TestBug] stress test Nodes initialization from a background thread [v4]
Kevin Rushforth
kcr at openjdk.org
Mon Feb 3 17:21:55 UTC 2025
On Fri, 31 Jan 2025 23:28:09 GMT, Andy Goryachev <angorya at openjdk.org> wrote:
>> Created a test that validates various Nodes can be initialized in a background thread.
>
> Andy Goryachev has updated the pull request incrementally with one additional commit since the last revision:
>
> better name
I left a couple comments. Regarding the tooltip issue, I was able to make it fail reliably by doing two things:
1. When not on the FX app thread, create a new tooltip rather than using the one created in the generator
2. When on the FX app thread, alternate between moving the mouse onto / off of the control
Like this:
AtomicBoolean overTooltip = new AtomicBoolean(false);
test(() -> {
Tooltip t = new Tooltip("this is a tooltip");
t.setShowDelay(Duration.ZERO);
t.setHideDelay(Duration.ZERO);
Label c = new Label("testing tooltip");
c.setSkin(new LabelSkin(c));
c.setTooltip(t);
c.setId("Tooltip");
return c;
}, (c) -> {
Tooltip t;
if (Platform.isFxApplicationThread()) {
t = c.getTooltip();
} else {
t = new Tooltip("this is a tooltip");
}
t.isShowing();
t.setGraphic(new Label("yo!"));
if (Platform.isFxApplicationThread()) {
boolean isOverTooltip = overTooltip.get();
Point2D p = isOverTooltip ?
c.localToScreen(c.getWidth() + 5.0, c.getHeight() + 5.0) :
c.localToScreen(c.getWidth() / 2.0, c.getHeight() / 2.0);
robot.mouseMove(p);
overTooltip.set(!isOverTooltip);
}
});
Feel free to use / adapt / whatever this suggestion.
tests/system/src/test/java/test/robot/javafx/scene/NodeInitializationStressTest.java line 158:
> 156: private static final AtomicLong seq = new AtomicLong();
> 157: private static final AtomicBoolean failed = new AtomicBoolean();
> 158: // for debugging purposes: setting this to false will skip working tests
That should be "setting this to _true_ will skip..."
tests/system/src/test/java/test/robot/javafx/scene/NodeInitializationStressTest.java line 671:
> 669: return c;
> 670: }, (c) -> {
> 671: Tooltip t = c.getTooltip();
For the background thread, construct a new object.
tests/system/src/test/java/test/robot/javafx/scene/NodeInitializationStressTest.java line 675:
> 673: t.setGraphic(new Label("yo!"));
> 674: if (Platform.isFxApplicationThread()) {
> 675: Point2D p = c.localToScreen(c.getWidth() / 2.0, c.getHeight() / 2.0);
In order to reliably reproduce it with the manual test, I had to move the mouse off and on the tooltip (so the tooltip is shown / hidden repeatedly). You can do that here by alternately moving the mouse to the center (as you've done here) and outside the window.
-------------
PR Review: https://git.openjdk.org/jfx/pull/1690#pullrequestreview-2590460238
PR Review Comment: https://git.openjdk.org/jfx/pull/1690#discussion_r1939696702
PR Review Comment: https://git.openjdk.org/jfx/pull/1690#discussion_r1939738534
PR Review Comment: https://git.openjdk.org/jfx/pull/1690#discussion_r1939744593
More information about the openjfx-dev
mailing list