RFR: 8351357: Add canary system test checking if Stage receives focus on show [v4]
Andy Goryachev
angorya at openjdk.org
Tue Jul 1 15:13:49 UTC 2025
On Tue, 1 Jul 2025 10:54:16 GMT, Lukasz Kostyra <lkostyra at openjdk.org> wrote:
>> tests/system/src/test/java/test/robot/javafx/stage/StageFocusTest.java line 118:
>>
>>> 116: Util.runAndWait(() -> {
>>> 117: Color color = getColor(STAGE_SIZE / 2, STAGE_SIZE / 2);
>>> 118: assertColorEquals(Color.LIGHTGREEN, color, TOLERANCE);
>>
>> I wonder if this implementation is a reliable test: the stage in question may be overlapped by another window somewhere in the corner, right?
>>
>> What would be a reliable test? Strictly speaking, we must check every pixel in the scene, though I wonder if checking each pixel in a grid (maybe 20 x 20, since we don't expect any reasonable window to be less than that) should be enough?
>
> The most reliable way would be to probably scan the whole grid, I agree... I could change this - the stage is not that big after all. Maybe even turn the stage to undecorated to make this more reliable across platforms. I expect the very edge of the Stage to be not exactly the same color, but if we leave ex. 1px margin around the edges it should still be fine. I'll play around with this and update soon.
I thought about that too - but why wouldn't the client area, the scene itself, be of different color? The decorations and possible effects should be outside of the stage, shouldn't they?
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/1804#discussion_r2177865033
More information about the openjfx-dev
mailing list