PositionAssertions

public final class PositionAssertions
extends Object

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


A collection of ViewAssertions for checking relative position of elements on the screen.

Summary

Public methods

static ViewAssertion isAbove(Matcher<View> matcher)

Returns an Assertion that asserts that view displayed is completely above the view matching the given matcher.

static ViewAssertion isBelow(Matcher<View> matcher)

Returns a ViewAssertion that asserts that view displayed is completely below the view matching the given matcher.

static ViewAssertion isBottomAlignedWith(Matcher<View> matcher)

Returns a ViewAssertion that asserts that view displayed is completely aligned to bottom with the view matching the given matcher.

static ViewAssertion isLeftAlignedWith(Matcher<View> matcher)

Returns a ViewAssertion that asserts that view displayed is completely aligned to the left as the view matching the given matcher.

static ViewAssertion isLeftOf(Matcher<View> matcher)

Returns a ViewAssertion that asserts that view displayed is completely left of the view matching the given matcher.

static ViewAssertion isRightAlignedWith(Matcher<View> matcher)

Returns a ViewAssertion that asserts that view displayed is completely aligned to the right as the view matching the given matcher.

static ViewAssertion isRightOf(Matcher<View> matcher)

Returns a ViewAssertion that asserts that view displayed is completely right of the view matching the given matcher.

static ViewAssertion isTopAlignedWith(Matcher<View> matcher)

Returns a ViewAssertion that asserts that view displayed is completely aligned to top with the view matching the given matcher.

Inherited methods

From class java.lang.Object

Public methods

isAbove

ViewAssertion isAbove (Matcher<View> matcher)

Returns an Assertion that asserts that view displayed is completely above the view matching the given 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)

Returns a ViewAssertion that asserts that view displayed is completely below the view matching the given 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.

isBottomAlignedWith

ViewAssertion isBottomAlignedWith (Matcher<View> matcher)

Returns a ViewAssertion that asserts that view displayed is completely aligned to bottom with the view matching the given matcher.

The bottom 'y' coordinate of the view displayed must equal the bottom 'y' coordinate of the view matching the given matcher.

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)

Returns a ViewAssertion that asserts that view displayed is completely aligned to the left as the view matching the given matcher.

The left 'x' coordinate of the view displayed must equal the left 'x' coordinate of the view matching the given matcher.

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)

Returns a ViewAssertion that asserts that view displayed is completely left of the view matching the given matcher.

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)

Returns a ViewAssertion that asserts that view displayed is completely aligned to the right as the view matching the given matcher.

The right 'x' coordinate of the view displayed must equal the right 'x' coordinate of the view matching the given matcher.

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)

Returns a ViewAssertion that asserts that view displayed is completely right of the view matching the given matcher.

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)

Returns a ViewAssertion that asserts that view displayed is completely aligned to top with the view matching the given matcher.

The top 'y' coordinate of the view displayed must equal the top 'y' coordinate of the view matching the given matcher.

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.