7107620: Need to round in test java/awt/print/PageFormat/PageFormatFromAttributes.java
Reviewed-by: prr
--- 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");
}
}