Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 41136 Details for
Bug 140056
org.eclipse.draw2d.geometry.Rectangle.Rectangle(Point,Point)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
new proposed patch
rectangle patch.txt (text/plain), 3.91 KB, created by
Steven R. Shaw
on 2006-05-11 11:36:18 EDT
(
hide
)
Description:
new proposed patch
Filename:
MIME Type:
Creator:
Steven R. Shaw
Created:
2006-05-11 11:36:18 EDT
Size:
3.91 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.draw2d >Index: src/org/eclipse/draw2d/geometry/Rectangle.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.draw2d/src/org/eclipse/draw2d/geometry/Rectangle.java,v >retrieving revision 1.17 >diff -u -r1.17 Rectangle.java >--- src/org/eclipse/draw2d/geometry/Rectangle.java 30 Mar 2005 21:27:45 -0000 1.17 >+++ src/org/eclipse/draw2d/geometry/Rectangle.java 11 May 2006 15:37:17 -0000 >@@ -95,8 +95,10 @@ > * @since 2.0 > */ > public Rectangle(Point p1, Point p2) { >- setLocation(p1); >- union(p2); >+ this.x = Math.min(p1.x, p2.x); >+ this.y = Math.min(p1.y, p2.y); >+ this.width = Math.abs(p2.x - p1.x) + 1; >+ this.height = Math.abs(p2.y - p1.y) + 1; > } > > /** >#P org.eclipse.draw2d.test >Index: src/org/eclipse/draw2d/test/Draw2dTestSuite.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.draw2d.test/src/org/eclipse/draw2d/test/Draw2dTestSuite.java,v >retrieving revision 1.17 >diff -u -r1.17 Draw2dTestSuite.java >--- src/org/eclipse/draw2d/test/Draw2dTestSuite.java 24 Apr 2006 18:15:13 -0000 1.17 >+++ src/org/eclipse/draw2d/test/Draw2dTestSuite.java 11 May 2006 15:37:18 -0000 >@@ -45,6 +45,7 @@ > addTest(new TestSuite(PrecisionRectangleTest.class)); > addTest(new TestSuite(ThumbnailTest.class)); > addTest(new TestSuite(FigureUtilitiesTest.class)); >+ addTest(new TestSuite(RectangleTest.class)); > // addTest(new TestSuite(ColorConstantTest.class)); > } > >Index: src/org/eclipse/draw2d/test/RectangleTest.java >=================================================================== >RCS file: src/org/eclipse/draw2d/test/RectangleTest.java >diff -N src/org/eclipse/draw2d/test/RectangleTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/draw2d/test/RectangleTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,73 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Eclipse Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.draw2d.test; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.draw2d.geometry.Point; >+import org.eclipse.draw2d.geometry.Rectangle; >+ >+public class RectangleTest extends TestCase { >+ /** >+ * @see TestCase#setUp() >+ */ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ } >+ >+ /** >+ * @see TestCase#tearDown() >+ */ >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ } >+ >+ public void test_creationSymmetry() { >+ Point topLeft = new Point(0, 0); >+ Point topRight = new Point(10, 0); >+ Point bottomLeft = new Point(0, 10); >+ Point bottomRight = new Point(10, 10); >+ Rectangle rect1 = new Rectangle(topLeft, bottomRight); >+ Rectangle rect2 = new Rectangle(topRight, bottomLeft); >+ >+ assertTrue(rect1.equals(rect2)); >+ } >+ >+ public void test_creationValues() { >+ >+ final Rectangle testRect = new Rectangle(10, 10, 10, 10); >+ >+ Point topLeft = new Point(10, 10); >+ Point topRight = new Point(19, 10); >+ Point bottomLeft = new Point(10, 19); >+ Point bottomRight = new Point(19, 19); >+ Rectangle rect1 = new Rectangle(topLeft, bottomRight); >+ Rectangle rect2 = new Rectangle(topRight, bottomLeft); >+ >+ assertTrue(rect1.equals(testRect)); >+ assertTrue(rect2.equals(testRect)); >+ } >+ >+ public void test_sameBehavior() { >+ >+ Point p1 = new Point(0,0); >+ Point p2 = new Point(10, 10); >+ Rectangle origRect = new Rectangle(); >+ origRect.setLocation(p1); >+ origRect.union(p2); >+ >+ Rectangle newRect = new Rectangle(p1, p2); >+ >+ assertTrue(origRect.equals(newRect)); >+ } >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 140056
:
40283
|
40982
| 41136