@Implements(value=android.view.View.class) public class ShadowView extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ShadowView.WindowIdHelper |
Modifier and Type | Field and Description |
---|---|
protected android.util.AttributeSet |
attributeSet |
protected android.view.View |
realView |
android.graphics.Point |
scrollToCoordinates |
Constructor and Description |
---|
ShadowView() |
Modifier and Type | Method and Description |
---|---|
protected void |
__constructor__(android.content.Context context,
android.util.AttributeSet attributeSet,
int defStyle) |
void |
callOnAttachedToWindow() |
void |
callOnDetachedFromWindow() |
boolean |
checkedPerformClick()
Utility method for clicking on views exposing testing scenarios that are not possible when using the actual app.
|
void |
clearWasInvalidated()
Clears the wasInvalidated flag
|
static boolean |
clickOn(android.view.View view)
Calls
performClick() on a View after ensuring that it and its ancestors are visible and that it is enabled. |
boolean |
didRequestLayout() |
protected void |
draw(android.graphics.Canvas canvas) |
void |
dump()
Dumps the status of this
View to System.out |
void |
dump(java.io.PrintStream out,
int indent)
Dumps the status of this
View to System.out at the given indentation level |
static void |
dump(android.view.View view)
Emits an xml-like representation of the view to System.out.
|
protected void |
dumpAttribute(java.io.PrintStream out,
java.lang.String name,
java.lang.String value) |
protected void |
dumpAttributes(java.io.PrintStream out) |
protected void |
dumpFirstPart(java.io.PrintStream out,
int indent) |
protected void |
dumpIndent(java.io.PrintStream out,
int indent) |
protected boolean |
getGlobalVisibleRect(android.graphics.Rect rect,
android.graphics.Point globalOffset) |
android.view.MotionEvent |
getLastTouchEvent() |
protected int |
getLayerType() |
android.view.View.OnClickListener |
getOnClickListener() |
android.view.View.OnCreateContextMenuListener |
getOnCreateContextMenuListener() |
android.view.View.OnLongClickListener |
getOnLongClickListener() |
android.view.View.OnSystemUiVisibilityChangeListener |
getOnSystemUiVisibilityChangeListener() |
android.view.View.OnTouchListener |
getOnTouchListener() |
protected int |
getScrollX() |
protected int |
getScrollY() |
protected android.view.WindowId |
getWindowId() |
java.lang.String |
innerText()
Returns a string representation of this
View . |
static java.lang.String |
innerText(android.view.View view)
Returns the text contained within this view.
|
protected void |
invalidate() |
protected boolean |
isAttachedToWindow() |
int |
lastHapticFeedbackPerformed() |
protected void |
onLayout(boolean changed,
int left,
int top,
int right,
int bottom) |
boolean |
onLayoutWasCalled() |
protected boolean |
onTouchEvent(android.view.MotionEvent event) |
protected boolean |
performHapticFeedback(int hapticFeedbackType) |
protected boolean |
post(java.lang.Runnable action) |
protected boolean |
postDelayed(java.lang.Runnable action,
long delayMills) |
protected void |
postInvalidateDelayed(long delayMilliseconds) |
protected boolean |
removeCallbacks(java.lang.Runnable callback) |
protected void |
requestLayout() |
protected void |
scrollBy(int x,
int y) |
protected void |
scrollTo(int x,
int y) |
protected void |
setAnimation(android.view.animation.Animation animation) |
void |
setDidRequestLayout(boolean didRequestLayout) |
void |
setGlobalVisibleRect(android.graphics.Rect rect) |
protected void |
setLayerType(int layerType,
android.graphics.Paint paint) |
void |
setMyParent(android.view.ViewParent viewParent) |
protected void |
setOnClickListener(android.view.View.OnClickListener onClickListener) |
protected void |
setOnCreateContextMenuListener(android.view.View.OnCreateContextMenuListener onCreateContextMenuListener) |
protected void |
setOnFocusChangeListener(android.view.View.OnFocusChangeListener l) |
protected void |
setOnLongClickListener(android.view.View.OnLongClickListener onLongClickListener) |
protected void |
setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener onSystemUiVisibilityChangeListener) |
protected void |
setOnTouchListener(android.view.View.OnTouchListener onTouchListener) |
protected void |
setScrollX(int scrollX) |
protected void |
setScrollY(int scrollY) |
void |
setViewFocus(boolean hasFocus) |
static java.lang.String |
visualize(android.view.View view)
Returns a textual representation of the appearance of the object.
|
boolean |
wasInvalidated() |
@RealObject protected android.view.View realView
protected android.util.AttributeSet attributeSet
public android.graphics.Point scrollToCoordinates
public static boolean clickOn(android.view.View view)
Calls performClick()
on a View
after ensuring that it and its ancestors are visible and that it is enabled.
view
- the view to click onView.OnClickListener
s were found and fired, false otherwise.java.lang.RuntimeException
- if the preconditions are not met.public static java.lang.String visualize(android.view.View view)
Returns a textual representation of the appearance of the object.
view
- the view to visualizepublic static void dump(android.view.View view)
Emits an xml-like representation of the view to System.out.
view
- the view to dumppublic static java.lang.String innerText(android.view.View view)
Returns the text contained within this view.
view
- the view to scan for text@Implementation protected void __constructor__(android.content.Context context, android.util.AttributeSet attributeSet, int defStyle)
@Implementation protected void setLayerType(int layerType, android.graphics.Paint paint)
@Implementation protected void setOnFocusChangeListener(android.view.View.OnFocusChangeListener l)
@Implementation protected void setOnClickListener(android.view.View.OnClickListener onClickListener)
@Implementation protected void setOnLongClickListener(android.view.View.OnLongClickListener onLongClickListener)
@Implementation protected void setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener onSystemUiVisibilityChangeListener)
@Implementation protected void setOnCreateContextMenuListener(android.view.View.OnCreateContextMenuListener onCreateContextMenuListener)
@Implementation protected void draw(android.graphics.Canvas canvas)
@Implementation protected void onLayout(boolean changed, int left, int top, int right, int bottom)
public boolean onLayoutWasCalled()
@Implementation protected void requestLayout()
public boolean didRequestLayout()
public void setDidRequestLayout(boolean didRequestLayout)
public void setViewFocus(boolean hasFocus)
@Implementation protected void invalidate()
@Implementation protected boolean onTouchEvent(android.view.MotionEvent event)
@Implementation protected void setOnTouchListener(android.view.View.OnTouchListener onTouchListener)
public android.view.MotionEvent getLastTouchEvent()
public java.lang.String innerText()
Returns a string representation of this View
. Unless overridden, it will be an empty string.
Robolectric extension.
public void dump()
Dumps the status of this View
to System.out
public void dump(java.io.PrintStream out, int indent)
Dumps the status of this View
to System.out
at the given indentation level
out
- Output stream.indent
- Indentation level.protected void dumpFirstPart(java.io.PrintStream out, int indent)
protected void dumpAttributes(java.io.PrintStream out)
protected void dumpAttribute(java.io.PrintStream out, java.lang.String name, java.lang.String value)
protected void dumpIndent(java.io.PrintStream out, int indent)
public boolean wasInvalidated()
invalidate()
has been calledpublic void clearWasInvalidated()
Clears the wasInvalidated flag
public boolean checkedPerformClick()
Utility method for clicking on views exposing testing scenarios that are not possible when using the actual app.
java.lang.RuntimeException
- if the view is disabled or if the view or any of its parents are not visible.public android.view.View.OnTouchListener getOnTouchListener()
public android.view.View.OnClickListener getOnClickListener()
public android.view.View.OnLongClickListener getOnLongClickListener()
public android.view.View.OnSystemUiVisibilityChangeListener getOnSystemUiVisibilityChangeListener()
public android.view.View.OnCreateContextMenuListener getOnCreateContextMenuListener()
@Implementation protected boolean post(java.lang.Runnable action)
@Implementation protected boolean postDelayed(java.lang.Runnable action, long delayMills)
@Implementation protected void postInvalidateDelayed(long delayMilliseconds)
@Implementation protected boolean removeCallbacks(java.lang.Runnable callback)
@Implementation protected void scrollTo(int x, int y)
@Implementation protected void scrollBy(int x, int y)
@Implementation protected int getScrollX()
@Implementation protected int getScrollY()
@Implementation protected void setScrollX(int scrollX)
@Implementation protected void setScrollY(int scrollY)
@Implementation protected int getLayerType()
@Implementation protected void setAnimation(android.view.animation.Animation animation)
@Implementation(minSdk=19) protected boolean isAttachedToWindow()
public void callOnAttachedToWindow()
public void callOnDetachedFromWindow()
@Implementation(minSdk=18) protected android.view.WindowId getWindowId()
@Implementation protected boolean performHapticFeedback(int hapticFeedbackType)
@Implementation protected boolean getGlobalVisibleRect(android.graphics.Rect rect, android.graphics.Point globalOffset)
public void setGlobalVisibleRect(android.graphics.Rect rect)
public int lastHapticFeedbackPerformed()
public void setMyParent(android.view.ViewParent viewParent)