Revision: 961
Author: allain.lalonde
Date: Wed Jan 27 13:34:51 2010
Log: Unit Test demonstrating Issue 158
http://code.google.com/p/piccolo2d/source/detail?r=961
Modified:
/piccolo2d.java/trunk/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java
=======================================
---
/piccolo2d.java/trunk/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java
Mon Jan 18 16:07:38 2010
+++
/piccolo2d.java/trunk/extras/src/test/java/edu/umd/cs/piccolox/pswing/PSwingTest.java
Wed Jan 27 13:34:51 2010
@@ -275,6 +275,20 @@
assertEquals(0, canvas1.getSwingWrapper().getComponentCount());
assertEquals(1, canvas2.getSwingWrapper().getComponentCount());
}
+
+ public void testPSwingRegistersWithCanvasThroughoutItsLifeCycle() {
+ PSwingCanvas canvas = new PSwingCanvas();
+ PSwing label = new PSwing(new JLabel("Hello"));
+
+ canvas.getLayer().addChild(label);
+ assertEquals(1, canvas.getSwingWrapper().getComponentCount());
+
+ label.removeFromParent();
+ assertEquals(0, canvas.getSwingWrapper().getComponentCount());
+
+ canvas.getLayer().addChild(label);
+ assertEquals(1, canvas.getSwingWrapper().getComponentCount());
+ }
public class MockPaintingPSwing extends PSwing {
private boolean paintedGreek;
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en