Ejemplo n.º 1
0
 @Test
 public void testScrollWithParent_shouldScrollAndClearFocus() {
   AccessibilityNodeInfoCompat parent = AccessibilityNodeInfoCompat.obtain();
   ((ShadowAccessibilityNodeInfoCompat) ShadowExtractor.extract(parent)).addChild(mCompat1);
   ShadowAccessibilityNodeInfo shadowParent =
       (ShadowAccessibilityNodeInfo) ShadowExtractor.extract(parent.getInfo());
   parent.setScrollable(true);
   mActionNode1.recycle();
   mActionNode1 =
       new AccessibilityNodeActionNode(
           mCompat1,
           new AccessibilityNodeInfoCompat.AccessibilityActionCompat(
               AccessibilityNodeInfoCompat.ACTION_CLICK, "label1"));
   mSelectionNode = new OptionScanSelectionNode(mActionNode1, mActionNode2);
   mOptionManager.clearFocusIfNewTree(mSelectionNode);
   mOptionManager.selectOption(0);
   mOptionManager.performScrollAction(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD);
   assertEquals(0, mShadowInfo1.getPerformedActions().size());
   List<Integer> parentActions = shadowParent.getPerformedActions();
   assertEquals(1, parentActions.size());
   assertEquals(
       new Integer(AccessibilityNodeInfoCompat.ACTION_SCROLL_FORWARD), parentActions.get(0));
   verify(mOverlayController, times(3)).clearOverlay();
   parent.recycle();
 }
 public void onInitializeAccessibilityNodeInfo(
     Object paramObject,
     View paramView,
     AccessibilityNodeInfoCompat paramAccessibilityNodeInfoCompat) {
   AccessibilityDelegateCompatIcs.onInitializeAccessibilityNodeInfo(
       paramObject, paramView, paramAccessibilityNodeInfoCompat.getInfo());
 }
Ejemplo n.º 3
0
 /**
  * Obtain a list of nodes in the order TalkBack would traverse them
  *
  * @param root The root of the tree to traverse
  * @return The nodes in {@code root}'s subtree (including root) in the order TalkBack would
  *     traverse them.
  */
 public static LinkedList<SwitchAccessNodeCompat> getNodesInTalkBackOrder(
     SwitchAccessNodeCompat root) {
   LinkedList<SwitchAccessNodeCompat> outList = new LinkedList<>();
   OrderedTraversalController traversalController = new OrderedTraversalController();
   traversalController.initOrder(root);
   AccessibilityNodeInfoCompat node = traversalController.findFirst();
   while (node != null) {
     outList.add(new SwitchAccessNodeCompat(node.getInfo(), root.getWindowsAbove()));
     node = traversalController.findNext(node);
   }
   traversalController.recycle();
   return outList;
 }
Ejemplo n.º 4
0
 public void onInitializeAccessibilityNodeInfo(
     View view, AccessibilityNodeInfoCompat accessibilitynodeinfocompat) {
   ViewCompatICS.onInitializeAccessibilityNodeInfo(view, accessibilitynodeinfocompat.getInfo());
 }