RFR: 8326619: Stage.sizeToScene() on maximized/fullscreen Stage breaks the Window [v8]

Lukasz Kostyra lkostyra at openjdk.org
Thu Jun 27 10:41:18 UTC 2024


On Tue, 25 Jun 2024 08:01:49 GMT, Marius Hanl <mhanl at openjdk.org> wrote:

>> This PR fixes the problem that maximizing/fullscreen a `Stage` or `Dialog` is broken when `sizeToScene()` was called before or after.
>> 
>> The approach here is to ignore the `sizeToScene()` request when the `Stage` is maximized or set to fullscreen. 
>> Otherwise the Window Manager of the OS will be confused and you will get weird flickering or wrong Window buttons (e.g. on Windows, the 'Maximize' button still shows the 'Restore' Icon, while we already resized the `Stage` to not be maximized).
>
> Marius Hanl has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Added sleep in tests / format javadoc

Change looks good, but I'm still seeing failures on my macOS system (Sonoma 14.5, MacBook Pro M1 Max):


SizeToSceneTest > testInitialSizeOnSizeToSceneThenFullscreen() FAILED
    org.opentest4j.AssertionFailedError: 1080.0 >= 1085.0 ==> expected: <true> but was: <false>
        at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:40)
        at app//org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:210)
        at app//test.javafx.stage.SizeToSceneTest.assertStageScreenBounds(SizeToSceneTest.java:76)
        at app//test.javafx.stage.SizeToSceneTest.testInitialSizeOnSizeToSceneThenFullscreen(SizeToSceneTest.java:150)

SizeToSceneTest > testInitialSizeAfterShowFullscreenThenSizeToScene() FAILED
    org.opentest4j.AssertionFailedError: 1080.0 >= 1085.0 ==> expected: <true> but was: <false>
        at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:40)
        at app//org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:210)
        at app//test.javafx.stage.SizeToSceneTest.assertStageScreenBounds(SizeToSceneTest.java:76)
        at app//test.javafx.stage.SizeToSceneTest.testInitialSizeAfterShowFullscreenThenSizeToScene(SizeToSceneTest.java:186)

SizeToSceneTest > testInitialSizeAfterShowSizeToSceneThenFullscreen() FAILED
    org.opentest4j.AssertionFailedError: 1080.0 >= 1085.0 ==> expected: <true> but was: <false>
        at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:40)
        at app//org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:210)
        at app//test.javafx.stage.SizeToSceneTest.assertStageScreenBounds(SizeToSceneTest.java:76)
        at app//test.javafx.stage.SizeToSceneTest.testInitialSizeAfterShowSizeToSceneThenFullscreen(SizeToSceneTest.java:162)

SizeToSceneTest > testInitialSizeOnFullscreenThenSizeToScene() FAILED
    org.opentest4j.AssertionFailedError: 1080.0 >= 1085.0 ==> expected: <true> but was: <false>
        at app//org.junit.jupiter.api.AssertionUtils.fail(AssertionUtils.java:55)
        at app//org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:40)
        at app//org.junit.jupiter.api.Assertions.assertTrue(Assertions.java:210)
        at app//test.javafx.stage.SizeToSceneTest.assertStageScreenBounds(SizeToSceneTest.java:76)
        at app//test.javafx.stage.SizeToSceneTest.testInitialSizeOnFullscreenThenSizeToScene(SizeToSceneTest.java:128)


Windows and Ubuntu 22.04 LTS work fine for me.

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

PR Review: https://git.openjdk.org/jfx/pull/1382#pullrequestreview-2144980246


More information about the openjfx-dev mailing list