8016534: javax/swing/text/View/8014863/bug8014863.java failed
authordmarkov
Fri, 28 Jun 2013 18:32:20 +0400
changeset 18524 455bd1fafe18
parent 18523 6266f3b9f101
child 18525 2d5db9a68add
8016534: javax/swing/text/View/8014863/bug8014863.java failed Reviewed-by: alexp, alexsch
jdk/test/javax/swing/text/View/8014863/bug8014863.java
--- a/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Thu Jun 27 13:56:16 2013 +0400
+++ b/jdk/test/javax/swing/text/View/8014863/bug8014863.java	Fri Jun 28 18:32:20 2013 +0400
@@ -136,9 +136,12 @@
                         "qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp" +
                         "</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq <em>pp</em> qqqq</p>");
                 editorPane.setCaretPosition(1);
-
+                // An actual font size depends on OS and might be differnet on various OSs.
+                // It is necessary to calculate the width to meet the expected number of lines.
+                int width = SwingUtilities.computeStringWidth(editorPane.getFontMetrics(editorPane.getFont()),
+                        "qqqq pp qqqq pp qqqq pp qqqqqqqq");
                 frame.add(editorPane);
-                frame.setSize(200, 200);
+                frame.setSize(width, 200);
                 frame.setVisible(true);
             }
         });