Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8229935: [TEST_BUG]: bug8132119.java inconsistently positions text
Backport-of: 5686851
  • Loading branch information
GoeLin committed Sep 30, 2021
1 parent ed98060 commit 23c3845
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 0 additions & 1 deletion test/jdk/ProblemList.txt
Expand Up @@ -761,7 +761,6 @@ javax/swing/MultiUIDefaults/Test6860438.java 8198391 generic-all
javax/swing/MultiUIDefaults/4300666/bug4300666.java 7105119 macosx-all
javax/swing/UITest/UITest.java 8198392 generic-all
javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java 8198394 generic-all
javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java linux-all
javax/swing/plaf/metal/MetalLookAndFeel/Test8039750.java 8198395 generic-all
javax/swing/text/DevanagariEditor.java 8198397 generic-all
javax/swing/SpringLayout/4726194/bug4726194.java 8198399 generic-all
Expand Down
Expand Up @@ -26,6 +26,7 @@
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.GraphicsEnvironment;
import java.awt.RenderingHints;
import java.awt.font.FontRenderContext;
import java.awt.font.NumericShaper;
import java.awt.font.TextAttribute;
Expand Down Expand Up @@ -145,6 +146,8 @@ private static void testDrawString(boolean underlined) {

g2.setColor(DRAW_COLOR);
g2.setFont(comp.getFont());
g2.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);

FontMetrics fontMetrices = comp.getFontMetrics(comp.getFont());
float width = BasicGraphicsUtils.getStringWidth(comp, fontMetrices, str);
Expand All @@ -159,7 +162,7 @@ private static void testDrawString(boolean underlined) {
g2.dispose();

float xx = BasicGraphicsUtils.getStringWidth(comp, fontMetrices, "A") +
BasicGraphicsUtils.getStringWidth(comp, fontMetrices, "O")/2;
BasicGraphicsUtils.getStringWidth(comp, fontMetrices, "O")/2 - 10;

checkImageContainsSymbol(buffImage, (int) xx, underlined ? 3 : 2);
}
Expand Down

1 comment on commit 23c3845

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.