public void testOutcode() {
   assertEquals(Rectangle2D.OUT_LEFT | Rectangle2D.OUT_TOP, r.outcode(0, 0));
   assertEquals(Rectangle2D.OUT_TOP, r.outcode(2, 0));
   assertEquals(Rectangle2D.OUT_RIGHT | Rectangle2D.OUT_TOP, r.outcode(5, 0));
   assertEquals(Rectangle2D.OUT_RIGHT, r.outcode(5, 3));
   assertEquals(Rectangle2D.OUT_RIGHT | Rectangle2D.OUT_BOTTOM, r.outcode(5, 7));
   assertEquals(Rectangle2D.OUT_BOTTOM, r.outcode(2, 7));
   assertEquals(Rectangle2D.OUT_LEFT | Rectangle2D.OUT_BOTTOM, r.outcode(0, 7));
   assertEquals(Rectangle2D.OUT_LEFT, r.outcode(0, 3));
   assertEquals(0, r.outcode(2, 3));
 }
 public void testIsEmpty() {
   assertFalse(r.isEmpty());
   assertTrue(new Rectangle2D.Double(1, 2, -1, 1).isEmpty());
   assertTrue(new Rectangle2D.Double(3, 4, 1, -1).isEmpty());
   assertTrue(new Rectangle2D.Double(3, 4, 1, 0).isEmpty());
   assertTrue(new Rectangle2D.Double(5, 6, -1, -1).isEmpty());
 }
 public void testCreateUnion() {
   //      assertEquals(r.createUnion(new Rectangle2D.Double()), new Rectangle2D.Double(1, 2, 3,
   // 4));           // Empty
   assertEquals(
       new Rectangle2D.Float(1, 2, 3, 4),
       r.createUnion(new Rectangle2D.Float(1, 2, 3, 4))); // The same
   assertEquals(
       new Rectangle2D.Double(1, 2, 3, 4),
       r.createUnion(new Rectangle2D.Double(2, 3, 1, 2))); // Inside
   assertEquals(
       new Rectangle2D.Float(1, 2, 5, 7),
       r.createUnion(new Rectangle2D.Float(5, 7, 1, 2))); // Outside
   assertEquals(
       new Rectangle2D.Double(1, 2, 6, 7),
       r.createUnion(new Rectangle2D.Double(2, 3, 5, 6))); // Intersect
   assertEquals(
       new Rectangle2D.Float(0, 0, 5, 6),
       r.createUnion(new Rectangle2D.Float(0, 0, 5, 6))); // Cover
 }
 public void testCreateIntersection() {
   assertEquals(
       new Rectangle2D.Float(1, 2, -1, -2),
       r.createIntersection(new Rectangle2D.Float())); // Empty
   assertEquals(
       new Rectangle2D.Double(1, 2, 3, 4),
       r.createIntersection(new Rectangle2D.Double(1, 2, 3, 4))); // The same
   assertEquals(
       new Rectangle2D.Float(2, 3, 1, 2),
       r.createIntersection(new Rectangle2D.Float(2, 3, 1, 2))); // Inside
   assertEquals(
       new Rectangle2D.Double(5, 7, -1, -1),
       r.createIntersection(new Rectangle2D.Double(5, 7, 1, 2))); // Outside
   assertEquals(
       new Rectangle2D.Float(2, 3, 2, 3),
       r.createIntersection(new Rectangle2D.Float(2, 3, 5, 6))); // Intersect
   assertEquals(
       new Rectangle2D.Double(1, 2, 3, 4),
       r.createIntersection(new Rectangle2D.Double(0, 0, 5, 6))); // Cover
 }
 public void testGetBounds2D() {
   assertEquals(new Rectangle2D.Double(1, 2, 3, 4), r.getBounds2D());
 }
 public void testSetRect3() {
   r.setRect(new Rectangle(5, 6, 7, 8));
   assertEquals(new Rectangle2D.Double(5, 6, 7, 8), r);
 }
 public void testSetRect2() {
   r.setRect(5.0f, 6.0f, 7.0f, 8.0f);
   assertEquals(new Rectangle2D.Double(5, 6, 7, 8), r);
 }
 public void testGetHeight() {
   assertEquals(4.0f, r.getHeight(), 0.0f);
 }
 public void testGetWidth() {
   assertEquals(3.0f, r.getWidth(), 0.0f);
 }
 public void testGetY() {
   assertEquals(2.0f, r.getY(), 0.0f);
 }
 public void testGetX() {
   assertEquals(1.0f, r.getX(), 0.0f);
 }
 public void testToString() {
   assertEquals(
       "com.google.code.appengine.awt.geom.Rectangle2D$Double[x=1.0,y=2.0,width=3.0,height=4.0]",
       r.toString());
 }