Package org.robolectric.shadows
Class ShadowAccessibilityNodeInfo
- java.lang.Object
-
- org.robolectric.shadows.ShadowAccessibilityNodeInfo
-
@Implements(android.view.accessibility.AccessibilityNodeInfo.class) public class ShadowAccessibilityNodeInfo extends Object
Properties ofAccessibilityNodeInfothat are normally locked may be changed using test APIs. Calls toobtain()andrecycle()are tracked to help spot bugs.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfaceShadowAccessibilityNodeInfo.OnPerformActionListener
-
Field Summary
Fields Modifier and Type Field Description static Parcelable.Creator<AccessibilityNodeInfo>CREATOR
-
Constructor Summary
Constructors Constructor Description ShadowAccessibilityNodeInfo()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void__constructor__()voidaddChild(AccessibilityNodeInfo child)Add a child node to this one.protected voidaddChild(View child)protected voidaddChild(View root, int virtualDescendantId)static booleanareThereUnrecycledNodes(boolean printUnrecycledNodesToSystemErr)Check for leaked objects that wereobtained but neverrecycled.protected intdescribeContents()booleanequals(Object object)Equality check based on reference equality of the Views from which these instances were created, or the equality of their assigned IDs.protected AccessibilityNodeInfogetChild(int index)protected intgetChildCount()protected AccessibilityNodeInfogetLabeledBy()protected AccessibilityNodeInfogetLabelFor()protected AccessibilityNodeInfogetParent()List<Integer>getPerformedActions()List<Pair<Integer,Bundle>>getPerformedActionsWithArgs()protected CharSequencegetText()protected AccessibilityNodeInfogetTraversalAfter()protected AccessibilityNodeInfogetTraversalBefore()protected AccessibilityWindowInfogetWindow()protected intgetWindowId()Returns the id of the window from which the info comes.inthashCode()booleanisPasteable()booleanisTextSelectionSetable()protected static AccessibilityNodeInfoobtain()protected static AccessibilityNodeInfoobtain(AccessibilityNodeInfo info)protected static AccessibilityNodeInfoobtain(View view)protected static AccessibilityNodeInfoobtain(View root, int virtualDescendantId)protected booleanperformAction(int action)protected booleanperformAction(int action, Bundle arguments)protected voidrecycle()protected booleanrefresh()static voidresetObtainedInstances()Clear list of obtained instance objects.voidsetAccessibilityWindowInfo(AccessibilityWindowInfo info)voidsetLabeledBy(AccessibilityNodeInfo info)voidsetLabelFor(AccessibilityNodeInfo info)voidsetOnPerformActionListener(ShadowAccessibilityNodeInfo.OnPerformActionListener listener)Configure the return result of an action if it is performedvoidsetPasteable(boolean isPasteable)voidsetRefreshReturnValue(boolean refreshReturnValue)protected voidsetSource(View source)protected voidsetSource(View root, int virtualDescendantId)protected voidsetText(CharSequence t)voidsetTextSelectionSetable(boolean isTextSelectionSetable)voidsetTraversalAfter(AccessibilityNodeInfo info)Sets the view whose node is visited after this one in accessibility traversal.protected voidsetTraversalAfter(View view, int virtualDescendantId)voidsetTraversalBefore(AccessibilityNodeInfo info)Sets the view before whose node this one should be visited during traversal.protected voidsetTraversalBefore(View info, int virtualDescendantId)StringtoString()protected voidwriteToParcel(Parcel dest, int flags)
-
-
-
Field Detail
-
CREATOR
public static final Parcelable.Creator<AccessibilityNodeInfo> CREATOR
-
-
Method Detail
-
__constructor__
@Implementation protected void __constructor__()
-
obtain
@Implementation protected static AccessibilityNodeInfo obtain(AccessibilityNodeInfo info)
-
obtain
@Implementation protected static AccessibilityNodeInfo obtain(View view)
-
obtain
@Implementation protected static AccessibilityNodeInfo obtain()
-
obtain
@Implementation protected static AccessibilityNodeInfo obtain(View root, int virtualDescendantId)
-
areThereUnrecycledNodes
public static boolean areThereUnrecycledNodes(boolean printUnrecycledNodesToSystemErr)
Check for leaked objects that wereobtained but neverrecycled.- Parameters:
printUnrecycledNodesToSystemErr- - if true, stack traces of calls toobtainthat lack matching calls torecycleare dumped to System.err.- Returns:
trueif there are unrecycled nodes
-
resetObtainedInstances
@Resetter public static void resetObtainedInstances()
Clear list of obtained instance objects.areThereUnrecycledNodeswill always return false if called immediately afterwards.
-
recycle
@Implementation protected void recycle()
-
getChildCount
@Implementation protected int getChildCount()
-
getChild
@Implementation protected AccessibilityNodeInfo getChild(int index)
-
getParent
@Implementation protected AccessibilityNodeInfo getParent()
-
refresh
@Implementation(minSdk=18) protected boolean refresh()
-
setRefreshReturnValue
public void setRefreshReturnValue(boolean refreshReturnValue)
-
isPasteable
public boolean isPasteable()
-
isTextSelectionSetable
public boolean isTextSelectionSetable()
-
setTextSelectionSetable
public void setTextSelectionSetable(boolean isTextSelectionSetable)
-
setPasteable
public void setPasteable(boolean isPasteable)
-
setText
@Implementation protected void setText(CharSequence t)
-
getText
@Implementation protected CharSequence getText()
-
getLabelFor
@Implementation(minSdk=18) protected AccessibilityNodeInfo getLabelFor()
-
setLabelFor
public void setLabelFor(AccessibilityNodeInfo info)
-
getLabeledBy
@Implementation(minSdk=17) protected AccessibilityNodeInfo getLabeledBy()
-
setLabeledBy
public void setLabeledBy(AccessibilityNodeInfo info)
-
getTraversalAfter
@Implementation(minSdk=22) protected AccessibilityNodeInfo getTraversalAfter()
-
setTraversalAfter
@Implementation(minSdk=22) protected void setTraversalAfter(View view, int virtualDescendantId)
-
setTraversalAfter
public void setTraversalAfter(AccessibilityNodeInfo info)
Sets the view whose node is visited after this one in accessibility traversal. This may be useful for configuring traversal order in tests before the corresponding views have been inflated.- Parameters:
info- The previous node.- See Also:
getTraversalAfter()
-
getTraversalBefore
@Implementation(minSdk=22) protected AccessibilityNodeInfo getTraversalBefore()
-
setTraversalBefore
@Implementation(minSdk=22) protected void setTraversalBefore(View info, int virtualDescendantId)
-
setTraversalBefore
public void setTraversalBefore(AccessibilityNodeInfo info)
Sets the view before whose node this one should be visited during traversal. This may be useful for configuring traversal order in tests before the corresponding views have been inflated.- Parameters:
info- The view providing the preceding node.- See Also:
getTraversalBefore()
-
setSource
@Implementation protected void setSource(View source)
-
setSource
@Implementation protected void setSource(View root, int virtualDescendantId)
-
getWindow
@Implementation(minSdk=21) protected AccessibilityWindowInfo getWindow()
-
getWindowId
@Implementation protected int getWindowId()
Returns the id of the window from which the info comes.
-
setAccessibilityWindowInfo
public void setAccessibilityWindowInfo(AccessibilityWindowInfo info)
-
performAction
@Implementation protected boolean performAction(int action)
-
performAction
@Implementation protected boolean performAction(int action, Bundle arguments)
-
equals
@Implementation public boolean equals(Object object)
Equality check based on reference equality of the Views from which these instances were created, or the equality of their assigned IDs.
-
addChild
public void addChild(AccessibilityNodeInfo child)
Add a child node to this one. Also initializes the parent field of the child.- Parameters:
child- The node to be added as a child.
-
addChild
@Implementation protected void addChild(View child)
-
addChild
@Implementation protected void addChild(View root, int virtualDescendantId)
-
getPerformedActions
public List<Integer> getPerformedActions()
- Returns:
- The list of arguments for the various calls to performAction. Unmodifiable.
-
getPerformedActionsWithArgs
public List<Pair<Integer,Bundle>> getPerformedActionsWithArgs()
- Returns:
- The list of arguments for the various calls to performAction. Unmodifiable.
-
describeContents
@Implementation protected int describeContents()
-
writeToParcel
@Implementation protected void writeToParcel(Parcel dest, int flags)
-
setOnPerformActionListener
public void setOnPerformActionListener(ShadowAccessibilityNodeInfo.OnPerformActionListener listener)
Configure the return result of an action if it is performed- Parameters:
listener- The listener.
-
-