changeset 6417:e010acbb357d

8016534: javax/swing/text/View/8014863/bug8014863.java failed Reviewed-by: alexp, alexsch
author dmarkov
date Tue, 02 Jul 2013 13:32:44 +0400
parents c126d36de5b2
children 178a30fcfb43
files test/javax/swing/text/View/8014863/bug8014863.java
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/swing/text/View/8014863/bug8014863.java	Tue Jul 02 11:03:30 2013 +0400
+++ b/test/javax/swing/text/View/8014863/bug8014863.java	Tue Jul 02 13:32:44 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);
             }
         });