changeset 13659:7bf9151c0407

8146881: [TEST] update some imageio plugins tests to affect TIFF format Reviewed-by: serb, ssadetsky
author avstepan
date Fri, 22 Jan 2016 13:37:46 +0300
parents 3b8b58b67559
children c24e4eca4aaf
files test/javax/imageio/MultiReadTest.java test/javax/imageio/plugins/shared/BitDepth.java test/javax/imageio/plugins/shared/ImageWriterCompressionTest.java
diffstat 3 files changed, 39 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/test/javax/imageio/MultiReadTest.java	Thu Jan 21 14:49:02 2016 -0800
+++ b/test/javax/imageio/MultiReadTest.java	Fri Jan 22 13:37:46 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -52,7 +52,7 @@
     private static final int max = 5;
 
     public static void main(String[] args) throws IOException {
-        final String[] formats = { "bmp", "png", "gif", "jpg" };
+        final String[] formats = { "bmp", "png", "gif", "jpg", "tif" };
 
         for (String f : formats) {
             test(f);
--- a/test/javax/imageio/plugins/shared/BitDepth.java	Thu Jan 21 14:49:02 2016 -0800
+++ b/test/javax/imageio/plugins/shared/BitDepth.java	Fri Jan 22 13:37:46 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,11 +23,11 @@
 
 /**
  * @test
- * @bug     4413109 4418221 6607198
+ * @bug     4413109 4418221 6607198 8147448
  * @run     main BitDepth
- * @summary Checks that the PNG and JPEG writers can handle various
- * BufferedImage types.  An optional list of arguments may be used to
- * test a different format writer or writers.
+ * @summary Checks that ImageIO writers for standard formats can handle
+ *          various BufferedImage RGB types. An optional list of arguments
+ *          may be used to test the writers for a different list of formats.
  */
 
 import java.awt.Color;
@@ -81,21 +81,19 @@
         BufferedImage.TYPE_INT_BGR,
         BufferedImage.TYPE_3BYTE_BGR,
         BufferedImage.TYPE_USHORT_565_RGB,
-        BufferedImage.TYPE_USHORT_555_RGB
-    };
-
-    private static final int[] biRGBATypes = {
+        BufferedImage.TYPE_USHORT_555_RGB,
         BufferedImage.TYPE_INT_ARGB,
         BufferedImage.TYPE_INT_ARGB_PRE,
         BufferedImage.TYPE_4BYTE_ABGR,
         BufferedImage.TYPE_4BYTE_ABGR_PRE
     };
 
-    private static final int[] biGrayTypes = {
-        BufferedImage.TYPE_BYTE_GRAY,
-        BufferedImage.TYPE_USHORT_GRAY,
-        BufferedImage.TYPE_BYTE_BINARY
-    };
+    //private static final int[] biGrayTypes = {
+    //    BufferedImage.TYPE_BYTE_GRAY,
+    //    BufferedImage.TYPE_USHORT_GRAY,
+    //    BufferedImage.TYPE_BYTE_BINARY
+    //};
+
 
     private static final String[] biTypeNames = {
         "CUSTOM",
@@ -116,7 +114,7 @@
 
     private int width = 80;
     private int height = 80;
-    private String[] format = { "png", "jpeg" };
+    private String[] format = { "png", "jpeg", "tif", "bmp", "gif" };
 
     public BitDepth(String[] args) throws IOException {
         if (args.length > 0) {
@@ -129,10 +127,28 @@
     }
 
     private void testFormat(String format) throws IOException {
+
         boolean allOK = true;
 
         for (int i = 0; i < biRGBTypes.length; i++) {
+
             int type = biRGBTypes[i];
+
+
+            // TODO: remove the following 'if' block after the 8147448 fix
+            if ( format.toLowerCase().equals("bmp") && (
+                (type == BufferedImage.TYPE_INT_ARGB       ) ||
+                (type == BufferedImage.TYPE_INT_ARGB_PRE   ) ||
+                (type == BufferedImage.TYPE_4BYTE_ABGR     ) ||
+                (type == BufferedImage.TYPE_4BYTE_ABGR_PRE ))) {
+
+                System.err.println("cannot use " + biTypeNames[type] +
+                " for bmp because of JDK-8147448.\t" +
+                " please update the test after fix of this bug!");
+                continue;
+            }
+
+
             System.out.println("Testing " + format +
                                " writer for type " + biTypeNames[type]);
             File f = testWriteRGB(format, type);
@@ -143,6 +159,8 @@
             allOK = allOK && ok;
         }
 
+
+
         if (format.equals("png")) {
             System.out.println("Testing png writer for black stripe");
             boolean ok = testPNGByteBinary();
@@ -154,8 +172,8 @@
         }
     }
 
-    private File testWriteRGB(String format, int type)
-        throws IOException {
+    private File testWriteRGB(String format, int type) throws IOException {
+
         BufferedImage bi = new BufferedImage(width, height, type);
         Graphics2D g = bi.createGraphics();
 
--- a/test/javax/imageio/plugins/shared/ImageWriterCompressionTest.java	Thu Jan 21 14:49:02 2016 -0800
+++ b/test/javax/imageio/plugins/shared/ImageWriterCompressionTest.java	Fri Jan 22 13:37:46 2016 +0300
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -53,8 +53,7 @@
     private static final Set<String> IGNORE_FILE_SUFFIXES
         = new HashSet<String>(Arrays.asList(new String[] {
             "bmp", "gif",
-            "jpg", "jpeg",
-//            "tif", "tiff"
+            "jpg", "jpeg"
         } ));
 
     public static void main(String[] args) {