|
26 | 26 | import javafx.event.EventType; |
27 | 27 | import javafx.geometry.Point2D; |
28 | 28 | import javafx.scene.Cursor; |
| 29 | +import javafx.scene.control.ButtonType; |
29 | 30 | import javafx.scene.input.*; |
30 | 31 | import javafx.stage.FileChooser; |
31 | 32 | import javafx.stage.Stage; |
@@ -74,9 +75,10 @@ void onSceneKeyPressed_ShouldPerformCorrectAction(TestInfo testinfo, FxRobot rob |
74 | 75 | Controller.KeyCombinations.selectFreehandDrawingMode, Controller.KeyCombinations.removeEditingVerticesWhenBoundingPolygonSelected, |
75 | 76 | Controller.KeyCombinations.changeSelectedBoundingShapeCategory, |
76 | 77 | Controller.KeyCombinations.hideNonSelectedBoundingShapes, Controller.KeyCombinations.simplifyPolygon, |
77 | | - Controller.KeyCombinations.saveBoundingShapeAsImage |
| 78 | + Controller.KeyCombinations.saveBoundingShapeAsImage, Controller.KeyCombinations.openSettings |
78 | 79 | )); |
79 | 80 |
|
| 81 | + testOpenSettingsKeyEvent(robot, testinfo); |
80 | 82 | testNavigateNextKeyEvent(testinfo, true, true, "wexor-tmg-L-2p8fapOA8-unsplash.jpg"); |
81 | 83 | testNavigatePreviousKeyEvent(testinfo, true, true, "rachel-hisko-rEM3cK8F1pk-unsplash.jpg"); |
82 | 84 | testNavigateNextKeyEvent(testinfo, false, true, "wexor-tmg-L-2p8fapOA8-unsplash.jpg"); |
@@ -172,6 +174,20 @@ void onSceneKeyPressed_ShouldPerformCorrectAction(TestInfo testinfo, FxRobot rob |
172 | 174 | testResetImageViewSizeKeyEvent(robot); |
173 | 175 | } |
174 | 176 |
|
| 177 | + private void testOpenSettingsKeyEvent(FxRobot robot, TestInfo testinfo) { |
| 178 | + KeyEvent openSettingsKeyEvent = buildKeyEventFromCombination((KeyCodeCombination) Controller.KeyCombinations.openSettings, KeyEvent.KEY_RELEASED); |
| 179 | + Platform.runLater(() -> controller.onRegisterSceneKeyReleased(openSettingsKeyEvent)); |
| 180 | + WaitForAsyncUtils.waitForFxEvents(); |
| 181 | + |
| 182 | + final Stage settingsStage = timeOutGetTopModalStage(robot, "Settings", testinfo); |
| 183 | + verifyThat(settingsStage.isShowing(), Matchers.is(true), saveScreenshot(testinfo)); |
| 184 | + |
| 185 | + timeOutClickOnButtonInDialogStage(robot, settingsStage, ButtonType.CANCEL, testinfo); |
| 186 | + timeOutAssertNoTopModelStage(robot, testinfo); |
| 187 | + |
| 188 | + verifyThat(settingsStage.isShowing(), Matchers.is(false)); |
| 189 | + } |
| 190 | + |
175 | 191 | private void testSaveCurrentlySelectedBoundingShapeKeyEvent() { |
176 | 192 | final AtomicReference<MockedConstruction<FileChooser>> mockedFileChooser = createMockedFileChooser(null); |
177 | 193 | verifyThat(mockedFileChooser.get(), Matchers.notNullValue()); |
|
0 commit comments