commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dam...@apache.org
Subject svn commit: r1394259 - in /commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd: ./ PsdBaseTest.java PsdReadTest.java
Date Thu, 04 Oct 2012 20:50:54 GMT
Author: damjan
Date: Thu Oct  4 20:50:53 2012
New Revision: 1394259

URL: http://svn.apache.org/viewvc?rev=1394259&view=rev
Log:
Add PSD tests.


Added:
    commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/
    commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java
  (with props)
    commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
  (with props)

Added: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java?rev=1394259&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java
(added)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java
Thu Oct  4 20:50:53 2012
@@ -0,0 +1,29 @@
+package org.apache.commons.imaging.formats.psd;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.List;
+
+import org.apache.commons.imaging.ImageFormat;
+import org.apache.commons.imaging.ImageReadException;
+import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.ImagingTest;
+
+public abstract class PsdBaseTest extends ImagingTest {
+    private static boolean isPsd(File file) throws IOException,
+            ImageReadException {
+        ImageFormat format = Imaging.guessFormat(file);
+        return format == ImageFormat.IMAGE_FORMAT_PSD;
+    }
+
+    private static final ImageFilter IMAGE_FILTER = new ImageFilter() {
+        public boolean accept(File file) throws IOException, ImageReadException {
+            return isPsd(file);
+        }
+    };
+
+    protected List<File> getPsdImages() throws IOException, ImageReadException {
+        return getTestImages(IMAGE_FILTER);
+    }
+
+}

Propchange: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdBaseTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
URL: http://svn.apache.org/viewvc/commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java?rev=1394259&view=auto
==============================================================================
--- commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
(added)
+++ commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
Thu Oct  4 20:50:53 2012
@@ -0,0 +1,40 @@
+package org.apache.commons.imaging.formats.psd;
+
+import java.awt.image.BufferedImage;
+import java.io.File;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.imaging.ImageInfo;
+import org.apache.commons.imaging.Imaging;
+import org.apache.commons.imaging.common.IImageMetadata;
+import org.apache.commons.imaging.util.Debug;
+
+public class PsdReadTest extends PsdBaseTest {
+    public void test() throws Exception {
+        Debug.debug("start");
+
+        List<File> images = getPsdImages();
+        for (int i = 0; i < images.size(); i++) {
+            if (i % 10 == 0)
+                Debug.purgeMemory();
+
+            File imageFile = images.get(i);
+            Debug.debug("imageFile", imageFile);
+
+            IImageMetadata metadata = Imaging.getMetadata(imageFile);
+            // assertNotNull(metadata);
+
+            Map<String,Object> params = new HashMap<String,Object>();
+            ImageInfo imageInfo = Imaging.getImageInfo(imageFile, params);
+            assertNotNull(imageInfo);
+            
+            Imaging.getICCProfile(imageFile, params);
+
+            BufferedImage image = Imaging.getBufferedImage(imageFile);
+            assertNotNull(image);
+        }
+    }
+
+}

Propchange: commons/proper/imaging/trunk/src/test/java/org/apache/commons/imaging/formats/psd/PsdReadTest.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message