Revision: 1010
Author: allain.lalonde
Date: Sat Apr 17 06:52:49 2010
Log: Adding Deep Copy Test to PNode.clone()
http://code.google.com/p/piccolo2d/source/detail?r=1010

Modified:
 /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java

=======================================
--- /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java Thu Apr 15 19:27:24 2010 +++ /piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java Sat Apr 17 06:52:49 2010
@@ -239,7 +239,7 @@

         final PNode clonedNode = (PNode) node.clone();

-        assertNull(clonedNode.getListenerList());
+        assertNull(clonedNode.getListenerList());
     }

     public void testCloneClonesChildrenAswell() {
@@ -251,6 +251,18 @@
         assertEquals(clonedNode.getChildrenCount(), 1);
         assertNotSame(child, clonedNode.getChild(0));
     }
+
+    public void testCloneDoesADeepCopy() {
+        final PNode child = new PNode();
+        node.addChild(child);
+
+        final PNode clonedNode = (PNode) node.clone();
+
+ assertNotSame(node.getChildrenReference(), clonedNode.getChildrenReference());
+        assertNotSame(node.getChild(0), clonedNode.getChild(0));
+
+ assertNotSame(node.getBoundsReference(), clonedNode.getBoundsReference());
+    }

     public void testCloneDoesNotCopyParent() {
         final PNode child = new PNode();

--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en

Reply via email to