Esempio n. 1
0
  public final void testEqualsObject() {
    Rect r = new Rect(3, 4, 20, 30);

    assertFalse(r.equals(null));
    assertFalse(r.equals(new Object()));
    assertTrue(r.equals(new Rect(3, 4, 20, 30)));
  }
Esempio n. 2
0
  public final void testEqualsObject_Invalid() {
    Rect r = new Rect(3, 4, 20, 30);
    assertTrue(r.isValid());

    Rect i1 = new Rect(3, 4, 0, 0);
    assertFalse(i1.isValid());
    Rect i2 = new Rect(10, 20, 0, 0);
    assertFalse(i2.isValid());

    // valid rects can't be equal to invalid rects
    assertFalse(r.equals(i1));
    assertFalse(r.equals(i2));

    // invalid rects are equal to each other whatever their content is
    assertEquals(i2, i1);
  }