@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 |
---|---|
void |
__constructor__(android.content.Context context,
android.util.AttributeSet attributeSet,
int defStyle) |
protected android.graphics.drawable.Drawable |
buildDrawable(int resourceId)
Build drawable, either LayerDrawable or BitmapDrawable.
|
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. |
void |
computeOpaqueFlags() |
boolean |
didRequestLayout() |
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) |
int |
getBackgroundColor()
Deprecated.
Use FEST assertions instead.
|
int |
getBackgroundResourceId()
Deprecated.
Use FEST assertions instead.
|
android.graphics.Bitmap |
getDrawingCache() |
boolean |
getGlobalVisibleRect(android.graphics.Rect rect,
android.graphics.Point globalOffset) |
android.view.MotionEvent |
getLastTouchEvent() |
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 java.lang.String |
getQualifiers()
Deprecated.
|
int |
getScrollX() |
int |
getScrollY() |
java.lang.Object |
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.
|
void |
invalidate() |
boolean |
isAttachedToWindow() |
int |
lastHapticFeedbackPerformed() |
void |
onLayout(boolean changed,
int left,
int top,
int right,
int bottom) |
boolean |
onLayoutWasCalled() |
boolean |
onTouchEvent(android.view.MotionEvent event) |
boolean |
performHapticFeedback(int hapticFeedbackType) |
void |
post(java.lang.Runnable action) |
void |
postDelayed(java.lang.Runnable action,
long delayMills) |
void |
postInvalidateDelayed(long delayMilliseconds) |
void |
removeCallbacks(java.lang.Runnable callback) |
void |
requestLayout() |
void |
scrollTo(int x,
int y) |
void |
setAnimation(android.view.animation.Animation animation) |
void |
setDidRequestLayout(boolean didRequestLayout) |
void |
setGlobalVisibleRect(android.graphics.Rect rect) |
void |
setMyParent(android.view.ViewParent viewParent) |
void |
setOnClickListener(android.view.View.OnClickListener onClickListener) |
void |
setOnCreateContextMenuListener(android.view.View.OnCreateContextMenuListener onCreateContextMenuListener) |
void |
setOnFocusChangeListener(android.view.View.OnFocusChangeListener l) |
void |
setOnLongClickListener(android.view.View.OnLongClickListener onLongClickListener) |
void |
setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener onSystemUiVisibilityChangeListener) |
void |
setOnTouchListener(android.view.View.OnTouchListener onTouchListener) |
void |
setScrollX(int scrollX) |
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 public void __constructor__(android.content.Context context, android.util.AttributeSet attributeSet, int defStyle)
protected android.graphics.drawable.Drawable buildDrawable(int resourceId)
Build drawable, either LayerDrawable or BitmapDrawable.
resourceId
- Resource id@Deprecated protected java.lang.String getQualifiers()
This will be removed in Robolectric 3.4 use RuntimeEnvironment.getQualifiers()
instead, however the correct way to configure qualifiers is using Config.qualifiers()
so a constant can be used if this is important to your tests. However, qualifier strings are typically just used to initialize the test environment in a certain configuration. Configuration
changes should be managed through ActivityController.configurationChange(android.content.res.Configuration)
@Deprecated public int getBackgroundResourceId()
@Deprecated public int getBackgroundColor()
@HiddenApi @Implementation public void computeOpaqueFlags()
@Implementation public void setOnFocusChangeListener(android.view.View.OnFocusChangeListener l)
@Implementation public void setOnClickListener(android.view.View.OnClickListener onClickListener)
@Implementation public void setOnLongClickListener(android.view.View.OnLongClickListener onLongClickListener)
@Implementation public void setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener onSystemUiVisibilityChangeListener)
@Implementation public void setOnCreateContextMenuListener(android.view.View.OnCreateContextMenuListener onCreateContextMenuListener)
@Implementation public void draw(android.graphics.Canvas canvas)
@Implementation public void onLayout(boolean changed, int left, int top, int right, int bottom)
public boolean onLayoutWasCalled()
@Implementation public void requestLayout()
public boolean didRequestLayout()
public void setDidRequestLayout(boolean didRequestLayout)
public void setViewFocus(boolean hasFocus)
@Implementation public void invalidate()
@Implementation public boolean onTouchEvent(android.view.MotionEvent event)
@Implementation public 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 public android.graphics.Bitmap getDrawingCache()
@Implementation public void post(java.lang.Runnable action)
@Implementation public void postDelayed(java.lang.Runnable action, long delayMills)
@Implementation public void postInvalidateDelayed(long delayMilliseconds)
@Implementation public void removeCallbacks(java.lang.Runnable callback)
@Implementation public void scrollTo(int x, int y)
@Implementation public int getScrollX()
@Implementation public int getScrollY()
@Implementation public void setScrollX(int scrollX)
@Implementation public void setScrollY(int scrollY)
@Implementation public void setAnimation(android.view.animation.Animation animation)
@Implementation public boolean isAttachedToWindow()
public void callOnAttachedToWindow()
public void callOnDetachedFromWindow()
@Implementation(minSdk=18) public java.lang.Object getWindowId()
@Implementation public boolean performHapticFeedback(int hapticFeedbackType)
@Implementation public 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)