8169897: [PIT] javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java fails
Reviewed-by: alexsch
--- a/jdk/test/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java Thu May 11 12:41:35 2017 +0530
+++ b/jdk/test/javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java Fri May 12 12:28:49 2017 +0530
@@ -41,7 +41,7 @@
/**
* @test
- * @bug 8132119 8168992
+ * @bug 8132119 8168992 8169897
* @author Alexandr Scherbatiy
* @summary Provide public API for text related methods in SwingBasicGraphicsUtils2
*/
@@ -158,7 +158,9 @@
}
g2.dispose();
- float xx = (WIDTH - width / 8) / 2;
+ float xx = BasicGraphicsUtils.getStringWidth(comp, fontMetrices, "A") +
+ BasicGraphicsUtils.getStringWidth(comp, fontMetrices, "O")/2;
+
checkImageContainsSymbol(buffImage, (int) xx, underlined ? 3 : 2);
}
@@ -285,7 +287,7 @@
break;
}
}
- return new Font(fontName, Font.PLAIN, 28);
+ return new Font(fontName, Font.PLAIN, 30);
}
private static float getLayoutWidth(String text, Font font, NumericShaper shaper) {
@@ -311,6 +313,7 @@
private static void checkImageContainsSymbol(BufferedImage buffImage,
int x, int intersections) {
+
int background = BACKGROUND_COLOR.getRGB();
boolean isBackground = true;
int backgroundChangesCount = 0;
@@ -321,6 +324,7 @@
backgroundChangesCount++;
}
}
+
if (backgroundChangesCount != intersections * 2) {
throw new RuntimeException("String is not properly drawn!");
}