PositionAssertions

public final class PositionAssertions
extends Object

java.lang.Object
   ↳ android.support.test.espresso.assertion.PositionAssertions


一组 ViewAssertion s用于检查屏幕上元素的相对位置。

Summary

Public methods

static ViewAssertion isAbove(Matcher<View> matcher)

返回断言,断言所显示的视图完全位于匹配给定匹配器的视图之上。

static ViewAssertion isBelow(Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全位于匹配给定匹配器的视图之下。

static ViewAssertion isBottomAlignedWith(Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全对齐到视图与给定匹配器匹配的底部。

static ViewAssertion isLeftAlignedWith(Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全与左侧对齐,作为匹配给定匹配器的视图。

static ViewAssertion isLeftOf(Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全位于匹配给定匹配器的视图的左侧。

static ViewAssertion isRightAlignedWith(Matcher<View> matcher)

返回一个 ViewAssertion ,声明所显示的视图完全对齐到与给定匹配器匹配的视图的右侧。

static ViewAssertion isRightOf(Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全匹配给定匹配器的视图的右侧。

static ViewAssertion isTopAlignedWith(Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全对齐到匹配给定匹配器的视图顶部。

Inherited methods

From class java.lang.Object

Public methods

isAbove

ViewAssertion isAbove (Matcher<View> matcher)

返回断言,断言所显示的视图完全位于匹配给定匹配器的视图之上。

Parameters
matcher Matcher
Returns
ViewAssertion
Throws
if there is more than 1 pixel of vertical overlap.
AmbiguousViewMatcherException if more than one view matches the given matcher.
NoMatchingViewException if no views match the given matcher.

isBelow

ViewAssertion isBelow (Matcher<View> matcher)

返回一个 ViewAssertion ,声明所显示的视图完全位于匹配给定匹配器的视图之下。

Parameters
matcher Matcher
Returns
ViewAssertion
Throws
if there is more than 1 pixel of vertical overlap.
AmbiguousViewMatcherException if more than one view matches the given matcher.
NoMatchingViewException if no views match the given matcher.

isBottomAlignedWith

ViewAssertion isBottomAlignedWith (Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全对齐到视图与给定匹配器匹配的底部。

显示视图的底部'y'坐标必须等于匹配给定匹配器的视图的底部'y'坐标。

Parameters
matcher Matcher
Returns
ViewAssertion
Throws
if the views are not aligned bottom.
AmbiguousViewMatcherException if more than one view matches the given matcher.
NoMatchingViewException if no views match the given matcher.

isLeftAlignedWith

ViewAssertion isLeftAlignedWith (Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全与左侧相匹配,以匹配给定的匹配器。

显示视图的左侧'x'坐标必须等于匹配给定匹配器的视图的左侧'x'坐标。

Parameters
matcher Matcher
Returns
ViewAssertion
Throws
if the views are not aligned to the left.
AmbiguousViewMatcherException if more than one view matches the given matcher.
NoMatchingViewException if no views match the given matcher.

isLeftOf

ViewAssertion isLeftOf (Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全位于匹配给定匹配器的视图的左侧。

Parameters
matcher Matcher
Returns
ViewAssertion
Throws
if there is more than 1 pixel of horizontal overlap.
AmbiguousViewMatcherException if more than one view matches the given matcher.
NoMatchingViewException if no views match the given matcher.

isRightAlignedWith

ViewAssertion isRightAlignedWith (Matcher<View> matcher)

返回一个 ViewAssertion ,声明所显示的视图与匹配给定匹配器的视图完全对齐。

所显示视图的右侧'x'坐标必须等于匹配给定匹配器的视图的右侧'x'坐标。

Parameters
matcher Matcher
Returns
ViewAssertion
Throws
if the views are not aligned to the right.
AmbiguousViewMatcherException if more than one view matches the given matcher.
NoMatchingViewException if no views match the given matcher.

isRightOf

ViewAssertion isRightOf (Matcher<View> matcher)

返回一个 ViewAssertion ,它声明所显示的视图完全匹配给定匹配器的视图的右侧。

Parameters
matcher Matcher
Returns
ViewAssertion
Throws
if there is more than 1 pixel of horizontal overlap.
AmbiguousViewMatcherException if more than one view matches the given matcher.
NoMatchingViewException if no views match the given matcher.

isTopAlignedWith

ViewAssertion isTopAlignedWith (Matcher<View> matcher)

返回一个 ViewAssertion ,声明所显示的视图完全与顶部匹配的给定匹配的视图。

所显示视图的顶部'y'坐标必须等于匹配给定匹配器的视图的顶部'y'坐标。

Parameters
matcher Matcher
Returns
ViewAssertion
Throws
if the views are not aligned top.
AmbiguousViewMatcherException if more than one view matches the given matcher.
NoMatchingViewException if no views match the given matcher.