Beispiel #1
0
  public final void testContainsPoint() {
    Rect r = new Rect(3, 4, 20, 30);

    assertTrue(r.contains(new Point(3, 4)));
    assertTrue(r.contains(new Point(3 + 19, 4)));
    assertTrue(r.contains(new Point(3 + 19, 4 + 29)));
    assertTrue(r.contains(new Point(3, 4 + 29)));

    assertFalse(r.contains(new Point(3 - 1, 4)));
    assertFalse(r.contains(new Point(3, 4 - 1)));
    assertFalse(r.contains(new Point(3 - 1, 4 - 1)));

    assertFalse(r.contains(new Point(3 + 20, 4)));
    assertFalse(r.contains(new Point(3 + 20, 4 + 30)));
    assertFalse(r.contains(new Point(3, 4 + 30)));
  }
Beispiel #2
0
  public final void testContainsRect() {
    Rect r = new Rect(3, 4, 20, 30);

    assertTrue(r.contains(new Rect(3, 4, 5, 10)));
    assertFalse(r.contains(new Rect(3 - 1, 4, 5, 10)));
  }
Beispiel #3
0
 public final void testContainsRect_Null() {
   // contains(null) returns false rather than an NPE
   Rect r = new Rect(3, 4, -20, -30);
   assertFalse(r.contains((Rect) null));
 }
Beispiel #4
0
 public final void testContainsIntInt_Invalid() {
   // Invalid rects always return false
   Rect r = new Rect(3, 4, -20, -30);
   assertFalse(r.contains(3, 4));
 }