use of com.stardust.automator.UiObject in project Auto.js by hyb1996.
the class NodeInfo method capture.
public static NodeInfo capture(@NonNull UiObject uiObject, @Nullable NodeInfo parent) {
NodeInfo nodeInfo = new NodeInfo(uiObject, parent);
int childCount = uiObject.getChildCount();
for (int i = 0; i < childCount; i++) {
UiObject child = uiObject.child(i);
if (child != null) {
nodeInfo.children.add(capture(child, nodeInfo));
}
}
return nodeInfo;
}
use of com.stardust.automator.UiObject in project Auto.js by hyb1996.
the class DfsFilterTest method filter.
@Test
public void filter() throws Exception {
DfsFilter filter = new RandomDfsFilter();
UiObject root = new TestUiObject(10);
List<UiObject> list = filter.filter(root);
for (UiObject uiObject : list) {
if (root != uiObject)
uiObject.recycle();
}
System.out.println(TestUiObject.max);
assertEquals(1, TestUiObject.count);
}
use of com.stardust.automator.UiObject in project Auto.js by hyb1996.
the class ScrollActionTest method perform.
@Test
public void perform() throws Exception {
ScrollAction action = new ScrollAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD, 0);
UiObject root = new TestUiObject(5);
action.perform(root);
System.out.println(TestUiObject.max);
assertEquals(1, TestUiObject.count);
}
use of com.stardust.automator.UiObject in project Auto.js by hyb1996.
the class ScrollAction method findScrollableNodes.
private static void findScrollableNodes(UiObject node, List<UiObject> list) {
if (node == null) {
return;
}
for (int i = 0; i < node.getChildCount(); i++) {
UiObject child = node.child(i);
if (child == null)
continue;
findScrollableNodes(child, list);
if (child.isScrollable()) {
list.add(child);
} else {
child.recycle();
}
}
}
Aggregations