You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by da...@apache.org on 2012/05/26 23:19:22 UTC

svn commit: r1342971 [18/20] - in /commons/proper/imaging/trunk/src: main/java/org/apache/commons/imaging/formats/bmp/ main/java/org/apache/commons/imaging/formats/bmp/pixelparsers/ main/java/org/apache/commons/imaging/formats/bmp/writers/ main/java/or...

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/icns/IcnsRoundTripTest.java Sat May 26 21:19:03 2012
@@ -30,8 +30,7 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.util.Debug;
 import org.apache.commons.imaging.util.IoUtils;
 
-public class IcnsRoundTripTest extends IcnsBaseTest
-{
+public class IcnsRoundTripTest extends IcnsBaseTest {
     // 16x16 test image
     private static final int[][] image = {
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
@@ -52,36 +51,31 @@ public class IcnsRoundTripTest extends I
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}
     };
 
-    public void test1BPPIconMaskVersus8BPPMask() throws Exception
-    {
+    public void test1BPPIconMaskVersus8BPPMask() throws Exception {
         final int foreground = 0xff000000;
         final int background = 0xff000000;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN);
         bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
-        bos.write4Bytes(4 + 4 + 4 + 4 + 2*16*16/8 + 4 + 4 + 16*16);
+        bos.write4Bytes(4 + 4 + 4 + 4 + 2 * 16 * 16 / 8 + 4 + 4 + 16 * 16);
         bos.write4Bytes(IcnsType.ICNS_16x16_1BIT_IMAGE_AND_MASK.getType());
-        bos.write4Bytes(4 + 4 + 2*16*16/8);
+        bos.write4Bytes(4 + 4 + 2 * 16 * 16 / 8);
         // 1 BPP image - all black
-        for (int y = 0; y < 16; y++)
-        {
+        for (int y = 0; y < 16; y++) {
             bos.write(0xff);
             bos.write(0xff);
         }
         // 1 BPP mask - all opaque
-        for (int y = 0; y < 16; y++)
-        {
+        for (int y = 0; y < 16; y++) {
             bos.write(0xff);
             bos.write(0xff);
         }
         // 8 BPP alpha mask - partially transparent
         bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_MASK.getType());
-        bos.write4Bytes(4 + 4 + 16*16);
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        bos.write4Bytes(4 + 4 + 16 * 16);
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 if (image[y][x] != 0)
                     bos.write(0xff);
                 else
@@ -93,22 +87,19 @@ public class IcnsRoundTripTest extends I
                 baos.toByteArray(), foreground, background);
     }
 
-    public void test8BPPIcon8BPPMask() throws Exception
-    {
+    public void test8BPPIcon8BPPMask() throws Exception {
         final int foreground = 0xff000000;
         final int background = 0x00cccccc;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN);
         bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
-        bos.write4Bytes(4 + 4 + 4 + 4 + 16*16 + 4 + 4 + 16*16);
+        bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16 + 4 + 4 + 16 * 16);
         bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType());
-        bos.write4Bytes(4 + 4 + 16*16);
+        bos.write4Bytes(4 + 4 + 16 * 16);
         // 8 BPP image
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 if (image[y][x] != 0)
                     bos.write(0xff);
                 else
@@ -117,11 +108,9 @@ public class IcnsRoundTripTest extends I
         }
         // 8 BPP alpha mask
         bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_MASK.getType());
-        bos.write4Bytes(4 + 4 + 16*16);
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        bos.write4Bytes(4 + 4 + 16 * 16);
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 if (image[y][x] != 0)
                     bos.write(0xff);
                 else
@@ -129,25 +118,24 @@ public class IcnsRoundTripTest extends I
             }
         }
         bos.flush();
-        writeAndReadImageData("8bpp-image-8bpp-mask", baos.toByteArray(), foreground, background);
+        writeAndReadImageData("8bpp-image-8bpp-mask", baos.toByteArray(),
+                foreground, background);
     }
 
-    public void test8BPPIcon8BPPMaskVersus1BPPMask() throws Exception
-    {
+    public void test8BPPIcon8BPPMaskVersus1BPPMask() throws Exception {
         final int foreground = 0xff000000;
         final int background = 0x00cccccc;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN);
         bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
-        bos.write4Bytes(4 + 4 + 4 + 4 + 16*16 + 4 + 4 + 16*16 + 4 + 4 + 2*16*16/8);
+        bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16 + 4 + 4 + 16 * 16 + 4 + 4 + 2
+                * 16 * 16 / 8);
         bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType());
-        bos.write4Bytes(4 + 4 + 16*16);
+        bos.write4Bytes(4 + 4 + 16 * 16);
         // 8 BPP image
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 if (image[y][x] != 0)
                     bos.write(0xff);
                 else
@@ -156,11 +144,9 @@ public class IcnsRoundTripTest extends I
         }
         // 8 BPP alpha mask, some transparent
         bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_MASK.getType());
-        bos.write4Bytes(4 + 4 + 16*16);
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        bos.write4Bytes(4 + 4 + 16 * 16);
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 if (image[y][x] != 0)
                     bos.write(0xff);
                 else
@@ -169,24 +155,20 @@ public class IcnsRoundTripTest extends I
         }
         // 1 BPP mask
         bos.write4Bytes(IcnsType.ICNS_16x16_1BIT_IMAGE_AND_MASK.getType());
-        bos.write4Bytes(4 + 4 + 2*16*16/8);
+        bos.write4Bytes(4 + 4 + 2 * 16 * 16 / 8);
         // 1 bit image
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x += 8)
-            {
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x += 8) {
                 int eightBits = 0;
-                for (int pos = 0; pos < 8; pos++)
-                {
-                    if (image[y][x+pos] != 0)
+                for (int pos = 0; pos < 8; pos++) {
+                    if (image[y][x + pos] != 0)
                         eightBits |= (1 << (7 - pos));
                 }
                 bos.write(eightBits);
             }
         }
         // 1 bit mask, all opaque
-        for (int y = 0; y < 16; y++)
-        {
+        for (int y = 0; y < 16; y++) {
             bos.write(0xff);
             bos.write(0xff);
         }
@@ -195,22 +177,20 @@ public class IcnsRoundTripTest extends I
                 baos.toByteArray(), foreground, background);
     }
 
-    public void test8BPPIcon1BPPMaskVersus8BPPMask() throws Exception
-    {
+    public void test8BPPIcon1BPPMaskVersus8BPPMask() throws Exception {
         final int foreground = 0xff000000;
         final int background = 0x00cccccc;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN);
         bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
-        bos.write4Bytes(4 + 4 + 4 + 4 + 16*16 + 4 + 4 + 16*16 + 4 + 4 + 2*16*16/8);
+        bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16 + 4 + 4 + 16 * 16 + 4 + 4 + 2
+                * 16 * 16 / 8);
         bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType());
-        bos.write4Bytes(4 + 4 + 16*16);
+        bos.write4Bytes(4 + 4 + 16 * 16);
         // 8 BPP image
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 if (image[y][x] != 0)
                     bos.write(0xff);
                 else
@@ -219,34 +199,28 @@ public class IcnsRoundTripTest extends I
         }
         // 1 BPP mask
         bos.write4Bytes(IcnsType.ICNS_16x16_1BIT_IMAGE_AND_MASK.getType());
-        bos.write4Bytes(4 + 4 + 2*16*16/8);
+        bos.write4Bytes(4 + 4 + 2 * 16 * 16 / 8);
         // 1 bit image
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x += 8)
-            {
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x += 8) {
                 int eightBits = 0;
-                for (int pos = 0; pos < 8; pos++)
-                {
-                    if (image[y][x+pos] != 0)
+                for (int pos = 0; pos < 8; pos++) {
+                    if (image[y][x + pos] != 0)
                         eightBits |= (1 << (7 - pos));
                 }
                 bos.write(eightBits);
             }
         }
         // 1 bit mask, all opaque
-        for (int y = 0; y < 16; y++)
-        {
+        for (int y = 0; y < 16; y++) {
             bos.write(0xff);
             bos.write(0xff);
         }
         // 8 BPP alpha mask, some transparent
         bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_MASK.getType());
-        bos.write4Bytes(4 + 4 + 16*16);
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        bos.write4Bytes(4 + 4 + 16 * 16);
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 if (image[y][x] != 0)
                     bos.write(0xff);
                 else
