RFR: 8219641: java/awt/font/Rotate/RotatedTextTest.java fails on Linux: Test failed for angle 15.0

Christoph Langer clanger at openjdk.org
Mon Sep 18 06:51:42 UTC 2023


On Mon, 18 Sep 2023 06:19:05 GMT, Arno Zeller <azeller at openjdk.org> wrote:

> The test fails on newer SLES versions that have RobotoSlab-Regular.ttf as default font. I suggest to try getting a DejaVu font as default on Linux because it is known to work without issues.

To me this looks pragmatic. I made a few suggestions for cleanup of the coding.

test/jdk/java/awt/font/Rotate/RotatedTextTest.java line 51:

> 49:     static void drawRotatedText(Graphics g) {
> 50:         Font fnt = fnt = new Font(Font.SERIF, Font.PLAIN, 12);
> 51:         String os = System.getProperty("os.name").toLowerCase();

Suggestion:

        boolean isLinux = System.getProperty("os.name").toLowerCase().startsWith("linux");
        Font fnt = isLinux ? new Font("DejaVu Serif", Font.PLAIN, 12) : new Font(Font.SERIF, Font.PLAIN, 12);

test/jdk/java/awt/font/Rotate/RotatedTextTest.java line 56:

> 54:             fnt = new Font("DejaVu Serif", Font.PLAIN, 12);
> 55:         }
> 56:         System.out.println(fnt);

Suggestion:

        System.out.println("Using font: " + fnt);

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

PR Review: https://git.openjdk.org/jdk/pull/15780#pullrequestreview-1630365935
PR Review Comment: https://git.openjdk.org/jdk/pull/15780#discussion_r1328300498
PR Review Comment: https://git.openjdk.org/jdk/pull/15780#discussion_r1328300872


More information about the client-libs-dev mailing list