7107620: Need to round in test java/awt/print/PageFormat/PageFormatFromAttributes.java

Reviewed-by: prr
This commit is contained in:
Prasanta Sadhukhan 2016-03-24 12:02:06 +05:30
parent c661c227e2
commit 234e906b1f

View File

@ -84,12 +84,13 @@ public class PageFormatFromAttributes {
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");
}
}