commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r995634 [4/6] - in /commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan: ./ common/ common/byteSources/ formats/bmp/ formats/gif/ formats/ico/ formats/jpeg/ formats/jpeg/exif/ formats/jpeg/iptc/ formats/jpeg/xmp/ formats/png/ fo...
Date Fri, 10 Sep 2010 01:35:52 GMT
Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/iptc/IptcUpdateTest.java Fri Sep 10 01:35:50 2010
@@ -37,387 +37,387 @@ import org.apache.sanselan.util.Debug;
 
 public class IptcUpdateTest extends IptcBaseTest
 {
-	private List imagesWithIptcData;
+    private List imagesWithIptcData;
 
-	public void setUp() throws Exception
-	{
-		super.setUp();
-
-		imagesWithIptcData = getImagesWithIptcData();
-	}
-
-	public void tearDown() throws Exception
-	{
-		super.tearDown();
-
-		imagesWithIptcData = null;
-	}
-
-	/*
-	 * Remove all Photoshop IPTC data from a JPEG file.
-	 */
-	public void testRemove() throws IOException, ImageReadException,
-			ImageWriteException
-	{
-		List images = imagesWithIptcData;
-		for (int i = 0; i < images.size(); i++)
-		{
-			if (i % 10 == 0)
-				Debug.purgeMemory();
-
-			File imageFile = (File) images.get(i);
-			// Debug.debug("imageFile", imageFile);
-			// Debug.debug();
-
-			ByteSource byteSource = new ByteSourceFile(imageFile);
-
-			Map params = new HashMap();
-			boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-			params
-					.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
-							!ignoreImageData));
-
-			JpegPhotoshopMetadata metadata = new JpegImageParser()
-					.getPhotoshopMetadata(byteSource, params);
-			assertNotNull(metadata);
-			// metadata.dump();
-
-			File noIptcFile = createTempFile(imageFile.getName()
-					+ ".iptc.remove.", ".jpg");
-			{
-				// test remove
-
-				OutputStream os = null;
-				try
-				{
-					os = new FileOutputStream(noIptcFile);
-					os = new BufferedOutputStream(os);
-					new JpegIptcRewriter().removeIPTC(byteSource, os);
-				} finally
-				{
-				    if (os != null) {
-				        os.close();
-				    }
-					os = null;
-				}
-
-				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
-						.getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
-								params);
-				assertTrue(outMetadata == null
-						|| outMetadata.getItems().size() == 0);
-			}
-
-		}
-	}
-
-	public void testRemoveInsertUpdate() throws IOException,
-			ImageReadException, ImageWriteException
-	{
-		List images = imagesWithIptcData;
-		for (int i = 0; i < images.size(); i++)
-		{
-			if (i % 10 == 0)
-				Debug.purgeMemory();
-
-			File imageFile = (File) images.get(i);
-			Debug.debug("imageFile", imageFile);
-			Debug.debug();
-
-			ByteSource byteSource = new ByteSourceFile(imageFile);
-			// Debug.debug("Segments:");
-			// 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_VERBOSE, Boolean.TRUE);
-			// params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
-
-			JpegPhotoshopMetadata metadata = new JpegImageParser()
-					.getPhotoshopMetadata(byteSource, params);
-			assertNotNull(metadata);
-			metadata.dump();
-
-			File noIptcFile = createTempFile(imageFile.getName()
-					+ ".iptc.remove.", ".jpg");
-			{
-				// test remove
-
-				OutputStream os = null;
-				try
-				{
-					os = new FileOutputStream(noIptcFile);
-					os = new BufferedOutputStream(os);
-					new JpegIptcRewriter().removeIPTC(byteSource, os);
-				} finally
-				{
+    public void setUp() throws Exception
+    {
+        super.setUp();
+
+        imagesWithIptcData = getImagesWithIptcData();
+    }
+
+    public void tearDown() throws Exception
+    {
+        super.tearDown();
+
+        imagesWithIptcData = null;
+    }
+
+    /*
+     * Remove all Photoshop IPTC data from a JPEG file.
+     */
+    public void testRemove() throws IOException, ImageReadException,
+            ImageWriteException
+    {
+        List images = imagesWithIptcData;
+        for (int i = 0; i < images.size(); i++)
+        {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
+
+            File imageFile = (File) images.get(i);
+            // Debug.debug("imageFile", imageFile);
+            // Debug.debug();
+
+            ByteSource byteSource = new ByteSourceFile(imageFile);
+
+            Map params = new HashMap();
+            boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
+            params
+                    .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
+                            !ignoreImageData));
+
+            JpegPhotoshopMetadata metadata = new JpegImageParser()
+                    .getPhotoshopMetadata(byteSource, params);
+            assertNotNull(metadata);
+            // metadata.dump();
+
+            File noIptcFile = createTempFile(imageFile.getName()
+                    + ".iptc.remove.", ".jpg");
+            {
+                // test remove
+
+                OutputStream os = null;
+                try
+                {
+                    os = new FileOutputStream(noIptcFile);
+                    os = new BufferedOutputStream(os);
+                    new JpegIptcRewriter().removeIPTC(byteSource, os);
+                } finally
+                {
                     if (os != null) {
                         os.close();
                     }
-					os = null;
-				}
+                    os = null;
+                }
 
-				// Debug.debug("Source Segments:");
-				// new JpegUtils().dumpJFIF(new ByteSourceFile(noIptcFile));
+                JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+                        .getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
+                                params);
+                assertTrue(outMetadata == null
+                        || outMetadata.getItems().size() == 0);
+            }
+
+        }
+    }
+
+    public void testRemoveInsertUpdate() throws IOException,
+            ImageReadException, ImageWriteException
+    {
+        List images = imagesWithIptcData;
+        for (int i = 0; i < images.size(); i++)
+        {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
+
+            File imageFile = (File) images.get(i);
+            Debug.debug("imageFile", imageFile);
+            Debug.debug();
+
+            ByteSource byteSource = new ByteSourceFile(imageFile);
+            // Debug.debug("Segments:");
+            // 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_VERBOSE, Boolean.TRUE);
+            // params.put(PARAM_KEY_VERBOSE, Boolean.TRUE);
+
+            JpegPhotoshopMetadata metadata = new JpegImageParser()
+                    .getPhotoshopMetadata(byteSource, params);
+            assertNotNull(metadata);
+            metadata.dump();
+
+            File noIptcFile = createTempFile(imageFile.getName()
+                    + ".iptc.remove.", ".jpg");
+            {
+                // test remove
+
+                OutputStream os = null;
+                try
+                {
+                    os = new FileOutputStream(noIptcFile);
+                    os = new BufferedOutputStream(os);
+                    new JpegIptcRewriter().removeIPTC(byteSource, os);
+                } finally
+                {
+                    if (os != null) {
+                        os.close();
+                    }
+                    os = null;
+                }
 
-				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
-						.getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
-								params);
-				assertTrue(outMetadata == null
-						|| outMetadata.getItems().size() == 0);
-			}
-			{
-				// test no-change update
-
-				List newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
-				List oldRecords = metadata.photoshopApp13Data.getRecords();
-				List newRecords = new ArrayList();
-				for (int j = 0; j < oldRecords.size(); j++)
-				{
-					IPTCRecord record = (IPTCRecord) oldRecords.get(j);
-					if (record.iptcType.type != IPTCConstants.IPTC_TYPE_CITY.type
-							&& record.iptcType.type != IPTCConstants.IPTC_TYPE_CREDIT.type)
-						newRecords.add(record);
-				}
-
-				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CITY,
-						"Albany, NY"));
-				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CREDIT,
-						"William Sorensen"));
-
-				PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
-						newBlocks);
-
-				File updated = createTempFile(imageFile.getName()
-						+ ".iptc.update.", ".jpg");
-				OutputStream os = null;
-				try
-				{
-					os = new FileOutputStream(updated);
-					os = new BufferedOutputStream(os);
-					new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
-				} finally
-				{
+                // Debug.debug("Source Segments:");
+                // new JpegUtils().dumpJFIF(new ByteSourceFile(noIptcFile));
+
+                JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+                        .getPhotoshopMetadata(new ByteSourceFile(noIptcFile),
+                                params);
+                assertTrue(outMetadata == null
+                        || outMetadata.getItems().size() == 0);
+            }
+            {
+                // test no-change update
+
+                List newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
+                List oldRecords = metadata.photoshopApp13Data.getRecords();
+                List newRecords = new ArrayList();
+                for (int j = 0; j < oldRecords.size(); j++)
+                {
+                    IPTCRecord record = (IPTCRecord) oldRecords.get(j);
+                    if (record.iptcType.type != IPTCConstants.IPTC_TYPE_CITY.type
+                            && record.iptcType.type != IPTCConstants.IPTC_TYPE_CREDIT.type)
+                        newRecords.add(record);
+                }
+
+                newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CITY,
+                        "Albany, NY"));
+                newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CREDIT,
+                        "William Sorensen"));
+
+                PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+                        newBlocks);
+
+                File updated = createTempFile(imageFile.getName()
+                        + ".iptc.update.", ".jpg");
+                OutputStream os = null;
+                try
+                {
+                    os = new FileOutputStream(updated);
+                    os = new BufferedOutputStream(os);
+                    new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
+                } finally
+                {
                     if (os != null) {
                         os.close();
                     }
-					os = null;
-				}
+                    os = null;
+                }
 
-				// Debug.debug("Source Segments:");
-				// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
+                // Debug.debug("Source Segments:");
+                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
 
