예제 #1
0
  @Test
  public void testButtonsPlacedOnPanel() {
    CardButton[] buttons = boardPanel.getButtons();

    assertEquals("board panel contain 5 components", 5, buttons.length);
    assertEquals(
        "1-st component on hand panel is card button",
        CardLargeButton.class,
        buttons[0].getClass());
    assertEquals(
        "last component on hand panel is card button",
        CardLargeButton.class,
        buttons[buttons.length - 1].getClass());
  }
예제 #2
0
  @Test
  public void testBoardCardContainLargeIconOfCard() {
    CardButton[] buttons = boardPanel.getButtons();
    cardButton = buttons[0];

    Card card = cardButton.getCard();

    String path = cardButton.getIconPath() + (card.getRevertedName() + ".gif");
    java.net.URL imgURL = getClass().getResource(path);
    ImageIcon icon = new ImageIcon(imgURL, card.toString());

    assertTrue(
        "button have large image icon",
        ((ImageIcon) cardButton.getIcon()).getImage().equals(icon.getImage()));
  }