Newer
Older
piccolo2d.java / core / src / test / java / TextNodeTest.java
@Marcus Rohrmoser Marcus Rohrmoser on 27 Jul 2008 889 bytes issue#44 subdirectory and artifact rename
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());
	}
}