diff --git a/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java b/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java index d7894af..5784634 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java +++ b/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java @@ -657,4 +657,16 @@ public Timer createTimer(int delay, ActionListener listener) { return new Timer(delay, listener); } + + public int getDefaultRenderQuality() { + return defaultRenderQuality; + } + + public int getAnimatingRenderQuality() { + return animatingRenderQuality; + } + + public int getInteractingRenderQuality() { + return interactingRenderQuality; + } } \ No newline at end of file diff --git a/core/src/test/java/edu/umd/cs/piccolo/MockPropertyChangeListener.java b/core/src/test/java/edu/umd/cs/piccolo/MockPropertyChangeListener.java index ccefc19..a218df6 100644 --- a/core/src/test/java/edu/umd/cs/piccolo/MockPropertyChangeListener.java +++ b/core/src/test/java/edu/umd/cs/piccolo/MockPropertyChangeListener.java @@ -18,4 +18,8 @@ public int getPropertyChangeCount() { return changes.size(); } + + public PropertyChangeEvent getPropertyChange(int index) { + return (PropertyChangeEvent) changes.get(index); + } } \ No newline at end of file diff --git a/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java b/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java index 6fe73a5..07be3e8 100644 --- a/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java +++ b/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java @@ -4,6 +4,7 @@ import junit.framework.TestCase; import edu.umd.cs.piccolo.util.PBounds; +import edu.umd.cs.piccolo.util.PPaintContext; public class PCanvasTest extends TestCase { private PCanvas canvas; @@ -39,26 +40,17 @@ /** * This should work, but for some reason there's no getDefaultRenderQuality(); */ - /*public void testDefaultRenderQualityIsHigh() { - fail("Pop cursor shouldn't fail on an empty stack"); - //assertEquals(PPaintContext.HIGH_QUALITY_RENDERING, canvas.getDefaultRenderQuality()); - }*/ + public void testDefaultRenderQualityIsHigh() { + assertEquals(PPaintContext.HIGH_QUALITY_RENDERING, canvas.getDefaultRenderQuality()); + } - /** - * This should work, but for some reason there's no getAnimatingRenderQuality(); - */ - /*public void testDefaultAnimatingRenderQualityIsLow() { - fail("Missing getter method"); - //assertEquals(PPaintContext.LOW_QUALITY_RENDERING, canvas.getAnimatingRenderQuality()); - }*/ + public void testDefaultAnimatingRenderQualityIsLow() { + assertEquals(PPaintContext.LOW_QUALITY_RENDERING, canvas.getAnimatingRenderQuality()); + } - /** - * This should work, but for some reason there's no getAnimatingRenderQuality(); - */ - /*public void testDefaultInteractingRenderQualityIsLow() { - fail("Missing getter method"); - //assertEquals(PPaintContext.LOW_QUALITY_RENDERING, canvas.getInteractingRenderQuality()); - }*/ + public void testDefaultInteractingRenderQualityIsLow() { + assertEquals(PPaintContext.LOW_QUALITY_RENDERING, canvas.getInteractingRenderQuality()); + } public void testDefaultZoomHandlerIsNotNull() { assertNotNull(canvas.getZoomEventHandler()); diff --git a/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java b/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java index 7573961..e12ca6d 100644 --- a/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java +++ b/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java @@ -35,6 +35,7 @@ import java.awt.geom.Point2D; import java.awt.geom.Rectangle2D; import java.awt.image.BufferedImage; +import java.beans.PropertyChangeEvent; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -664,6 +665,9 @@ aChild.setBounds(0, 0, 100, 100); assertEquals(1, mockListener.getPropertyChangeCount()); + PropertyChangeEvent propEvent = mockListener.getPropertyChange(0); + assertEquals(PNode.PROPERTY_BOUNDS, propEvent.getPropertyName()); + assertEquals(new PBounds(0, 0, 100, 100), propEvent.getNewValue()); } public void testStartEndResizeBoundsCanBeCalledWithoutResizes() { @@ -1285,4 +1289,5 @@ node.setOccluded(true); assertTrue(node.getOccluded()); } + }