File: TextNodeTest.java

package info (click to toggle)
piccolo 1.2-1.1
  • links: PTS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 1,668 kB
  • sloc: java: 16,496; xml: 259; sh: 18; makefile: 13
file content (40 lines) | stat: -rw-r--r-- 929 bytes parent folder | download | duplicates (2)
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
import junit.framework.TestCase;

import edu.umd.cs.piccolo.nodes.PText;

public class TextNodeTest extends TestCase {

	public TextNodeTest(String name) {
		super(name);
	}
	
	public void testCopy() {
		PText aNode = new PText("Boo");
		aNode = (PText) aNode.clone();
		assertNotNull(aNode.getText());
		assertNotNull(aNode.getFont());
	}	
	
	public void testEmptyString() {
		PText t = new PText();
		t.setText("hello world");
		t.setText("");
		t.setText(null);
	}

	public void testBoundsOfEmptyString() {
		PText t = new PText();
		t.setText("hello world");
		assertTrue(t.getBoundsReference().getWidth() > 0);
		t.setText("");
		assertTrue(t.getBoundsReference().getWidth() == 0);
		t.setText(null);
		assertTrue(t.getBoundsReference().getWidth() == 0);
	}
	
	public void testToString() {
		PText t = new PText();
		t.setText("hello world");
		System.out.println(t.toString());
	}
}