< prev index next >
test/java/awt/SplashScreen/MultiResolutionSplash/MultiResolutionSplashTest.java
Print this page
*** 24,33 ****
--- 24,34 ----
import java.awt.Color;
import java.awt.Dialog;
import java.awt.Frame;
import java.awt.Graphics;
import java.awt.Graphics2D;
+ import java.awt.GraphicsEnvironment;
import java.awt.Panel;
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.SplashScreen;
import java.awt.TextField;
*** 38,51 ****
import javax.imageio.ImageIO;
import sun.java2d.SunGraphics2D;
/**
* @test
! * @bug 8043869 8075244 8078082
! * @author Alexander Scherbatiy
! * @summary [macosx] java -splash does not honor 2x hi dpi notation for retina
! * support
* @modules java.desktop/sun.java2d
* @run main MultiResolutionSplashTest GENERATE_IMAGES
* @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0
* @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1
* @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2
--- 39,50 ----
import javax.imageio.ImageIO;
import sun.java2d.SunGraphics2D;
/**
* @test
! * @bug 8043869 8075244 8078082 8145173
! * @summary Tests the HiDPI splash screen support for windows and MAC
* @modules java.desktop/sun.java2d
* @run main MultiResolutionSplashTest GENERATE_IMAGES
* @run main/othervm -splash:splash1.png MultiResolutionSplashTest TEST_SPLASH 0
* @run main/othervm -splash:splash2 MultiResolutionSplashTest TEST_SPLASH 1
* @run main/othervm -splash:splash3. MultiResolutionSplashTest TEST_SPLASH 2
*** 54,73 ****
public class MultiResolutionSplashTest {
private static final int IMAGE_WIDTH = 300;
private static final int IMAGE_HEIGHT = 200;
! private static final ImageInfo[] tests = {
new ImageInfo("splash1.png", "splash1@2x.png", Color.BLUE, Color.GREEN),
new ImageInfo("splash2", "splash2@2x", Color.WHITE, Color.BLACK),
new ImageInfo("splash3.", "splash3@2x.", Color.YELLOW, Color.RED)
};
public static void main(String[] args) throws Exception {
String test = args[0];
!
switch (test) {
case "GENERATE_IMAGES":
generateImages();
break;
case "TEST_SPLASH":
--- 53,82 ----
public class MultiResolutionSplashTest {
private static final int IMAGE_WIDTH = 300;
private static final int IMAGE_HEIGHT = 200;
! private static final ImageInfo[] macTests = {
new ImageInfo("splash1.png", "splash1@2x.png", Color.BLUE, Color.GREEN),
new ImageInfo("splash2", "splash2@2x", Color.WHITE, Color.BLACK),
new ImageInfo("splash3.", "splash3@2x.", Color.YELLOW, Color.RED)
};
+ private static final ImageInfo[] windowsTests = {
+ new ImageInfo("splash1.png", "splash1.scale-120.png", Color.BLUE, Color.GREEN),
+ new ImageInfo("splash2", "splash2.scale-120", Color.WHITE, Color.BLACK),
+ new ImageInfo("splash3.", "splash3.scale-120.", Color.YELLOW, Color.RED)
+ };
+ private static ImageInfo[] tests;
public static void main(String[] args) throws Exception {
String test = args[0];
! tests = windowsTests;
! String osName = System.getProperty("os.name");
! if(osName.equalsIgnoreCase("mac")) {
! tests = macTests;
! }
switch (test) {
case "GENERATE_IMAGES":
generateImages();
break;
case "TEST_SPLASH":
*** 154,164 ****
@Override
public void paint(Graphics g) {
float scaleFactor = 1;
if (g instanceof SunGraphics2D) {
! scaleFactor = ((SunGraphics2D) g).surfaceData.getDefaultScale();
}
scaleFactors[0] = scaleFactor;
dialog.setVisible(false);
}
};
--- 163,176 ----
@Override
public void paint(Graphics g) {
float scaleFactor = 1;
if (g instanceof SunGraphics2D) {
! scaleFactor = (float)GraphicsEnvironment.
! getLocalGraphicsEnvironment().
! getDefaultScreenDevice().getDefaultConfiguration().
! getDefaultTransform().getScaleX();
}
scaleFactors[0] = scaleFactor;
dialog.setVisible(false);
}
};
< prev index next >