incubator-sanselan-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmc...@apache.org
Subject svn commit: r682233 - in /incubator/sanselan/trunk/src/test: data/images/png/3/ data/images/png/3/info.txt data/images/png/3/testImage.png data/images/png/3/testImageNoAlpha.png java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java
Date Sun, 03 Aug 2008 23:53:29 GMT
Author: cmchen
Date: Sun Aug  3 16:53:28 2008
New Revision: 682233

URL: http://svn.apache.org/viewvc?rev=682233&view=rev
Log:
trying to recreate SANSELAN-9.

Added:
    incubator/sanselan/trunk/src/test/data/images/png/3/
    incubator/sanselan/trunk/src/test/data/images/png/3/info.txt   (with props)
    incubator/sanselan/trunk/src/test/data/images/png/3/testImage.png   (with props)
    incubator/sanselan/trunk/src/test/data/images/png/3/testImageNoAlpha.png   (with props)
    incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java
  (with props)

Added: incubator/sanselan/trunk/src/test/data/images/png/3/info.txt
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/test/data/images/png/3/info.txt?rev=682233&view=auto
==============================================================================
--- incubator/sanselan/trunk/src/test/data/images/png/3/info.txt (added)
+++ incubator/sanselan/trunk/src/test/data/images/png/3/info.txt Sun Aug  3 16:53:28 2008
@@ -0,0 +1,2 @@
+These files contributed by Kevin Theisen.
+

Propchange: incubator/sanselan/trunk/src/test/data/images/png/3/info.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/sanselan/trunk/src/test/data/images/png/3/testImage.png
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/test/data/images/png/3/testImage.png?rev=682233&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/sanselan/trunk/src/test/data/images/png/3/testImage.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/sanselan/trunk/src/test/data/images/png/3/testImageNoAlpha.png
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/test/data/images/png/3/testImageNoAlpha.png?rev=682233&view=auto
==============================================================================
Binary file - no diff available.

Propchange: incubator/sanselan/trunk/src/test/data/images/png/3/testImageNoAlpha.png
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java
URL: http://svn.apache.org/viewvc/incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java?rev=682233&view=auto
==============================================================================
--- incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java
(added)
+++ incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java
Sun Aug  3 16:53:28 2008
@@ -0,0 +1,78 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.sanselan.formats.png;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.sanselan.ImageFormat;
+import org.apache.sanselan.ImageReadException;
+import org.apache.sanselan.ImageWriteException;
+import org.apache.sanselan.Sanselan;
+import org.apache.sanselan.util.Debug;
+
+public class PngMultipleRoundtripTest extends PngBaseTest
+{
+
+	public void test() throws IOException, ImageReadException,
+			ImageWriteException
+	{
+		File imagesFolder = new File("src\\test\\data\\images\\png\\3");
+		assert(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;
+			}
+		}
+	}
+
+}

Propchange: incubator/sanselan/trunk/src/test/java/org/apache/sanselan/formats/png/PngMultipleRoundtripTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message