RFR: 8199592: Control labels truncated at certain DPI scaling levels

Kevin Rushforth kcr at openjdk.java.net
Thu Nov 19 02:15:07 UTC 2020


On Mon, 9 Nov 2020 11:34:25 GMT, Jose Pereda <jpereda at openjdk.org> wrote:

> As commented in the [JBS issue](https://bugs.openjdk.java.net/browse/JDK-8199592), the default UI scale 1.0 is used to perform initial calculations of preferred sizes of the scene, even if the scale has already a different value (i.e 175%). As a workaround, calling `Stage::sizeToScene` fix it, as it forces to do new calculations but now with the correct UI scale.
> 
> This PR moves the call to `Window::updateOutputScales` before the scene initialization takes place, so the UI scale is correctly set for the initial preferred size of the scene, and no workaround is required.
> 
> It also provides a system test that can be tested on Linux and Windows. Before applying the fix, the `Check` text of the checkboxes is rendered as `Che...`. With the fix, the test verifies, for a given UI scale, that the rendered text is `Check`.

tests/system/src/test/java/test/javafx/scene/UIRenderSceneTest.java line 83:

> 81:         new Thread(() -> Application.launch(TestApp.class, (String[])null)).start();
> 82:         try {
> 83:             if (!startupLatch.await(15, TimeUnit.SECONDS)) {

If you add `throws Exception` to this method you can get rid of the try/catch and just do:

    assertTrue("Timeout waiting for FX runtime to start",
        startupLatch.await(15, TimeUnit.SECONDS));

(this is the pattern we use for most of our newer tests)

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

PR: https://git.openjdk.java.net/jfx/pull/351


More information about the openjfx-dev mailing list