@@ -258,22 +232,19 @@ public class IcnsRoundTripTest extends I
                 baos.toByteArray(), foreground, background);
     }
 
-    public void test8BPPIconNoMask() throws Exception
-    {
+    public void test8BPPIconNoMask() throws Exception {
         final int foreground = 0xff000000;
         final int background = 0xffcccccc;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN);
         bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
-        bos.write4Bytes(4 + 4 + 4 + 4 + 16*16);
+        bos.write4Bytes(4 + 4 + 4 + 4 + 16 * 16);
         bos.write4Bytes(IcnsType.ICNS_16x16_8BIT_IMAGE.getType());
-        bos.write4Bytes(4 + 4 + 16*16);
+        bos.write4Bytes(4 + 4 + 16 * 16);
         // 8 BPP image
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 if (image[y][x] != 0)
                     bos.write(0xff);
                 else
@@ -281,24 +252,22 @@ public class IcnsRoundTripTest extends I
             }
         }
         bos.flush();
-        writeAndReadImageData("8bpp-image-no-mask", baos.toByteArray(), foreground, background);
+        writeAndReadImageData("8bpp-image-no-mask", baos.toByteArray(),
+                foreground, background);
     }
 
-    public void test32BPPMaskedIcon() throws Exception
-    {
+    public void test32BPPMaskedIcon() throws Exception {
         final int foreground = 0xff000000;
         final int background = 0x000000ff;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN);
         bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
-        bos.write4Bytes(4 + 4 + 4 + 4 + 4*16*16 + 4 + 4 + 2*16*16/8);
+        bos.write4Bytes(4 + 4 + 4 + 4 + 4 * 16 * 16 + 4 + 4 + 2 * 16 * 16 / 8);
         bos.write4Bytes(IcnsType.ICNS_16x16_32BIT_IMAGE.getType());
-        bos.write4Bytes(4 + 4 + 4*16*16);
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        bos.write4Bytes(4 + 4 + 4 * 16 * 16);
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 // argb, a ignored
                 bos.write(0);
                 final int pixel;
@@ -312,54 +281,46 @@ public class IcnsRoundTripTest extends I
             }
         }
         bos.write4Bytes(IcnsType.ICNS_16x16_1BIT_IMAGE_AND_MASK.getType());
-        bos.write4Bytes(4 + 4 + 2*16*16/8);
+        bos.write4Bytes(4 + 4 + 2 * 16 * 16 / 8);
         // 1 bit image
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x += 8)
-            {
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x += 8) {
                 int eightBits = 0;
-                for (int pos = 0; pos < 8; pos++)
-                {
-                    if (image[y][x+pos] != 0)
+                for (int pos = 0; pos < 8; pos++) {
+                    if (image[y][x + pos] != 0)
                         eightBits |= (1 << (7 - pos));
                 }
                 bos.write(eightBits);
             }
         }
         // 1 bit mask
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x += 8)
-            {
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x += 8) {
                 int eightBits = 0;
-                for (int pos = 0; pos < 8; pos++)
-                {
-                    if (image[y][x+pos] != 0)
+                for (int pos = 0; pos < 8; pos++) {
+                    if (image[y][x + pos] != 0)
                         eightBits |= (1 << (7 - pos));
                 }
                 bos.write(eightBits);
             }
         }
         bos.flush();
-        writeAndReadImageData("32bpp-image-1bpp-mask", baos.toByteArray(), foreground, background);
+        writeAndReadImageData("32bpp-image-1bpp-mask", baos.toByteArray(),
+                foreground, background);
     }
 
-    public void test32BPPHalfMaskedIcon() throws Exception
-    {
+    public void test32BPPHalfMaskedIcon() throws Exception {
         final int foreground = 0xff000000;
         final int background = 0xff0000ff;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN);
         bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
-        bos.write4Bytes(4 + 4 + 4 + 4 + 4*16*16 + 4 + 4 + 16*16/8);
+        bos.write4Bytes(4 + 4 + 4 + 4 + 4 * 16 * 16 + 4 + 4 + 16 * 16 / 8);
         bos.write4Bytes(IcnsType.ICNS_16x16_32BIT_IMAGE.getType());
-        bos.write4Bytes(4 + 4 + 4*16*16);
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        bos.write4Bytes(4 + 4 + 4 * 16 * 16);
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 // argb, a ignored
                 bos.write(0);
                 final int pixel;
@@ -373,16 +334,13 @@ public class IcnsRoundTripTest extends I
             }
         }
         bos.write4Bytes(IcnsType.ICNS_16x16_1BIT_IMAGE_AND_MASK.getType());
