8146881: [TEST] update some imageio plugins tests to affect TIFF format
Reviewed-by: serb, ssadetsky
This commit is contained in:
parent
8969d1404a
commit
08f0edbf5a
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -52,7 +52,7 @@ public class MultiReadTest {
|
|||||||
private static final int max = 5;
|
private static final int max = 5;
|
||||||
|
|
||||||
public static void main(String[] args) throws IOException {
|
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) {
|
for (String f : formats) {
|
||||||
test(f);
|
test(f);
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -23,11 +23,11 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
* @bug 4413109 4418221 6607198
|
* @bug 4413109 4418221 6607198 8147448
|
||||||
* @run main BitDepth
|
* @run main BitDepth
|
||||||
* @summary Checks that the PNG and JPEG writers can handle various
|
* @summary Checks that ImageIO writers for standard formats can handle
|
||||||
* BufferedImage types. An optional list of arguments may be used to
|
* various BufferedImage RGB types. An optional list of arguments
|
||||||
* test a different format writer or writers.
|
* may be used to test the writers for a different list of formats.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
@ -81,21 +81,19 @@ public class BitDepth {
|
|||||||
BufferedImage.TYPE_INT_BGR,
|
BufferedImage.TYPE_INT_BGR,
|
||||||
BufferedImage.TYPE_3BYTE_BGR,
|
BufferedImage.TYPE_3BYTE_BGR,
|
||||||
BufferedImage.TYPE_USHORT_565_RGB,
|
BufferedImage.TYPE_USHORT_565_RGB,
|
||||||
BufferedImage.TYPE_USHORT_555_RGB
|
BufferedImage.TYPE_USHORT_555_RGB,
|
||||||
};
|
|
||||||
|
|
||||||
private static final int[] biRGBATypes = {
|
|
||||||
BufferedImage.TYPE_INT_ARGB,
|
BufferedImage.TYPE_INT_ARGB,
|
||||||
BufferedImage.TYPE_INT_ARGB_PRE,
|
BufferedImage.TYPE_INT_ARGB_PRE,
|
||||||
BufferedImage.TYPE_4BYTE_ABGR,
|
BufferedImage.TYPE_4BYTE_ABGR,
|
||||||
BufferedImage.TYPE_4BYTE_ABGR_PRE
|
BufferedImage.TYPE_4BYTE_ABGR_PRE
|
||||||
};
|
};
|
||||||
|
|
||||||
private static final int[] biGrayTypes = {
|
//private static final int[] biGrayTypes = {
|
||||||
BufferedImage.TYPE_BYTE_GRAY,
|
// BufferedImage.TYPE_BYTE_GRAY,
|
||||||
BufferedImage.TYPE_USHORT_GRAY,
|
// BufferedImage.TYPE_USHORT_GRAY,
|
||||||
BufferedImage.TYPE_BYTE_BINARY
|
// BufferedImage.TYPE_BYTE_BINARY
|
||||||
};
|
//};
|
||||||
|
|
||||||
|
|
||||||
private static final String[] biTypeNames = {
|
private static final String[] biTypeNames = {
|
||||||
"CUSTOM",
|
"CUSTOM",
|
||||||
@ -116,7 +114,7 @@ public class BitDepth {
|
|||||||
|
|
||||||
private int width = 80;
|
private int width = 80;
|
||||||
private int height = 80;
|
private int height = 80;
|
||||||
private String[] format = { "png", "jpeg" };
|
private String[] format = { "png", "jpeg", "tif", "bmp", "gif" };
|
||||||
|
|
||||||
public BitDepth(String[] args) throws IOException {
|
public BitDepth(String[] args) throws IOException {
|
||||||
if (args.length > 0) {
|
if (args.length > 0) {
|
||||||
@ -129,10 +127,28 @@ public class BitDepth {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void testFormat(String format) throws IOException {
|
private void testFormat(String format) throws IOException {
|
||||||
|
|
||||||
boolean allOK = true;
|
boolean allOK = true;
|
||||||
|
|
||||||
for (int i = 0; i < biRGBTypes.length; i++) {
|
for (int i = 0; i < biRGBTypes.length; i++) {
|
||||||
|
|
||||||
int type = biRGBTypes[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 +
|
System.out.println("Testing " + format +
|
||||||
" writer for type " + biTypeNames[type]);
|
" writer for type " + biTypeNames[type]);
|
||||||
File f = testWriteRGB(format, type);
|
File f = testWriteRGB(format, type);
|
||||||
@ -143,6 +159,8 @@ public class BitDepth {
|
|||||||
allOK = allOK && ok;
|
allOK = allOK && ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (format.equals("png")) {
|
if (format.equals("png")) {
|
||||||
System.out.println("Testing png writer for black stripe");
|
System.out.println("Testing png writer for black stripe");
|
||||||
boolean ok = testPNGByteBinary();
|
boolean ok = testPNGByteBinary();
|
||||||
@ -154,8 +172,8 @@ public class BitDepth {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private File testWriteRGB(String format, int type)
|
private File testWriteRGB(String format, int type) throws IOException {
|
||||||
throws IOException {
|
|
||||||
BufferedImage bi = new BufferedImage(width, height, type);
|
BufferedImage bi = new BufferedImage(width, height, type);
|
||||||
Graphics2D g = bi.createGraphics();
|
Graphics2D g = bi.createGraphics();
|
||||||
|
|
||||||
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -53,8 +53,7 @@ public class ImageWriterCompressionTest {
|
|||||||
private static final Set<String> IGNORE_FILE_SUFFIXES
|
private static final Set<String> IGNORE_FILE_SUFFIXES
|
||||||
= new HashSet<String>(Arrays.asList(new String[] {
|
= new HashSet<String>(Arrays.asList(new String[] {
|
||||||
"bmp", "gif",
|
"bmp", "gif",
|
||||||
"jpg", "jpeg",
|
"jpg", "jpeg"
|
||||||
// "tif", "tiff"
|
|
||||||
} ));
|
} ));
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user