Search in sources :

Example 6 with NodeQuery

use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.

the class NodeMatchers method hasChildren.

private static boolean hasChildren(Node node, int amount, String query) {
    NodeFinder nodeFinder = FxAssert.assertContext().getNodeFinder();
    NodeQuery nodeQuery = nodeFinder.from(node);
    return nodeQuery.lookup(query).queryAll().size() == amount;
}
Also used : NodeQuery(org.testfx.service.query.NodeQuery) NodeFinder(org.testfx.service.finder.NodeFinder)

Example 7 with NodeQuery

use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.

the class NodeMatchers method hasChild.

private static boolean hasChild(Node node, String query) {
    NodeFinder nodeFinder = FxAssert.assertContext().getNodeFinder();
    NodeQuery nodeQuery = nodeFinder.from(node);
    return !nodeQuery.lookup(query).queryAll().isEmpty();
}
Also used : NodeQuery(org.testfx.service.query.NodeQuery) NodeFinder(org.testfx.service.finder.NodeFinder)

Example 8 with NodeQuery

use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.

the class NodeAndPointQueryTest method node_queryAll_returns_empty_set.

@Test
public void node_queryAll_returns_empty_set() {
    // when:
    NodeQuery query = fx.lookup(".missing");
    // then:
    assertThat(query.queryAll(), is(Collections.unmodifiableSet(new HashSet<>())));
}
Also used : NodeQuery(org.testfx.service.query.NodeQuery) Test(org.junit.Test)

Example 9 with NodeQuery

use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.

the class NodeAndPointQueryTest method node_queryFirst_returns_null.

@Test
public void node_queryFirst_returns_null() {
    // when:
    NodeQuery query = fx.lookup(".missing");
    // then:
    assertThat(query.query(), nullValue());
}
Also used : NodeQuery(org.testfx.service.query.NodeQuery) Test(org.junit.Test)

Example 10 with NodeQuery

use of org.testfx.service.query.NodeQuery in project TestFX by TestFX.

the class NodeAndPointQueryTest method node_queryFirst_returns_node.

@Test
public void node_queryFirst_returns_node() {
    // when:
    NodeQuery query = fx.lookup(".button");
    // then:
    assertThat(query.query(), is(button0));
}
Also used : NodeQuery(org.testfx.service.query.NodeQuery) Test(org.junit.Test)

Aggregations

NodeQuery (org.testfx.service.query.NodeQuery)16 Node (javafx.scene.Node)8 Test (org.junit.Test)6 NodeFinder (org.testfx.service.finder.NodeFinder)4 ArrayList (java.util.ArrayList)2 Button (javafx.scene.control.Button)2 Cell (javafx.scene.control.Cell)2 TextField (javafx.scene.control.TextField)2 Region (javafx.scene.layout.Region)2 Unstable (org.testfx.api.annotation.Unstable)1