-				ByteSource updateByteSource = new ByteSourceFile(updated);
-				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
-						.getPhotoshopMetadata(updateByteSource, params);
-
-				// Debug.debug("outMetadata", outMetadata.toString());
-				// Debug.debug("hasIptcSegment", new JpegImageParser()
-				// .hasIptcSegment(updateByteSource));
-
-				assertNotNull(outMetadata);
-				assertTrue(outMetadata.getItems().size() == newRecords.size());
-				// assertEquals(metadata.toString(), outMetadata.toString());
-			}
-
-			{
-				// test update
-
-				List newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
-				List newRecords = new ArrayList();
-
-				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CITY,
-						"Albany, NY"));
-				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CREDIT,
-						"William Sorensen"));
-
-				PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
-						newBlocks);
-
-				File updated = createTempFile(imageFile.getName()
-						+ ".iptc.update.", ".jpg");
-				OutputStream os = null;
-				try
-				{
-					os = new FileOutputStream(updated);
-					os = new BufferedOutputStream(os);
-					new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
-				} finally
-				{
+                ByteSource updateByteSource = new ByteSourceFile(updated);
+                JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+                        .getPhotoshopMetadata(updateByteSource, params);
+
+                // Debug.debug("outMetadata", outMetadata.toString());
+                // Debug.debug("hasIptcSegment", new JpegImageParser()
+                // .hasIptcSegment(updateByteSource));
+
+                assertNotNull(outMetadata);
+                assertTrue(outMetadata.getItems().size() == newRecords.size());
+                // assertEquals(metadata.toString(), outMetadata.toString());
+            }
+
+            {
+                // test update
+
+                List newBlocks = metadata.photoshopApp13Data.getNonIptcBlocks();
+                List newRecords = new ArrayList();
+
+                newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CITY,
+                        "Albany, NY"));
+                newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CREDIT,
+                        "William Sorensen"));
+
+                PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+                        newBlocks);
+
+                File updated = createTempFile(imageFile.getName()
+                        + ".iptc.update.", ".jpg");
+                OutputStream os = null;
+                try
+                {
+                    os = new FileOutputStream(updated);
+                    os = new BufferedOutputStream(os);
+                    new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
+                } finally
+                {
                     if (os != null) {
                         os.close();
                     }
-					os = null;
-				}
+                    os = null;
+                }
 
-				// Debug.debug("Source Segments:");
-				// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
+                // Debug.debug("Source Segments:");
+                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
 
-				ByteSource updateByteSource = new ByteSourceFile(updated);
-				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
-						.getPhotoshopMetadata(updateByteSource, params);
-
-				// Debug.debug("outMetadata", outMetadata.toString());
-				// Debug.debug("hasIptcSegment", new JpegImageParser()
-				// .hasIptcSegment(updateByteSource));
-
-				assertNotNull(outMetadata);
-				assertTrue(outMetadata.getItems().size() == 2);
-				// assertEquals(metadata.toString(), outMetadata.toString());
-			}
-
-			{
-				// test insert
-
-				List newBlocks = new ArrayList();
-				List newRecords = new ArrayList();
-
-				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CITY,
-						"Albany, NY"));
-				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CREDIT,
-						"William Sorensen"));
-
-				PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
-						newBlocks);
-
-				File updated = createTempFile(imageFile.getName()
-						+ ".iptc.insert.", ".jpg");
-				OutputStream os = null;
-				try
-				{
-					os = new FileOutputStream(updated);
-					os = new BufferedOutputStream(os);
-					new JpegIptcRewriter().writeIPTC(new ByteSourceFile(
-							noIptcFile), os, newData);
-				} finally
-				{
+                ByteSource updateByteSource = new ByteSourceFile(updated);
+                JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+                        .getPhotoshopMetadata(updateByteSource, params);
+
+                // Debug.debug("outMetadata", outMetadata.toString());
+                // Debug.debug("hasIptcSegment", new JpegImageParser()
+                // .hasIptcSegment(updateByteSource));
+
+                assertNotNull(outMetadata);
+                assertTrue(outMetadata.getItems().size() == 2);
+                // assertEquals(metadata.toString(), outMetadata.toString());
+            }
+
+            {
+                // test insert
+
+                List newBlocks = new ArrayList();
+                List newRecords = new ArrayList();
+
+                newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CITY,
+                        "Albany, NY"));
+                newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CREDIT,
+                        "William Sorensen"));
+
+                PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+                        newBlocks);
+
+                File updated = createTempFile(imageFile.getName()
+                        + ".iptc.insert.", ".jpg");
+                OutputStream os = null;
+                try
+                {
+                    os = new FileOutputStream(updated);
+                    os = new BufferedOutputStream(os);
+                    new JpegIptcRewriter().writeIPTC(new ByteSourceFile(
+                            noIptcFile), os, newData);
+                } finally
+                {
                     if (os != null) {
                         os.close();
                     }
-					os = null;
-				}
+                    os = null;
+                }
+
+                // Debug.debug("Source Segments:");
+                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
 
-				// Debug.debug("Source Segments:");
-				// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
+                ByteSource updateByteSource = new ByteSourceFile(updated);
+                JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+                        .getPhotoshopMetadata(updateByteSource, params);
+
+                // Debug.debug("outMetadata", outMetadata.toString());
+                // Debug.debug("hasIptcSegment", new JpegImageParser()
+                // .hasIptcSegment(updateByteSource));
+
+                assertNotNull(outMetadata);
+                assertTrue(outMetadata.getItems().size() == 2);
+                // assertEquals(metadata.toString(), outMetadata.toString());
+            }
+
+        }
+    }
+
+    /*
+     * Add a few IPTC values to JPEG images, whether or not they have existing
+     * IPTC data.
+     */
+    public void testAddIptcData() throws IOException, ImageReadException,
+            ImageWriteException
+    {
+        List images = getJpegImages();
+        for (int i = 0; i < images.size(); i++)
+        {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
+
+            File imageFile = (File) images.get(i);
+//             Debug.debug("imageFile", imageFile);
+//             Debug.debug();
+
+            ByteSource byteSource = new ByteSourceFile(imageFile);
+//             Debug.debug("Segments:");
+//             new JpegUtils().dumpJFIF(byteSource);
+
+            Map params = new HashMap();
+            boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
+            params
+                    .put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
+                            !ignoreImageData));
+
+            JpegPhotoshopMetadata metadata = new JpegImageParser()
+                    .getPhotoshopMetadata(byteSource, params);
+            // metadata.dump();
+
+            {
+                List newBlocks = new ArrayList();
+                List newRecords = new ArrayList();
+
+                if (null != metadata)
+                {
+                    boolean keepOldIptcNonTextValues = true;
+                    if (keepOldIptcNonTextValues)
+                        newBlocks.addAll(metadata.photoshopApp13Data
+                                .getNonIptcBlocks());
+                    boolean keepOldIptcTextValues = true;
+                    if (keepOldIptcTextValues)
+                    {
+                        List oldRecords = metadata.photoshopApp13Data
+                                .getRecords();
+
+                        newRecords = new ArrayList();
+                        for (int j = 0; j < oldRecords.size(); j++)
+                        {
+                            IPTCRecord record = (IPTCRecord) oldRecords.get(j);
+                            if (record.iptcType.type != IPTCConstants.IPTC_TYPE_CITY.type
+                                    && record.iptcType.type != IPTCConstants.IPTC_TYPE_CREDIT.type)
+                                newRecords.add(record);
+                        }
+                    }
+                }
 
-				ByteSource updateByteSource = new ByteSourceFile(updated);
-				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
-						.getPhotoshopMetadata(updateByteSource, params);
-
-				// Debug.debug("outMetadata", outMetadata.toString());
-				// Debug.debug("hasIptcSegment", new JpegImageParser()
-				// .hasIptcSegment(updateByteSource));
-
-				assertNotNull(outMetadata);
-				assertTrue(outMetadata.getItems().size() == 2);
-				// assertEquals(metadata.toString(), outMetadata.toString());
-			}
-
-		}
-	}
-
-	/*
-	 * Add a few IPTC values to JPEG images, whether or not they have existing
-	 * IPTC data.
-	 */
-	public void testAddIptcData() throws IOException, ImageReadException,
-			ImageWriteException
-	{
-		List images = getJpegImages();
-		for (int i = 0; i < images.size(); i++)
-		{
-			if (i % 10 == 0)
-				Debug.purgeMemory();
-
-			File imageFile = (File) images.get(i);
-//			 Debug.debug("imageFile", imageFile);
-//			 Debug.debug();
-
-			ByteSource byteSource = new ByteSourceFile(imageFile);
-//			 Debug.debug("Segments:");
-//			 new JpegUtils().dumpJFIF(byteSource);
-
-			Map params = new HashMap();
-			boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-			params
-					.put(PARAM_KEY_READ_THUMBNAILS, new Boolean(
-							!ignoreImageData));
-
-			JpegPhotoshopMetadata metadata = new JpegImageParser()
-					.getPhotoshopMetadata(byteSource, params);
-			// metadata.dump();
-
-			{
-				List newBlocks = new ArrayList();
-				List newRecords = new ArrayList();
-
-				if (null != metadata)
-				{
-					boolean keepOldIptcNonTextValues = true;
-					if (keepOldIptcNonTextValues)
-						newBlocks.addAll(metadata.photoshopApp13Data
-								.getNonIptcBlocks());
-					boolean keepOldIptcTextValues = true;
-					if (keepOldIptcTextValues)
-					{
-						List oldRecords = metadata.photoshopApp13Data
-								.getRecords();
-
-						newRecords = new ArrayList();
-						for (int j = 0; j < oldRecords.size(); j++)
-						{
-							IPTCRecord record = (IPTCRecord) oldRecords.get(j);
-							if (record.iptcType.type != IPTCConstants.IPTC_TYPE_CITY.type
-									&& record.iptcType.type != IPTCConstants.IPTC_TYPE_CREDIT.type)
-								newRecords.add(record);
-						}
-					}
-				}
-
-				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CITY,
-						"Albany, NY"));
-				newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CREDIT,
-						"William Sorensen"));
-
-				PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
-						newBlocks);
-
-				File updated = createTempFile(imageFile.getName()
-						+ ".iptc.add.", ".jpg");
-				OutputStream os = null;
-				try
-				{
-					os = new FileOutputStream(updated);
-					os = new BufferedOutputStream(os);
-					new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
-				} finally
-				{
+                newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CITY,
+                        "Albany, NY"));
+                newRecords.add(new IPTCRecord(IPTCConstants.IPTC_TYPE_CREDIT,
+                        "William Sorensen"));
+
+                PhotoshopApp13Data newData = new PhotoshopApp13Data(newRecords,
+                        newBlocks);
+
+                File updated = createTempFile(imageFile.getName()
+                        + ".iptc.add.", ".jpg");
+                OutputStream os = null;
+                try
+                {
+                    os = new FileOutputStream(updated);
+                    os = new BufferedOutputStream(os);
+                    new JpegIptcRewriter().writeIPTC(byteSource, os, newData);
+                } finally
+                {
                     if (os != null) {
                         os.close();
                     }
-					os = null;
-				}
+                    os = null;
+                }
 