-        bos.write4Bytes(4 + 4 + 16*16/8);
+        bos.write4Bytes(4 + 4 + 16 * 16 / 8);
         // 1 bit image
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x += 8)
-            {
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x += 8) {
                 int eightBits = 0;
-                for (int pos = 0; pos < 8; pos++)
-                {
-                    if (image[y][x+pos] != 0)
+                for (int pos = 0; pos < 8; pos++) {
+                    if (image[y][x + pos] != 0)
                         eightBits |= (1 << (7 - pos));
                 }
                 bos.write(eightBits);
@@ -392,32 +350,27 @@ public class IcnsRoundTripTest extends I
         bos.flush();
 
         boolean threw = false;
-        try
-        {
-            writeAndReadImageData("32bpp-half-masked-CORRUPT", baos.toByteArray(), foreground, background);
-        }
-        catch (ImageReadException imageReadException)
-        {
+        try {
+            writeAndReadImageData("32bpp-half-masked-CORRUPT",
+                    baos.toByteArray(), foreground, background);
+        } catch (ImageReadException imageReadException) {
             threw = true;
         }
         assertTrue("ICNS file with corrupt mask didn't fail to parse", threw);
     }
 
-    public void test32BPPMaskMissingIcon() throws Exception
-    {
+    public void test32BPPMaskMissingIcon() throws Exception {
         final int foreground = 0xff000000;
         final int background = 0xff0000ff;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_BIG_ENDIAN);
         bos.write4Bytes(IcnsImageParser.ICNS_MAGIC);
-        bos.write4Bytes(4 + 4 + 4 + 4 + 4*16*16);
+        bos.write4Bytes(4 + 4 + 4 + 4 + 4 * 16 * 16);
         bos.write4Bytes(IcnsType.ICNS_16x16_32BIT_IMAGE.getType());
-        bos.write4Bytes(4 + 4 + 4*16*16);
-        for (int y = 0; y < 16; y++)
-        {
-            for (int x = 0; x < 16; x++)
-            {
+        bos.write4Bytes(4 + 4 + 4 * 16 * 16);
+        for (int y = 0; y < 16; y++) {
+            for (int x = 0; x < 16; x++) {
                 // argb, a ignored
                 bos.write(0);
                 final int pixel;
@@ -431,13 +384,13 @@ public class IcnsRoundTripTest extends I
             }
         }
         bos.flush();
-        writeAndReadImageData("32bpp-mask-missing", baos.toByteArray(), foreground, background);
+        writeAndReadImageData("32bpp-mask-missing", baos.toByteArray(),
+                foreground, background);
     }
 
     private void writeAndReadImageData(String description, byte[] rawData,
             int foreground, int background) throws IOException,
-            ImageReadException
-    {
+            ImageReadException {
         // Uncomment to generate ICNS files that can be tested with MacOS:
         File exportFile = new File("/tmp/" + description + ".icns");
         IoUtils.writeToFile(rawData, exportFile);
@@ -454,25 +407,22 @@ public class IcnsRoundTripTest extends I
         verify(dstImage, foreground, background);
     }
 
-    private void verify(BufferedImage data, int foreground, int background)
-    {
+    private void verify(BufferedImage data, int foreground, int background) {
         assertNotNull(data);
         assertTrue(data.getHeight() == image.length);
 
-        for (int y = 0; y < data.getHeight(); y++)
-        {
+        for (int y = 0; y < data.getHeight(); y++) {
             assertTrue(data.getWidth() == image[y].length);
-            for (int x = 0; x < data.getWidth(); x++)
-            {
+            for (int x = 0; x < data.getWidth(); x++) {
                 int imageARGB = (image[y][x] == 1) ? foreground : background;
                 int dataARGB = data.getRGB(x, y);
 
-                if (imageARGB != dataARGB)
-                {
-                    Debug.debug("x: " + x + ", y: " + y + ", image: " + imageARGB
-                            + " (0x" + Integer.toHexString(imageARGB) + ")"
-                            + ", data: " + dataARGB + " (0x"
-                            + Integer.toHexString(dataARGB) + ")");
+                if (imageARGB != dataARGB) {
+                    Debug.debug("x: " + x + ", y: " + y + ", image: "
+                            + imageARGB + " (0x"
+                            + Integer.toHexString(imageARGB) + ")" + ", data: "
+                            + dataARGB + " (0x" + Integer.toHexString(dataARGB)
+                            + ")");
                 }
                 assertTrue(imageARGB == dataARGB);
             }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoBaseTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoBaseTest.java Sat May 26 21:19:03 2012
@@ -24,26 +24,21 @@ import java.util.List;
 import org.apache.commons.imaging.ImageReadException;
 import org.apache.commons.imaging.ImagingTest;
 
-public abstract class IcoBaseTest extends ImagingTest
-{
+public abstract class IcoBaseTest extends ImagingTest {
 
-    private static boolean isIco(File file)
-    {
-        return file.getName().toLowerCase().endsWith(".ico") ||
-            file.getName().toLowerCase().endsWith(".cur");
+    private static boolean isIco(File file) {
+        return file.getName().toLowerCase().endsWith(".ico")
+                || file.getName().toLowerCase().endsWith(".cur");
     }
 
     private static final ImageFilter IMAGE_FILTER = new ImageFilter() {
-        public boolean accept(File file) throws IOException, ImageReadException
-        {
+        public boolean accept(File file) throws IOException, ImageReadException {
             return isIco(file);
         }
     };
 
-    protected List getIcoImages() throws IOException, ImageReadException
-    {
+    protected List getIcoImages() throws IOException, ImageReadException {
         return getTestImages(IMAGE_FILTER);
     }
 
-
 }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoReadTest.java Sat May 26 21:19:03 2012
@@ -28,16 +28,13 @@ import org.apache.commons.imaging.Imagin
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 
-public class IcoReadTest extends IcoBaseTest
-{
+public class IcoReadTest extends IcoBaseTest {
 
-    public void test() throws Exception
-    {
+    public void test() throws Exception {
         Debug.debug("start");
 
         List images = getIcoImages();
-        for (int i = 0; i < images.size(); i++)
-        {
+        for (int i = 0; i < images.size(); i++) {
             if (i % 10 == 0)
                 Debug.purgeMemory();
 

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/ico/IcoRoundtripTest.java Sat May 26 21:19:03 2012
@@ -32,8 +32,7 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.util.Debug;
 import org.apache.commons.imaging.util.IoUtils;
 
-public class IcoRoundtripTest extends IcoBaseTest
-{
+public class IcoRoundtripTest extends IcoBaseTest {
     // 16x16 test image
     private static final int[][] image = {
         {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0},
@@ -56,8 +55,7 @@ public class IcoRoundtripTest extends Ic
 
     private Map generatorMap = new HashMap();
 
-    public IcoRoundtripTest()
-    {
+    public IcoRoundtripTest() {
         generatorMap.put(new Integer(1), new GeneratorFor1BitBitmaps());
         generatorMap.put(new Integer(4), new GeneratorFor4BitBitmaps());
         generatorMap.put(new Integer(8), new GeneratorFor8BitBitmaps());
@@ -66,17 +64,14 @@ public class IcoRoundtripTest extends Ic
         generatorMap.put(new Integer(32), new GeneratorFor32BitBitmaps());
     }
 
-    private static interface BitmapGenerator
-    {
+    private static interface BitmapGenerator {
         byte[] generateBitmap(int foreground, int background, int paletteSize)
                 throws IOException, ImageWriteException;
     }
 
-    private class GeneratorFor1BitBitmaps implements BitmapGenerator
-    {
-        public byte[] generateBitmap(int foreground, int background, int paletteSize)
-                throws IOException, ImageWriteException
-        {
+    private class GeneratorFor1BitBitmaps implements BitmapGenerator {
+        public byte[] generateBitmap(int foreground, int background,
+                int paletteSize) throws IOException, ImageWriteException {
             ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
@@ -88,27 +83,23 @@ public class IcoRoundtripTest extends Ic
             for (int i = 2; i < paletteSize; i++)
                 bos.write4Bytes(0);
             // Image
-            for (int y = 15; y >= 0; y--)
-            {
-                for (int x = 0; x < 16; x += 8)
-                {
-                    bos.write(
-                        ((0x1 & image[y][x]) << 7) |
-                        ((0x1 & image[y][x+1]) << 6) |
-                        ((0x1 & image[y][x+2]) << 5) |
-                        ((0x1 & image[y][x+3]) << 4) |
-                        ((0x1 & image[y][x+4]) << 3) |
-                        ((0x1 & image[y][x+5]) << 2) |
-                        ((0x1 & image[y][x+6]) << 1) |
-                        ((0x1 & image[y][x+7]) << 0));
+            for (int y = 15; y >= 0; y--) {
+                for (int x = 0; x < 16; x += 8) {
+                    bos.write(((0x1 & image[y][x]) << 7)
+                            | ((0x1 & image[y][x + 1]) << 6)
+                            | ((0x1 & image[y][x + 2]) << 5)
+                            | ((0x1 & image[y][x + 3]) << 4)
+                            | ((0x1 & image[y][x + 4]) << 3)
+                            | ((0x1 & image[y][x + 5]) << 2)
+                            | ((0x1 & image[y][x + 6]) << 1)
+                            | ((0x1 & image[y][x + 7]) << 0));
                 }
                 // Pad to multiple of 32 bytes
                 bos.write(0);
                 bos.write(0);
             }
             // Mask
-            for (int y = image.length - 1; y >= 0; y--)
-            {
+            for (int y = image.length - 1; y >= 0; y--) {
                 bos.write(0);
                 bos.write(0);
                 // Pad to 4 bytes:
@@ -120,11 +111,9 @@ public class IcoRoundtripTest extends Ic
         }
     }
 
-    private class GeneratorFor4BitBitmaps implements BitmapGenerator
-    {
-        public byte[] generateBitmap(int foreground, int background, int paletteSize)
-                throws IOException, ImageWriteException
-        {
+    private class GeneratorFor4BitBitmaps implements BitmapGenerator {
+        public byte[] generateBitmap(int foreground, int background,
+                int paletteSize) throws IOException, ImageWriteException {
             ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
@@ -136,17 +125,14 @@ public class IcoRoundtripTest extends Ic
             for (int i = 2; i < paletteSize; i++)
                 bos.write4Bytes(0);
             // Image
-            for (int y = 15; y >= 0; y--)
-            {
-                for (int x = 0; x < 16; x += 2)
-                {
-                    bos.write(((0xf & image[y][x]) << 4) |
-                        (0xf & image[y][x+1]));
+            for (int y = 15; y >= 0; y--) {
+                for (int x = 0; x < 16; x += 2) {
+                    bos.write(((0xf & image[y][x]) << 4)
+                            | (0xf & image[y][x + 1]));
                 }
             }
             // Mask
-            for (int y = image.length - 1; y >= 0; y--)
-            {
+            for (int y = image.length - 1; y >= 0; y--) {
                 bos.write(0);
                 bos.write(0);
                 // Pad to 4 bytes:
@@ -158,11 +144,9 @@ public class IcoRoundtripTest extends Ic
         }
     }
 
-    private class GeneratorFor8BitBitmaps implements BitmapGenerator
-    {
-        public byte[] generateBitmap(int foreground, int background, int paletteSize)
-                throws IOException, ImageWriteException
-        {
+    private class GeneratorFor8BitBitmaps implements BitmapGenerator {
+        public byte[] generateBitmap(int foreground, int background,
+                int paletteSize) throws IOException, ImageWriteException {
             ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
@@ -174,16 +158,13 @@ public class IcoRoundtripTest extends Ic
             for (int i = 2; i < paletteSize; i++)
                 bos.write4Bytes(0);
             // Image
-            for (int y = 15; y >= 0; y--)
-            {
-                for (int x = 0; x < 16; x++)
-                {
+            for (int y = 15; y >= 0; y--) {
+                for (int x = 0; x < 16; x++) {
                     bos.write(image[y][x]);
                 }
             }
             // Mask
-            for (int y = image.length - 1; y >= 0; y--)
-            {
+            for (int y = image.length - 1; y >= 0; y--) {
                 bos.write(0);
                 bos.write(0);
                 // Pad to 4 bytes:
@@ -195,11 +176,9 @@ public class IcoRoundtripTest extends Ic
         }
     }
 
-    private class GeneratorFor16BitBitmaps implements BitmapGenerator
-    {
-        public byte[] generateBitmap(int foreground, int background, int paletteSize)
-                throws IOException, ImageWriteException
-        {
+    private class GeneratorFor16BitBitmaps implements BitmapGenerator {
+        public byte[] generateBitmap(int foreground, int background,
+                int paletteSize) throws IOException, ImageWriteException {
             ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
@@ -207,23 +186,20 @@ public class IcoRoundtripTest extends Ic
             for (int i = 0; i < paletteSize; i++)
                 bos.write4Bytes(0);
             // Image
-            for (int y = 15; y >= 0; y--)
-            {
-                for (int x = 0; x < 16; x++)
-                {
+            for (int y = 15; y >= 0; y--) {
+                for (int x = 0; x < 16; x++) {
                     if (image[y][x] == 1)
-                        bos.write2Bytes((0x1f & (foreground >> 3)) |
-                                ((0x1f & (foreground >> 11)) << 5) |
-                                ((0x1f & (foreground >> 19)) << 10));
+                        bos.write2Bytes((0x1f & (foreground >> 3))
+                                | ((0x1f & (foreground >> 11)) << 5)
+                                | ((0x1f & (foreground >> 19)) << 10));
                     else
-                        bos.write2Bytes((0x1f & (background >> 3)) |
-                                ((0x1f & (background >> 11)) << 5) |
-                                ((0x1f & (background >> 19)) << 10));
+                        bos.write2Bytes((0x1f & (background >> 3))
+                                | ((0x1f & (background >> 11)) << 5)
+                                | ((0x1f & (background >> 19)) << 10));
                 }
             }
             // Mask
-            for (int y = image.length - 1; y >= 0; y--)
-            {
+            for (int y = image.length - 1; y >= 0; y--) {
                 bos.write(0);
                 bos.write(0);
                 // Pad to 4 bytes:
@@ -235,11 +211,9 @@ public class IcoRoundtripTest extends Ic
         }
     }
 
-    private class GeneratorFor24BitBitmaps implements BitmapGenerator
-    {
-        public byte[] generateBitmap(int foreground, int background, int paletteSize)
-                throws IOException, ImageWriteException
-        {
+    private class GeneratorFor24BitBitmaps implements BitmapGenerator {
+        public byte[] generateBitmap(int foreground, int background,
+                int paletteSize) throws IOException, ImageWriteException {
             ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
@@ -247,10 +221,8 @@ public class IcoRoundtripTest extends Ic
             for (int i = 0; i < paletteSize; i++)
                 bos.write4Bytes(0);
             // Image
-            for (int y = 15; y >= 0; y--)
-            {
-                for (int x = 0; x < 16; x++)
-                {
+            for (int y = 15; y >= 0; y--) {
+                for (int x = 0; x < 16; x++) {
                     if (image[y][x] == 1)
                         bos.write3Bytes(0xffffff & foreground);
                     else
@@ -258,8 +230,7 @@ public class IcoRoundtripTest extends Ic
                 }
             }
             // Mask
-            for (int y = image.length - 1; y >= 0; y--)
-            {
+            for (int y = image.length - 1; y >= 0; y--) {
                 bos.write(0);
                 bos.write(0);
                 // Pad to 4 bytes:
@@ -271,17 +242,15 @@ public class IcoRoundtripTest extends Ic
         }
     }
 
-    private class GeneratorFor32BitBitmaps implements BitmapGenerator
-    {
-        public byte[] generateBitmap(int foreground, int background, int paletteSize)
-                throws IOException, ImageWriteException
-        {
-            return generate32bitRGBABitmap(foreground, background, paletteSize, true);
+    private class GeneratorFor32BitBitmaps implements BitmapGenerator {
+        public byte[] generateBitmap(int foreground, int background,
+                int paletteSize) throws IOException, ImageWriteException {
+            return generate32bitRGBABitmap(foreground, background, paletteSize,
+                    true);
         }
 
         public byte[] generate32bitRGBABitmap(int foreground, int background,
-                int paletteSize, boolean writeMask) throws IOException
-        {
+                int paletteSize, boolean writeMask) throws IOException {
             ByteArrayOutputStream byteArrayStream = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(byteArrayStream,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
@@ -289,10 +258,8 @@ public class IcoRoundtripTest extends Ic
             for (int i = 0; i < paletteSize; i++)
                 bos.write4Bytes(0);
             // Image
-            for (int y = 15; y >= 0; y--)
-            {
-                for (int x = 0; x < 16; x++)
-                {
+            for (int y = 15; y >= 0; y--) {
+                for (int x = 0; x < 16; x++) {
                     if (image[y][x] == 1)
                         bos.write4Bytes(foreground);
                     else
@@ -300,10 +267,8 @@ public class IcoRoundtripTest extends Ic
                 }
             }
             // Mask
-            if (writeMask)
-            {
-                for (int y = image.length - 1; y >= 0; y--)
-                {
+            if (writeMask) {
+                for (int y = image.length - 1; y >= 0; y--) {
                     bos.write(0);
                     bos.write(0);
                     // Pad to 4 bytes:
@@ -316,18 +281,16 @@ public class IcoRoundtripTest extends Ic
         }
     }
 
-    private void writeICONDIR(BinaryOutputStream bos, int reserved, int type, int count)
-            throws IOException
-    {
+    private void writeICONDIR(BinaryOutputStream bos, int reserved, int type,
+            int count) throws IOException {
         bos.write2Bytes(reserved);
         bos.write2Bytes(type);
         bos.write2Bytes(count);
     }
 
-    private void writeICONDIRENTRY(BinaryOutputStream bos, int width, int height,
-            int colorCount, int reserved, int planes, int bitCount, int bytesInRes)
-            throws IOException
-    {
+    private void writeICONDIRENTRY(BinaryOutputStream bos, int width,
+            int height, int colorCount, int reserved, int planes, int bitCount,
+            int bytesInRes) throws IOException {
         bos.write(width);
         bos.write(height);
         bos.write(colorCount);
@@ -338,10 +301,9 @@ public class IcoRoundtripTest extends Ic
         bos.write4Bytes(22); // image comes immediately after this
     }
 
-    private void writeBITMAPINFOHEADER(BinaryOutputStream bos, int width, int height,
-            int colorPlanes, int bitCount, int compression, int colorsUsed,
-            int colorsImportant) throws IOException
-    {
+    private void writeBITMAPINFOHEADER(BinaryOutputStream bos, int width,
+            int height, int colorPlanes, int bitCount, int compression,
+            int colorsUsed, int colorsImportant) throws IOException {
         // BITMAPINFOHEADER
         bos.write4Bytes(40); // biSize, always 40 for BITMAPINFOHEADER
         bos.write4Bytes(width); // biWidth
@@ -356,79 +318,93 @@ public class IcoRoundtripTest extends Ic
         bos.write4Bytes(colorsImportant); // colors important
     }
 
-    public void testNormalIcons() throws Exception
-    {
+    public void testNormalIcons() throws Exception {
         final int foreground = 0xFFF000E0;
         final int background = 0xFF102030;
-        for (Iterator it = generatorMap.entrySet().iterator(); it.hasNext(); )
-        {
+        for (Iterator it = generatorMap.entrySet().iterator(); it.hasNext();) {
             Map.Entry entry = (Map.Entry) it.next();
-            int bitDepth = ((Integer)entry.getKey()).intValue();
-            BitmapGenerator bitmapGenerator = (BitmapGenerator) entry.getValue();
+            int bitDepth = ((Integer) entry.getKey()).intValue();
+            BitmapGenerator bitmapGenerator = (BitmapGenerator) entry
+                    .getValue();
 
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(baos,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
-            byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background,
-                    (bitDepth <= 8) ? (1 << bitDepth) : 0);
+            byte[] bitmap = bitmapGenerator.generateBitmap(foreground,
+                    background, (bitDepth <= 8) ? (1 << bitDepth) : 0);
             writeICONDIR(bos, 0, 1, 1);
-            writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, bitDepth, 40 + bitmap.length);
-            writeBITMAPINFOHEADER(bos, 16, 2*16, 1, bitDepth, 0, 0, 0);
+            writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, bitDepth,
+                    40 + bitmap.length);
+            writeBITMAPINFOHEADER(bos, 16, 2 * 16, 1, bitDepth, 0, 0, 0);
             bos.write(bitmap);
             bos.flush();
-            writeAndReadImageData("16x16x" + bitDepth, baos.toByteArray(), foreground, background);
+            writeAndReadImageData("16x16x" + bitDepth, baos.toByteArray(),
+                    foreground, background);
         }
     }
 
-    public void testBadICONDIRENTRYIcons() throws Exception
-    {
+    public void testBadICONDIRENTRYIcons() throws Exception {
         final int foreground = 0xFFF000E0;
         final int background = 0xFF102030;
         // Windows ignores the ICONDIRENTRY values when parsing the ICO file.
-        for (Iterator it = generatorMap.entrySet().iterator(); it.hasNext(); )
-        {
+        for (Iterator it = generatorMap.entrySet().iterator(); it.hasNext();) {
             Map.Entry entry = (Map.Entry) it.next();
-            int bitDepth = ((Integer)entry.getKey()).intValue();
-            BitmapGenerator bitmapGenerator = (BitmapGenerator) entry.getValue();
+            int bitDepth = ((Integer) entry.getKey()).intValue();
+            BitmapGenerator bitmapGenerator = (BitmapGenerator) entry
+                    .getValue();
 
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(baos,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
-            byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background,
-                    (bitDepth <= 8) ? (1 << bitDepth) : 0);
+            byte[] bitmap = bitmapGenerator.generateBitmap(foreground,
+                    background, (bitDepth <= 8) ? (1 << bitDepth) : 0);
             writeICONDIR(bos, 0, 1, 1);
-            writeICONDIRENTRY(bos, 3 /* width, should be 16 */,
-                    4 /* height, should be 16 */,
-                    7 /* colorCount, should be 2 or 0 */,
-                    20 /* reserved, should be 0 */,
-                    11 /* planes, should be 1 or 0 */,
-                    19 /* bitCount, should be bitDepth */,
+            writeICONDIRENTRY(bos, 3 /* width, should be 16 */, 4 /*
+                                                                   * height,
+                                                                   * should be
+                                                                   * 16
+                                                                   */, 7 /*
+                                                                          * colorCount
+                                                                          * ,
+                                                                          * should
+                                                                          * be 2
+                                                                          * or 0
+                                                                          */,
+                    20 /* reserved, should be 0 */, 11 /*
+                                                        * planes, should be 1 or
+                                                        * 0
+                                                        */, 19 /*
+                                                                * bitCount,
+                                                                * should be
+                                                                * bitDepth
+                                                                */,
                     40 + bitmap.length);
-            writeBITMAPINFOHEADER(bos, 16, 2*16, 1, bitDepth, 0, 0, 0);
+            writeBITMAPINFOHEADER(bos, 16, 2 * 16, 1, bitDepth, 0, 0, 0);
             bos.write(bitmap);
             bos.flush();
-            writeAndReadImageData("16x16x" + bitDepth + "-corrupt-icondirentry",
+            writeAndReadImageData(
+                    "16x16x" + bitDepth + "-corrupt-icondirentry",
                     baos.toByteArray(), foreground, background);
         }
     }
 
-    public void testColorsUsed() throws Exception
-    {
+    public void testColorsUsed() throws Exception {
         final int foreground = 0xFFF000E0;
         final int background = 0xFF102030;
-        for (Iterator it = generatorMap.entrySet().iterator(); it.hasNext(); )
-        {
+        for (Iterator it = generatorMap.entrySet().iterator(); it.hasNext();) {
             Map.Entry entry = (Map.Entry) it.next();
-            int bitDepth = ((Integer)entry.getKey()).intValue();
-            BitmapGenerator bitmapGenerator = (BitmapGenerator) entry.getValue();
+            int bitDepth = ((Integer) entry.getKey()).intValue();
+            BitmapGenerator bitmapGenerator = (BitmapGenerator) entry
+                    .getValue();
 
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(baos,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
-            byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background, 2);
+            byte[] bitmap = bitmapGenerator.generateBitmap(foreground,
+                    background, 2);
             writeICONDIR(bos, 0, 1, 1);
             writeICONDIRENTRY(bos, 3, 4, 7, 20, 11, 19, 40 + bitmap.length);
-            writeBITMAPINFOHEADER(bos, 16, 2*16, 1, bitDepth, 0, 2, 0);
+            writeBITMAPINFOHEADER(bos, 16, 2 * 16, 1, bitDepth, 0, 2, 0);
             bos.write(bitmap);
             bos.flush();
             writeAndReadImageData("16x16x" + bitDepth + "-custom-palette",
@@ -436,43 +412,41 @@ public class IcoRoundtripTest extends Ic
         }
     }
 
-    public void testZeroColorPlanes() throws Exception
-    {
+    public void testZeroColorPlanes() throws Exception {
         final int foreground = 0xFFF000E0;
         final int background = 0xFF102030;
-        for (Iterator it = generatorMap.entrySet().iterator(); it.hasNext(); )
-        {
+        for (Iterator it = generatorMap.entrySet().iterator(); it.hasNext();) {
             Map.Entry entry = (Map.Entry) it.next();
-            int bitDepth = ((Integer)entry.getKey()).intValue();
-            BitmapGenerator bitmapGenerator = (BitmapGenerator) entry.getValue();
+            int bitDepth = ((Integer) entry.getKey()).intValue();
+            BitmapGenerator bitmapGenerator = (BitmapGenerator) entry
+                    .getValue();
 
             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             BinaryOutputStream bos = new BinaryOutputStream(baos,
                     BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
-            byte[] bitmap = bitmapGenerator.generateBitmap(foreground, background,
-                    (bitDepth <= 8) ? (1 << bitDepth) : 0);
+            byte[] bitmap = bitmapGenerator.generateBitmap(foreground,
+                    background, (bitDepth <= 8) ? (1 << bitDepth) : 0);
             writeICONDIR(bos, 0, 1, 1);
-            writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, bitDepth, 40 + bitmap.length);
-            writeBITMAPINFOHEADER(bos, 16, 2*16, 0 /* should be 1 */, bitDepth, 0, 0, 0);
+            writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, bitDepth,
+                    40 + bitmap.length);
+            writeBITMAPINFOHEADER(bos, 16, 2 * 16, 0 /* should be 1 */,
+                    bitDepth, 0, 0, 0);
             bos.write(bitmap);
             bos.flush();
 
             boolean threw = false;
-            try
-            {
-                writeAndReadImageData("16x16x" + bitDepth + "-zero-colorPlanes",
+            try {
+                writeAndReadImageData(
+                        "16x16x" + bitDepth + "-zero-colorPlanes",
                         baos.toByteArray(), foreground, background);
-            }
-            catch (ImageReadException imageReadException)
-            {
+            } catch (ImageReadException imageReadException) {
                 threw = true;
             }
             assertTrue(threw);
         }
     }
 
-    public void testBitfieldCompression() throws Exception
-    {
+    public void testBitfieldCompression() throws Exception {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
@@ -480,18 +454,18 @@ public class IcoRoundtripTest extends Ic
                 0xFFFF0000, 0xFFFFFFFF, 0, true);
         writeICONDIR(bos, 0, 1, 1);
         writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, 32, 40 + bitmap.length);
-        writeBITMAPINFOHEADER(bos, 16, 2*16, 1, 32, 3 /* BI_BITFIELDS */, 0, 0);
+        writeBITMAPINFOHEADER(bos, 16, 2 * 16, 1, 32, 3 /* BI_BITFIELDS */, 0,
+                0);
         bos.write4Bytes(0x000000FF); // red mask
         bos.write4Bytes(0x0000FF00); // green mask
         bos.write4Bytes(0x00FF0000); // blue mask
         bos.write(bitmap);
         bos.flush();
-        writeAndReadImageData("16x16x32-bitfield-compressed", baos.toByteArray(),
-                0xFF0000FF, 0xFFFFFFFF);
+        writeAndReadImageData("16x16x32-bitfield-compressed",
+                baos.toByteArray(), 0xFF0000FF, 0xFFFFFFFF);
     }
 
-    public void test32bitMask() throws Exception
-    {
+    public void test32bitMask() throws Exception {
         final int foreground = 0xFFF000E0;
         final int background = 0xFF102030;
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
@@ -502,14 +476,14 @@ public class IcoRoundtripTest extends Ic
                 foreground, background, 0, false);
         writeICONDIR(bos, 0, 1, 1);
         writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, 32, 40 + bitmap.length);
-        writeBITMAPINFOHEADER(bos, 16, 2*16, 1, 32, 0, 0, 0);
+        writeBITMAPINFOHEADER(bos, 16, 2 * 16, 1, 32, 0, 0, 0);
         bos.write(bitmap);
         bos.flush();
-        writeAndReadImageData("16x16x32-no-mask", baos.toByteArray(), foreground, background);
+        writeAndReadImageData("16x16x32-no-mask", baos.toByteArray(),
+                foreground, background);
     }
 
-    public void testAlphaVersusANDMask() throws Exception
-    {
+    public void testAlphaVersusANDMask() throws Exception {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
@@ -517,16 +491,16 @@ public class IcoRoundtripTest extends Ic
                 0xFF000000, 0x00000000, 0, true);
         writeICONDIR(bos, 0, 1, 1);
         writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, 32, 40 + bitmap.length);
-        writeBITMAPINFOHEADER(bos, 16, 2*16, 1, 32, 0, 0, 0);
+        writeBITMAPINFOHEADER(bos, 16, 2 * 16, 1, 32, 0, 0, 0);
         bos.write(bitmap);
         bos.flush();
-        // The AND mask is fully opaque, yet the fully transparent alpha should win:
+        // The AND mask is fully opaque, yet the fully transparent alpha should
+        // win:
         writeAndReadImageData("16x16x32-alpha-vs-mask", baos.toByteArray(),
                 0xFF000000, 0x00000000);
     }
 
-    public void testFullyTransparent32bitRGBA() throws Exception
-    {
+    public void testFullyTransparent32bitRGBA() throws Exception {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         BinaryOutputStream bos = new BinaryOutputStream(baos,
                 BinaryOutputStream.BYTE_ORDER_LITTLE_ENDIAN);
@@ -534,7 +508,7 @@ public class IcoRoundtripTest extends Ic
                 0x00000000, 0x00FFFFFF, 0, true);
         writeICONDIR(bos, 0, 1, 1);
         writeICONDIRENTRY(bos, 16, 16, 0, 0, 1, 32, 40 + bitmap.length);
-        writeBITMAPINFOHEADER(bos, 16, 2*16, 1, 32, 0, 0, 0);
+        writeBITMAPINFOHEADER(bos, 16, 2 * 16, 1, 32, 0, 0, 0);
         bos.write(bitmap);
         bos.flush();
         // Because every pixel is fully trasparent, ***ALPHA GETS IGNORED***:
@@ -544,11 +518,10 @@ public class IcoRoundtripTest extends Ic
 
     private void writeAndReadImageData(String description, byte[] rawData,
             int foreground, int background) throws IOException,
-            ImageReadException
-    {
+            ImageReadException {
         // Uncomment to generate ICO files that can be tested with Windows:
-        //File exportFile = new File("/tmp/" + description + ".ico");
-        //IoUtils.writeToFile(rawData, exportFile);
+        // File exportFile = new File("/tmp/" + description + ".ico");
+        // IoUtils.writeToFile(rawData, exportFile);
 
         File tempFile = createTempFile("temp", ".ico");
         IoUtils.writeToFile(rawData, tempFile);
@@ -562,25 +535,22 @@ public class IcoRoundtripTest extends Ic
         verify(dstImage, foreground, background);
     }
 
-    private void verify(BufferedImage data, int foreground, int background)
-    {
+    private void verify(BufferedImage data, int foreground, int background) {
         assertNotNull(data);
         assertTrue(data.getHeight() == image.length);
 
-        for (int y = 0; y < data.getHeight(); y++)
-        {
+        for (int y = 0; y < data.getHeight(); y++) {
             assertTrue(data.getWidth() == image[y].length);
-            for (int x = 0; x < data.getWidth(); x++)
-            {
+            for (int x = 0; x < data.getWidth(); x++) {
                 int imageARGB = (image[y][x] == 1) ? foreground : background;
                 int dataARGB = data.getRGB(x, y);
 
-                if (imageARGB != dataARGB)
-                {
-                    Debug.debug("x: " + x + ", y: " + y + ", image: " + imageARGB
-                            + " (0x" + Integer.toHexString(imageARGB) + ")"
-                            + ", data: " + dataARGB + " (0x"
-                            + Integer.toHexString(dataARGB) + ")");
+                if (imageARGB != dataARGB) {
+                    Debug.debug("x: " + x + ", y: " + y + ", image: "
+                            + imageARGB + " (0x"
+                            + Integer.toHexString(imageARGB) + ")" + ", data: "
+                            + dataARGB + " (0x" + Integer.toHexString(dataARGB)
+                            + ")");
                 }
                 assertTrue(imageARGB == dataARGB);
             }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegBaseTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegBaseTest.java Sat May 26 21:19:03 2012
@@ -26,28 +26,21 @@ import org.apache.commons.imaging.ImageR
 import org.apache.commons.imaging.Imaging;
 import org.apache.commons.imaging.ImagingTest;
 
-public abstract class JpegBaseTest extends ImagingTest
-{
+public abstract class JpegBaseTest extends ImagingTest {
 
     protected static boolean isJpeg(File file) throws IOException,
-            ImageReadException
-    {
+            ImageReadException {
         ImageFormat format = Imaging.guessFormat(file);
         return format == ImageFormat.IMAGE_FORMAT_JPEG;
     }
 
-    public static final ImageFilter imageFilter = new ImageFilter()
-    {
-        public boolean accept(File file) throws IOException, ImageReadException
-        {
+    public static final ImageFilter imageFilter = new ImageFilter() {
+        public boolean accept(File file) throws IOException, ImageReadException {
             return isJpeg(file);
         }
     };
 
-
-
-    protected List getJpegImages() throws IOException, ImageReadException
-    {
+    protected List getJpegImages() throws IOException, ImageReadException {
         return getTestImages(imageFilter);
     }
 

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegReadTest.java Sat May 26 21:19:03 2012
@@ -27,31 +27,26 @@ import org.apache.commons.imaging.Imagin
 import org.apache.commons.imaging.common.IImageMetadata;
 import org.apache.commons.imaging.util.Debug;
 
-public class JpegReadTest extends JpegBaseTest
-{
+public class JpegReadTest extends JpegBaseTest {
 
-    public void test() throws Exception
-    {
+    public void test() throws Exception {
         List images = getJpegImages();
-        for (int i = 0; i < images.size(); i++)
-        {
-            if(i%10==0)
-            Debug.purgeMemory();
+        for (int i = 0; i < images.size(); i++) {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
 
             File imageFile = (File) images.get(i);
             Debug.debug("imageFile", imageFile.getAbsoluteFile());
 
-            //            ByteSource byteSource = new ByteSourceFile(imageFile);
-            //            new JpegUtils().dumpJFIF(byteSource);
+            // ByteSource byteSource = new ByteSourceFile(imageFile);
+            // new JpegUtils().dumpJFIF(byteSource);
 
             Map params = new HashMap();
             boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-            params
-                    .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
-                            !ignoreImageData));
+            params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
 
             IImageMetadata metadata = Imaging.getMetadata(imageFile, params);
-            //            assertNotNull(metadata);
+            // assertNotNull(metadata);
             Debug.debug("metadata", metadata);
 
             ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/JpegWithJpegThumbnailTest.java Sat May 26 21:19:03 2012
@@ -29,8 +29,7 @@ import org.apache.commons.imaging.format
 
 public class JpegWithJpegThumbnailTest extends ImagingTest {
 
-    public void testSingleImage() throws Exception
-    {
+    public void testSingleImage() throws Exception {
         File imageFile = getTestImageByName("img_F028c_small.jpg");
 
         Map params = new HashMap();
@@ -41,4 +40,3 @@ public class JpegWithJpegThumbnailTest e
         assertNotNull(image);
     }
 }
-

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/decoder/DctTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/decoder/DctTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/decoder/DctTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/decoder/DctTest.java Sat May 26 21:19:03 2012
@@ -19,47 +19,41 @@ package org.apache.commons.imaging.forma
 
 import junit.framework.TestCase;
 
-public class DctTest extends TestCase
-{
-    public void testVectors() throws Exception
-    {
+public class DctTest extends TestCase {
+    public void testVectors() throws Exception {
         float[] originalData = new float[8];
-        for (int i = 0; i < 8; i++)
-        {
+        for (int i = 0; i < 8; i++) {
             originalData[i] = i;
         }
 
         float[] transformed = REFERENCE_forwardDCT(originalData);
         float[] reversed = REFERENCE_inverseDCT(transformed);
-        for (int i = 0; i < 8; i++)
-        {
-            assertEquals("Reference transforms broken, at x=" + i, originalData[i], reversed[i], 0.001);
+        for (int i = 0; i < 8; i++) {
+            assertEquals("Reference transforms broken, at x=" + i,
+                    originalData[i], reversed[i], 0.001);
         }
 
         float[] data = originalData.clone();
         Dct.forwardDCT8(data);
         Dct.scaleQuantizationVector(data);
-        for (int i = 0; i < 8; i++)
-        {
-            assertEquals("Forward transform broken, at x=" + i, data[i], transformed[i], 0.001);
+        for (int i = 0; i < 8; i++) {
+            assertEquals("Forward transform broken, at x=" + i, data[i],
+                    transformed[i], 0.001);
         }
-        
+
         Dct.scaleDequantizationVector(data);
         Dct.inverseDCT8(data);
-        for (int i = 0; i < 8; i++)
-        {
-            assertEquals("Inverse transform broken, at x=" + i, data[i], originalData[i], 0.001);
+        for (int i = 0; i < 8; i++) {
+            assertEquals("Inverse transform broken, at x=" + i, data[i],
+                    originalData[i], 0.001);
         }
     }
 
-    public void testMatrices() throws Exception
-    {
+    public void testMatrices() throws Exception {
         float[] originalData = new float[8 * 8];
         float[][] originalData8x8 = new float[8][8];
-        for (int y = 0; y < 8; y++)
-        {
-            for (int x = 0; x < 8; x++)
-            {
+        for (int y = 0; y < 8; y++) {
+            for (int x = 0; x < 8; x++) {
                 float value = 8 * y + x;
                 originalData8x8[y][x] = value;
                 originalData[8 * y + x] = value;
@@ -68,54 +62,47 @@ public class DctTest extends TestCase
 
         float[][] transformed8x8 = REFERENCE_forwardDCT(originalData8x8);
         float[][] reversed8x8 = REFERENCE_inverseDCT(transformed8x8);
-        for (int y = 0; y < 8; y++)
-        {
-            for (int x = 0; x < 8; x++)
-            {
-                assertEquals("Reference transforms broken, at x=" + x + ",y=" + y, originalData8x8[y][x], reversed8x8[y][x], 0.001);
+        for (int y = 0; y < 8; y++) {
+            for (int x = 0; x < 8; x++) {
+                assertEquals("Reference transforms broken, at x=" + x + ",y="
+                        + y, originalData8x8[y][x], reversed8x8[y][x], 0.001);
             }
         }
 
         float[] data = originalData.clone();
         Dct.forwardDCT8x8(data);
         Dct.scaleQuantizationMatrix(data);
-        for (int y = 0; y < 8; y++)
-        {
-            for (int x = 0; x < 8; x++)
-            {
-                assertEquals("Forward transform broken, at x=" + x + ",y=" + y, transformed8x8[y][x], data[8 * y + x], 0.001);
+        for (int y = 0; y < 8; y++) {
+            for (int x = 0; x < 8; x++) {
+                assertEquals("Forward transform broken, at x=" + x + ",y=" + y,
+                        transformed8x8[y][x], data[8 * y + x], 0.001);
             }
         }
 
         Dct.scaleDequantizationMatrix(data);
         Dct.inverseDCT8x8(data);
-        for (int y = 0; y < 8; y++)
-        {
-            for (int x = 0; x < 8; x++)
-            {
-                assertEquals("Inverse transform broken, at x=" + x + ",y=" + y, originalData8x8[y][x], data[8 * y + x], 0.001);
+        for (int y = 0; y < 8; y++) {
+            for (int x = 0; x < 8; x++) {
+                assertEquals("Inverse transform broken, at x=" + x + ",y=" + y,
+                        originalData8x8[y][x], data[8 * y + x], 0.001);
             }
         }
     }
 
-
-    private static float[][] REFERENCE_inverseDCT(float[][] matrix)
-    {
+    private static float[][] REFERENCE_inverseDCT(float[][] matrix) {
         float[][] ret = new float[8][8];
-        for (int y = 0; y < 8; y++)
-        {
-            for (int x = 0; x < 8; x++)
-            {
+        for (int y = 0; y < 8; y++) {
+            for (int x = 0; x < 8; x++) {
                 float sum = 0;
-                for (int u = 0; u < 8; u++)
-                {
-                    for (int v = 0; v < 8; v++)
-                    {
-                        float cu = (u == 0) ? ((float) (1.0 / Math.sqrt(2))) : 1;
-                        float cv = (v == 0) ? ((float) (1.0 / Math.sqrt(2))) : 1;
-                        sum += cu * cv * matrix[v][u] *
-                                Math.cos((2 * x + 1) * u * Math.PI / 16) *
-                                Math.cos((2 * y + 1) * v * Math.PI / 16);
+                for (int u = 0; u < 8; u++) {
+                    for (int v = 0; v < 8; v++) {
+                        float cu = (u == 0) ? ((float) (1.0 / Math.sqrt(2)))
+                                : 1;
+                        float cv = (v == 0) ? ((float) (1.0 / Math.sqrt(2)))
+                                : 1;
+                        sum += cu * cv * matrix[v][u]
+                                * Math.cos((2 * x + 1) * u * Math.PI / 16)
+                                * Math.cos((2 * y + 1) * v * Math.PI / 16);
                     }
                 }
                 ret[y][x] = 0.25f * sum;
@@ -124,40 +111,32 @@ public class DctTest extends TestCase
         return ret;
     }
 
-    private static float[] REFERENCE_inverseDCT(float[] vector)
-    {
+    private static float[] REFERENCE_inverseDCT(float[] vector) {
         float[] ret = new float[8];
-        for (int x = 0; x < 8; x++)
-        {
+        for (int x = 0; x < 8; x++) {
             float sum = 0;
-            for (int u = 0; u < 8; u++)
-            {
+            for (int u = 0; u < 8; u++) {
                 float cu = (u == 0) ? ((float) (1.0 / Math.sqrt(2))) : 1;
-                sum += cu * vector[u] *
-                        Math.cos((2 * x + 1) * u * Math.PI / 16);
+                sum += cu * vector[u]
+                        * Math.cos((2 * x + 1) * u * Math.PI / 16);
             }
             ret[x] = 0.5f * sum;
         }
         return ret;
     }
 
-    private static float[][] REFERENCE_forwardDCT(float[][] matrix)
-    {
+    private static float[][] REFERENCE_forwardDCT(float[][] matrix) {
         float[][] ret = new float[8][8];
-        for (int u = 0; u < 8; u++)
-        {
-            for (int v = 0; v < 8; v++)
-            {
+        for (int u = 0; u < 8; u++) {
+            for (int v = 0; v < 8; v++) {
                 float sum = 0;
                 float cu = (u == 0) ? ((float) (1.0 / Math.sqrt(2))) : 1;
                 float cv = (v == 0) ? ((float) (1.0 / Math.sqrt(2))) : 1;
-                for (int x = 0; x < 8; x++)
-                {
-                    for (int y = 0; y < 8; y++)
-                    {
-                        sum += matrix[y][x] *
-                                Math.cos((2 * x + 1) * u * Math.PI / 16) *
-                                Math.cos((2 * y + 1) * v * Math.PI / 16);
+                for (int x = 0; x < 8; x++) {
+                    for (int y = 0; y < 8; y++) {
+                        sum += matrix[y][x]
+                                * Math.cos((2 * x + 1) * u * Math.PI / 16)
+                                * Math.cos((2 * y + 1) * v * Math.PI / 16);
                     }
                 }
                 ret[v][u] = 0.25f * cu * cv * sum;
@@ -166,17 +145,13 @@ public class DctTest extends TestCase
         return ret;
     }
 
-    private static float[] REFERENCE_forwardDCT(float[] vector)
-    {
+    private static float[] REFERENCE_forwardDCT(float[] vector) {
         float[] ret = new float[8];
-        for (int u = 0; u < 8; u++)
-        {
+        for (int u = 0; u < 8; u++) {
             float sum = 0;
             float cu = (u == 0) ? ((float) (1.0 / Math.sqrt(2))) : 1;
-            for (int x = 0; x < 8; x++)
-            {
-                sum += vector[x] *
-                        Math.cos((2 * x + 1) * u * Math.PI / 16);
+            for (int x = 0; x < 8; x++) {
+                sum += vector[x] * Math.cos((2 * x + 1) * u * Math.PI / 16);
             }
             ret[u] = 0.5f * cu * sum;
         }

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/AsciiFieldTest.java Sat May 26 21:19:03 2012
@@ -34,8 +34,7 @@ import org.apache.commons.imaging.format
 
 public class AsciiFieldTest extends ExifBaseTest implements AllTagConstants {
 
-    public void testSingleImage() throws Exception
-    {
+    public void testSingleImage() throws Exception {
         File imageFile = getTestImageByName("Canon Powershot SD750 - 2007.12.26.n.IMG_3704.JPG");
 
         Map params = new HashMap();
@@ -51,7 +50,8 @@ public class AsciiFieldTest extends Exif
 
         List fields = exif.getAllFields();
         Map fieldMap = new Hashtable();
-        // Build a simplified field tag -> field map, ignoring directory structures.
+        // Build a simplified field tag -> field map, ignoring directory
+        // structures.
         // Good enough for our purposes, since the image in question is known.
         for (int i = 0; i < fields.size(); i++) {
             TiffField field = (TiffField) fields.get(i);
@@ -59,9 +59,14 @@ public class AsciiFieldTest extends Exif
         }
 
         Map expectedFieldValues = new Hashtable();
-        expectedFieldValues.put(new Integer(TiffTagConstants.TIFF_TAG_MAKE.tag), "Canon");
-        expectedFieldValues.put(new Integer(TiffTagConstants.TIFF_TAG_MODEL.tag), "Canon PowerShot SD750");
-        expectedFieldValues.put(new Integer(TiffTagConstants.TIFF_TAG_DATE_TIME.tag), "2007:12:25 13:34:39");
+        expectedFieldValues.put(
+                new Integer(TiffTagConstants.TIFF_TAG_MAKE.tag), "Canon");
+        expectedFieldValues.put(
+                new Integer(TiffTagConstants.TIFF_TAG_MODEL.tag),
+                "Canon PowerShot SD750");
+        expectedFieldValues
+                .put(new Integer(TiffTagConstants.TIFF_TAG_DATE_TIME.tag),
+                        "2007:12:25 13:34:39");
         Iterator expectedTags = expectedFieldValues.keySet().iterator();
         while (expectedTags.hasNext()) {
             Integer tag = (Integer) expectedTags.next();

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifBaseTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifBaseTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifBaseTest.java Sat May 26 21:19:03 2012
@@ -27,85 +27,70 @@ import org.apache.commons.imaging.common
 import org.apache.commons.imaging.common.bytesource.ByteSourceFile;
 import org.apache.commons.imaging.formats.jpeg.JpegImageParser;
 
-public abstract class ExifBaseTest extends ImagingTest
-{
-    //    public ExifBaseTest(String name)
-    //    {
-    //        super(name);
-    //    }
-
-    protected static boolean hasExifData(File file)
-    {
-        //        Debug.debug("hasExifData file", file.getAbsoluteFile());
+public abstract class ExifBaseTest extends ImagingTest {
+    // public ExifBaseTest(String name)
+    // {
+    // super(name);
+    // }
+
+    protected static boolean hasExifData(File file) {
+        // Debug.debug("hasExifData file", file.getAbsoluteFile());
 
         if (!file.getName().toLowerCase().endsWith(".jpg"))
             return false;
-        //ImageFormat format = Sanselan.guessFormat(file);
-        //if (format != ImageFormat.IMAGE_FORMAT_JPEG)
-        //    return false;
+        // ImageFormat format = Sanselan.guessFormat(file);
+        // if (format != ImageFormat.IMAGE_FORMAT_JPEG)
+        // return false;
 
-        //        Debug.debug("possible file", file);
+        // Debug.debug("possible file", file);
 
-        try
-        {
+        try {
             ByteSource byteSource = new ByteSourceFile(file);
             return new JpegImageParser().hasExifSegment(byteSource);
-        }
-        catch (Exception e)
-        {
-            //            Debug.debug("Error file", file.getAbsoluteFile());
-            //            Debug.debug(e, 4);
+        } catch (Exception e) {
+            // Debug.debug("Error file", file.getAbsoluteFile());
+            // Debug.debug(e, 4);
             return false;
         }
     }
 
-    private static final ImageFilter HAS_EXIF_IMAGE_FILTER = new ImageFilter()
-    {
-        public boolean accept(File file) throws IOException, ImageReadException
-        {
+    private static final ImageFilter HAS_EXIF_IMAGE_FILTER = new ImageFilter() {
+        public boolean accept(File file) throws IOException, ImageReadException {
             return hasExifData(file);
         }
     };
 
-    private static final ImageFilter JPEG_IMAGE_FILTER = new ImageFilter()
-    {
-        public boolean accept(File file) throws IOException, ImageReadException
-        {
+    private static final ImageFilter JPEG_IMAGE_FILTER = new ImageFilter() {
+        public boolean accept(File file) throws IOException, ImageReadException {
             return file.getName().toLowerCase().endsWith(".jpg");
         }
     };
 
     protected File getImageWithExifData() throws IOException,
-            ImageReadException
-    {
+            ImageReadException {
         return getTestImage(HAS_EXIF_IMAGE_FILTER);
     }
 
     protected List getImagesWithExifData() throws IOException,
-            ImageReadException
-    {
+            ImageReadException {
         return getTestImages(HAS_EXIF_IMAGE_FILTER);
     }
 
     protected List getImagesWithExifData(int max) throws IOException,
-            ImageReadException
-    {
+            ImageReadException {
         return getTestImages(HAS_EXIF_IMAGE_FILTER, max);
     }
 
-    protected File getJpegImage() throws IOException, ImageReadException
-    {
+    protected File getJpegImage() throws IOException, ImageReadException {
         return getTestImage(JPEG_IMAGE_FILTER);
     }
 
-    protected List getJpegImages() throws IOException, ImageReadException
-    {
+    protected List getJpegImages() throws IOException, ImageReadException {
         return getTestImages(JPEG_IMAGE_FILTER);
     }
 
     protected List getJpegImages(int max) throws IOException,
-            ImageReadException
-    {
+            ImageReadException {
         return getTestImages(JPEG_IMAGE_FILTER, max);
     }
 

Modified: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java?rev=1342971&r1=1342970&r2=1342971&view=diff
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java (original)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/jpeg/exif/ExifDumpTest.java Sat May 26 21:19:03 2012
@@ -29,20 +29,17 @@ import org.apache.commons.imaging.format
 import org.apache.commons.imaging.formats.jpeg.JpegUtils;
 import org.apache.commons.imaging.util.Debug;
 
-public class ExifDumpTest extends ExifBaseTest
-{
-    //    public ExifDumpTest(String name)
-    //    {
-    //        super(name);
-    //    }
+public class ExifDumpTest extends ExifBaseTest {
+    // public ExifDumpTest(String name)
+    // {
+    // super(name);
+    // }
 
-    public void test() throws Exception
-    {
+    public void test() throws Exception {
         List images = getImagesWithExifData();
-        for (int i = 0; i < images.size(); i++)
-        {
-            if(i%10==0)
-            Debug.purgeMemory();
+        for (int i = 0; i < images.size(); i++) {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
 
             File imageFile = (File) images.get(i);
             Debug.debug("imageFile", imageFile);
@@ -54,15 +51,13 @@ public class ExifDumpTest extends ExifBa
 
             Map params = new HashMap();
             boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-            params
-                    .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
-                            !ignoreImageData));
+            params.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(!ignoreImageData));
 
             JpegImageMetadata metadata = (JpegImageMetadata) Imaging
                     .getMetadata(imageFile, params);
             if (null == metadata)
                 continue;
-            //            assertNotNull(metadata.getExif());
+            // assertNotNull(metadata.getExif());
 
             metadata.dump();
         }