< prev index next >
test/java/awt/image/multiresolution/MultiresolutionIconTest.java
Print this page
*** 26,37 ****
* @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
*/
--- 26,35 ----
*** 40,50 ****
// 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 {
--- 38,47 ----
*** 126,143 ****
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);
--- 123,132 ----
*** 173,186 ****
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;
Point p = lbl.getLocationOnScreen();
int x = p.x + lbl.getWidth() / 2;
int y = p.y + lbl.getHeight() / 2;
int w = lbl.getWidth();
--- 162,174 ----
private void doTest() {
r.waitForIdle(2000);
String scale = System.getProperty(SCALE);
! 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,237 ****
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();
}
}
--- 213,222 ----
< prev index next >