8146881: [TEST] update some imageio plugins tests to affect TIFF format
Reviewed-by: serb, ssadetsky
--- a/jdk/test/javax/imageio/MultiReadTest.java Thu Jan 21 14:49:02 2016 -0800
+++ b/jdk/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/jdk/test/javax/imageio/plugins/shared/BitDepth.java Thu Jan 21 14:49:02 2016 -0800
+++ b/jdk/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/jdk/test/javax/imageio/plugins/shared/ImageWriterCompressionTest.java Thu Jan 21 14:49:02 2016 -0800
+++ b/jdk/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) {