Skip to content

Commit 802a9d7

Browse files
committed
Add test app and a robot test case to test Finder recursion
1 parent 5883c44 commit 802a9d7

File tree

6 files changed

+147
-0
lines changed

6 files changed

+147
-0
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package javafxlibrary.testapps;
2+
3+
import javafx.application.Application;
4+
import javafx.fxml.FXMLLoader;
5+
import javafx.scene.Parent;
6+
import javafx.scene.Scene;
7+
import javafx.stage.Stage;
8+
9+
public class FinderApp extends Application {
10+
11+
int scale = 200;
12+
13+
@Override
14+
public void start(Stage firstStage) throws Exception {
15+
16+
Stage secondStage = new Stage();
17+
Stage thirdStage = new Stage();
18+
Stage fourthStage = new Stage();
19+
Stage[] stages = new Stage[]{firstStage, secondStage, thirdStage, fourthStage};
20+
21+
Parent firstRoot = FXMLLoader.load(getClass().getResource("/fxml/javafxlibrary/ui/FinderApp/FirstScene.fxml"));
22+
Parent secondRoot = FXMLLoader.load(getClass().getResource("/fxml/javafxlibrary/ui/FinderApp/SecondScene.fxml"));
23+
Parent thirdRoot = FXMLLoader.load(getClass().getResource("/fxml/javafxlibrary/ui/FinderApp/ThirdScene.fxml"));
24+
Parent fourthRoot = FXMLLoader.load(getClass().getResource("/fxml/javafxlibrary/ui/FinderApp/FirstScene.fxml"));
25+
26+
Scene[] scenes = new Scene[]{new Scene(firstRoot), new Scene(secondRoot), new Scene(thirdRoot), new Scene(fourthRoot)};
27+
28+
for (int i = 0; i < stages.length; i++) {
29+
Stage current = stages[i];
30+
current.setWidth(scale);
31+
current.setHeight(scale);
32+
current.setX(i * scale);
33+
current.setScene(scenes[i]);
34+
current.setTitle("Window " + (i + 1));
35+
current.show();
36+
37+
38+
}
39+
40+
}
41+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.scene.layout.*?>
4+
5+
<?import javafx.scene.control.Button?>
6+
<?import javafx.scene.control.Label?>
7+
<?import java.net.URL?>
8+
<VBox xmlns="http://javafx.com/javafx"
9+
xmlns:fx="http://javafx.com/fxml">
10+
<Label>Scene type 1</Label>
11+
<VBox>
12+
<HBox>
13+
<Button fx:id="firstButton">1</Button>
14+
<Button>2</Button>
15+
<Button>3</Button>
16+
<Button>4</Button>
17+
</HBox>
18+
</VBox>
19+
<VBox>
20+
<HBox>
21+
<Button>5</Button>
22+
<Button>6</Button>
23+
<Button>7</Button>
24+
<Button>8</Button>
25+
</HBox>
26+
</VBox>
27+
28+
<stylesheets>
29+
<URL value="@../css/FinderApp.css" />
30+
</stylesheets>
31+
</VBox>
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.scene.layout.*?>
4+
5+
<?import javafx.scene.control.Button?>
6+
<?import javafx.scene.control.Label?>
7+
<?import java.net.URL?>
8+
<VBox xmlns="http://javafx.com/javafx">
9+
<Label>Scene type 2</Label>
10+
<VBox>
11+
<HBox>
12+
<Button>1</Button>
13+
<Button>2</Button>
14+
<Button>3</Button>
15+
<Button>4</Button>
16+
</HBox>
17+
</VBox>
18+
<VBox>
19+
<HBox>
20+
<Button>5</Button>
21+
<Button>6</Button>
22+
<Button>7</Button>
23+
<Button>8</Button>
24+
</HBox>
25+
</VBox>
26+
27+
<stylesheets>
28+
<URL value="@../css/FinderApp.css" />
29+
</stylesheets>
30+
</VBox>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<?import javafx.scene.layout.*?>
4+
5+
<?import javafx.scene.control.Button?>
6+
<?import javafx.scene.control.Label?>
7+
<?import java.net.URL?>
8+
<VBox xmlns="http://javafx.com/javafx">
9+
<Label>Scene type 3</Label>
10+
<Button>1</Button>
11+
<Button>2</Button>
12+
<Button>3</Button>
13+
<Button>4</Button>
14+
<stylesheets>
15+
<URL value="@../css/FinderApp.css" />
16+
</stylesheets>
17+
</VBox>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.button {
2+
-fx-pref-width: 50px;
3+
-fx-pref-height: 50px;
4+
-fx-background-color: #323232;
5+
-fx-border-color: #929292;
6+
-fx-text-fill: white;
7+
}
8+
9+
.label {
10+
-fx-pref-width: 200px;
11+
-fx-pref-height: 100px;
12+
-fx-background-color: green;
13+
-fx-text-fill: white;
14+
}
15+
16+
VBox > .button {
17+
-fx-pref-width: 200px;
18+
}

src/test/robotframework/acceptance/FindTest.robot

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Force Tags set-find
88
${CURRENT_APPLICATION} NOT SET
99
${BOUNDS_APP} javafxlibrary.testapps.TestBoundsLocation
1010
${WINDOW_APP} javafxlibrary.testapps.TestMultipleWindows
11+
${FINDER_APP} javafxlibrary.testapps.FinderApp
1112

1213
*** Test Cases ***
1314
Find With TestFX Query
@@ -210,6 +211,15 @@ Find All From Multiple Windows Using Chained Selector
210211
${nodes} Find All css=HBox css=.label
211212
Length Should Be ${nodes} 3
212213

214+
Find All From Multiple Windows Containing Multiple Matches Using Chained Selector
215+
[Tags] not-ready bug
216+
Set Test App ${FINDER_APP}
217+
# TODO: Nodes should contain ALL matching nodes from every window, fix the recursion in Finder!
218+
${nodes} Find All css=VBox css=HBox css=.button
219+
220+
:FOR ${node} IN @{nodes}
221+
\ LOG ${node}
222+
213223
*** Keywords ***
214224
Set Test App
215225
[Arguments] ${APPLICATION}

0 commit comments

Comments
 (0)