0N/A/*
2362N/A * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
0N/A * published by the Free Software Foundation.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/A
0N/Aimport java.awt.color.ColorSpace;
0N/Aimport java.awt.image.BufferedImage;
0N/Aimport java.awt.image.DataBuffer;
0N/A
0N/Apublic abstract class ColConvTest implements Runnable {
0N/A
0N/A /* Parameters of the testing subimage */
0N/A static final int SI_X = 10;
0N/A static final int SI_Y = 10;
0N/A static final int SI_W = 100;
0N/A static final int SI_H = 100;
0N/A
0N/A private boolean passed = false;
0N/A
0N/A static String getCSName(int cs) {
0N/A switch(cs) {
0N/A case ColorSpace.CS_GRAY:
0N/A return "CS_GRAY";
0N/A case ColorSpace.CS_CIEXYZ:
0N/A return "CS_CIEXYZ";
0N/A case ColorSpace.CS_LINEAR_RGB:
0N/A return "CS_LINEAR_RGB";
0N/A case ColorSpace.CS_PYCC:
0N/A return "CS_PYCC";
0N/A case ColorSpace.CS_sRGB:
0N/A return "CS_sRGB";
0N/A }
0N/A return "UNKNOWN";
0N/A }
0N/A
0N/A static String getDTName(int dType) {
0N/A switch(dType) {
0N/A case DataBuffer.TYPE_BYTE:
0N/A return "TYPE_BYTE";
0N/A case DataBuffer.TYPE_DOUBLE:
0N/A return "TYPE_DOUBLE";
0N/A case DataBuffer.TYPE_FLOAT:
0N/A return "TYPE_FLOAT";
0N/A case DataBuffer.TYPE_INT:
0N/A return "TYPE_INT";
0N/A case DataBuffer.TYPE_SHORT:
0N/A return "TYPE_SHORT";
0N/A case DataBuffer.TYPE_USHORT:
0N/A return "TYPE_USHORT";
0N/A case DataBuffer.TYPE_UNDEFINED:
0N/A return "TYPE_UNDEFINED";
0N/A }
0N/A return "UNKNOWN";
0N/A }
0N/A
0N/A static String getImageTypeName(int type) {
0N/A switch(type) {
0N/A case BufferedImage.TYPE_INT_ARGB:
0N/A return "TYPE_INT_ARGB";
0N/A case BufferedImage.TYPE_INT_RGB:
0N/A return "TYPE_INT_RGB";
0N/A case BufferedImage.TYPE_INT_BGR:
0N/A return "TYPE_INT_BGR";
0N/A case BufferedImage.TYPE_INT_ARGB_PRE:
0N/A return "TYPE_INT_ARGB_PRE";
0N/A case BufferedImage.TYPE_3BYTE_BGR:
0N/A return "TYPE_3BYTE_BGR";
0N/A case BufferedImage.TYPE_4BYTE_ABGR:
0N/A return "TYPE_4BYTE_ABGR";
0N/A case BufferedImage.TYPE_4BYTE_ABGR_PRE:
0N/A return "TYPE_4BYTE_ABGR_PRE";
0N/A case BufferedImage.TYPE_BYTE_BINARY:
0N/A return "TYPE_BYTE_BINARY";
0N/A case BufferedImage.TYPE_BYTE_GRAY:
0N/A return "TYPE_BYTE_GRAY";
0N/A case BufferedImage.TYPE_BYTE_INDEXED:
0N/A return "TYPE_BYTE_INDEXED";
0N/A case BufferedImage.TYPE_USHORT_555_RGB:
0N/A return "TYPE_USHORT_555_RGB";
0N/A case BufferedImage.TYPE_USHORT_565_RGB:
0N/A return "TYPE_USHORT_565_RGB";
0N/A case BufferedImage.TYPE_USHORT_GRAY:
0N/A return "TYPE_USHORT_GRAY";
0N/A }
0N/A return "UNKNOWN";
0N/A }
0N/A
0N/A /* Actual tests should override this method and put initialization logic
0N/A * into it
0N/A */
0N/A public abstract void init();
0N/A
0N/A /* Actual tests should override this method and put test logic into it */
0N/A public abstract void runTest();
0N/A
0N/A public final void run() {
0N/A try {
0N/A runTest();
0N/A passed = true;
0N/A } catch (Throwable ex) {
0N/A ex.printStackTrace();
0N/A passed = false;
0N/A throw new RuntimeException(ex);
0N/A }
0N/A }
0N/A
0N/A /* returns result of the test */
0N/A public boolean isPassed() {
0N/A return passed;
0N/A }
0N/A}