Skip to content

Commit 845f74f

Browse files
committed
8362204: test/jdk/sun/awt/font/TestDevTransform.java fails on Ubuntu 24.04
1 parent cc65836 commit 845f74f

File tree

1 file changed

+44
-4
lines changed

1 file changed

+44
-4
lines changed

test/jdk/sun/awt/font/TestDevTransform.java

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -22,9 +22,31 @@
2222
*/
2323

2424
/*
25-
* @test
25+
* @test id=dialog_double
2626
* @bug 4269775 8341535
2727
* @summary Check that different text rendering APIs agree
28+
* @run main/othervm TestDevTransform DIALOG DOUBLE
29+
*/
30+
31+
/*
32+
* @test id=dialog_float
33+
* @bug 4269775 8341535
34+
* @summary Check that different text rendering APIs agree
35+
* @run main/othervm TestDevTransform DIALOG FLOAT
36+
*/
37+
38+
/*
39+
* @test id=monospaced_double
40+
* @bug 4269775 8341535
41+
* @summary Check that different text rendering APIs agree
42+
* @run main/othervm TestDevTransform MONOSPACED DOUBLE
43+
*/
44+
45+
/*
46+
* @test id=monospaced_float
47+
* @bug 4269775 8341535
48+
* @summary Check that different text rendering APIs agree
49+
* @run main/othervm TestDevTransform MONOSPACED FLOAT
2850
*/
2951

3052
/**
@@ -66,6 +88,8 @@ public class TestDevTransform {
6688
static String test = "This is only a test";
6789
static double angle = Math.PI / 6.0; // Rotate 30 degrees
6890
static final int W = 400, H = 400;
91+
static boolean useDialog;
92+
static boolean useDouble;
6993

7094
static void draw(Graphics2D g2d, TextLayout layout,
7195
float x, float y, float scalex) {
@@ -101,9 +125,19 @@ static void init(Graphics2D g2d) {
101125
g2d.setColor(Color.white);
102126
g2d.fillRect(0, 0, W, H);
103127
g2d.setColor(Color.black);
104-
g2d.scale(1.481f, 1.481); // Convert to 108 dpi
128+
if (useDouble) {
129+
g2d.scale(1.481, 1.481); // Convert to 108 dpi
130+
} else {
131+
g2d.scale(1.481f, 1.481f); // Convert to 108 dpi
132+
}
105133
g2d.addRenderingHints(hints);
106-
Font font = new Font(Font.DIALOG, Font.PLAIN, 12);
134+
String name;
135+
if (useDialog) {
136+
name = Font.DIALOG;
137+
} else {
138+
name = Font.MONOSPACED;
139+
}
140+
Font font = new Font(name, Font.PLAIN, 12);
107141
g2d.setFont(font);
108142
}
109143

@@ -135,6 +169,12 @@ static void compare(BufferedImage bi1, String name1, BufferedImage bi2, String n
135169
}
136170

137171
public static void main(String args[]) throws Exception {
172+
if (args[0].equals("DIALOG")) {
173+
useDialog = true;
174+
}
175+
if (args[1].equals("DOUBLE")) {
176+
useDouble = true;
177+
}
138178

139179
BufferedImage tl_Image = new BufferedImage(W, H, BufferedImage.TYPE_INT_RGB);
140180
{

0 commit comments

Comments
 (0)