< prev index next >

test/java/awt/image/multiresolution/MultiresolutionIconTest.java

Print this page

        

@@ -26,12 +26,10 @@
  * @bug 8150724 8151303
  * @author a.stepanov
  * @summary Check that correct resolution variants are chosen for icons
  *          when multiresolution image is used for their construction.
  *
- * @requires (os.family != "mac")
- *
  * @library ../../../../lib/testlibrary/
  * @build ExtendedRobot
  * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=1 MultiresolutionIconTest
  * @run main/othervm/timeout=240 -Dsun.java2d.uiScale=2 MultiresolutionIconTest
  */

@@ -40,11 +38,10 @@
 // TODO: please remove the "@requires" tag after 8151303 fix
 
 
 import java.awt.*;
 import java.awt.event.InputEvent;
-import java.awt.geom.AffineTransform;
 import java.awt.image.BaseMultiResolutionImage;
 import java.awt.image.BufferedImage;
 import javax.swing.*;
 
 public class MultiresolutionIconTest extends JFrame {

@@ -126,18 +123,10 @@
 
         setResizable(false);
         setVisible(true);
     }
 
-    private static boolean is2x() {
-
-        AffineTransform tr = GraphicsEnvironment.getLocalGraphicsEnvironment().
-            getDefaultScreenDevice().getDefaultConfiguration().
-            getDefaultTransform();
-        return (Math.min(tr.getScaleX(), tr.getScaleY()) > 1.001);
-    }
-
     private boolean checkPressedColor(int x, int y, Color ok) {
 
         r.mouseMove(x, y);
         r.waitForIdle();
         r.mousePress(InputEvent.BUTTON1_DOWN_MASK);

@@ -173,14 +162,13 @@
 
     private void doTest() {
 
         r.waitForIdle(2000);
         String scale = System.getProperty(SCALE);
-        System.out.println("scale = " + scale);
-        Color
-            expected   = is2x() ? C2X : C1X,
-            unexpected = is2x() ? C1X : C2X;
+        boolean is2x = "2".equals(scale);
+        Color expected = is2x ? C2X : C1X;
+        Color unexpected = is2x ? C1X : C2X;
 
         Point p = lbl.getLocationOnScreen();
         int x = p.x + lbl.getWidth() / 2;
         int y = p.y + lbl.getHeight() / 2;
         int w = lbl.getWidth();

@@ -225,13 +213,10 @@
         dispose();
     }
 
     public static void main(String[] args) throws Exception {
 
-        // TODO: remove is2x() check after JDK-8150844 fix
-        if (is2x() != "2".equals(System.getProperty(SCALE))) { return; }
-
         for (UIManager.LookAndFeelInfo LF: UIManager.getInstalledLookAndFeels()) {
             System.out.println("\nL&F: " + LF.getName());
             (new MultiresolutionIconTest(LF)).doTest();
         }
     }
< prev index next >