RFR: 8351357: Add canary system test checking if Stage receives focus on show [v4]

Lukasz Kostyra lkostyra at openjdk.org
Tue Jul 1 10:56:53 UTC 2025


On Mon, 30 Jun 2025 16:58:33 GMT, Andy Goryachev <angorya at openjdk.org> wrote:

>> Lukasz Kostyra has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Review fixes; rewrite test to extend VisualTestBase
>
> 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.

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

PR Review Comment: https://git.openjdk.org/jfx/pull/1804#discussion_r2177242492


More information about the openjfx-dev mailing list