< prev index next >

test/java/awt/image/multiresolution/MultiResolutionToolkitImageTest.java

Print this page


   1 /*
   2  * Copyright (c) 2014, 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  */
  23 
  24 import java.awt.Color;
  25 import java.awt.Graphics;
  26 import java.awt.Image;
  27 import java.awt.Toolkit;
  28 import java.awt.image.BufferedImage;
  29 import java.awt.image.ImageObserver;
  30 import static java.awt.image.ImageObserver.ALLBITS;
  31 import java.io.File;
  32 import javax.imageio.ImageIO;
  33 import sun.awt.OSInfo;
  34 import sun.awt.SunToolkit;
  35 import sun.awt.image.MultiResolutionToolkitImage;
  36 
  37 /**
  38  * @test

  39  * @bug 8040291
  40  * @author Alexander Scherbatiy
  41  * @summary [macosx] Http-Images are not fully loaded when using ImageIcon
  42  * @run main MultiResolutionToolkitImageTest
  43  */

  44 public class MultiResolutionToolkitImageTest {
  45 
  46     private static final int IMAGE_WIDTH = 300;
  47     private static final int IMAGE_HEIGHT = 200;
  48     private static final Color COLOR_1X = Color.GREEN;
  49     private static final Color COLOR_2X = Color.BLUE;
  50     private static final String IMAGE_NAME_1X = "image.png";
  51     private static final String IMAGE_NAME_2X = "image@2x.png";
  52     private static final int WAIT_TIME = 400;
  53     private static volatile boolean isImageLoaded = false;
  54     private static volatile boolean isRVObserverCalled = false;
  55 
  56     public static void main(String[] args) throws Exception {
  57 
  58         if (!checkOS()) {
  59             return;
  60         }
  61         generateImages();
  62         testToolkitMultiResolutionImageLoad();
  63     }


   1 /*
   2  * Copyright (c) 2014, 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  */
  23 
  24 import java.awt.Color;
  25 import java.awt.Graphics;
  26 import java.awt.Image;
  27 import java.awt.Toolkit;
  28 import java.awt.image.BufferedImage;
  29 import java.awt.image.ImageObserver;
  30 import static java.awt.image.ImageObserver.ALLBITS;
  31 import java.io.File;
  32 import javax.imageio.ImageIO;
  33 import sun.awt.OSInfo;
  34 import sun.awt.SunToolkit;
  35 import sun.awt.image.MultiResolutionToolkitImage;
  36 
  37 /**
  38  * @test
  39  * @key headful
  40  * @bug 8040291
  41  * @author Alexander Scherbatiy
  42  * @summary [macosx] Http-Images are not fully loaded when using ImageIcon
  43  * @run main MultiResolutionToolkitImageTest
  44  */
  45 
  46 public class MultiResolutionToolkitImageTest {
  47 
  48     private static final int IMAGE_WIDTH = 300;
  49     private static final int IMAGE_HEIGHT = 200;
  50     private static final Color COLOR_1X = Color.GREEN;
  51     private static final Color COLOR_2X = Color.BLUE;
  52     private static final String IMAGE_NAME_1X = "image.png";
  53     private static final String IMAGE_NAME_2X = "image@2x.png";
  54     private static final int WAIT_TIME = 400;
  55     private static volatile boolean isImageLoaded = false;
  56     private static volatile boolean isRVObserverCalled = false;
  57 
  58     public static void main(String[] args) throws Exception {
  59 
  60         if (!checkOS()) {
  61             return;
  62         }
  63         generateImages();
  64         testToolkitMultiResolutionImageLoad();
  65     }


< prev index next >