7107620: Need to round in test java/awt/print/PageFormat/PageFormatFromAttributes.java
authorpsadhukhan
Thu, 24 Mar 2016 12:02:06 +0530
changeset 36904 84e94f8469b5
parent 36903 addc2e9d4bd4
child 36905 585c3dcca560
7107620: Need to round in test java/awt/print/PageFormat/PageFormatFromAttributes.java Reviewed-by: prr
jdk/test/java/awt/print/PageFormat/PageFormatFromAttributes.java
--- a/jdk/test/java/awt/print/PageFormat/PageFormatFromAttributes.java	Thu Mar 24 02:22:01 2016 +0300
+++ b/jdk/test/java/awt/print/PageFormat/PageFormatFromAttributes.java	Thu Mar 24 12:02:06 2016 +0530
@@ -84,12 +84,13 @@
             throw new RuntimeException("expected a media size");
         }
         double units = Size2DSyntax.INCH/72.0;
-        int w = (int)(mediaSize.getX(1)/units);
-        int h = (int)(mediaSize.getY(1)/units);
+        double w = mediaSize.getX(1) / units;
+        double h = mediaSize.getY(1) / units;
         Paper paper = pf.getPaper();
-        int pw = (int)paper.getWidth();
-        int ph = (int)paper.getHeight();
-        if (pw != w || ph != h) {
+        double pw = paper.getWidth();
+        double ph = paper.getHeight();
+        if (Math.round(pw) != Math.round(w) ||
+            Math.round(ph) != Math.round(h)) {
             throw new RuntimeException("size not as specified");
         }
     }