< prev index next >

modules/javafx.swing/src/test/java/test/javafx/embed/swing/SwingFXUtilsTest.java

Print this page

 39 import org.junit.AfterClass;
 40 import static org.junit.Assert.assertEquals;
 41 import static org.junit.Assert.assertNotNull;
 42 import static org.junit.Assert.assertTrue;
 43 import org.junit.BeforeClass;
 44 import org.junit.Test;
 45 
 46 
 47 public class SwingFXUtilsTest {
 48     static final boolean verbose = false;
 49 
 50     // Used to launch the application before running any test
 51     private static final CountDownLatch launchLatch = new CountDownLatch(1);
 52 
 53 
 54     @BeforeClass
 55     public static void doSetupOnce() {
 56         JFXPanelTest.doSetupOnce();
 57     }
 58 
 59     @AfterClass
 60     public static void doTeardownOnce() {
 61         Platform.exit();
 62     }
 63 
 64     @Test
 65     public void testFromFXImg() {
 66         testFromFXImg("alpha.png");
 67         testFromFXImg("opaque.gif");
 68         testFromFXImg("opaque.jpg");
 69         testFromFXImg("opaque.png");
 70         testFromFXImg("trans.gif");
 71     }
 72 
 73     static void testFromFXImg(String imgfilename) {
 74         Image img = new Image("test/javafx/embed/swing/"+imgfilename);
 75         boolean rgbrequired = (img.getPixelReader().getPixelFormat().getType() == PixelFormat.Type.BYTE_RGB);
 76         BufferedImage bimg = SwingFXUtils.fromFXImage(img, null);
 77         checkBimg(img, bimg);
 78         boolean reusesitself = reusesBimg(img, bimg, true);
 79         boolean reusesxrgb = reusesBimg(img, BufferedImage.TYPE_INT_RGB, rgbrequired);
 80         boolean reusesargb = reusesBimg(img, BufferedImage.TYPE_INT_ARGB, true);
 81         boolean reusesargbpre = reusesBimg(img, BufferedImage.TYPE_INT_ARGB_PRE, true);
 82         if (verbose) {
 83             System.out.println(imgfilename+" type = "+img.getPixelReader().getPixelFormat());

 39 import org.junit.AfterClass;
 40 import static org.junit.Assert.assertEquals;
 41 import static org.junit.Assert.assertNotNull;
 42 import static org.junit.Assert.assertTrue;
 43 import org.junit.BeforeClass;
 44 import org.junit.Test;
 45 
 46 
 47 public class SwingFXUtilsTest {
 48     static final boolean verbose = false;
 49 
 50     // Used to launch the application before running any test
 51     private static final CountDownLatch launchLatch = new CountDownLatch(1);
 52 
 53 
 54     @BeforeClass
 55     public static void doSetupOnce() {
 56         JFXPanelTest.doSetupOnce();
 57     }
 58 





 59     @Test
 60     public void testFromFXImg() {
 61         testFromFXImg("alpha.png");
 62         testFromFXImg("opaque.gif");
 63         testFromFXImg("opaque.jpg");
 64         testFromFXImg("opaque.png");
 65         testFromFXImg("trans.gif");
 66     }
 67 
 68     static void testFromFXImg(String imgfilename) {
 69         Image img = new Image("test/javafx/embed/swing/"+imgfilename);
 70         boolean rgbrequired = (img.getPixelReader().getPixelFormat().getType() == PixelFormat.Type.BYTE_RGB);
 71         BufferedImage bimg = SwingFXUtils.fromFXImage(img, null);
 72         checkBimg(img, bimg);
 73         boolean reusesitself = reusesBimg(img, bimg, true);
 74         boolean reusesxrgb = reusesBimg(img, BufferedImage.TYPE_INT_RGB, rgbrequired);
 75         boolean reusesargb = reusesBimg(img, BufferedImage.TYPE_INT_ARGB, true);
 76         boolean reusesargbpre = reusesBimg(img, BufferedImage.TYPE_INT_ARGB_PRE, true);
 77         if (verbose) {
 78             System.out.println(imgfilename+" type = "+img.getPixelReader().getPixelFormat());
< prev index next >