-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathTransformTest.java
More file actions
36 lines (29 loc) · 1.02 KB
/
TransformTest.java
File metadata and controls
36 lines (29 loc) · 1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package nodebox.graphics;
import junit.framework.TestCase;
import java.util.List;
public class TransformTest extends TestCase {
public void testTranslate() {
Transform t = new Transform();
t.translate(0, 0);
Point p = new Point(1, 2);
assertEquals(new Point(1, 2), t.map(p));
t.translate(0, 100);
assertEquals(new Point(1, 102), t.map(p));
t.translate(0, 100);
assertEquals(new Point(1, 202), t.map(p));
}
public void testMapPath() {
Path p = new Path();
p.addPoint(0, 0);
p.addPoint(10, 20);
Transform t = new Transform();
t.translate(10, 5);
Path newPath = t.map(p);
List<Point> oldPoints = p.getPoints();
assertEquals(new Point(0, 0), oldPoints.get(0));
assertEquals(new Point(10, 20), oldPoints.get(1));
List<Point> newPoints = newPath.getPoints();
assertEquals(new Point(10, 5), newPoints.get(0));
assertEquals(new Point(20, 25), newPoints.get(1));
}
}