本文整理汇总了Java中android.support.test.espresso.action.GeneralSwipeAction类的典型用法代码示例。如果您正苦于以下问题:Java GeneralSwipeAction类的具体用法?Java GeneralSwipeAction怎么用?Java GeneralSwipeAction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GeneralSwipeAction类属于android.support.test.espresso.action包,在下文中一共展示了GeneralSwipeAction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSwipeUpToExpand
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
@Test
@MediumTest
public void testSwipeUpToExpand() {
Espresso.onView(ViewMatchers.withId(R.id.bottom_sheet))
.perform(
DesignViewActions.withCustomConstraints(
new GeneralSwipeAction(
Swipe.FAST,
GeneralLocation.VISIBLE_CENTER,
new CoordinatesProvider() {
@Override
public float[] calculateCoordinates(View view) {
return new float[] {view.getWidth() / 2, 0};
}
},
Press.FINGER),
ViewMatchers.isDisplayingAtLeast(5)));
registerIdlingResourceCallback();
try {
Espresso.onView(ViewMatchers.withId(R.id.bottom_sheet))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()));
assertThat(getBehavior().getState(), is(BottomSheetBehavior.STATE_EXPANDED));
} finally {
unregisterIdlingResourceCallback();
}
}
开发者ID:material-components,项目名称:material-components-android,代码行数:27,代码来源:BottomSheetBehaviorTest.java
示例2: testNewNoteFromQuickMenuWhenCabIsDisplayed
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
@Test
public void testNewNoteFromQuickMenuWhenCabIsDisplayed() {
shelfTestUtils.setupBook("booky", "Booky Preface\n* 1\n** 2\n*** 3\n*** 4\n** 5\n* 6");
activityRule.launchActivity(null);
onView(allOf(withText("booky"), isDisplayed())).perform(click());
onView(withId(R.id.action_context_bar)).check(matches(not(isDisplayed())));
onListItem(2).perform(longClick());
/* Swipe left. */
onListItem(2).perform(new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER, GeneralLocation.CENTER_LEFT, Press.FINGER));
onView(withId(R.id.action_context_bar)).check(matches(isDisplayed()));
onListItem(2).onChildView(withId(R.id.item_menu_new_under_btn)).perform(click());
onView(withId(R.id.fragment_note_title)).check(matches(isDisplayed()));
onView(withId(R.id.done)).check(matches(isDisplayed()));
onView(withId(R.id.action_context_bar)).check(matches(not(isDisplayed())));
}
开发者ID:orgzly,项目名称:orgzly-android,代码行数:17,代码来源:NewNoteTest.java
示例3: swipeRightNotReachingThreshold
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
static ViewAction swipeRightNotReachingThreshold(Context context) {
final float x = getWidthScreen(context) * 0.3f;
return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.TOP_LEFT, new CoordinatesProvider() {
@Override public float[] calculateCoordinates(View view) {
return new float[] {x, 0f};
}
}, Press.FINGER);
}
开发者ID:VictorAlbertos,项目名称:SwipeCoordinator,代码行数:9,代码来源:ViewActions.java
示例4: swipeRightReachingThreshold
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
static ViewAction swipeRightReachingThreshold(Context context) {
final float x = getWidthScreen(context) * 0.8f;
return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.TOP_LEFT, new CoordinatesProvider() {
@Override public float[] calculateCoordinates(View view) {
return new float[] {x, 0f};
}
}, Press.FINGER);
}
开发者ID:VictorAlbertos,项目名称:SwipeCoordinator,代码行数:9,代码来源:ViewActions.java
示例5: swipeDownNotReachingThreshold
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
static ViewAction swipeDownNotReachingThreshold(Context context) {
final float y = getHeightScreen(context) * 0.3f;
return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.TOP_LEFT, new CoordinatesProvider() {
@Override public float[] calculateCoordinates(View view) {
return new float[] {0f, y};
}
}, Press.FINGER);
}
开发者ID:VictorAlbertos,项目名称:SwipeCoordinator,代码行数:9,代码来源:ViewActions.java
示例6: swipeDownReachingThreshold
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
static ViewAction swipeDownReachingThreshold(Context context) {
final float y = getHeightScreen(context) * 0.8f;
return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.TOP_LEFT, new CoordinatesProvider() {
@Override public float[] calculateCoordinates(View view) {
return new float[] {0f, y};
}
}, Press.FINGER);
}
开发者ID:VictorAlbertos,项目名称:SwipeCoordinator,代码行数:9,代码来源:ViewActions.java
示例7: swipeUp
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
public static ViewAction swipeUp(final Swiper swipe) {
return ViewActions.actionWithAssertions(new GeneralSwipeAction(
swipe,
GeneralLocation.CENTER,
GeneralLocation.TOP_CENTER,
Press.FINGER
));
}
开发者ID:sephiroth74,项目名称:Material-BottomNavigation,代码行数:9,代码来源:ViewActionsCompat.java
示例8: swipeDown
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
public static ViewAction swipeDown(final Swiper swipe) {
return ViewActions.actionWithAssertions(new GeneralSwipeAction(
swipe,
GeneralLocation.CENTER,
GeneralLocation.BOTTOM_CENTER,
Press.FINGER
));
}
开发者ID:sephiroth74,项目名称:Material-BottomNavigation,代码行数:9,代码来源:ViewActionsCompat.java
示例9: testHalfExpandedToExpanded
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
@Test
@MediumTest
public void testHalfExpandedToExpanded() throws Throwable {
getBehavior().setFitToContents(false);
checkSetState(BottomSheetBehavior.STATE_HALF_EXPANDED, ViewMatchers.isDisplayed());
Espresso.onView(ViewMatchers.withId(R.id.bottom_sheet))
.perform(
DesignViewActions.withCustomConstraints(
new GeneralSwipeAction(
Swipe.FAST,
GeneralLocation.VISIBLE_CENTER,
new CoordinatesProvider() {
@Override
public float[] calculateCoordinates(View view) {
return new float[] {view.getWidth() / 2, 0};
}
},
Press.FINGER),
ViewMatchers.isDisplayingAtLeast(5)));
registerIdlingResourceCallback();
try {
Espresso.onView(ViewMatchers.withId(R.id.bottom_sheet))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()));
assertThat(getBehavior().getState(), is(BottomSheetBehavior.STATE_EXPANDED));
} finally {
unregisterIdlingResourceCallback();
}
}
开发者ID:material-components,项目名称:material-components-android,代码行数:29,代码来源:BottomSheetBehaviorTest.java
示例10: testCollapsedToExpanded
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
@Test
@MediumTest
public void testCollapsedToExpanded() throws Throwable {
getBehavior().setFitToContents(false);
checkSetState(BottomSheetBehavior.STATE_COLLAPSED, ViewMatchers.isDisplayed());
Espresso.onView(ViewMatchers.withId(R.id.bottom_sheet))
.perform(
DesignViewActions.withCustomConstraints(
new GeneralSwipeAction(
Swipe.FAST,
GeneralLocation.VISIBLE_CENTER,
new CoordinatesProvider() {
@Override
public float[] calculateCoordinates(View view) {
return new float[] {view.getWidth() / 2, 0};
}
},
Press.FINGER),
ViewMatchers.isDisplayingAtLeast(5)));
registerIdlingResourceCallback();
try {
Espresso.onView(ViewMatchers.withId(R.id.bottom_sheet))
.check(ViewAssertions.matches(ViewMatchers.isDisplayed()));
assertThat(getBehavior().getState(), is(BottomSheetBehavior.STATE_EXPANDED));
} finally {
unregisterIdlingResourceCallback();
}
}
开发者ID:material-components,项目名称:material-components-android,代码行数:29,代码来源:BottomSheetBehaviorTest.java
示例11: testInvisible
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
@Test
@MediumTest
public void testInvisible() throws Throwable {
// Make the bottomsheet invisible
activityTestRule.runOnUiThread(
new Runnable() {
@Override
public void run() {
getBottomSheet().setVisibility(View.INVISIBLE);
assertThat(getBehavior().getState(), is(BottomSheetBehavior.STATE_COLLAPSED));
}
});
// Swipe up as if to expand it
Espresso.onView(ViewMatchers.withId(R.id.bottom_sheet))
.perform(
DesignViewActions.withCustomConstraints(
new GeneralSwipeAction(
Swipe.FAST,
GeneralLocation.VISIBLE_CENTER,
new CoordinatesProvider() {
@Override
public float[] calculateCoordinates(View view) {
return new float[] {view.getWidth() / 2, 0};
}
},
Press.FINGER),
not(ViewMatchers.isDisplayed())));
// Check that the bottom sheet stays the same collapsed state
activityTestRule.runOnUiThread(
new Runnable() {
@Override
public void run() {
assertThat(getBehavior().getState(), is(BottomSheetBehavior.STATE_COLLAPSED));
}
});
}
开发者ID:material-components,项目名称:material-components-android,代码行数:37,代码来源:BottomSheetBehaviorTest.java
示例12: swipeAwayRight
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
ViewAction swipeAwayRight() {
return actionWithAssertions(new GeneralSwipeAction(Swipe.FAST,
GeneralLocation.CENTER,
new CoordinatesProvider() {
@Override
public float[] calculateCoordinates(View view) {
float xy[] = GeneralLocation.CENTER_RIGHT.calculateCoordinates(view);
xy[0] += 20f * view.getWidth();
return xy;
}
},
Press.FINGER));
}
开发者ID:sewerk,项目名称:Bill-Calculator,代码行数:14,代码来源:Tester.java
示例13: getSwipe
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
/**
* Gets a swipe action.
*
* @param speed the speed of the swipe
* @param direction the direction of the swipe
* @return the swipe action requested
*/
public static GeneralSwipeAction getSwipe(Swiper speed, SwipeDirection direction) {
Pair<Swiper, SwipeDirection> key = new Pair<>(speed, direction);
if (!bufferedSwipeActions.containsKey(key))
bufferedSwipeActions.put(key, generateSwipe(speed, direction));
return bufferedSwipeActions.get(key);
}
开发者ID:mindbody,项目名称:Ironhide,代码行数:16,代码来源:SwipeAction.java
示例14: scroll
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
/**
* Uses a slow swipe to simulate a scroll
* @return the view action
*/
private ViewAction scroll() {
return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.BOTTOM_CENTER,
GeneralLocation.TOP_CENTER, Press.FINGER);
}
开发者ID:alex-townsend,项目名称:SwipeOpenItemTouchHelper,代码行数:9,代码来源:SwipeOpenItemTouchHelperTest.java
示例15: swipeRight
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
private static ViewAction swipeRight() {
return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER_LEFT,
GeneralLocation.CENTER_RIGHT, Press.FINGER);
}
开发者ID:alex-townsend,项目名称:SwipeOpenItemTouchHelper,代码行数:5,代码来源:SwipeOpenItemTouchHelperTest.java
示例16: swipeLeft
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
private static ViewAction swipeLeft() {
return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.CENTER_RIGHT,
GeneralLocation.CENTER_LEFT, Press.FINGER);
}
开发者ID:alex-townsend,项目名称:SwipeOpenItemTouchHelper,代码行数:5,代码来源:SwipeOpenItemTouchHelperTest.java
示例17: swipeDown
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
public static ViewAction swipeDown() {
return new GeneralSwipeAction(Swipe.SLOW, GeneralLocation.TOP_CENTER,
GeneralLocation.BOTTOM_CENTER, Press.FINGER
);
}
开发者ID:malmstein,项目名称:tagscout,代码行数:6,代码来源:TagsScreenTest.java
示例18: swipeTop
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
public static ViewAction swipeTop() {
return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.BOTTOM_CENTER, GeneralLocation.TOP_CENTER, Press.FINGER);
}
开发者ID:talenguyen,项目名称:PrettyBundle,代码行数:4,代码来源:ExtViewActions.java
示例19: swipeBottom
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
public static ViewAction swipeBottom() {
return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER, GeneralLocation.BOTTOM_CENTER, Press.FINGER);
}
开发者ID:talenguyen,项目名称:PrettyBundle,代码行数:4,代码来源:ExtViewActions.java
示例20: swipeDown
import android.support.test.espresso.action.GeneralSwipeAction; //导入依赖的package包/类
private static ViewAction swipeDown() {
return new GeneralSwipeAction(Swipe.FAST, GeneralLocation.TOP_CENTER,
GeneralLocation.BOTTOM_CENTER, Press.FINGER);
}
开发者ID:google,项目名称:agera,代码行数:5,代码来源:MainActivityTest.java
注:本文中的android.support.test.espresso.action.GeneralSwipeAction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论