-				// Debug.debug("Destination Segments:");
-				// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
+                // Debug.debug("Destination Segments:");
+                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
 
-				ByteSource updateByteSource = new ByteSourceFile(updated);
-				JpegPhotoshopMetadata outMetadata = new JpegImageParser()
-						.getPhotoshopMetadata(updateByteSource, params);
-
-				// Debug.debug("outMetadata", outMetadata.toString());
-				// Debug.debug("hasIptcSegment", new JpegImageParser()
-				// .hasIptcSegment(updateByteSource));
-
-				assertNotNull(outMetadata);
-				assertTrue(outMetadata.getItems().size() == newRecords.size());
-				// assertEquals(metadata.toString(), outMetadata.toString());
-			}
+                ByteSource updateByteSource = new ByteSourceFile(updated);
+                JpegPhotoshopMetadata outMetadata = new JpegImageParser()
+                        .getPhotoshopMetadata(updateByteSource, params);
+
+                // Debug.debug("outMetadata", outMetadata.toString());
+                // Debug.debug("hasIptcSegment", new JpegImageParser()
+                // .hasIptcSegment(updateByteSource));
+
+                assertNotNull(outMetadata);
+                assertTrue(outMetadata.getItems().size() == newRecords.size());
+                // assertEquals(metadata.toString(), outMetadata.toString());
+            }
 
