Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Ole Hermann Bakka
todo-list-example
Commits
68e89d60
Commit
68e89d60
authored
Nov 23, 2021
by
Hallvard Trætteberg
Browse files
Test that todosettings panel opens
parent
dcbf8dea
Changes
3
Hide whitespace changes
Inline
Side-by-side
todolist/fxui/src/main/resources/todolist/ui/TodoSettings.fxml
View file @
68e89d60
...
...
@@ -9,7 +9,7 @@
<?import javafx.scene.control.ChoiceBox?>
<?import javafx.collections.FXCollections?>
<VBox
xmlns:fx=
"http://javafx.com/fxml"
fx:controller=
"todolist.ui.TodoSettingsController"
>
<VBox
fx:id=
"todoSettingsRoot"
xmlns:fx=
"http://javafx.com/fxml"
fx:controller=
"todolist.ui.TodoSettingsController"
>
<Label
text=
"Settings"
/>
<GridPane
alignment=
"center"
hgap=
"10"
vgap=
"10"
>
<!-- <padding><Insets top="25" right="25" bottom="25" left="25"/></padding> -->
...
...
todolist/fxui/src/test/java/todolist/ui/TodoAppTest.java
View file @
68e89d60
...
...
@@ -4,6 +4,7 @@ import javafx.fxml.FXMLLoader;
import
javafx.scene.Parent
;
import
javafx.scene.Scene
;
import
javafx.stage.Stage
;
import
javafx.stage.Window
;
import
todolist.json.TodoPersistence
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
assertNotNull
;
import
static
org
.
junit
.
jupiter
.
api
.
Assertions
.
fail
;
...
...
@@ -15,6 +16,7 @@ import org.junit.jupiter.api.BeforeAll;
import
org.junit.jupiter.api.BeforeEach
;
import
org.junit.jupiter.api.Test
;
import
org.testfx.framework.junit5.ApplicationTest
;
import
org.testfx.util.WaitForAsyncUtils
;
public
class
TodoAppTest
extends
ApplicationTest
{
...
...
@@ -55,4 +57,23 @@ public class TodoAppTest extends ApplicationTest {
public
void
testSelectedTodoList_initial
()
{
assertNotNull
(
this
.
controller
.
getSelectedTodoList
());
}
@Test
public
void
testTodoSettings
()
{
clickOn
(
"#todoSettingsButton"
);
WaitForAsyncUtils
.
waitForFxEvents
();
assertNotNull
(
findSceneRootWithId
(
"todoSettingsRoot"
));
}
private
Parent
findSceneRootWithId
(
String
id
)
{
for
(
Window
window
:
Window
.
getWindows
())
{
if
(
window
instanceof
Stage
&&
window
.
isShowing
())
{
var
root
=
window
.
getScene
().
getRoot
();
if
(
id
.
equals
(
root
.
getId
()))
{
return
root
;
}
}
}
return
null
;
}
}
todolist/fxui/src/test/resources/todolist/ui/TodoModel_test.fxml
View file @
68e89d60
...
...
@@ -3,10 +3,12 @@
<?import javafx.scene.layout.VBox?>
<?import javafx.scene.layout.HBox?>
<?import javafx.scene.control.ComboBox?>
<?import javafx.scene.control.Button?>
<VBox
xmlns:fx=
"http://javafx.com/fxml/1"
fx:controller=
"todolist.ui.TodoModelController"
>
<HBox>
<ComboBox
fx:id=
"todoListsView"
/>
<Button
fx:id=
"todoSettingsButton"
onAction=
"#handleSettingsAction"
/>
</HBox>
<fx:include
fx:id=
"todoListView"
source=
"TodoList_test.fxml"
/>
</VBox>
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment