Author: allain.lalonde
Date: Mon Jul 13 12:57:28 2009
New Revision: 455

Modified:
    piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java
     
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/MockPropertyChangeListener.java
     
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java
    piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java

Log:
Added accessors for render quality on PCanvas (Issue 93) , and also wrote  
more tests to confirm that Issue 87 is fixed.

Modified:  
piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java
==============================================================================
--- piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java     
 
(original)
+++ piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/PCanvas.java     
 
Mon Jul 13 12:57:28 2009
@@ -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;
+    }
  }

Modified:  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/MockPropertyChangeListener.java
==============================================================================
---  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/MockPropertyChangeListener.java
       
(original)
+++  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/MockPropertyChangeListener.java
       
Mon Jul 13 12:57:28 2009
@@ -18,4 +18,8 @@
        public int getPropertyChangeCount() {
                return changes.size();
        }
+       
+       public PropertyChangeEvent getPropertyChange(int index) {
+               return (PropertyChangeEvent) changes.get(index);
+       }
  }

Modified:  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java
==============================================================================
---  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java     
 
(original)
+++  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PCanvasTest.java     
 
Mon Jul 13 12:57:28 2009
@@ -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());

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       
 
(original)
+++  
piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/PNodeTest.java       
 
Mon Jul 13 12:57:28 2009
@@ -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());
        }
+               
  }

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

Reply via email to