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 491402 | Differences between
and this patch

Collapse All | Expand All

(-)a/org.eclipse.gef4.geometry.tests/src/org/eclipse/gef4/geometry/tests/AngleTests.java (-3 / +33 lines)
Lines 1-14 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2011, 2014 itemis AG and others.
2
 * Copyright (c) 2011, 2014 itemis AG and others.
3
 * 
3
 *
4
 * All rights reserved. This program and the accompanying materials
4
 * All rights reserved. This program and the accompanying materials
5
 * are made available under the terms of the Eclipse Public License v1.0
5
 * are made available under the terms of the Eclipse Public License v1.0
6
 * which accompanies this distribution, and is available at
6
 * which accompanies this distribution, and is available at
7
 * http://www.eclipse.org/legal/epl-v10.html
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 * 
8
 *
9
 * Contributors:
9
 * Contributors:
10
 *     Matthias Wienand (itemis AG) - initial API and implementation
10
 *     Matthias Wienand (itemis AG) - initial API and implementation
11
 *     
11
 *
12
 *******************************************************************************/
12
 *******************************************************************************/
13
package org.eclipse.gef4.geometry.tests;
13
package org.eclipse.gef4.geometry.tests;
14
14
Lines 92-97 Link Here
92
	}
92
	}
93
93
94
	@Test
94
	@Test
95
	public void test_getDeltaCCW() throws Exception {
96
		Angle alpha = Angle.fromDeg(270);
97
		assertEquals(Angle.fromDeg(60), alpha.getDeltaCCW(Angle.fromDeg(210)));
98
		assertEquals(Angle.fromDeg(210), alpha.getDeltaCCW(Angle.fromDeg(60)));
99
		alpha = Angle.fromDeg(90);
100
		assertEquals(Angle.fromDeg(120), alpha.getDeltaCCW(Angle.fromDeg(330)));
101
	}
102
103
	@Test
104
	public void test_getDeltaCW() throws Exception {
105
		Angle alpha = Angle.fromDeg(90);
106
		assertEquals(Angle.fromDeg(60), alpha.getDeltaCW(Angle.fromDeg(150)));
107
		assertEquals(Angle.fromDeg(210), alpha.getDeltaCW(Angle.fromDeg(300)));
108
		alpha = Angle.fromDeg(270);
109
		assertEquals(Angle.fromDeg(120), alpha.getDeltaCW(Angle.fromDeg(30)));
110
	}
111
112
	@Test
95
	public void test_getMultiplied() {
113
	public void test_getMultiplied() {
96
		Angle alpha = Angle.fromDeg(180);
114
		Angle alpha = Angle.fromDeg(180);
97
115
Lines 99-104 Link Here
99
	}
117
	}
100
118
101
	@Test
119
	@Test
120
	public void test_isClockwise() throws Exception {
121
		Angle alpha = Angle.fromDeg(90);
122
		assertTrue(alpha.isClockwise(Angle.fromDeg(180)));
123
		assertFalse(alpha.isClockwise(Angle.fromDeg(0)));
124
		alpha = Angle.fromDeg(300);
125
		assertTrue(alpha.isClockwise(Angle.fromDeg(60)));
126
		assertFalse(alpha.isClockwise(Angle.fromDeg(140)));
127
		// edge case - exactly 180 degrees is true
128
		assertTrue(alpha.isClockwise(Angle.fromDeg(120)));
129
	}
130
131
	@Test
102
	public void test_norm() {
132
	public void test_norm() {
103
		Angle alpha = Angle.fromDeg(361);
133
		Angle alpha = Angle.fromDeg(361);
104
		Angle beta = Angle.fromDeg(1);
134
		Angle beta = Angle.fromDeg(1);

Return to bug 491402