Example #1
0
 @Test
 public void shouldReturnRightNumberOfElems() {
   Glass glass =
       new Glass(
           "    *         *         *         *                                                                                                                                                                     ");
   assertEquals(4, glass.numbOfElemsOnField());
 }
Example #2
0
 public void setModal(boolean modal) {
   if (modal != dialogBox.isModal()) {
     if (isShowing()) {
       if (modal) glass.show();
       else glass.hide();
     }
     dialogBox.setModal(modal);
   }
 }
Example #3
0
 @Test
 public void shouldInitializeGlassCorrectly() {
   Glass glass =
       new Glass(
           "    *         *         *         *                                                                                                                                                                     ");
   assertEquals(
       "|          |\n|          |\n|          |\n|          |\n|          |\n|          |\n|          |\n|          |\n|          |\n"
           + "|          |\n|          |\n|          |\n|          |\n|          |\n|          |\n|          |\n|    *     |\n|    *     |\n|    *     |\n|    *     |\n------------",
       glass.toString());
 }
Example #4
0
 @Test
 public void shouldReturnRightSufrace() {
   Glass glass =
       new Glass(
           "    *         *         *         *                                                                                                                                                                     ");
   int[] surf = glass.getSurface();
   int[] shouldBe = new int[] {0, 0, 0, 4, -4, 0, 0, 0, 0};
   for (int i = 0; i < surf.length; i++) {
     assertEquals(shouldBe[i], surf[i]);
   }
 }
Example #5
0
  public void show() {
    if (isShowing()) return;
    if (inicialized == false) {
      initContent(contentPanel);
      initActionButton();
      inicialized = true;
    } else cleanUp();

    if (isModal()) glass.show();
    dialogBox.setVisible(false);
    dialogBox.show();
    showTimer.schedule(1);
  }
Example #6
0
 protected void afterHide(boolean autoHiden) {
   if (isModal()) glass.hide();
 }
 private OngoingStubbing<Boolean> rejectWhenCoordinates(int x, int y) {
   return when(glass.accept(Matchers.<Figure>anyObject(), eq(x), eq(y))).thenReturn(false);
 }
 private void glassToAccept(boolean accept) {
   when(glass.accept(Matchers.<Figure>anyObject(), anyInt(), anyInt())).thenReturn(accept);
 }