On Mon, 18 Sep 2023 13:14:34 GMT, Lukasz Kostyra <lkost...@openjdk.org> wrote:

>> PR adds tests mentioned in the title - a new `AttributesTest` class is added 
>> testing iconification, maximization and full-screen-ification of a Stage.
>> 
>> All variants are tested with decorated stage style.
>> 
>> Iconification is tested via overlaying two stages on top of one another, and 
>> then iconifying the top one - this is similar to already existing 
>> `IconifyTest.java` but it tests just the iconfication process and nothing 
>> more.
>> 
>> Maximization and FullScreen are both tested by creating two stages _not_ 
>> overlapping each other. After maximization/fullscreen top stage (being 
>> always on top as well) should cover the bottom stage. Moreover, FullScreen 
>> and Maximize are differentiated by checking if window decoration exists - 
>> maximized Stage will have its decoration taking space on top of the screen, 
>> whereas FullScreen one will not.
>> 
>> **NOTE:** on macOS I had issues with `getColor()` returning a valid color 
>> when called a second time. This only happened on macOS and with FullScreen 
>> test (others worked fine). Unfortunately I couldn't figure out why it 
>> returned (0, 0, 0, 255) or (255, 255, 255, 255). To mitigate that I moved 
>> color checks into separate `runAndWait()`-s with a small sleep between them, 
>> which seemed to help `getColor()` return proper values.
>> 
>> Verified to work on Windows 11, macOS and Linux.
>
> Lukasz Kostyra has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   Fix skip comment on testMaximizedStageBeforeShow
>   
>   Comment pointed at wrong JDK issue (aka. Copy-Paste's Error)

On Windows 10 system, several tests fail for me:


StageAttributesTest > testFullScreenStageBeforeShow FAILED
    junit.framework.AssertionFailedError: expected:rgba(0,255,0,255) but 
was:rgba(42,244,71,255)
        at 
test.robot.testharness.VisualTestBase.assertColorEquals(VisualTestBase.java:173)
        at 
test.robot.javafx.stage.StageAttributesTest.lambda$testFullScreenStageBeforeShow$17(StageAttributesTest.java:298)

StageAttributesTest > testIconifiedStageBeforeShow FAILED
    junit.framework.AssertionFailedError: expected:rgba(0,255,0,255) but 
was:rgba(28,248,48,255)
        at 
test.robot.testharness.VisualTestBase.assertColorEquals(VisualTestBase.java:173)
        at 
test.robot.javafx.stage.StageAttributesTest.lambda$testIconifiedStageBeforeShow$12(StageAttributesTest.java:226)

StageAttributesTest > testMaximizedStage FAILED
    junit.framework.AssertionFailedError: expected:rgba(0,255,0,255) but 
was:rgba(23,249,38,255)
        at 
test.robot.testharness.VisualTestBase.assertColorEquals(VisualTestBase.java:173)
        at 
test.robot.javafx.stage.StageAttributesTest.lambda$testMaximizedStage$6(StageAttributesTest.java:147)

StageAttributesTest > testFullScreenStage FAILED
    junit.framework.AssertionFailedError: expected:rgba(0,255,0,255) but 
was:rgba(28,248,48,255)
        at 
test.robot.testharness.VisualTestBase.assertColorEquals(VisualTestBase.java:173)
        at 
test.robot.javafx.stage.StageAttributesTest.lambda$testFullScreenStage$9(StageAttributesTest.java:185)

StageAttributesTest > testIconifiedStage FAILED
    junit.framework.AssertionFailedError: expected:rgba(255,0,0,255) but 
was:rgba(177,84,13,255)
        at 
test.robot.testharness.VisualTestBase.assertColorEquals(VisualTestBase.java:173)
        at 
test.robot.javafx.stage.StageAttributesTest.lambda$testIconifiedStage$4(StageAttributesTest.java:122)

StageAttributesTest > testMaximizedStageBeforeShow FAILED
    junit.framework.AssertionFailedError: expected:rgba(0,255,0,255) but 
was:rgba(23,249,39,255)
        at 
test.robot.testharness.VisualTestBase.assertColorEquals(VisualTestBase.java:173)
        at 
test.robot.javafx.stage.StageAttributesTest.lambda$testMaximizedStageBeforeShow$14(StageAttributesTest.java:258)


I tracked this down to a missing sleep in `setupStages` (see inline comments).

tests/system/src/test/java/test/robot/javafx/stage/StageAttributesTest.java 
line 109:

> 107:             assertTrue("Timeout waiting for top stage to be shown",
> 108:                 topShownLatch.await(TIMEOUT, TimeUnit.MILLISECONDS));
> 109:         }

Several tests fail for me without an additional sleep. I recommend adding 
`Util.sleep(1000)` here.

tests/system/src/test/java/test/robot/javafx/stage/StageAttributesTest.java 
line 128:

> 126: 
> 127:         // wait a bit to let window system animate the change
> 128:         Util.waitForIdle(topScene);

In looking at this more closely, this change should be reverted back to using 
`sleep(1000)`. `Util.waitForIdle` is intended to wait for scene graph changes 
to be propagated, not for platform windowing operations to settle down, so 
using it could lead to intermittent failures.

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

Changes requested by kcr (Lead).

PR Review: https://git.openjdk.org/jfx/pull/1240#pullrequestreview-1631184924
PR Review Comment: https://git.openjdk.org/jfx/pull/1240#discussion_r1328803323
PR Review Comment: https://git.openjdk.org/jfx/pull/1240#discussion_r1328809860

Reply via email to