< prev index next >

test/java/awt/image/MultiResolutionImageTest.java

Print this page
rev 17561 : 8185500: [TESTBUG] Add keywords headful/printer in java/awt and javax tests.
Summary: Add new keyword 'printer'. Some minor test fixes to show headless exception. Add some @requires windows.
   1 /*
   2  * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  24 import java.awt.Color;
  25 import java.awt.Graphics;
  26 import java.awt.Graphics2D;
  27 import java.awt.Image;
  28 import java.awt.Toolkit;
  29 import java.awt.image.BufferedImage;
  30 import java.io.File;
  31 import java.lang.reflect.Method;
  32 import java.net.URL;
  33 import javax.imageio.ImageIO;
  34 import sun.awt.SunHints;
  35 import java.awt.MediaTracker;
  36 import java.awt.RenderingHints;
  37 import java.awt.image.ImageObserver;
  38 import javax.swing.JPanel;
  39 import jdk.test.lib.Platform;
  40 import java.awt.image.MultiResolutionImage;
  41 
  42 /**
  43  * @test @bug 8011059

  44  * @author Alexander Scherbatiy
  45  * @summary [macosx] Make JDK demos look perfect on retina displays
  46  * @library /test/lib
  47  * @build jdk.test.lib.Platform
  48  * @requires (os.family == "mac")
  49  * @modules java.desktop/sun.awt
  50  *          java.desktop/sun.awt.image
  51  *          java.desktop/sun.lwawt.macosx:open
  52  * @run main MultiResolutionImageTest TOOLKIT_PREPARE
  53  * @run main MultiResolutionImageTest TOOLKIT_LOAD
  54  * @run main MultiResolutionImageTest TOOLKIT
  55  */

  56 public class MultiResolutionImageTest {
  57 
  58     private static final int IMAGE_WIDTH = 300;
  59     private static final int IMAGE_HEIGHT = 200;
  60     private static final Color COLOR_1X = Color.GREEN;
  61     private static final Color COLOR_2X = Color.BLUE;
  62     private static final String IMAGE_NAME_1X = "image.png";
  63     private static final String IMAGE_NAME_2X = "image@2x.png";
  64 
  65     public static void main(String[] args) throws Exception {
  66 
  67         System.out.println("args: " + args.length);
  68 
  69         if (args.length == 0) {
  70             throw new RuntimeException("Not found a test");
  71         }
  72         String test = args[0];
  73         System.out.println("TEST: " + test);
  74 
  75         // To automatically pass the test if the test is not run using JTReg.


   1 /*
   2  * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */


  24 import java.awt.Color;
  25 import java.awt.Graphics;
  26 import java.awt.Graphics2D;
  27 import java.awt.Image;
  28 import java.awt.Toolkit;
  29 import java.awt.image.BufferedImage;
  30 import java.io.File;
  31 import java.lang.reflect.Method;
  32 import java.net.URL;
  33 import javax.imageio.ImageIO;
  34 import sun.awt.SunHints;
  35 import java.awt.MediaTracker;
  36 import java.awt.RenderingHints;
  37 import java.awt.image.ImageObserver;
  38 import javax.swing.JPanel;
  39 import jdk.test.lib.Platform;
  40 import java.awt.image.MultiResolutionImage;
  41 
  42 /**
  43  * @test @bug 8011059
  44  * @key headful
  45  * @author Alexander Scherbatiy
  46  * @summary [macosx] Make JDK demos look perfect on retina displays
  47  * @library /test/lib
  48  * @build jdk.test.lib.Platform
  49  * @requires (os.family == "mac")
  50  * @modules java.desktop/sun.awt
  51  *          java.desktop/sun.awt.image
  52  *          java.desktop/sun.lwawt.macosx:open
  53  * @run main MultiResolutionImageTest TOOLKIT_PREPARE
  54  * @run main MultiResolutionImageTest TOOLKIT_LOAD
  55  * @run main MultiResolutionImageTest TOOLKIT
  56  */
  57 
  58 public class MultiResolutionImageTest {
  59 
  60     private static final int IMAGE_WIDTH = 300;
  61     private static final int IMAGE_HEIGHT = 200;
  62     private static final Color COLOR_1X = Color.GREEN;
  63     private static final Color COLOR_2X = Color.BLUE;
  64     private static final String IMAGE_NAME_1X = "image.png";
  65     private static final String IMAGE_NAME_2X = "image@2x.png";
  66 
  67     public static void main(String[] args) throws Exception {
  68 
  69         System.out.println("args: " + args.length);
  70 
  71         if (args.length == 0) {
  72             throw new RuntimeException("Not found a test");
  73         }
  74         String test = args[0];
  75         System.out.println("TEST: " + test);
  76 
  77         // To automatically pass the test if the test is not run using JTReg.


< prev index next >