You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by hi...@apache.org on 2007/10/17 10:37:12 UTC
svn commit: r585412 - in
/harmony/enhanced/classlib/trunk/modules/awt/src/test/api:
java/common/org/apache/harmony/awt/gl/image/ resources/images/
Author: hindessm
Date: Wed Oct 17 01:37:11 2007
New Revision: 585412
URL: http://svn.apache.org/viewvc?rev=585412&view=rev
Log:
Applying patches from "[#HARMONY-1954] [classlib][awt] Unit tests for image
decoders.".
Added:
harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/gl/image/
harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/gl/image/ImageDecoderTest.java (with props)
harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.gif (with props)
harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.jpg (with props)
harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.png (with props)
Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/gl/image/ImageDecoderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/gl/image/ImageDecoderTest.java?rev=585412&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/gl/image/ImageDecoderTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/gl/image/ImageDecoderTest.java Wed Oct 17 01:37:11 2007
@@ -0,0 +1,65 @@
+/*
+ * 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.harmony.awt.gl.image;
+
+import java.awt.Frame;
+import java.awt.Image;
+import java.awt.MediaTracker;
+import java.awt.Toolkit;
+import java.awt.image.BufferedImage;
+import java.net.URL;
+
+import junit.framework.TestCase;
+
+public class ImageDecoderTest extends TestCase {
+
+ private final int EXP_WIDTH = 320;
+ private final int EXP_HEIGHT = 182;
+
+ private final String[] IMG_TYPES = { "jpg", "gif", "png" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+
+ public void testDecodeImage() throws InterruptedException {
+ final Class<? extends ImageDecoderTest> c = getClass();
+
+ for (String type : IMG_TYPES) {
+ final String res = "/images/utest." + type; //$NON-NLS-1$
+ final URL path = c.getResource(res);
+
+ assertNotNull("Resource not found: " + res, path); //$NON-NLS-1$
+ setName(type);
+ decodeImage(path);
+ }
+ }
+
+ private void decodeImage(final URL path) throws InterruptedException {
+ final Image im = Toolkit.getDefaultToolkit().createImage(path);
+ final BufferedImage bim = new BufferedImage(EXP_WIDTH, EXP_HEIGHT,
+ BufferedImage.TYPE_INT_RGB);
+ final Frame f = new Frame();
+ final MediaTracker t = new MediaTracker(f);
+
+ t.addImage(im, 0);
+ t.waitForAll();
+
+ assertEquals(EXP_WIDTH, im.getWidth(null));
+ assertEquals(EXP_HEIGHT, im.getHeight(null));
+
+ bim.getGraphics().drawImage(im, 0, 0, null);
+ int rgbVal = bim.getRGB(0, 0);
+ assertEquals(0xFFFFFFFF, rgbVal);
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/org/apache/harmony/awt/gl/image/ImageDecoderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.gif
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.gif?rev=585412&view=auto
==============================================================================
Binary file - no diff available.
Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.jpg
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.jpg?rev=585412&view=auto
==============================================================================
Binary file - no diff available.
Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.jpg
------------------------------------------------------------------------------
svn:mime-type = image/jpeg
Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.png
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.png?rev=585412&view=auto
==============================================================================
Binary file - no diff available.
Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/resources/images/utest.png
------------------------------------------------------------------------------
svn:mime-type = image/png