harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From apetre...@apache.org
Subject svn commit: r563973 - in /harmony/enhanced/classlib/trunk/modules/awt/src: main/java/common/org/apache/harmony/awt/gl/Crossing.java test/api/java/common/java/awt/geom/AreaTest.java
Date Wed, 08 Aug 2007 18:39:28 GMT
Author: apetrenko
Date: Wed Aug  8 11:39:24 2007
New Revision: 563973

URL: http://svn.apache.org/viewvc?view=rev&rev=563973
Log:
Patch for HARMONY-4612 "[classlib][awt] The method java.awt.geom.Area.contains() returns no
correct result if the parameter is the vertex of rhomb"

Modified:
    harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java
    harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java?view=diff&rev=563973&r1=563972&r2=563973
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/main/java/common/org/apache/harmony/awt/gl/Crossing.java
Wed Aug  8 11:39:24 2007
@@ -382,14 +382,9 @@
             }
         }
 
-        // START
-        if (x == x1) {
-            return x1 < x2 ? 0 : -1;
-        }
-
-        // END
-        if (x == x2) {
-            return x1 < x2 ? 1 : 0;
+        // START or END
+        if (x == x1 || x == x2) {
+            return 0;
         }
 
         // INSIDE-DOWN

Modified: harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java?view=diff&rev=563973&r1=563972&r2=563973
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java
(original)
+++ harmony/enhanced/classlib/trunk/modules/awt/src/test/api/java/common/java/awt/geom/AreaTest.java
Wed Aug  8 11:39:24 2007
@@ -46,14 +46,6 @@
     
     public void testContainsPoint() {
         try {
-             Area area = new Area(new Ellipse2D.Double(200, 300, 400, 200));
-             assertTrue(area.contains(250, 350));
-             assertFalse(area.contains(200, 300));
-             assertFalse(area.contains(50, 50));
-             
-             assertTrue(area.contains(new Point2D.Double(500, 400)));
-             assertFalse(area.contains(new Point2D.Double(700, 400)));
-             
              // Regression test HARMONY-1404
              Area emptyArea = new Area();
              emptyArea.contains((Point2D)null);
@@ -61,6 +53,25 @@
          } catch (NullPointerException e) {
              // expected
          }
+         
+         Area area = new Area(new Ellipse2D.Double(200, 300, 400, 200));
+         assertTrue(area.contains(250, 350));
+         assertFalse(area.contains(200, 300));
+         assertFalse(area.contains(50, 50));
+         
+         assertTrue(area.contains(new Point2D.Double(500, 400)));
+         assertFalse(area.contains(new Point2D.Double(700, 400)));
+         
+         // Regression test HARMONY-4612
+         GeneralPath path = new GeneralPath();
+         path.moveTo(50, 100);
+         path.lineTo(100, 50);
+         path.lineTo(150, 100);
+         path.lineTo(100, 150);
+         path.closePath();
+         
+         Area areaPath = new Area(path);
+         assertFalse(areaPath.contains(100, 50));
      }
 
      public void testContainsRect() {



Mime
View raw message