本文整理汇总了Java中android.support.test.filters.MediumTest类的典型用法代码示例。如果您正苦于以下问题:Java MediumTest类的具体用法?Java MediumTest怎么用?Java MediumTest使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MediumTest类属于android.support.test.filters包,在下文中一共展示了MediumTest类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testSwipeDownToHide
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void testSwipeDownToHide() {
Espresso.onView(ViewMatchers.withId(R.id.bottom_sheet))
.perform(
DesignViewActions.withCustomConstraints(
ViewActions.swipeDown(), ViewMatchers.isDisplayingAtLeast(5)));
registerIdlingResourceCallback();
try {
Espresso.onView(ViewMatchers.withId(R.id.bottom_sheet))
.check(ViewAssertions.matches(not(ViewMatchers.isDisplayed())));
assertThat(getBehavior().getState(), is(BottomSheetBehavior.STATE_HIDDEN));
} finally {
unregisterIdlingResourceCallback();
}
}
开发者ID:material-components,项目名称:material-components-android,代码行数:17,代码来源:BottomSheetBehaviorTest.java
示例2: testSwipeUpToExpand
import android.support.test.filters.MediumTest; //导入依赖的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
示例3: ViewTest3
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void ViewTest3() throws InterruptedException{
rule2.getActivity();
Thread.sleep(15000);
onView(isRoot()).perform(swipeUp());
Thread.sleep(2000);
String name = "Low Cost";
for(int i=0; i<3;i++){
if(i==1){ name = "Medium Cost"; }
if(i==2){ name = "High Cost"; }
onView(withId(R.id.averageCostSpinner)).perform(click());
onData(allOf(is(instanceOf(String.class)), is(name))).perform(click());
onView(withId(R.id.averageCostSpinner)).check(matches(withSpinnerText(containsString(name))));
}
}
示例4: summarize
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void summarize() throws Exception {
Sum sum = new Sum();
assertEquals(sum.summarize("A wiki is run using wiki software, otherwise known as a wiki engine. " +
"A wiki engine is a type of content management system, but it differs from most other such systems, including blog software, " +
"in that the content is created without any defined owner or leader, and wikis have little implicit structure, " +
"allowing structure to emerge according to the needs of the users.[2] There are dozens of different wiki engines in use, " +
"both standalone and part of other software, such as bug tracking systems. Some wiki engines are open source, " +
"whereas others are proprietary. Some permit control over different functions (levels of access); for example, " +
"editing rights may permit changing, adding or removing material. Others may permit access without enforcing access control. " +
"Other rules may be imposed to organize content." +
"The online encyclopedia project Wikipedia is by far the most popular wiki-based website, " +
"and is one of the most widely viewed sites of any kind in the world, having been ranked in the top ten since 2007.[3] " +
"Wikipedia is not a single wiki but rather a collection of hundreds of wikis, one for each language. " +
"There are tens of thousands of other wikis in use, both public and private, including wikis functioning as knowledge management resources, " +
"notetaking tools, community websites and intranets. The English-language Wikipedia has the largest collection of articles; as of September 2016, " +
"it had over five million articles. Ward Cunningham, the developer of the first wiki software")
," A wiki is run using wiki software, otherwise known as a wiki engine. " +
"A wiki engine is a type of content management system, but it differs from most other such systems, " +
"including blog software, in that the content is created without any defined owner or leader, and wikis have little implicit structure, " +
"allowing structure to emerge according to the needs of the users. [2] There are dozens of different wiki engines in use, " +
"both standalone and part of other software, such as bug tracking systems." );
}
示例5: testAutoPeekHeight
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void testAutoPeekHeight() throws Throwable {
activityTestRule.runOnUiThread(
new Runnable() {
@Override
public void run() {
getBehavior().setPeekHeight(BottomSheetBehavior.PEEK_HEIGHT_AUTO);
}
});
activityTestRule.runOnUiThread(
new Runnable() {
@Override
public void run() {
CoordinatorLayout col = getCoordinatorLayout();
assertThat(
getBottomSheet().getTop(),
is(
Math.min(
col.getWidth() * 9 / 16,
col.getHeight() - getBehavior().getPeekHeightMin())));
}
});
}
开发者ID:material-components,项目名称:material-components-android,代码行数:25,代码来源:BottomSheetBehaviorTest.java
示例6: testExpandedPeekHeight
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void testExpandedPeekHeight() throws Throwable {
activityTestRule.runOnUiThread(
new Runnable() {
@Override
public void run() {
// Make the peek height as tall as the bottom sheet.
BottomSheetBehavior<?> behavior = getBehavior();
behavior.setPeekHeight(getBottomSheet().getHeight());
assertThat(behavior.getState(), is(BottomSheetBehavior.STATE_COLLAPSED));
}
});
// Both of these will not animate the sheet , but the state should be changed.
checkSetState(BottomSheetBehavior.STATE_EXPANDED, ViewMatchers.isDisplayed());
checkSetState(BottomSheetBehavior.STATE_COLLAPSED, ViewMatchers.isDisplayed());
}
开发者ID:material-components,项目名称:material-components-android,代码行数:18,代码来源:BottomSheetBehaviorTest.java
示例7: testDismissViaAnotherSnackbar
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void testDismissViaAnotherSnackbar() throws Throwable {
final CustomSnackbar anotherSnackbar =
makeCustomSnackbar()
.setTitle("Different title")
.setSubtitle("Different subtitle")
.setDuration(Snackbar.LENGTH_SHORT);
// Our dismiss action is to show another snackbar (and verify that the original snackbar
// is now dismissed with CONSECUTIVE event)
verifyDismissCallback(
onView(isAssignableFrom(Snackbar.SnackbarLayout.class)),
null,
new DismissAction() {
@Override
public void dismiss(CustomSnackbar snackbar) {
anotherSnackbar.show();
}
},
Snackbar.LENGTH_LONG,
Snackbar.Callback.DISMISS_EVENT_CONSECUTIVE);
// And dismiss the second snackbar to get back to clean state
SnackbarUtils.dismissTransientBottomBarAndWaitUntilFullyDismissed(anotherSnackbar);
}
示例8: testMultipleCallbacks
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void testMultipleCallbacks() throws Throwable {
final CustomSnackbar snackbar =
makeCustomSnackbar()
.setTitle(TITLE_TEXT)
.setSubtitle(SUBTITLE_TEXT)
.setDuration(Snackbar.LENGTH_INDEFINITE);
final BaseTransientBottomBar.BaseCallback mockCallback1 =
mock(BaseTransientBottomBar.BaseCallback.class);
final BaseTransientBottomBar.BaseCallback mockCallback2 =
mock(BaseTransientBottomBar.BaseCallback.class);
snackbar.addCallback(mockCallback1);
snackbar.addCallback(mockCallback2);
SnackbarUtils.showTransientBottomBarAndWaitUntilFullyShown(snackbar);
verify(mockCallback1, times(1)).onShown(snackbar);
verify(mockCallback2, times(1)).onShown(snackbar);
SnackbarUtils.dismissTransientBottomBarAndWaitUntilFullyDismissed(snackbar);
verify(mockCallback1, times(1))
.onDismissed(snackbar, BaseTransientBottomBar.BaseCallback.DISMISS_EVENT_MANUAL);
verify(mockCallback2, times(1))
.onDismissed(snackbar, BaseTransientBottomBar.BaseCallback.DISMISS_EVENT_MANUAL);
}
示例9: testRotationInExpandedState
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void testRotationInExpandedState() {
ExpandableTransformationActivity activity = activityTestRule.getActivity();
int oldOrientation = TestUtils.getScreenOrientation(activity);
onView(withId(R.id.fab)).perform(setExpanded(true));
TestUtils.switchScreenOrientation(activity);
onView(isRoot()).perform(waitUntilIdle());
onView(withId(R.id.fab)).check(matches(not(isDisplayed())));
onView(withId(R.id.sheet)).check(matches(isDisplayed()));
onView(withId(R.id.scrim)).check(matches(isDisplayed()));
TestUtils.resetScreenOrientation(activity, oldOrientation);
}
开发者ID:material-components,项目名称:material-components-android,代码行数:17,代码来源:FabTransformationBehaviorTest.java
示例10: query_bad_state
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@MediumTest
@Test
public void query_bad_state() {
final Condition condition = getCondition();
try {
final Bundle bundle = new Bundle();
bundle.putInt(PluginBundleManager.BUNDLE_EXTRA_INT_VERSION_CODE, 1);
bundle.putInt(PluginBundleManager.BUNDLE_EXTRA_INT_RESULT_CODE,
1); //$NON-NLS-1$
assertThat(condition.query(getPluginInstanceData(bundle),
com.twofortyfouram.locale.api.Intent.RESULT_CONDITION_UNKNOWN),
is(com.twofortyfouram.locale.api.Intent.RESULT_CONDITION_UNKNOWN));
} finally {
condition.destroy();
}
}
示例11: peekPluginMap_after_blocking
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@MediumTest
@Test
public void peekPluginMap_after_blocking() {
final PluginRegistry registry = new PluginRegistry(InstrumentationRegistry.getContext(),
getIntentAction());
try {
registry.init();
registry.blockUntilLoaded();
assertThat(registry.peekPluginMap(PluginType.CONDITION), notNullValue());
assertThat(registry.peekPluginMap(PluginType.SETTING), notNullValue());
} finally {
registry.destroy();
}
}
示例12: viewModelActivity_instance_count_test
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@MediumTest
@Test
public void viewModelActivity_instance_count_test() {
mActivityTestRule.launchActivity(VMTestActivity.makeIntent(InstrumentationRegistry.getContext(), false));
String uniqueIdentifierActivity = mActivityTestRule.getActivity().getViewModel().getUniqueIdentifier();
String uniqueIdentifierFragment = mActivityTestRule.getActivity().getTestFragment().getViewModel().getUniqueIdentifier();
rotateScreen(5);
Map<String, AbstractViewModel<? extends IView>> viewModels =
mActivityTestRule.getActivity().getViewModelProvider().getViewModels();
assertThat(viewModels.size(), is(2)); //activity + fragment
assertThat(viewModels.containsKey(uniqueIdentifierActivity), is(true));
assertThat(viewModels.containsKey(uniqueIdentifierFragment), is(true));
}
示例13: profileViewTests1
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void profileViewTests1() throws InterruptedException{
rule2.getActivity();
Thread.sleep(20000);
onView(withId(R.id.displayNameTextView)).check(matches(isDisplayed()));
onView(withId(R.id.describeEditText)).check(matches(isDisplayed()));
onView(withId(R.id.fullNameTextView)).check(matches(isDisplayed()));
onView(withId(R.id.imageView2)).check(matches(isDisplayed()));
}
示例14: ViewTests1
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void ViewTests1() throws InterruptedException{
rule2.getActivity();
Thread.sleep(10000);
onView(withId(R.id.ViewAddedAreaOwnerText)).check(matches(isDisplayed()));
onView(withId(R.id.ViewAddedAreaAddressText)).check(matches(isDisplayed()));
onView(withId(R.id.likeFloatingActionButton)).check(matches(isDisplayed()));
onView(withId(R.id.ViewAddedAreaImageView)).check(matches(isDisplayed()));
onView(withId(R.id.authorImageView)).check(matches(isDisplayed()));
onView(withId(R.id.navigationImageView)).check(matches(isDisplayed()));
}
示例15: ViewTests2
import android.support.test.filters.MediumTest; //导入依赖的package包/类
@Test
@MediumTest
public void ViewTests2() throws InterruptedException{
rule2.getActivity();
Thread.sleep(10000);
onView(isRoot()).perform(swipeUp());
onView(withId(R.id.descriptImageView)).check(matches(isDisplayed()));
onView(withId(R.id.averageCostImageView)).check(matches(isDisplayed()));
onView(withId(R.id.ViewAddedAreaDescText)).check(matches(isDisplayed()));
onView(withId(R.id.averageCostSpinner)).check(matches(isDisplayed()));
}