RFR: 8298500: Create test to initially show stage with various attributes (iconified, maximized, full screen)
Kevin Rushforth
kcr at openjdk.org
Thu Sep 14 17:57:51 UTC 2023
On Wed, 13 Sep 2023 11:37:39 GMT, Lukasz Kostyra <lkostyra at 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.
I left a few inline comment. I still need to test it, but I'll wait until you address my main feedback about the order of operations before I do too much testing.
tests/system/src/test/java/test/robot/javafx/stage/AttributesTest.java line 111:
> 109:
> 110: topStage.setIconified(true);
> 111: });
This will show the stage before setting it as iconified. Testing correct behavior for a stage that is initially iconified/maximized/fullScreen prior to showing the stage is the main purpose of this test enhancement, so you will need to do something like split the creation and showing of the stages into separate methods or pass flags for the initial state of those three attributes as arguments to the setupStages method.
tests/system/src/test/java/test/robot/javafx/stage/AttributesTest.java line 130:
> 128: assertColorEquals(BOTTOM_COLOR, color, TOLERANCE);
> 129:
> 130: topStage.setMaximized(true);
Same comment about needing to set maximized before showing topStage.
tests/system/src/test/java/test/robot/javafx/stage/AttributesTest.java line 163:
> 161: assertColorEquals(BOTTOM_COLOR, color, TOLERANCE);
> 162:
> 163: topStage.setFullScreen(true);
Same comment about needing to set fullScreen before showing topStage.
-------------
PR Review: https://git.openjdk.org/jfx/pull/1240#pullrequestreview-1627423784
PR Review Comment: https://git.openjdk.org/jfx/pull/1240#discussion_r1326315338
PR Review Comment: https://git.openjdk.org/jfx/pull/1240#discussion_r1326331934
PR Review Comment: https://git.openjdk.org/jfx/pull/1240#discussion_r1326331278
More information about the openjfx-dev
mailing list