8229935: [TEST_BUG]: bug8132119.java inconsistently positions text
authorpsadhukhan
Wed, 06 Nov 2019 10:48:10 +0530
changeset 59180 d8888ab6c0ec
parent 59179 119ae24bce3e
child 59181 a4ecc45541da
8229935: [TEST_BUG]: bug8132119.java inconsistently positions text Reviewed-by: serb
test/jdk/ProblemList.txt
test/jdk/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java
--- a/test/jdk/ProblemList.txt	Tue Nov 05 15:55:46 2019 -0800
+++ b/test/jdk/ProblemList.txt	Wed Nov 06 10:48:10 2019 +0530
@@ -793,7 +793,6 @@
 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
--- a/test/jdk/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java	Tue Nov 05 15:55:46 2019 -0800
+++ b/test/jdk/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java	Wed Nov 06 10:48:10 2019 +0530
@@ -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;
@@ -145,6 +146,8 @@
 
         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);
@@ -159,7 +162,7 @@
         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);
     }