Esempio n. 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)));
  }
Esempio n. 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)));
  }
Esempio n. 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));
 }
Esempio n. 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));
 }