Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 140056 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/draw2d/test/Draw2dTestSuite.java (+1 lines)
Lines 45-50 Link Here
45
    addTest(new TestSuite(PrecisionRectangleTest.class));
45
    addTest(new TestSuite(PrecisionRectangleTest.class));
46
    addTest(new TestSuite(ThumbnailTest.class));
46
    addTest(new TestSuite(ThumbnailTest.class));
47
    addTest(new TestSuite(FigureUtilitiesTest.class));
47
    addTest(new TestSuite(FigureUtilitiesTest.class));
48
    addTest(new TestSuite(RectangleTest.class));
48
//    addTest(new TestSuite(ColorConstantTest.class));
49
//    addTest(new TestSuite(ColorConstantTest.class));
49
}
50
}
50
51
(-)src/org/eclipse/draw2d/test/RectangleTest.java (+46 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
12
package org.eclipse.draw2d.test;
13
14
import junit.framework.TestCase;
15
16
import org.eclipse.draw2d.geometry.Point;
17
import org.eclipse.draw2d.geometry.Rectangle;
18
19
20
public class RectangleTest  extends TestCase {
21
    /**
22
     * @see TestCase#setUp()
23
     */
24
    protected void setUp() throws Exception {
25
        super.setUp();
26
    }
27
28
    /**
29
     * @see TestCase#tearDown()
30
     */
31
    protected void tearDown() throws Exception {
32
        super.tearDown();
33
    }
34
    
35
    public void test_creationSymmetry() {
36
    		Point topLeft = new Point(0, 0);
37
        Point topRight = new Point(10, 0);
38
        Point bottomLeft = new Point(0, 10);
39
        Point bottomRight = new Point(10, 10);
40
        Rectangle rect1 = new Rectangle(topLeft, bottomRight);
41
        Rectangle rect2 = new Rectangle(topRight, bottomLeft);
42
        
43
        assertTrue(rect1.equals(rect2));
44
    }
45
46
}
(-)src/org/eclipse/draw2d/geometry/Rectangle.java (-2 / +4 lines)
Lines 95-102 Link Here
95
 * @since 2.0
95
 * @since 2.0
96
 */
96
 */
97
public Rectangle(Point p1, Point p2) {
97
public Rectangle(Point p1, Point p2) {
98
	setLocation(p1);
98
	this.x = Math.min(p1.x, p2.x);
99
	union(p2);
99
	this.y = Math.min(p1.y, p2.y);
100
	this.width = Math.abs(p2.x - p1.x);
101
	this.height = Math.abs(p2.y - p1.y);
100
}
102
}
101
103
102
/**
104
/**

Return to bug 140056