-
Notifications
You must be signed in to change notification settings - Fork 89
Expand file tree
/
Copy pathGrobTest.java
More file actions
43 lines (31 loc) · 1000 Bytes
/
GrobTest.java
File metadata and controls
43 lines (31 loc) · 1000 Bytes
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
37
38
39
40
41
42
43
package nodebox.graphics;
import junit.framework.TestCase;
import java.awt.*;
public class GrobTest extends TestCase {
public class TestGrob extends AbstractGrob {
private float x, y, width, height;
public TestGrob(float x, float y, float width, float height) {
this.x = x;
this.y = y;
this.width = width;
this.height = height;
}
public void draw(Graphics2D g) {
}
public boolean isEmpty() {
return false;
}
public Rect getBounds() {
return getTransform().map(new Rect(x, y, width, height));
}
public Grob clone() {
return new TestGrob(x, y, width, height);
}
}
public void testTransform() {
TestGrob tg = new TestGrob(1, 2, 3, 4);
assertEquals(new Rect(1, 2, 3, 4), tg.getBounds());
tg.translate(200, 300);
assertEquals(new Rect(201, 302, 3, 4), tg.getBounds());
}
}