Revision: 923
Author: allain.lalonde
Date: Thu Jan 14 12:02:43 2010
Log: Fixing Issue #155 by removing check for "isEmpty" on passed bounds to
add.
This makes add(PBounds) fall in line with the add(x, y) method.
http://code.google.com/p/piccolo2d/source/detail?r=923
Modified:
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/util/PBoundsTest.java
=======================================
---
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java
Tue Oct 13 09:36:51 2009
+++
/piccolo2d.java/trunk/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java
Thu Jan 14 12:02:43 2010
@@ -233,10 +233,7 @@
* @param bounds bounds being added
*/
public void add(final PBounds bounds) {
- if (bounds.isEmpty) {
- return;
- }
- else if (isEmpty) {
+ if (isEmpty) {
x = bounds.x;
y = bounds.y;
width = bounds.width;
=======================================
---
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/util/PBoundsTest.java
Fri Oct 23 12:36:22 2009
+++
/piccolo2d.java/trunk/core/src/test/java/edu/umd/cs/piccolo/util/PBoundsTest.java
Thu Jan 14 12:02:43 2010
@@ -31,6 +31,7 @@
import java.awt.geom.Rectangle2D;
import junit.framework.TestCase;
+import edu.umd.cs.piccolo.PNode;
import edu.umd.cs.piccolo.PiccoloAsserts;
/**
@@ -80,4 +81,11 @@
b.add(0, 0);
PiccoloAsserts.assertEquals(new PDimension(10, 10), b.getSize(),
0.00001);
}
-}
+
+ public void testWhenBoundsHas0HeightFullBoundsIsCorrectlyReturned() {
+ final PNode node = new PNode();
+ final PBounds testBounds = new PBounds(10, 10, 10, 0);
+ node.setBounds(testBounds);
+ assertEquals(testBounds, node.getFullBounds());
+ }
+}
--
Piccolo2D Developers Group: http://groups.google.com/group/piccolo2d-dev?hl=en