public final class

PositionAssertions

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

Class Overview

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.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public static ViewAssertion isAbove (Matcher<View> matcher)

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

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.

public static ViewAssertion isBelow (Matcher<View> matcher)

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

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.

public 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.

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

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.

public 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.

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

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.

public static ViewAssertion isLeftOf (Matcher<View> matcher)

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

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.

public 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.

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

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.

public static ViewAssertion isRightOf (Matcher<View> matcher)

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

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.

public 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.

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

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.