-		}
-	}
+        }
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpBaseTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpBaseTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpBaseTest.java Fri Sep 10 01:35:50 2010
@@ -30,77 +30,77 @@ import org.apache.sanselan.formats.jpeg.
 public abstract class JpegXmpBaseTest extends SanselanTest
 {
 
-	protected static boolean hasJpegXmpData(File file)
-	{
-		if (!file.getName().toLowerCase().endsWith(".jpg"))
-			return false;
-		//ImageFormat format = Sanselan.guessFormat(file);
-		//if (format != ImageFormat.IMAGE_FORMAT_JPEG)
-		//	return false;
-
-		//		Debug.debug("possible file", file);
-
-		try
-		{
-			ByteSource byteSource = new ByteSourceFile(file);
-			return new JpegImageParser().hasXmpSegment(byteSource);
-		}
-		catch (Exception e)
-		{
-			//			Debug.debug("Error file", file.getAbsoluteFile());
-			//			Debug.debug(e, 4);
-			return false;
-		}
-	}
-
-	private static final ImageFilter HAS_JPEG_XMP_IMAGE_FILTER = new ImageFilter()
-	{
-		public boolean accept(File file) throws IOException, ImageReadException
-		{
-			return hasJpegXmpData(file);
-		}
-	};
-
-//	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 getImageWithXmpData() throws IOException,
-			ImageReadException
-	{
-		return getTestImage(HAS_JPEG_XMP_IMAGE_FILTER);
-	}
-
-	protected List getImagesWithXmpData() throws IOException,
-			ImageReadException
-	{
-		return getTestImages(HAS_JPEG_XMP_IMAGE_FILTER);
-	}
-
-	protected List getImagesWithXmpData(int max) throws IOException,
-			ImageReadException
-	{
-		return getTestImages(HAS_JPEG_XMP_IMAGE_FILTER, max);
-	}
-
-//	protected File getJpegImage() throws IOException, ImageReadException
-//	{
-//		return getTestImage(JPEG_IMAGE_FILTER);
-//	}
+    protected static boolean hasJpegXmpData(File file)
+    {
+        if (!file.getName().toLowerCase().endsWith(".jpg"))
+            return false;
+        //ImageFormat format = Sanselan.guessFormat(file);
+        //if (format != ImageFormat.IMAGE_FORMAT_JPEG)
+        //    return false;
+
+        //        Debug.debug("possible file", file);
+
+        try
+        {
+            ByteSource byteSource = new ByteSourceFile(file);
+            return new JpegImageParser().hasXmpSegment(byteSource);
+        }
+        catch (Exception e)
+        {
+            //            Debug.debug("Error file", file.getAbsoluteFile());
+            //            Debug.debug(e, 4);
+            return false;
+        }
+    }
+
+    private static final ImageFilter HAS_JPEG_XMP_IMAGE_FILTER = new ImageFilter()
+    {
+        public boolean accept(File file) throws IOException, ImageReadException
+        {
+            return hasJpegXmpData(file);
+        }
+    };
+
+//    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 getImageWithXmpData() throws IOException,
+            ImageReadException
+    {
+        return getTestImage(HAS_JPEG_XMP_IMAGE_FILTER);
+    }
+
+    protected List getImagesWithXmpData() throws IOException,
+            ImageReadException
+    {
+        return getTestImages(HAS_JPEG_XMP_IMAGE_FILTER);
+    }
+
+    protected List getImagesWithXmpData(int max) throws IOException,
+            ImageReadException
+    {
+        return getTestImages(HAS_JPEG_XMP_IMAGE_FILTER, max);
+    }
+
+//    protected File getJpegImage() throws IOException, ImageReadException
+//    {
+//        return getTestImage(JPEG_IMAGE_FILTER);
+//    }
 //
-//	protected List getJpegImages() throws IOException, ImageReadException
-//	{
-//		return getTestImages(JPEG_IMAGE_FILTER);
-//	}
+//    protected List getJpegImages() throws IOException, ImageReadException
+//    {
+//        return getTestImages(JPEG_IMAGE_FILTER);
+//    }
 //
-//	protected List getJpegImages(int max) throws IOException,
-//			ImageReadException
-//	{
-//		return getTestImages(JPEG_IMAGE_FILTER, max);
-//	}
+//    protected List getJpegImages(int max) throws IOException,
+//            ImageReadException
+//    {
+//        return getTestImages(JPEG_IMAGE_FILTER, max);
+//    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpDumpTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpDumpTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpDumpTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpDumpTest.java Fri Sep 10 01:35:50 2010
@@ -32,26 +32,26 @@ import org.apache.sanselan.util.Debug;
 public class JpegXmpDumpTest extends JpegXmpBaseTest
 {
 
-	public void test() throws IOException, ImageReadException
-	{
-		List images = getImagesWithXmpData();
-		for (int i = 0; i < images.size(); i++)
-		{
-			if (i % 10 == 0)
-				Debug.purgeMemory();
+    public void test() throws IOException, ImageReadException
+    {
+        List images = getImagesWithXmpData();
+        for (int i = 0; i < images.size(); i++)
+        {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
 
-			File imageFile = (File) images.get(i);
-			Debug.debug("imageFile", imageFile);
-			Debug.debug();
+            File imageFile = (File) images.get(i);
+            Debug.debug("imageFile", imageFile);
+            Debug.debug();
 
-			ByteSource byteSource = new ByteSourceFile(imageFile);
-			Map params = new HashMap();
-			String xmpXml = new JpegImageParser().getXmpXml(byteSource, params );
-			assertNotNull(xmpXml);
+            ByteSource byteSource = new ByteSourceFile(imageFile);
+            Map params = new HashMap();
+            String xmpXml = new JpegImageParser().getXmpXml(byteSource, params );
+            assertNotNull(xmpXml);
 
-			Debug.debug("xmpXml", xmpXml);
-			Debug.debug();
-		}
-	}
+            Debug.debug("xmpXml", xmpXml);
+            Debug.debug();
+        }
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriteTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriteTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriteTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/jpeg/xmp/JpegXmpRewriteTest.java Fri Sep 10 01:35:50 2010
@@ -36,117 +36,117 @@ import org.apache.sanselan.util.Debug;
 public class JpegXmpRewriteTest extends JpegXmpBaseTest
 {
 
-	public void testRemoveInsertUpdate() throws IOException, ImageReadException,
-			ImageWriteException
-	{
-		List images = getImagesWithXmpData();
-		for (int i = 0; i < images.size(); i++)
-		{
-			if (i % 10 == 0)
-				Debug.purgeMemory();
-
-			File imageFile = (File) images.get(i);
-			Debug.debug("imageFile", imageFile);
-
-			// boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
-			// if (ignoreImageData)
-			// continue;
-
-			ByteSource byteSource = new ByteSourceFile(imageFile);
-			// Debug.debug("Source Segments:");
-			// new JpegUtils().dumpJFIF(byteSource);
-
-			Map params = new HashMap();
-			String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
-			assertNotNull(xmpXml);
-
-			// Debug.debug("xmpXml", xmpXml.length());
-			// Debug.debug();
-
-			File noXmpFile = createTempFile(imageFile.getName() + ".", ".jpg");
-			{
-				// test remove
-				
-				OutputStream os = null;
-				try
-				{
-					os = new FileOutputStream(noXmpFile);
-					os = new BufferedOutputStream(os);
-					new JpegXmpRewriter().removeXmpXml(byteSource, os);
-				} finally
-				{
-					if (os != null) {
-					    os.close();
-					}
-					os = null;
-				}
-
-				// Debug.debug("Source Segments:");
-				// new JpegUtils().dumpJFIF(new ByteSourceFile(noXmpFile));
-
-				String outXmp = new JpegImageParser().getXmpXml(
-						new ByteSourceFile(noXmpFile), params);
-				assertNull(outXmp);
-			}
-
-			{
-				// test update
-				
-				String newXmpXml = "test";
-				File updated = createTempFile(imageFile.getName() + ".", ".jpg");
-				OutputStream os = null;
-				try
-				{
-					os = new FileOutputStream(updated);
-					os = new BufferedOutputStream(os);
-					new JpegXmpRewriter().updateXmpXml(byteSource, os,
-							newXmpXml);
-				} finally
-				{
-				    if (os != null) {
-				        os.close();
-				    }
-					os = null;
-				}
-
-				// Debug.debug("Source Segments:");
-				// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
-
-				String outXmp = new JpegImageParser().getXmpXml(
-						new ByteSourceFile(updated), params);
-				assertNotNull(outXmp);
-				assertEquals(outXmp, newXmpXml);
-			}
-
-			{
-				// test insert
-				
-				String newXmpXml = "test";
-				File updated = createTempFile(imageFile.getName() + ".", ".jpg");
-				OutputStream os = null;
-				try
-				{
-					os = new FileOutputStream(updated);
-					os = new BufferedOutputStream(os);
-					new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(noXmpFile), os,
-							newXmpXml);
-				} finally
-				{
-				    if (os != null) {
-				        os.close();
-				    }
-					os = null;
-				}
-
-				// Debug.debug("Source Segments:");
-				// new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
-
-				String outXmp = new JpegImageParser().getXmpXml(
-						new ByteSourceFile(updated), params);
-				assertNotNull(outXmp);
-				assertEquals(outXmp, newXmpXml);
-			}
-		}
-	}
+    public void testRemoveInsertUpdate() throws IOException, ImageReadException,
+            ImageWriteException
+    {
+        List images = getImagesWithXmpData();
+        for (int i = 0; i < images.size(); i++)
+        {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
+
+            File imageFile = (File) images.get(i);
+            Debug.debug("imageFile", imageFile);
+
+            // boolean ignoreImageData = isPhilHarveyTestImage(imageFile);
+            // if (ignoreImageData)
+            // continue;
+
+            ByteSource byteSource = new ByteSourceFile(imageFile);
+            // Debug.debug("Source Segments:");
+            // new JpegUtils().dumpJFIF(byteSource);
+
+            Map params = new HashMap();
+            String xmpXml = new JpegImageParser().getXmpXml(byteSource, params);
+            assertNotNull(xmpXml);
+
+            // Debug.debug("xmpXml", xmpXml.length());
+            // Debug.debug();
+
+            File noXmpFile = createTempFile(imageFile.getName() + ".", ".jpg");
+            {
+                // test remove
+
+                OutputStream os = null;
+                try
+                {
+                    os = new FileOutputStream(noXmpFile);
+                    os = new BufferedOutputStream(os);
+                    new JpegXmpRewriter().removeXmpXml(byteSource, os);
+                } finally
+                {
+                    if (os != null) {
+                        os.close();
+                    }
+                    os = null;
+                }
+
+                // Debug.debug("Source Segments:");
+                // new JpegUtils().dumpJFIF(new ByteSourceFile(noXmpFile));
+
+                String outXmp = new JpegImageParser().getXmpXml(
+                        new ByteSourceFile(noXmpFile), params);
+                assertNull(outXmp);
+            }
+
+            {
+                // test update
+
+                String newXmpXml = "test";
+                File updated = createTempFile(imageFile.getName() + ".", ".jpg");
+                OutputStream os = null;
+                try
+                {
+                    os = new FileOutputStream(updated);
+                    os = new BufferedOutputStream(os);
+                    new JpegXmpRewriter().updateXmpXml(byteSource, os,
+                            newXmpXml);
+                } finally
+                {
+                    if (os != null) {
+                        os.close();
+                    }
+                    os = null;
+                }
+
+                // Debug.debug("Source Segments:");
+                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
+
+                String outXmp = new JpegImageParser().getXmpXml(
+                        new ByteSourceFile(updated), params);
+                assertNotNull(outXmp);
+                assertEquals(outXmp, newXmpXml);
+            }
+
+            {
+                // test insert
+
+                String newXmpXml = "test";
+                File updated = createTempFile(imageFile.getName() + ".", ".jpg");
+                OutputStream os = null;
+                try
+                {
+                    os = new FileOutputStream(updated);
+                    os = new BufferedOutputStream(os);
+                    new JpegXmpRewriter().updateXmpXml(new ByteSourceFile(noXmpFile), os,
+                            newXmpXml);
+                } finally
+                {
+                    if (os != null) {
+                        os.close();
+                    }
+                    os = null;
+                }
+
+                // Debug.debug("Source Segments:");
+                // new JpegUtils().dumpJFIF(new ByteSourceFile(updated));
+
+                String outXmp = new JpegImageParser().getXmpXml(
+                        new ByteSourceFile(updated), params);
+                assertNotNull(outXmp);
+                assertEquals(outXmp, newXmpXml);
+            }
+        }
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/ConvertPngToGifTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/ConvertPngToGifTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/ConvertPngToGifTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/ConvertPngToGifTest.java Fri Sep 10 01:35:50 2010
@@ -33,33 +33,33 @@ public class ConvertPngToGifTest extends
 
 
 
-	public void test() throws IOException, ImageReadException,
-			ImageWriteException {
+    public void test() throws IOException, ImageReadException,
+            ImageWriteException {
 
-		List images = getPngImages();
-		for (int i = 0; i < images.size(); i++) {
-			if (i % 10 == 0)
-				Debug.purgeMemory();
-
-			File imageFile = (File) images.get(i);
-			if (isInvalidPNGTestFile(imageFile))
-				continue;
-			// Debug.debug("imageFile", imageFile);
-			// Debug.debug();
-
-			Hashtable params = new Hashtable();
-//			params.put(SanselanConstants.PARAM_KEY_VERBOSE, Boolean.TRUE);
-
-			BufferedImage image = Sanselan.getBufferedImage(imageFile, params);
-			assertNotNull(image);
-
-			File outFile = createTempFile(imageFile.getName()+".", ".gif");
-//			Debug.debug("outFile", outFile);
-
-			Sanselan.writeImage(image, outFile, ImageFormat.IMAGE_FORMAT_GIF,
-					params);
-		}
-		Debug.debug("complete.");
-	}
+        List images = getPngImages();
+        for (int i = 0; i < images.size(); i++) {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
+
+            File imageFile = (File) images.get(i);
+            if (isInvalidPNGTestFile(imageFile))
+                continue;
+            // Debug.debug("imageFile", imageFile);
+            // Debug.debug();
+
+            Hashtable params = new Hashtable();
+//            params.put(SanselanConstants.PARAM_KEY_VERBOSE, Boolean.TRUE);
+
+            BufferedImage image = Sanselan.getBufferedImage(imageFile, params);
+            assertNotNull(image);
+
+            File outFile = createTempFile(imageFile.getName()+".", ".gif");
+//            Debug.debug("outFile", outFile);
+
+            Sanselan.writeImage(image, outFile, ImageFormat.IMAGE_FORMAT_GIF,
+                    params);
+        }
+        Debug.debug("complete.");
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngBaseTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngBaseTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngBaseTest.java Fri Sep 10 01:35:50 2010
@@ -29,24 +29,24 @@ import org.apache.sanselan.SanselanTest;
 public abstract class PngBaseTest extends SanselanTest
 {
 
-	private static boolean isPng(File file) throws IOException,
-			ImageReadException
-	{
-		ImageFormat format = Sanselan.guessFormat(file);
-		return format == ImageFormat.IMAGE_FORMAT_PNG;
-	}
-
-	private static final ImageFilter imageFilter = new ImageFilter() {
-		public boolean accept(File file) throws IOException, ImageReadException
-		{
-			return isPng(file);
-		}
-	};
-
-	protected List getPngImages() throws IOException, ImageReadException
-	{
-		return getTestImages(imageFilter);
-	}
+    private static boolean isPng(File file) throws IOException,
+            ImageReadException
+    {
+        ImageFormat format = Sanselan.guessFormat(file);
+        return format == ImageFormat.IMAGE_FORMAT_PNG;
+    }
+
+    private static final ImageFilter imageFilter = new ImageFilter() {
+        public boolean accept(File file) throws IOException, ImageReadException
+        {
+            return isPng(file);
+        }
+    };
+
+    protected List getPngImages() throws IOException, ImageReadException
+    {
+        return getTestImages(imageFilter);
+    }
 
 
 

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java Fri Sep 10 01:35:50 2010
@@ -33,46 +33,46 @@ import org.apache.commons.io.FilenameUti
 public class PngMultipleRoundtripTest extends PngBaseTest
 {
 
-	public void test() throws IOException, ImageReadException,
-			ImageWriteException
-	{
-		String imagesFolderPath = FilenameUtils.separatorsToSystem("src\\test\\data\\images\\png\\3");
-		File imagesFolder = new File(imagesFolderPath);
-		assertTrue(imagesFolder.exists() && imagesFolder.isDirectory());
-		
-		File files[] = imagesFolder.listFiles();
-		for (int i = 0; i < files.length; i++)
-		{
-			File imageFile = files[i];
-			if(!imageFile.isFile() )
-				continue;
-			if(!imageFile.getName().toLowerCase().endsWith(".png"))
-				continue;
-			
-			Debug.debug();
-			Debug.debug("imageFile", imageFile);
-
-			File lastFile = imageFile;
-			for (int j = 0; j < 10; j++)
-			{
-				Map readParams = new HashMap();
-				// readParams.put(SanselanConstants.BUFFERED_IMAGE_FACTORY,
-				// new RgbBufferedImageFactory());
-				BufferedImage image = Sanselan.getBufferedImage(lastFile,
-						readParams);
-				assertNotNull(image);
-
-				File tempFile = createTempFile(imageFile.getName() + "." + j
-						+ ".", ".png");
-				Debug.debug("tempFile", tempFile);
-
-				Map writeParams = new HashMap();
-				Sanselan.writeImage(image, tempFile,
-						ImageFormat.IMAGE_FORMAT_PNG, writeParams);
-
-				lastFile = tempFile;
-			}
-		}
-	}
+    public void test() throws IOException, ImageReadException,
+            ImageWriteException
+    {
+        String imagesFolderPath = FilenameUtils.separatorsToSystem("src\\test\\data\\images\\png\\3");
+        File imagesFolder = new File(imagesFolderPath);
+        assertTrue(imagesFolder.exists() && imagesFolder.isDirectory());
+
+        File files[] = imagesFolder.listFiles();
+        for (int i = 0; i < files.length; i++)
+        {
+            File imageFile = files[i];
+            if(!imageFile.isFile() )
+                continue;
+            if(!imageFile.getName().toLowerCase().endsWith(".png"))
+                continue;
+
+            Debug.debug();
+            Debug.debug("imageFile", imageFile);
+
+            File lastFile = imageFile;
+            for (int j = 0; j < 10; j++)
+            {
+                Map readParams = new HashMap();
+                // readParams.put(SanselanConstants.BUFFERED_IMAGE_FACTORY,
+                // new RgbBufferedImageFactory());
+                BufferedImage image = Sanselan.getBufferedImage(lastFile,
+                        readParams);
+                assertNotNull(image);
+
+                File tempFile = createTempFile(imageFile.getName() + "." + j
+                        + ".", ".png");
+                Debug.debug("tempFile", tempFile);
+
+                Map writeParams = new HashMap();
+                Sanselan.writeImage(image, tempFile,
+                        ImageFormat.IMAGE_FORMAT_PNG, writeParams);
+
+                lastFile = tempFile;
+            }
+        }
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngReadTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngReadTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngReadTest.java Fri Sep 10 01:35:50 2010
@@ -33,55 +33,55 @@ public class PngReadTest extends PngBase
 
 
 
-	public void test() throws IOException, ImageReadException
-	{
-		Debug.debug("start");
-
-		List images = getPngImages();
-		for (int i = 0; i < images.size(); i++)
-		{
-			if (i % 10 == 0)
-				Debug.purgeMemory();
-
-			File imageFile = (File) images.get(i);
-			Debug.debug("imageFile", imageFile);
-			if (isInvalidPNGTestFile(imageFile))
-			{
-				try
-				{
-					Sanselan.getMetadata(imageFile);
-					fail("Image read should have failed.");
-				} catch (Exception e)
-				{
-				}
-
-				try
-				{
-					Sanselan.getImageInfo(imageFile);
-					fail("Image read should have failed.");
-				} catch (Exception e)
-				{
-				}
-
-				try
-				{
-					Sanselan.getBufferedImage(imageFile);
-					fail("Image read should have failed.");
-				} catch (Exception e)
-				{
-				}
-			} else
-			{
-				IImageMetadata metadata = Sanselan.getMetadata(imageFile);
-				// assertNotNull(metadata);
-
-				ImageInfo imageInfo = Sanselan.getImageInfo(imageFile);
-				assertNotNull(imageInfo);
-
-				BufferedImage image = Sanselan.getBufferedImage(imageFile);
-				assertNotNull(image);
-			}
-		}
-	}
+    public void test() throws IOException, ImageReadException
+    {
+        Debug.debug("start");
+
+        List images = getPngImages();
+        for (int i = 0; i < images.size(); i++)
+        {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
+
+            File imageFile = (File) images.get(i);
+            Debug.debug("imageFile", imageFile);
+            if (isInvalidPNGTestFile(imageFile))
+            {
+                try
+                {
+                    Sanselan.getMetadata(imageFile);
+                    fail("Image read should have failed.");
+                } catch (Exception e)
+                {
+                }
+
+                try
+                {
+                    Sanselan.getImageInfo(imageFile);
+                    fail("Image read should have failed.");
+                } catch (Exception e)
+                {
+                }
+
+                try
+                {
+                    Sanselan.getBufferedImage(imageFile);
+                    fail("Image read should have failed.");
+                } catch (Exception e)
+                {
+                }
+            } else
+            {
+                IImageMetadata metadata = Sanselan.getMetadata(imageFile);
+                // assertNotNull(metadata);
+
+                ImageInfo imageInfo = Sanselan.getImageInfo(imageFile);
+                assertNotNull(imageInfo);
+
+                BufferedImage image = Sanselan.getBufferedImage(imageFile);
+                assertNotNull(image);
+            }
+        }
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngTextTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngTextTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngTextTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngTextTest.java Fri Sep 10 01:35:50 2010
@@ -35,62 +35,62 @@ import org.apache.sanselan.util.IOUtils;
 public class PngTextTest extends PngBaseTest
 {
 
-	public void test() throws IOException, ImageReadException,
-			ImageWriteException
-	{
-		int width = 1;
-		int height = 1;
-		BufferedImage srcImage = new BufferedImage(width, height,
-				BufferedImage.TYPE_INT_ARGB);
-		srcImage.setRGB(0, 0, Color.red.getRGB());
-
-		Map writeParams = new HashMap();
-
-		List writeTexts = new ArrayList();
-		{
-			String keyword = "a";
-			String text = "b";
-			writeTexts.add(new PngText.tEXt(keyword, text));
-		}
-		{
-			String keyword = "c";
-			String text = "d";
-			writeTexts.add(new PngText.zTXt(keyword, text));
-		}
-		{
-			String keyword = "e";
-			String text = "f";
-			String languageTag = "g";
-			String translatedKeyword = "h";
-			writeTexts.add(new PngText.iTXt(keyword, text, languageTag,
-					translatedKeyword));
-		}
-
-		writeParams.put(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS, writeTexts);
-
-		byte bytes[] = Sanselan.writeImageToBytes(srcImage,
-				ImageFormat.IMAGE_FORMAT_PNG, writeParams);
-
-		File tempFile = createTempFile("temp", ".png");
-		IOUtils.writeToFile(bytes, tempFile);
-
-		PngImageInfo imageInfo = (PngImageInfo) Sanselan.getImageInfo(bytes);
-		assertNotNull(imageInfo);
-
-		List readTexts = imageInfo.getTextChunks();
-		assertEquals(readTexts.size(), 3);
-		for (int i = 0; i < readTexts.size(); i++)
-		{
-			PngText text = (PngText) readTexts.get(i);
-			if (text.keyword.equals("a"))
-				assertEquals(text.text, "b");
-			else if (text.keyword.equals("c"))
-				assertEquals(text.text, "d");
-			else if (text.keyword.equals("e"))
-				assertEquals(text.text, "f");
-			else
-				fail("unknown text chunk.");
-		}
-	}
+    public void test() throws IOException, ImageReadException,
+            ImageWriteException
+    {
+        int width = 1;
+        int height = 1;
+        BufferedImage srcImage = new BufferedImage(width, height,
+                BufferedImage.TYPE_INT_ARGB);
+        srcImage.setRGB(0, 0, Color.red.getRGB());
+
+        Map writeParams = new HashMap();
+
+        List writeTexts = new ArrayList();
+        {
+            String keyword = "a";
+            String text = "b";
+            writeTexts.add(new PngText.tEXt(keyword, text));
+        }
+        {
+            String keyword = "c";
+            String text = "d";
+            writeTexts.add(new PngText.zTXt(keyword, text));
+        }
+        {
+            String keyword = "e";
+            String text = "f";
+            String languageTag = "g";
+            String translatedKeyword = "h";
+            writeTexts.add(new PngText.iTXt(keyword, text, languageTag,
+                    translatedKeyword));
+        }
+
+        writeParams.put(PngConstants.PARAM_KEY_PNG_TEXT_CHUNKS, writeTexts);
+
+        byte bytes[] = Sanselan.writeImageToBytes(srcImage,
+                ImageFormat.IMAGE_FORMAT_PNG, writeParams);
+
+        File tempFile = createTempFile("temp", ".png");
+        IOUtils.writeToFile(bytes, tempFile);
+
+        PngImageInfo imageInfo = (PngImageInfo) Sanselan.getImageInfo(bytes);
+        assertNotNull(imageInfo);
+
+        List readTexts = imageInfo.getTextChunks();
+        assertEquals(readTexts.size(), 3);
+        for (int i = 0; i < readTexts.size(); i++)
+        {
+            PngText text = (PngText) readTexts.get(i);
+            if (text.keyword.equals("a"))
+                assertEquals(text.text, "b");
+            else if (text.keyword.equals("c"))
+                assertEquals(text.text, "d");
+            else if (text.keyword.equals("e"))
+                assertEquals(text.text, "f");
+            else
+                fail("unknown text chunk.");
+        }
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngWriteForceTrueColorText.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngWriteForceTrueColorText.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngWriteForceTrueColorText.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngWriteForceTrueColorText.java Fri Sep 10 01:35:50 2010
@@ -29,45 +29,45 @@ import org.apache.sanselan.util.Debug;
 
 public class PngWriteForceTrueColorText extends PngBaseTest {
 
-	public void test() throws Exception {
+    public void test() throws Exception {
 
-		List images = getPngImages();
-		for (int i = 0; i < images.size(); i++) {
-			if (i % 10 == 0)
-				Debug.purgeMemory();
-
-			File imageFile = (File) images.get(i);
-			try {
-				if (isInvalidPNGTestFile(imageFile))
-					continue;
-
-				Debug.debug("imageFile", imageFile);
-				// Debug.debug();
-
-				// params.put(SanselanConstants.PARAM_KEY_VERBOSE,
-				// Boolean.TRUE);
-
-				BufferedImage image = Sanselan.getBufferedImage(imageFile,
-						new HashMap());
-				assertNotNull(image);
-
-				File outFile = createTempFile(imageFile.getName() + ".", ".gif");
-				// Debug.debug("outFile", outFile);
-
-				Map params = new HashMap();
-				params.put(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR,
-						Boolean.TRUE);
-				Sanselan.writeImage(image, outFile,
-						ImageFormat.IMAGE_FORMAT_PNG, params);
-
-				BufferedImage image2 = Sanselan.getBufferedImage(outFile,
-						new HashMap());
-			} catch (Exception e) {
-				Debug.debug("imageFile", imageFile);
-				throw e;
-			}
-		}
-		Debug.debug("complete.");
-	}
+        List images = getPngImages();
+        for (int i = 0; i < images.size(); i++) {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
+
+            File imageFile = (File) images.get(i);
+            try {
+                if (isInvalidPNGTestFile(imageFile))
+                    continue;
+
+                Debug.debug("imageFile", imageFile);
+                // Debug.debug();
+
+                // params.put(SanselanConstants.PARAM_KEY_VERBOSE,
+                // Boolean.TRUE);
+
+                BufferedImage image = Sanselan.getBufferedImage(imageFile,
+                        new HashMap());
+                assertNotNull(image);
+
+                File outFile = createTempFile(imageFile.getName() + ".", ".gif");
+                // Debug.debug("outFile", outFile);
+
+                Map params = new HashMap();
+                params.put(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR,
+                        Boolean.TRUE);
+                Sanselan.writeImage(image, outFile,
+                        ImageFormat.IMAGE_FORMAT_PNG, params);
+
+                BufferedImage image2 = Sanselan.getBufferedImage(outFile,
+                        new HashMap());
+            } catch (Exception e) {
+                Debug.debug("imageFile", imageFile);
+                throw e;
+            }
+        }
+        Debug.debug("complete.");
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngWriteReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngWriteReadTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngWriteReadTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngWriteReadTest.java Fri Sep 10 01:35:50 2010
@@ -33,143 +33,143 @@ import org.apache.sanselan.util.IOUtils;
 
 public class PngWriteReadTest extends SanselanTest
 {
-	//	public PngWriteReadTest(String name)
-	//	{
-	//		super(name);
-	//	}
-
-	private int[][] getSimpleRawData(int width, int height, int value)
-	{
-		int[][] result = new int[height][width];
-		for (int y = 0; y < height; y++)
-			for (int x = 0; x < width; x++)
-				result[y][x] = value;
-		return result;
-	}
-
-	private int[][] getAscendingRawData(int width, int height)
-	{
-		int[][] result = new int[height][width];
-		for (int y = 0; y < height; y++)
-			for (int x = 0; x < width; x++)
-			{
-				int alpha = (x + y) % 256;
-				int value = (x + y) % 256;
-				int argb = (0xff & alpha) << 24 | (0xff & value) << 16
-						| (0xff & value) << 8 | (0xff & value) << 0;
-
-				result[y][x] = argb;
-			}
-		return result;
-	}
-
-	private int[][] randomRawData(int width, int height)
-	{
-		Random random = new Random();
-		int[][] result = new int[height][width];
-		for (int y = 0; y < height; y++)
-			for (int x = 0; x < width; x++)
-			{
-				int argb = random.nextInt();
-				result[y][x] = argb;
-			}
-		return result;
-	}
-
-	public void test() throws IOException, ImageReadException,
-			ImageWriteException
-	{
-		int[][] smallBlackPixels = getSimpleRawData(256, 256, 0);
-		int[][] singleBlackPixel = getSimpleRawData(1, 1, 0);
-		int[][] smallRedPixels = getSimpleRawData(256, 256, 0xffff0000);
-		int[][] singleRedPixel = getSimpleRawData(1, 1, 0xffff0000);
-		int[][] smallAscendingPixels = getAscendingRawData(256, 256);
-		int[][] smallRandomPixels = randomRawData(256, 256);
-
-		int[][][] testData = {
-				smallBlackPixels, singleBlackPixel, smallRedPixels,
-				singleRedPixel, smallAscendingPixels, smallRandomPixels,
-		};
-
-		for (int i = 0; i < testData.length; i++)
-		{
-			int rawData[][] = testData[i];
-			writeAndReadImageData(rawData);
-		}
-	}
-
-	private BufferedImage imageDataToBufferedImage(int[][] rawData)
-	{
-		int width = rawData[0].length;
-		int height = rawData.length;
-		BufferedImage image = new BufferedImage(width, height,
-				BufferedImage.TYPE_INT_ARGB);
-		for (int y = 0; y < height; y++)
-			for (int x = 0; x < width; x++)
-			{
-				image.setRGB(x, y, rawData[y][x]);
-			}
-		return image;
-	}
-
-	private int[][] bufferedImageToImageData(BufferedImage image)
-	{
-		int width = image.getWidth();
-		int height = image.getHeight();
-		int[][] result = new int[height][width];
-
-		for (int y = 0; y < height; y++)
-			for (int x = 0; x < width; x++)
-			{
-				result[y][x] = image.getRGB(x, y);
-			}
-		return result;
-	}
-
-	private void writeAndReadImageData(int[][] rawData) throws IOException,
-			ImageReadException, ImageWriteException
-	{
-		BufferedImage srcImage = imageDataToBufferedImage(rawData);
-
-		Map writeParams = new HashMap();
-		//		writeParams.put(SanselanConstants.PARAM_KEY_FORMAT, ImageFormat.IMAGE_FORMAT_PNG);
-		//		writeParams.put(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR,
-		//				Boolean.TRUE);
-
-		byte bytes[] = Sanselan.writeImageToBytes(srcImage,
-				ImageFormat.IMAGE_FORMAT_PNG, writeParams);
-
-		//		Debug.debug("bytes", bytes);
-
-		File tempFile = createTempFile("temp", ".png");
-		IOUtils.writeToFile(bytes, tempFile);
-
-		BufferedImage dstImage = Sanselan.getBufferedImage(bytes);
-
-		assertNotNull(dstImage);
-		assertTrue(srcImage.getWidth() == dstImage.getWidth());
-		assertTrue(srcImage.getHeight() == dstImage.getHeight());
-
-		int dstData[][] = bufferedImageToImageData(dstImage);
-		compare(rawData, dstData);
-	}
-
-	private void compare(int[][] a, int[][] b)
-	{
-		assertNotNull(a);
-		assertNotNull(b);
-		assertTrue(a.length == b.length);
-
-		for (int y = 0; y < a.length; y++)
-		{
-			assertTrue(a[y].length == b[y].length);
-			// make sure row lengths consistent.
-			assertTrue(a[0].length == b[y].length);
-			for (int x = 0; x < a[y].length; x++)
-			{
-				assertTrue(a[y][x] == b[y][x]);
-			}
-		}
-	}
+    //    public PngWriteReadTest(String name)
+    //    {
+    //        super(name);
+    //    }
+
+    private int[][] getSimpleRawData(int width, int height, int value)
+    {
+        int[][] result = new int[height][width];
+        for (int y = 0; y < height; y++)
+            for (int x = 0; x < width; x++)
+                result[y][x] = value;
+        return result;
+    }
+
+    private int[][] getAscendingRawData(int width, int height)
+    {
+        int[][] result = new int[height][width];
+        for (int y = 0; y < height; y++)
+            for (int x = 0; x < width; x++)
+            {
+                int alpha = (x + y) % 256;
+                int value = (x + y) % 256;
+                int argb = (0xff & alpha) << 24 | (0xff & value) << 16
+                        | (0xff & value) << 8 | (0xff & value) << 0;
+
+                result[y][x] = argb;
+            }
+        return result;
+    }
+
+    private int[][] randomRawData(int width, int height)
+    {
+        Random random = new Random();
+        int[][] result = new int[height][width];
+        for (int y = 0; y < height; y++)
+            for (int x = 0; x < width; x++)
+            {
+                int argb = random.nextInt();
+                result[y][x] = argb;
+            }
+        return result;
+    }
+
+    public void test() throws IOException, ImageReadException,
+            ImageWriteException
+    {
+        int[][] smallBlackPixels = getSimpleRawData(256, 256, 0);
+        int[][] singleBlackPixel = getSimpleRawData(1, 1, 0);
+        int[][] smallRedPixels = getSimpleRawData(256, 256, 0xffff0000);
+        int[][] singleRedPixel = getSimpleRawData(1, 1, 0xffff0000);
+        int[][] smallAscendingPixels = getAscendingRawData(256, 256);
+        int[][] smallRandomPixels = randomRawData(256, 256);
+
+        int[][][] testData = {
+                smallBlackPixels, singleBlackPixel, smallRedPixels,
+                singleRedPixel, smallAscendingPixels, smallRandomPixels,
+        };
+
+        for (int i = 0; i < testData.length; i++)
+        {
+            int rawData[][] = testData[i];
+            writeAndReadImageData(rawData);
+        }
+    }
+
+    private BufferedImage imageDataToBufferedImage(int[][] rawData)
+    {
+        int width = rawData[0].length;
+        int height = rawData.length;
+        BufferedImage image = new BufferedImage(width, height,
+                BufferedImage.TYPE_INT_ARGB);
+        for (int y = 0; y < height; y++)
+            for (int x = 0; x < width; x++)
+            {
+                image.setRGB(x, y, rawData[y][x]);
+            }
+        return image;
+    }
+
+    private int[][] bufferedImageToImageData(BufferedImage image)
+    {
+        int width = image.getWidth();
+        int height = image.getHeight();
+        int[][] result = new int[height][width];
+
+        for (int y = 0; y < height; y++)
+            for (int x = 0; x < width; x++)
+            {
+                result[y][x] = image.getRGB(x, y);
+            }
+        return result;
+    }
+
+    private void writeAndReadImageData(int[][] rawData) throws IOException,
+            ImageReadException, ImageWriteException
+    {
+        BufferedImage srcImage = imageDataToBufferedImage(rawData);
+
+        Map writeParams = new HashMap();
+        //        writeParams.put(SanselanConstants.PARAM_KEY_FORMAT, ImageFormat.IMAGE_FORMAT_PNG);
+        //        writeParams.put(PngConstants.PARAM_KEY_PNG_FORCE_TRUE_COLOR,
+        //                Boolean.TRUE);
+
+        byte bytes[] = Sanselan.writeImageToBytes(srcImage,
+                ImageFormat.IMAGE_FORMAT_PNG, writeParams);
+
+        //        Debug.debug("bytes", bytes);
+
+        File tempFile = createTempFile("temp", ".png");
+        IOUtils.writeToFile(bytes, tempFile);
+
+        BufferedImage dstImage = Sanselan.getBufferedImage(bytes);
+
+        assertNotNull(dstImage);
+        assertTrue(srcImage.getWidth() == dstImage.getWidth());
+        assertTrue(srcImage.getHeight() == dstImage.getHeight());
+
+        int dstData[][] = bufferedImageToImageData(dstImage);
+        compare(rawData, dstData);
+    }
+
+    private void compare(int[][] a, int[][] b)
+    {
+        assertNotNull(a);
+        assertNotNull(b);
+        assertTrue(a.length == b.length);
+
+        for (int y = 0; y < a.length; y++)
+        {
+            assertTrue(a[y].length == b[y].length);
+            // make sure row lengths consistent.
+            assertTrue(a[0].length == b[y].length);
+            for (int x = 0; x < a[y].length; x++)
+            {
+                assertTrue(a[y][x] == b[y][x]);
+            }
+        }
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffBaseTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffBaseTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffBaseTest.java Fri Sep 10 01:35:50 2010
@@ -29,23 +29,23 @@ import org.apache.sanselan.SanselanTest;
 public abstract class TiffBaseTest extends SanselanTest
 {
 
-	private static boolean isTiff(File file) throws IOException,
-			ImageReadException
-	{
-		ImageFormat format = Sanselan.guessFormat(file);
-		return format == ImageFormat.IMAGE_FORMAT_TIFF;
-	}
+    private static boolean isTiff(File file) throws IOException,
+            ImageReadException
+    {
+        ImageFormat format = Sanselan.guessFormat(file);
+        return format == ImageFormat.IMAGE_FORMAT_TIFF;
+    }
 
-	private static final ImageFilter imageFilter = new ImageFilter() {
-		public boolean accept(File file) throws IOException, ImageReadException
-		{
-			return isTiff(file);
-		}
-	};
+    private static final ImageFilter imageFilter = new ImageFilter() {
+        public boolean accept(File file) throws IOException, ImageReadException
+        {
+            return isTiff(file);
+        }
+    };
 
-	protected List getTiffImages() throws IOException, ImageReadException
-	{
-		return getTestImages(imageFilter);
-	}
+    protected List getTiffImages() throws IOException, ImageReadException
+    {
+        return getTestImages(imageFilter);
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffLZWTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffLZWTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffLZWTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffLZWTest.java Fri Sep 10 01:35:50 2010
@@ -31,250 +31,250 @@ import org.apache.sanselan.util.Debug;
 public class TiffLZWTest extends TiffBaseTest implements BinaryConstants
 {
 
-	public void testTrivial() throws IOException
-	{
-		byte bytes[] = { 0, };
-		compressRoundtripAndValidate(bytes);
-	}
-
-	public void testMedium() throws IOException
-	{
-		int LENGTH = 1024 * 32;
-		byte bytes[] = new byte[LENGTH];
-		for (int modulator = 1; modulator < 255; modulator += 3)
-		{
-			for (int i = 0; i < LENGTH; i++)
-				bytes[i] = (byte) (0xff & (i % modulator));
-
-			compressRoundtripAndValidate(bytes);
-		}
-	}
-
-//	public void testTiffImageData() throws IOException, ImageReadException,
-//			ImageWriteException
-//	{
-//		List images = getTiffImages();
-//		for (int i = 0; i < images.size(); i++)
-//		{
-//			if (i % 10 == 0)
-//				Debug.purgeMemory();
+    public void testTrivial() throws IOException
+    {
+        byte bytes[] = { 0, };
+        compressRoundtripAndValidate(bytes);
+    }
+
+    public void testMedium() throws IOException
+    {
+        int LENGTH = 1024 * 32;
+        byte bytes[] = new byte[LENGTH];
+        for (int modulator = 1; modulator < 255; modulator += 3)
+        {
+            for (int i = 0; i < LENGTH; i++)
+                bytes[i] = (byte) (0xff & (i % modulator));
+
+            compressRoundtripAndValidate(bytes);
+        }
+    }
+
+//    public void testTiffImageData() throws IOException, ImageReadException,
+//            ImageWriteException
+//    {
+//        List images = getTiffImages();
+//        for (int i = 0; i < images.size(); i++)
+//        {
+//            if (i % 10 == 0)
+//                Debug.purgeMemory();
 //
-//			File imageFile = (File) images.get(i);
-//			Debug.debug("imageFile", imageFile);
+//            File imageFile = (File) images.get(i);
+//            Debug.debug("imageFile", imageFile);
 //
-//			ByteSource byteSource = new ByteSourceFile(imageFile);
-//			Map params = new HashMap();
-//			List data = new TiffImageParser().collectRawImageData(byteSource,
-//					params);
+//            ByteSource byteSource = new ByteSourceFile(imageFile);
+//            Map params = new HashMap();
+//            List data = new TiffImageParser().collectRawImageData(byteSource,
+//                    params);
 //
-//			for (int j = 0; j < data.size(); j++)
-//			{
-//				byte bytes[] = (byte[]) data.get(j);
-//				decompressRoundtripAndValidate(bytes);
-//			}
-//		}
-//	}
-
-	private void compressRoundtripAndValidate(byte src[]) throws IOException
-	{
-		final boolean DEBUG = false;
-
-		if (DEBUG)
-		{
-			Debug.debug();
-			Debug.debug("roundtripAndValidate: " + src.length);
-			Debug.debug();
-		}
-
-		int LZW_MINIMUM_CODE_SIZE = 8;
-		final List codes = new ArrayList();
-		MyLZWCompressor.Listener compressionListener = new MyLZWCompressor.Listener() {
-			public void dataCode(int code)
-			{
-				codes.add(new Integer(code));
-			}
-
-			public void eoiCode(int code)
-			{
-				codes.add(new Integer(code));
-			}
-
-			public void clearCode(int code)
-			{
-				codes.add(new Integer(code));
-			}
-
-			public void init(int clearCode, int eoiCode)
-			{
-			}
-		};
-
-		MyLZWCompressor compressor = new MyLZWCompressor(LZW_MINIMUM_CODE_SIZE,
-				BYTE_ORDER_MSB, true, compressionListener);
-		byte compressed[] = compressor.compress(src);
-
-		MyLZWDecompressor.Listener decompressionListener = new MyLZWDecompressor.Listener() {
-
-			int index = 0;
-			int clearCode, eoiCode;
-
-			public void code(int code)
-			{
-				if (DEBUG)
-				{
-					if (code == clearCode)
-					{
-						Debug.debug("clearCode: " + index + "/" + codes.size());
-						Debug.debug();
-					}
-					if (code == eoiCode)
-					{
-						Debug.debug("eoiCode: " + index + "/" + codes.size());
-						Debug.debug();
-					}
-				}
-				Integer expectedCode = (Integer) codes.get(index++);
-				if (code != expectedCode.intValue())
-				{
-					Debug.debug("bad code: " + index + "/" + codes.size());
-					Debug.debug("code: " + code + " (0x"
-							+ Integer.toHexString(code) + ") "
-							+ Integer.toBinaryString(code));
-					Debug.debug("expected: " + expectedCode + " (0x"
-							+ Integer.toHexString(expectedCode.intValue())
-							+ ") "
-							+ Integer.toBinaryString(expectedCode.intValue()));
-					Debug.debug("clearCode: " + clearCode + " (0x"
-							+ Integer.toHexString(clearCode) + ") "
-							+ Integer.toBinaryString(clearCode));
-					Debug.debug("eoiCode: " + eoiCode + " (0x"
-							+ Integer.toHexString(eoiCode) + ") "
-							+ Integer.toBinaryString(eoiCode));
-					Debug.debug();
-				}
-			}
-
-			public void init(int clearCode, int eoiCode)
-			{
-				this.clearCode = clearCode;
-				this.eoiCode = eoiCode;
-			}
-
-		};
-		InputStream is = new ByteArrayInputStream(compressed);
-		MyLZWDecompressor decompressor = new MyLZWDecompressor(
-				LZW_MINIMUM_CODE_SIZE, BYTE_ORDER_NETWORK,
-				decompressionListener);
-		decompressor.setTiffLZWMode();
-		byte decompressed[] = decompressor.decompress(is, src.length);
-
-		assertEquals(src.length, decompressed.length);
-		for (int i = 0; i < src.length; i++)
-			assertEquals(src[i], decompressed[i]);
-	}
-
-	private void decompressRoundtripAndValidate(byte src[]) throws IOException
-	{
-		Debug.debug();
-		Debug.debug("roundtripAndValidate: " + src.length);
-		Debug.debug();
-
-		int LZW_MINIMUM_CODE_SIZE = 8;
-		final List codes = new ArrayList();
-
-		MyLZWDecompressor.Listener decompressionListener = new MyLZWDecompressor.Listener() {
-
-			public void code(int code)
-			{
-				Debug.debug("listener code: " + code + " (0x"
-						+ Integer.toHexString(code) + ") "
-						+ Integer.toBinaryString(code) + ", index: "
-						+ codes.size());
-				codes.add(new Integer(code));
-			}
-
-			public void init(int clearCode, int eoiCode)
-			{
-			}
-
-		};
-		InputStream is = new ByteArrayInputStream(src);
-		MyLZWDecompressor decompressor = new MyLZWDecompressor(
-				LZW_MINIMUM_CODE_SIZE, BYTE_ORDER_NETWORK,
-				decompressionListener);
-		decompressor.setTiffLZWMode();
-		byte decompressed[] = decompressor.decompress(is, src.length);
-
-		MyLZWCompressor.Listener compressionListener = new MyLZWCompressor.Listener() {
-
-			int clearCode, eoiCode;
-
-			public void init(int clearCode, int eoiCode)
-			{
-				this.clearCode = clearCode;
-				this.eoiCode = eoiCode;
-			}
-
-			int index = 0;
-
-			private void code(int code)
-			{
-
-				if (code == clearCode)
-				{
-					Debug.debug("clearCode: " + index + "/" + codes.size());
-					Debug.debug();
-				}
-				if (code == eoiCode)
-				{
-					Debug.debug("eoiCode: " + index + "/" + codes.size());
-					Debug.debug();
-				}
-				Integer expectedCode = (Integer) codes.get(index++);
-				if (code != expectedCode.intValue())
-				{
-					Debug.debug("bad code: " + index + "/" + codes.size());
-					Debug.debug("code: " + code + " (0x"
-							+ Integer.toHexString(code) + ") "
-							+ Integer.toBinaryString(code));
-					Debug.debug("expected: " + expectedCode + " (0x"
-							+ Integer.toHexString(expectedCode.intValue())
-							+ ") "
-							+ Integer.toBinaryString(expectedCode.intValue()));
-					Debug.debug("clearCode: " + clearCode + " (0x"
-							+ Integer.toHexString(clearCode) + ") "
-							+ Integer.toBinaryString(clearCode));
-					Debug.debug("eoiCode: " + eoiCode + " (0x"
-							+ Integer.toHexString(eoiCode) + ") "
-							+ Integer.toBinaryString(eoiCode));
-					Debug.debug();
-				}
-			}
-
-			public void dataCode(int code)
-			{
-				code(code);
-			}
-
-			public void eoiCode(int code)
-			{
-				code(code);
-			}
-
-			public void clearCode(int code)
-			{
-				code(code);
-			}
-
-		};
-
-		MyLZWCompressor compressor = new MyLZWCompressor(LZW_MINIMUM_CODE_SIZE,
-				BYTE_ORDER_MSB, true, compressionListener);
-		byte compressed[] = compressor.compress(decompressed);
-
-		assertEquals(src.length, compressed.length);
-		for (int i = 0; i < src.length; i++)
-			assertEquals(src[i], compressed[i]);
-	}
+//            for (int j = 0; j < data.size(); j++)
+//            {
+//                byte bytes[] = (byte[]) data.get(j);
+//                decompressRoundtripAndValidate(bytes);
+//            }
+//        }
+//    }
+
+    private void compressRoundtripAndValidate(byte src[]) throws IOException
+    {
+        final boolean DEBUG = false;
+
+        if (DEBUG)
+        {
+            Debug.debug();
+            Debug.debug("roundtripAndValidate: " + src.length);
+            Debug.debug();
+        }
+
+        int LZW_MINIMUM_CODE_SIZE = 8;
+        final List codes = new ArrayList();
+        MyLZWCompressor.Listener compressionListener = new MyLZWCompressor.Listener() {
+            public void dataCode(int code)
+            {
+                codes.add(new Integer(code));
+            }
+
+            public void eoiCode(int code)
+            {
+                codes.add(new Integer(code));
+            }
+
+            public void clearCode(int code)
+            {
+                codes.add(new Integer(code));
+            }
+
+            public void init(int clearCode, int eoiCode)
+            {
+            }
+        };
+
+        MyLZWCompressor compressor = new MyLZWCompressor(LZW_MINIMUM_CODE_SIZE,
+                BYTE_ORDER_MSB, true, compressionListener);
+        byte compressed[] = compressor.compress(src);
+
+        MyLZWDecompressor.Listener decompressionListener = new MyLZWDecompressor.Listener() {
+
+            int index = 0;
+            int clearCode, eoiCode;
+
+            public void code(int code)
+            {
+                if (DEBUG)
+                {
+                    if (code == clearCode)
+                    {
+                        Debug.debug("clearCode: " + index + "/" + codes.size());
+                        Debug.debug();
+                    }
+                    if (code == eoiCode)
+                    {
+                        Debug.debug("eoiCode: " + index + "/" + codes.size());
+                        Debug.debug();
+                    }
+                }
+                Integer expectedCode = (Integer) codes.get(index++);
+                if (code != expectedCode.intValue())
+                {
+                    Debug.debug("bad code: " + index + "/" + codes.size());
+                    Debug.debug("code: " + code + " (0x"
+                            + Integer.toHexString(code) + ") "
+                            + Integer.toBinaryString(code));
+                    Debug.debug("expected: " + expectedCode + " (0x"
+                            + Integer.toHexString(expectedCode.intValue())
+                            + ") "
+                            + Integer.toBinaryString(expectedCode.intValue()));
+                    Debug.debug("clearCode: " + clearCode + " (0x"
+                            + Integer.toHexString(clearCode) + ") "
+                            + Integer.toBinaryString(clearCode));
+                    Debug.debug("eoiCode: " + eoiCode + " (0x"
+                            + Integer.toHexString(eoiCode) + ") "
+                            + Integer.toBinaryString(eoiCode));
+                    Debug.debug();
+                }
+            }
+
+            public void init(int clearCode, int eoiCode)
+            {
+                this.clearCode = clearCode;
+                this.eoiCode = eoiCode;
+            }
+
+        };
+        InputStream is = new ByteArrayInputStream(compressed);
+        MyLZWDecompressor decompressor = new MyLZWDecompressor(
+                LZW_MINIMUM_CODE_SIZE, BYTE_ORDER_NETWORK,
+                decompressionListener);
+        decompressor.setTiffLZWMode();
+        byte decompressed[] = decompressor.decompress(is, src.length);
+
+        assertEquals(src.length, decompressed.length);
+        for (int i = 0; i < src.length; i++)
+            assertEquals(src[i], decompressed[i]);
+    }
+
+    private void decompressRoundtripAndValidate(byte src[]) throws IOException
+    {
+        Debug.debug();
+        Debug.debug("roundtripAndValidate: " + src.length);
+        Debug.debug();
+
+        int LZW_MINIMUM_CODE_SIZE = 8;
+        final List codes = new ArrayList();
+
+        MyLZWDecompressor.Listener decompressionListener = new MyLZWDecompressor.Listener() {
+
+            public void code(int code)
+            {
+                Debug.debug("listener code: " + code + " (0x"
+                        + Integer.toHexString(code) + ") "
+                        + Integer.toBinaryString(code) + ", index: "
+                        + codes.size());
+                codes.add(new Integer(code));
+            }
+
+            public void init(int clearCode, int eoiCode)
+            {
+            }
+
+        };
+        InputStream is = new ByteArrayInputStream(src);
+        MyLZWDecompressor decompressor = new MyLZWDecompressor(
+                LZW_MINIMUM_CODE_SIZE, BYTE_ORDER_NETWORK,
+                decompressionListener);
+        decompressor.setTiffLZWMode();
+        byte decompressed[] = decompressor.decompress(is, src.length);
+
+        MyLZWCompressor.Listener compressionListener = new MyLZWCompressor.Listener() {
+
+            int clearCode, eoiCode;
+
+            public void init(int clearCode, int eoiCode)
+            {
+                this.clearCode = clearCode;
+                this.eoiCode = eoiCode;
+            }
+
+            int index = 0;
+
+            private void code(int code)
+            {
+
+                if (code == clearCode)
+                {
+                    Debug.debug("clearCode: " + index + "/" + codes.size());
+                    Debug.debug();
+                }
+                if (code == eoiCode)
+                {
+                    Debug.debug("eoiCode: " + index + "/" + codes.size());
+                    Debug.debug();
+                }
+                Integer expectedCode = (Integer) codes.get(index++);
+                if (code != expectedCode.intValue())
+                {
+                    Debug.debug("bad code: " + index + "/" + codes.size());
+                    Debug.debug("code: " + code + " (0x"
+                            + Integer.toHexString(code) + ") "
+                            + Integer.toBinaryString(code));
+                    Debug.debug("expected: " + expectedCode + " (0x"
+                            + Integer.toHexString(expectedCode.intValue())
+                            + ") "
+                            + Integer.toBinaryString(expectedCode.intValue()));
+                    Debug.debug("clearCode: " + clearCode + " (0x"
+                            + Integer.toHexString(clearCode) + ") "
+                            + Integer.toBinaryString(clearCode));
+                    Debug.debug("eoiCode: " + eoiCode + " (0x"
+                            + Integer.toHexString(eoiCode) + ") "
+                            + Integer.toBinaryString(eoiCode));
+                    Debug.debug();
+                }
+            }
+
+            public void dataCode(int code)
+            {
+                code(code);
+            }
+
+            public void eoiCode(int code)
+            {
+                code(code);
+            }
+
+            public void clearCode(int code)
+            {
+                code(code);
+            }
+
+        };
+
+        MyLZWCompressor compressor = new MyLZWCompressor(LZW_MINIMUM_CODE_SIZE,
+                BYTE_ORDER_MSB, true, compressionListener);
+        byte compressed[] = compressor.compress(decompressed);
+
+        assertEquals(src.length, compressed.length);
+        for (int i = 0; i < src.length; i++)
+            assertEquals(src[i], compressed[i]);
+    }
 
 }

Modified: commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffReadTest.java?rev=995634&r1=995633&r2=995634&view=diff
==============================================================================
--- commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffReadTest.java (original)
+++ commons/proper/sanselan/trunk/src/test/java/org/apache/sanselan/formats/tiff/TiffReadTest.java Fri Sep 10 01:35:50 2010
@@ -31,26 +31,26 @@ import org.apache.sanselan.util.Debug;
 public class TiffReadTest extends TiffBaseTest
 {
 
-	public void test() throws IOException, ImageReadException
-	{
-		List images = getTiffImages();
-		for (int i = 0; i < images.size(); i++)
-		{
-			if (i % 10 == 0)
-				Debug.purgeMemory();
-
-			File imageFile = (File) images.get(i);
-			Debug.debug("imageFile", imageFile);
-
-			IImageMetadata metadata = Sanselan.getMetadata(imageFile);
-			assertNotNull(metadata);
-
-			ImageInfo imageInfo = Sanselan.getImageInfo(imageFile);
-			assertNotNull(imageInfo);
-
-			BufferedImage image = Sanselan.getBufferedImage(imageFile);
-			assertNotNull(image);
-		}
-	}
+    public void test() throws IOException, ImageReadException
+    {
+        List images = getTiffImages();
+        for (int i = 0; i < images.size(); i++)
+        {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
+
+            File imageFile = (File) images.get(i);
+            Debug.debug("imageFile", imageFile);
+
+            IImageMetadata metadata = Sanselan.getMetadata(imageFile);
+            assertNotNull(metadata);
+
+            ImageInfo imageInfo = Sanselan.getImageInfo(imageFile);
+            assertNotNull(imageInfo);
+
+            BufferedImage image = Sanselan.getBufferedImage(imageFile);
+            assertNotNull(image);
+        }
+    }
 
 }



Mime
View raw message