File: SerializationTest.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 (35 lines) | stat: -rw-r--r-- 802 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
import java.util.Iterator;

import junit.framework.TestCase;

import edu.umd.cs.piccolo.PLayer;
import edu.umd.cs.piccolo.PNode;
import edu.umd.cs.piccolo.nodes.PPath;
import edu.umd.cs.piccolo.nodes.PText;

public class SerializationTest extends TestCase {

	public SerializationTest(String name) {
		super(name);
	}
	
	public void test() {
		PNode l = new PLayer();
		
		
		for (int i = 0; i < 100; i++) {
			l.addChild(new PNode());
			l.addChild(new PText("Hello World"));
			l.addChild(new PPath());
		}
		
		l = (PNode) l.clone(); // copy uses serialization internally
		assertTrue(l.getChildrenCount() == 300);
		
		Iterator i = l.getChildrenIterator();
		while (i.hasNext()) {
			PNode each = (PNode) i.next();
			assertEquals(l, each.getParent());
		}
	}	
}