Пример #1
0
  // Helper function to test any rectangle covering (0,0) to (2,2)
  private static void testOverlaps0022(Rectangle r0022) {
    Rectangle r3 = new CorneredRectangle(0, 2, 4, 4);
    Rectangle r4 = new CorneredRectangle(-1, 1, 4, 4);
    Rectangle r5 = new CorneredRectangle(0, 1, 3, 3);

    assertFalse(r0022.overlaps(r3));
    assertFalse(r3.overlaps(r0022));
    assertTrue(r0022.overlaps(r4));
    assertTrue(r4.overlaps(r0022));
    assertTrue(r0022.overlaps(r5));
    assertTrue(r5.overlaps(r0022));
  }
Пример #2
0
 @Test
 public void testCorneredRectangle5() {
   Rectangle cr1 = new CorneredRectangle(0, 0, 2, 2);
   Rectangle cr2 = new CorneredRectangle(-1, 0.5, 4, 1.5);
   assertTrue(cr1.overlaps(cr2));
 }