diff --git a/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java b/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java index 32491f0..f60c8f7 100644 --- a/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java +++ b/core/src/main/java/edu/umd/cs/piccolo/util/PBounds.java @@ -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; diff --git a/core/src/test/java/edu/umd/cs/piccolo/util/PBoundsTest.java b/core/src/test/java/edu/umd/cs/piccolo/util/PBoundsTest.java index 10a5126..aa16518 100644 --- a/core/src/test/java/edu/umd/cs/piccolo/util/PBoundsTest.java +++ b/core/src/test/java/edu/umd/cs/piccolo/util/PBoundsTest.java @@ -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()); + } }