Esempio n. 1
0
  @Test
  public void slider() {
    pg.setItems(0);
    assertEquals(0, pg.getSlider().length);

    pg.setItems(123);
    assertEquals(0, pg.getSlider(0).length);

    assertSlide(1, 2, 3, 4, 5, 6, 7);

    pg.setPage(2);
    assertSlide(1, 2, 3, 4, 5, 6, 7);

    pg.setPage(3);
    assertSlide(1, 2, 3, 4, 5, 6, 7);

    pg.setPage(4);
    assertSlide(1, 2, 3, 4, 5, 6, 7);

    pg.setPage(5);
    assertSlide(2, 3, 4, 5, 6, 7, 8);

    pg.setPage(6);
    assertSlide(3, 4, 5, 6, 7, 8, 9);

    pg.setPage(7);
    assertSlide(4, 5, 6, 7, 8, 9, 10);

    pg.setPage(8);
    assertSlide(5, 6, 7, 8, 9, 10, 11);

    pg.setPage(9);
    assertSlide(6, 7, 8, 9, 10, 11, 12);

    pg.setPage(10);
    assertSlide(7, 8, 9, 10, 11, 12, 13);

    pg.setPage(11);
    assertSlide(7, 8, 9, 10, 11, 12, 13);

    pg.setPage(12);
    assertSlide(7, 8, 9, 10, 11, 12, 13);

    pg.setPage(13);
    assertSlide(7, 8, 9, 10, 11, 12, 13);
  }
Esempio n. 2
0
  private void assertSlide(int a, int b, int c, int d, int e, int f, int g) {
    int i = 0;
    int[] slider = pg.getSlider(7);

    assertEquals(a, slider[i++]);
    assertEquals(b, slider[i++]);
    assertEquals(c, slider[i++]);
    assertEquals(d, slider[i++]);
    assertEquals(e, slider[i++]);
    assertEquals(f, slider[i++]);
    assertEquals(g, slider[i++]);
  }