harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r593078 - /harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageTest.java
Date Thu, 08 Nov 2007 08:57:36 GMT
Author: apetrenko
Date: Thu Nov  8 00:57:35 2007
New Revision: 593078

URL: http://svn.apache.org/viewvc?rev=593078&view=rev
Log:
Unit test for HARMONY-5066

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageTest.java?rev=593078&r1=593077&r2=593078&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/image/BufferedImageTest.java
Thu Nov  8 00:57:35 2007
@@ -63,4 +63,148 @@
                      Image.UndefinedProperty, img.getProperty("XXX"));
     }
 
+    //Regression tests for HARMONY-5066
+    public final void testH5066_INT_RGB(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_INT_RGB);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+    public final void testH5066_INT_ARGB(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+    public final void testH5066_INT_ARGB_PRE(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_INT_ARGB_PRE);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+    public final void testH5066_INT_BGR(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_INT_BGR);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+    public final void testH5066_3BYTE_BGR(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_3BYTE_BGR);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+
+    public final void testH5066_4BYTE_ABGR(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_4BYTE_ABGR);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+
+    public final void testH5066_4BYTE_ABGR_PRE(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_4BYTE_ABGR_PRE);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+    public final void testH5066_USHORT_565_RGB(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_USHORT_565_RGB);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+    public final void testH5066_USHORT_555_RGB(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_USHORT_555_RGB);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+    public final void testH5066_BYTE_GRAY(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_BYTE_GRAY);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+    public final void testH5066_USHORT_GRAY(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_USHORT_GRAY);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
+    static byte[] cm1 = new byte[] {0, (byte)255 };
+    static byte[] cm2 = new byte[] {0, (byte)85, (byte)170, (byte)255};
+    static byte[] cm4 = new byte[] {0, (byte)17, (byte)34, (byte)51,
+                                  (byte)68, (byte)85,(byte) 102, (byte)119,
+                                  (byte)136, (byte)153, (byte)170, (byte)187,
+                                  (byte)204, (byte)221, (byte)238, (byte)255};
+
+    public final void testH5066_BYTE_BINARY(){
+        WritableRaster wr = null;
+        IndexColorModel icm = null;
+
+        try {
+            icm = new IndexColorModel(1, cm1.length, cm1, cm1, cm1);
+            wr = icm.createCompatibleWritableRaster(10, 10);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException (pixel bits = 1): " + e.getMessage());
+        }
+
+        try {
+            icm = new IndexColorModel(2, cm2.length, cm2, cm2, cm2);
+            wr = icm.createCompatibleWritableRaster(10, 10);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException (pixel bits = 2): " + e.getMessage());
+        }
+
+        try {
+            icm = new IndexColorModel(4, cm4.length, cm4, cm4, cm4);
+            wr = icm.createCompatibleWritableRaster(10, 10);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException (pixel bits = 4): " + e.getMessage());
+        }
+    }
+
+    public final void testH5066_BYTE_INDEXED(){
+        BufferedImage bi = null;
+        try {
+            bi = new BufferedImage(10, 10, BufferedImage.TYPE_BYTE_INDEXED);
+        } catch (RasterFormatException e) {
+            fail("Unexpected RasterFormatException: " + e.getMessage());
+        }
+    }
+
 }



Mime
View raw message