Beispiel #1
0
  @Test
  public void testCanZoomOutAtLowerBoundary() {

    ZoomLevel.getInstance().setZoomLevel(ZoomLevel.getInstance().getZoomLevelAmount() - 1);

    assertEquals(true, ZoomLevel.getInstance().zoomOut());
  }
Beispiel #2
0
  @Test
  public void testCanZoomOutAtMiddlePosition() {

    ZoomLevel.getInstance().setZoomLevel(ZoomLevel.getInstance().getZoomLevelAmount() / 2);

    assertEquals(true, ZoomLevel.getInstance().zoomOut());
  }
Beispiel #3
0
  @Test
  public void testCanZoomOutAtUpperBoundary() {

    ZoomLevel.getInstance().setZoomLevel(0);

    assertEquals(false, ZoomLevel.getInstance().zoomOut());
  }
Beispiel #4
0
  @Test
  public void testCanZoomInAtUpperBoundary() {

    ZoomLevel.getInstance().setZoomLevel(0);

    assertEquals(true, ZoomLevel.getInstance().zoomIn());
  }
Beispiel #5
0
  @Test
  public void testFindZoomAboveUpperBoundary() {

    double testZoomLevel = -1;

    assertEquals(
        ZoomLevel.getInstance().getZoomLevelAmount() - 1,
        ZoomLevel.getInstance().findIndex(testZoomLevel));
  }
Beispiel #6
0
  @Test
  public void testCanZoomOutWorks() {

    ZoomLevel.getInstance().setZoomLevel(ZoomLevel.getInstance().getZoomLevelAmount() - 1);

    int preZoomLevel = ZoomLevel.getInstance().getZoomIndex();

    ZoomLevel.getInstance().zoomOut();

    assertEquals(preZoomLevel - 1, ZoomLevel.getInstance().getZoomIndex());
  }
Beispiel #7
0
  @Test
  public void testCanZoomInWorks() {

    ZoomLevel.getInstance().setZoomLevel(0);

    int preZoomLevel = ZoomLevel.getInstance().getZoomIndex();

    ZoomLevel.getInstance().zoomIn();

    assertEquals(preZoomLevel + 1, ZoomLevel.getInstance().getZoomIndex());
  }
Beispiel #8
0
  @Test
  public void testFindZoomWorks() {

    int targetIndex = ZoomLevel.getInstance().getZoomLevelAmount() / 2;

    double difference =
        ZoomLevel.getInstance().getZoomLevel(targetIndex)
            - ZoomLevel.getInstance().getZoomLevel(targetIndex + 1);
    double testZoomLevel = ZoomLevel.getInstance().getZoomLevel(targetIndex) - (difference / 2);

    assertEquals(targetIndex, ZoomLevel.getInstance().findIndex(testZoomLevel));
  }
Beispiel #9
0
  @Test
  public void testFindZoomAtLowerBoundary() {

    double testZoomLevel = 1.5;

    assertEquals(0, ZoomLevel.getInstance().findIndex(testZoomLevel));
  }