Пример #1
0
  public void testGetImage() {
    Balloon testBalloon = new Balloon(1000, 1000, -1, 0);

    assertTrue(
        "Test Failure: Balloon Image is not consistent with theme",
        theme.getBalloon(0).equals(testBalloon.getImage(theme)));
  }
Пример #2
0
  public void testGetImageWhenPopped() {
    Balloon testBalloon = new Balloon(1000, 1000, -1, 0);

    testBalloon.popped = true;

    assertTrue(
        "Test Failure: Popped Image is not consistent with theme",
        theme.getPoppedBalloon(0).equals(testBalloon.getImage(theme)));
  }
Пример #3
0
  public void testMoveFallOffTop() {
    Balloon dummyBalloon = new Balloon(0, 0, -1, 0);

    Bitmap image = dummyBalloon.getImage(theme);
    Balloon testBalloon = new Balloon(0, -1 * image.getHeight(), -1, 0);

    testBalloon.move(theme, 1, 1);

    assertFalse("Test Failure: Balloon should not pop when floating off top", testBalloon.popped);
    assertTrue(
        "Test Failure: Balloon should show as offscreen when it floats too high",
        testBalloon.offScreen);
  }
Пример #4
0
  public void testGettingSameImage() {
    Balloon testBalloon = new Balloon(1000, 1000, -1, 0);

    Bitmap originalImage = testBalloon.getImage(theme);
    testBalloon.move(theme, 1, 1);
    Bitmap nextImage = testBalloon.getImage(theme);
    assertEquals(
        "Test Failure: Images should not change for poppable objects", originalImage, nextImage);

    testBalloon.move(theme, 1, 1);
    nextImage = testBalloon.getImage(theme);
    assertEquals(
        "Test Failure: Images should not change for poppable objects", originalImage, nextImage);

    testBalloon.move(theme, 1, 1);
    nextImage = testBalloon.getImage(theme);
    assertEquals(
        "Test Failure: Images should not change for poppable objects", originalImage, nextImage);

    testBalloon.move(theme, 1, 1);
    nextImage = testBalloon.getImage(theme);
    assertEquals(
        "Test Failure: Images should not change for poppable objects", originalImage, nextImage);
  }