Most visited

Recently visited

Added in API level 1
Deprecated since API level 24

ViewAsserts

public class ViewAsserts
extends Object

java.lang.Object
   ↳ android.test.ViewAsserts


此类在API级别24中已被弃用。
改为使用Espresso View Matchers 新的测试应该使用Android Testing Support Library编写 有关UI测试的更多信息,请参加Espresso UI testing培训。

一些有用的观点断言。

Summary

Public methods

static void assertBaselineAligned(View first, View second)

断言两个视图在他们的基线上对齐,那就是他们的基线位于相同的y位置。

static void assertBottomAligned(View first, View second, int margin)

断言两个视图是底部对齐的,也就是说它们的底部边缘位于相同的y位置,相对于指定的边距。

static void assertBottomAligned(View first, View second)

断言两个视图是底部对齐的,也就是说它们的底部边缘位于相同的y位置。

static void assertGroupContains(ViewGroup parent, View child)

断言指定的组只包含一次特定的小孩一次。

static void assertGroupIntegrity(ViewGroup parent)

断言指定的组的完整性。

static void assertGroupNotContains(ViewGroup parent, View child)

断言指定的组不包含特定的子项。

static void assertHasScreenCoordinates(View origin, View view, int x, int y)

断言视图在可见屏幕上具有特定的x和y位置。

static void assertHorizontalCenterAligned(View reference, View test)

断言 test视图是水平中心相对于所述对准 reference视图。

static void assertLeftAligned(View first, View second)

断言两个视图左对齐,即他们的左边缘位于同一个x位置。

static void assertLeftAligned(View first, View second, int margin)

断言两个视图左对齐,即相对于指定的边距,它们的左边缘位于相同的x位置。

static void assertOffScreenAbove(View origin, View view)

断言该视图位于可见屏幕上方。

static void assertOffScreenBelow(View origin, View view)

断言该视图位于可见屏幕下方。

static void assertOnScreen(View origin, View view)

断言该视图在屏幕上。

static void assertRightAligned(View first, View second, int margin)

断言两个视图是右对齐的,也就是说它们的右边在相同的x位置上,相对于指定的边距。

static void assertRightAligned(View first, View second)

断言两个视图是右对齐的,也就是说他们的右边缘位于同一个x位置。

static void assertTopAligned(View first, View second, int margin)

断言两个视图是顶部对齐的,也就是说它们的顶部边缘相对于指定的边距位于相同的y位置。

static void assertTopAligned(View first, View second)

断言两个视图是顶部对齐的,也就是说它们的顶部边缘位于相同的y位置。

static void assertVerticalCenterAligned(View reference, View test)

断言 test视图是相对于该垂直对齐中心 reference图。

Inherited methods

From class java.lang.Object

Public methods

assertBaselineAligned

Added in API level 1
void assertBaselineAligned (View first, 
                View second)

断言两个视图在他们的基线上对齐,那就是他们的基线位于相同的y位置。

Parameters
first View: The first view
second View: The second view

assertBottomAligned

Added in API level 1
void assertBottomAligned (View first, 
                View second, 
                int margin)

断言两个视图是底部对齐的,也就是说它们的底部边缘位于相同的y位置,相对于指定的边距。

Parameters
first View: The first view
second View: The second view
margin int: The margin between the first view and the second view

assertBottomAligned

Added in API level 1
void assertBottomAligned (View first, 
                View second)

断言两个视图是底部对齐的,也就是说它们的底部边缘位于相同的y位置。

Parameters
first View: The first view
second View: The second view

assertGroupContains

Added in API level 1
void assertGroupContains (ViewGroup parent, 
                View child)

断言指定的组只包含一次特定的小孩一次。

Parameters
parent ViewGroup: The group
child View: The child that should belong to group

assertGroupIntegrity

Added in API level 1
void assertGroupIntegrity (ViewGroup parent)

断言指定的组的完整性。 孩子的数量应该> = 0,每个孩子都应该是非空的。

Parameters
parent ViewGroup: The group whose integrity to check

assertGroupNotContains

Added in API level 1
void assertGroupNotContains (ViewGroup parent, 
                View child)

断言指定的组不包含特定的子项。

Parameters
parent ViewGroup: The group
child View: The child that should not belong to group

assertHasScreenCoordinates

Added in API level 1
void assertHasScreenCoordinates (View origin, 
                View view, 
                int x, 
                int y)

断言视图在可见屏幕上具有特定的x和y位置。

Parameters
origin View: The root view of the screen.
view View: The view.
x int: The expected x coordinate.
y int: The expected y coordinate.

assertHorizontalCenterAligned

Added in API level 1
void assertHorizontalCenterAligned (View reference, 
                View test)

断言 test视图是水平中心相对于所述对准 reference视图。

Parameters
reference View: The reference view
test View: The view that should be center aligned with the reference view

assertLeftAligned

Added in API level 1
void assertLeftAligned (View first, 
                View second)

断言两个视图左对齐,即他们的左边缘位于同一个x位置。

Parameters
first View: The first view
second View: The second view

assertLeftAligned

Added in API level 1
void assertLeftAligned (View first, 
                View second, 
                int margin)

断言两个视图左对齐,即相对于指定的边距,它们的左边缘位于相同的x位置。

Parameters
first View: The first view
second View: The second view
margin int: The margin between the first view and the second view

assertOffScreenAbove

Added in API level 1
void assertOffScreenAbove (View origin, 
                View view)

断言该视图位于可见屏幕上方。

Parameters
origin View: Te root view of the screen.
view View: The view

assertOffScreenBelow

Added in API level 1
void assertOffScreenBelow (View origin, 
                View view)

断言该视图位于可见屏幕下方。

Parameters
origin View: The root view of the screen.
view View: The view

assertOnScreen

Added in API level 1
void assertOnScreen (View origin, 
                View view)

断言该视图在屏幕上。

Parameters
origin View: The root view of the screen.
view View: The view.

assertRightAligned

Added in API level 1
void assertRightAligned (View first, 
                View second, 
                int margin)

断言两个视图是右对齐的,也就是说它们的右边在相同的x位置上,相对于指定的边距。

Parameters
first View: The first view
second View: The second view
margin int: The margin between the first view and the second view

assertRightAligned

Added in API level 1
void assertRightAligned (View first, 
                View second)

断言两个视图是右对齐的,也就是说他们的右边缘位于同一个x位置。

Parameters
first View: The first view
second View: The second view

assertTopAligned

Added in API level 1
void assertTopAligned (View first, 
                View second, 
                int margin)

断言两个视图是顶部对齐的,也就是说它们的顶部边缘相对于指定的边距位于相同的y位置。

Parameters
first View: The first view
second View: The second view
margin int: The margin between the first view and the second view

assertTopAligned

Added in API level 1
void assertTopAligned (View first, 
                View second)

断言两个视图是顶部对齐的,也就是说它们的顶部边缘位于相同的y位置。

Parameters
first View: The first view
second View: The second view

assertVerticalCenterAligned

Added in API level 1
void assertVerticalCenterAligned (View reference, 
                View test)

断言 test视图是相对于该垂直对齐中心 reference图。

Parameters
reference View: The reference view
test View: The view that should be center aligned with the reference view

Hooray!