Search in sources :

Example 1 with TestUiObject

use of com.stardust.automator.test.TestUiObject in project Auto.js by hyb1996.

the class ScrollMaxActionTest method perform.

@Test
public void perform() throws Exception {
    ScrollMaxAction action = new ScrollMaxAction(AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD);
    UiObject root = new TestUiObject(20);
    action.perform(root);
    System.out.println(TestUiObject.max);
    assertEquals(1, TestUiObject.count);
}
Also used : UiObject(com.stardust.automator.UiObject) TestUiObject(com.stardust.automator.test.TestUiObject) TestUiObject(com.stardust.automator.test.TestUiObject) Test(org.junit.Test)

Example 2 with TestUiObject

use of com.stardust.automator.test.TestUiObject in project Auto.js by hyb1996.

the class DepthFirstSearchTargetActionTest method perform.

@Test
public void perform() {
    DepthFirstSearchTargetAction action = new DepthFirstSearchTargetAction(AccessibilityNodeInfo.ACTION_CLICK, new FilterAction.Filter() {

        @Override
        public List<UiObject> filter(UiObject root) {
            List<UiObject> list = new ArrayList<>();
            for (int i = 0; i < root.getChildCount(); i++) {
                list.add(root.child(i));
            }
            return list;
        }
    });
    TestUiObject root = new TestUiObject(5);
    action.perform(root);
    System.out.println(TestUiObject.max);
    assertEquals(1, TestUiObject.count);
}
Also used : UiObject(com.stardust.automator.UiObject) TestUiObject(com.stardust.automator.test.TestUiObject) TestUiObject(com.stardust.automator.test.TestUiObject) List(java.util.List) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 3 with TestUiObject

use of com.stardust.automator.test.TestUiObject 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);
}
Also used : UiObject(com.stardust.automator.UiObject) TestUiObject(com.stardust.automator.test.TestUiObject) TestUiObject(com.stardust.automator.test.TestUiObject) Test(org.junit.Test)

Example 4 with TestUiObject

use of com.stardust.automator.test.TestUiObject 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);
}
Also used : UiObject(com.stardust.automator.UiObject) TestUiObject(com.stardust.automator.test.TestUiObject) TestUiObject(com.stardust.automator.test.TestUiObject) Test(org.junit.Test)

Aggregations

UiObject (com.stardust.automator.UiObject)4 TestUiObject (com.stardust.automator.test.TestUiObject)4 Test (org.junit.Test)4 ArrayList (java.util.ArrayList)1 List (java.util.List)1