harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r470907 - in /incubator/harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/org/apache/harmony/awt/gl/ main/java/common/org/apache/harmony/awt/gl/opengl/ main/java/linux/org/apache/harmony/awt/gl/linux/ main/java/windows/org/a...
Date Fri, 03 Nov 2006 17:08:56 GMT
Author: apetrenko
Date: Fri Nov  3 09:08:55 2006
New Revision: 470907

URL: http://svn.apache.org/viewvc?view=rev&rev=470907
Log:
Patch for HARMONY-1448 "[classlib][awt] Paint can be set to null by Graphics2D.setPaint()"

Added:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java
Modified:
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLGraphics2D.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/linux/org/apache/harmony/awt/gl/linux/XGraphics2D.java
    incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java?view=diff&rev=470907&r1=470906&r2=470907
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/CommonGraphics2D.java
Fri Nov  3 09:08:55 2006
@@ -975,6 +975,9 @@
 
     @Override
     public void setPaint(Paint paint) {
+        if (paint == null)
+            return;
+            
         this.paint = paint;
         if (paint instanceof Color) {
             fgColor = (Color)paint;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLGraphics2D.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLGraphics2D.java?view=diff&rev=470907&r1=470906&r2=470907
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLGraphics2D.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/opengl/OGLGraphics2D.java
Fri Nov  3 09:08:55 2006
@@ -267,6 +267,9 @@
 
     @Override
     public void setPaint(Paint paint) {
+        if (paint == null)
+            return;
+                
         super.setPaint(paint);
 
         makeCurrent();

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/linux/org/apache/harmony/awt/gl/linux/XGraphics2D.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/linux/org/apache/harmony/awt/gl/linux/XGraphics2D.java?view=diff&rev=470907&r1=470906&r2=470907
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/linux/org/apache/harmony/awt/gl/linux/XGraphics2D.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/linux/org/apache/harmony/awt/gl/linux/XGraphics2D.java
Fri Nov  3 09:08:55 2006
@@ -167,6 +167,9 @@
     }
 
     public void setPaint(Paint paint) {
+        if (paint == null)
+            return;
+            
         if (paint instanceof Color) {
             setColor((Color)paint);
             nativePaint = true;

Modified: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java?view=diff&rev=470907&r1=470906&r2=470907
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
(original)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/windows/org/apache/harmony/awt/gl/windows/WinGDIPGraphics2D.java
Fri Nov  3 09:08:55 2006
@@ -217,6 +217,9 @@
     //REMARK: Think how to implement this
     @Override
     public void setPaint(Paint paint) {
+        if (paint == null)
+            return;
+            
         if (paint instanceof Color) {
             setColor((Color)paint);
         } else {

Added: incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java
URL: http://svn.apache.org/viewvc/incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java?view=auto&rev=470907
==============================================================================
--- incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java
(added)
+++ incubator/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/Graphics2DTest.java
Fri Nov  3 09:08:55 2006
@@ -0,0 +1,60 @@
+/*
+ *  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 java.awt;
+
+import java.awt.image.BufferedImage;
+
+import junit.framework.TestCase;
+
+public class Graphics2DTest extends TestCase {
+    private Frame frame;
+    
+    protected void setUp() throws Exception {
+        super.setUp();
+        frame = new Frame();
+        frame.addNotify();
+    }
+
+    protected void tearDown() throws Exception {
+        if (frame != null) {
+            frame.dispose();
+        }        
+        super.tearDown();
+    }
+    
+    public void testSetPaintScreen() {
+        // regression test for HARMONY-1448        
+        Graphics2D g2d = (Graphics2D) frame.getGraphics();
+        Paint paint = g2d.getPaint();
+        assertNotNull(paint);
+        g2d.setPaint(null);
+        assertNotNull(g2d.getPaint());        
+    }
+    
+    public void testSetPaintImage() {
+        // regression test for HARMONY-1448
+        int imgType = BufferedImage.TYPE_INT_ARGB;
+        BufferedImage img = new BufferedImage(100, 100, imgType);
+        Graphics2D g2d = (Graphics2D) img.getGraphics();
+        Paint paint = g2d.getPaint();
+        assertNotNull(paint);
+        g2d.setPaint(null);
+        assertNotNull(g2d.getPaint());        
+    }
+
+}



Mime
View raw message