|
|
|
@ -1,53 +0,0 @@
|
|
|
|
|
package GUI;
|
|
|
|
|
|
|
|
|
|
import PR2.HitoriSpiel.GUI.StartMenu;
|
|
|
|
|
import org.assertj.swing.edt.GuiActionRunner;
|
|
|
|
|
import org.assertj.swing.fixture.FrameFixture;
|
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
|
|
|
|
|
|
import static org.assertj.core.api.Assertions.assertThat;
|
|
|
|
|
|
|
|
|
|
public class StartMenuTest {
|
|
|
|
|
|
|
|
|
|
private FrameFixture window;
|
|
|
|
|
|
|
|
|
|
@BeforeEach
|
|
|
|
|
public void setUp() {
|
|
|
|
|
JFrame frame = GuiActionRunner.execute(() -> {
|
|
|
|
|
JFrame testFrame = new JFrame();
|
|
|
|
|
testFrame.add(new StartMenu(testFrame));
|
|
|
|
|
testFrame.pack();
|
|
|
|
|
testFrame.setVisible(true);
|
|
|
|
|
return testFrame;
|
|
|
|
|
});
|
|
|
|
|
window = new FrameFixture(frame);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@AfterEach
|
|
|
|
|
public void tearDown() {
|
|
|
|
|
window.cleanUp();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testButtonsExist() {
|
|
|
|
|
// Buttons über ihre Namen finden und testen
|
|
|
|
|
assertThat(window.button("continueButton")).isNotNull();
|
|
|
|
|
assertThat(window.button("selectBoardButton")).isNotNull();
|
|
|
|
|
assertThat(window.button("randomBoardButton")).isNotNull();
|
|
|
|
|
assertThat(window.button("highscorelistButton")).isNotNull();
|
|
|
|
|
assertThat(window.button("exitButton")).isNotNull();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
public void testButtonActions() {
|
|
|
|
|
window.button("continueButton").click();
|
|
|
|
|
window.button("selectBoardButton").click();
|
|
|
|
|
window.button("randomBoardButton").click();
|
|
|
|
|
window.button("highscorelistButton").click();
|
|
|
|
|
window.button("exitButton").click();
|
|
|
|
|
}
|
|
|
|
|
}
|