< prev index next >
test/java/awt/image/multiresolution/MenuMultiresolutionIconTest.java
Print this page
*** 113,129 ****
popup.show(MenuMultiresolutionIconTest.this, e.getX(), e.getY());
}
}
}
- private static boolean is2x() {
-
- return GraphicsEnvironment.getLocalGraphicsEnvironment().
- getDefaultScreenDevice().getDefaultConfiguration().
- getDefaultTransform().getScaleX() > 1.001;
- }
-
private boolean eqColors(Color c1, Color c2) {
int tol = 15;
return (
Math.abs(c2.getRed() - c1.getRed() ) < tol &&
--- 113,122 ----
*** 131,141 ****
Math.abs(c2.getBlue() - c1.getBlue() ) < tol);
}
private void checkIconColor(Point p, String what) {
! Color expected = is2x() ? C2X : C1X;
Color c = r.getPixelColor(p.x + SZ / 2, p.y + SZ / 2);
if (!eqColors(c, expected)) {
frame.dispose();
throw new RuntimeException("invalid " + what + "menu item icon " +
"color, expected: " + expected + ", got: " + c);
--- 124,135 ----
Math.abs(c2.getBlue() - c1.getBlue() ) < tol);
}
private void checkIconColor(Point p, String what) {
! String scale = System.getProperty(SCALE);
! Color expected = "2".equals(scale) ? C2X : C1X;
Color c = r.getPixelColor(p.x + SZ / 2, p.y + SZ / 2);
if (!eqColors(c, expected)) {
frame.dispose();
throw new RuntimeException("invalid " + what + "menu item icon " +
"color, expected: " + expected + ", got: " + c);
*** 175,185 ****
frame.dispose();
}
public static void main(String s[]) throws Exception {
- // TODO: remove is2x() after JDK-8150844 fix
- if (is2x() == "2".equals(System.getProperty(SCALE))) {
(new MenuMultiresolutionIconTest()).doTest();
}
- }
}
--- 169,176 ----
< prev index next >