Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 21408 invoked from network); 29 Feb 2008 12:01:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Feb 2008 12:01:58 -0000 Received: (qmail 79573 invoked by uid 500); 29 Feb 2008 12:01:54 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 79555 invoked by uid 500); 29 Feb 2008 12:01:53 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 79546 invoked by uid 99); 29 Feb 2008 12:01:53 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Feb 2008 04:01:53 -0800 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 29 Feb 2008 12:01:15 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 53EE41A9832; Fri, 29 Feb 2008 04:01:32 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r632300 - /harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/org/apache/harmony/awt/tests/image/GifDecoderTest.java Date: Fri, 29 Feb 2008 12:01:26 -0000 To: commits@harmony.apache.org From: tellison@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20080229120133.53EE41A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: tellison Date: Fri Feb 29 04:01:08 2008 New Revision: 632300 URL: http://svn.apache.org/viewvc?rev=632300&view=rev Log: Apply regression test for HARMONY-5491 ([classlib][awt] GifDecoder not always passes ColorModel through setPixels method) Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/org/apache/harmony/awt/tests/image/GifDecoderTest.java (with props) Added: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/org/apache/harmony/awt/tests/image/GifDecoderTest.java URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/org/apache/harmony/awt/tests/image/GifDecoderTest.java?rev=632300&view=auto ============================================================================== --- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/org/apache/harmony/awt/tests/image/GifDecoderTest.java (added) +++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/org/apache/harmony/awt/tests/image/GifDecoderTest.java Fri Feb 29 04:01:08 2008 @@ -0,0 +1,109 @@ +/* + * 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.tests.image; + +import java.awt.Image; +import java.awt.Toolkit; +import java.awt.image.ColorModel; +import java.awt.image.ImageConsumer; +import java.awt.image.ImageProducer; +import java.net.URL; +import java.util.Hashtable; + +import junit.framework.TestCase; + +public class GifDecoderTest extends TestCase implements ImageConsumer{ + + ImageProducer ip; + Object lock = new Object(); + ColorModel cm = ColorModel.getRGBdefault(); + int state = 0; + boolean started = false; + + private final ClassLoader c = ClassLoader.getSystemClassLoader(); + + private Image createImage(String name) { + final URL path = c.getResource("../resources/images/" + name); + assertNotNull("Resource not found: " + name, path); //$NON-NLS-1$ + return Toolkit.getDefaultToolkit().createImage(path); + } + + public void setColorModel(ColorModel model){} + public void setHints(int hintflags){} + public void setDimensions(int width, int height){} + public void setProperties(Hashtable props){} + + public void imageComplete(int status){ + + state = status; + if(state == STATICIMAGEDONE) stopProduction(); + synchronized(lock){ + lock.notify(); + } + + } + + public void setPixels(int x, int y, int w, int h, ColorModel model, + byte[] pixels, int off, int scansize) { + + cm = model; + synchronized(lock){ + lock.notify(); + } + + } + + public void setPixels(int x, int y, int w, int h, ColorModel model, + int[] pixels, int off, int scansize) { + + cm = model; + synchronized(lock){ + lock.notify(); + } + + } + + private void startProduction(ImageProducer ip){ + if(!started){ + this.ip = ip; + started = true; + ip.startProduction(this); + } + + } + + private synchronized void stopProduction(){ + ip.removeConsumer(this); + } + + public void test_H5491() throws Exception{ + + Image img = createImage("test.gif"); + while(state != STATICIMAGEDONE){ + startProduction(img.getSource()); + synchronized(lock){ + try{ + lock.wait(2000); + } catch(InterruptedException e){} + } + + if(cm == null) fail("ColorModel in setPixels is null!"); + } + + } +} Propchange: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/org/apache/harmony/awt/tests/image/GifDecoderTest.java ------------------------------------------------------------------------------ svn:eol-style = native