• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java FragmentTestUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.robolectric.util.FragmentTestUtil的典型用法代码示例。如果您正苦于以下问题:Java FragmentTestUtil类的具体用法?Java FragmentTestUtil怎么用?Java FragmentTestUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



FragmentTestUtil类属于org.robolectric.util包,在下文中一共展示了FragmentTestUtil类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testLifecycle

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
private void testLifecycle(LifecycleProvider<FragmentEvent> provider) {
    Fragment fragment = (Fragment) provider;
    FragmentTestUtil.startFragment(fragment);

    TestObserver<FragmentEvent> testObserver = provider.lifecycle().skip(1).test();

    fragment.onAttach(null);
    fragment.onCreate(null);
    fragment.onViewCreated(null, null);
    fragment.onStart();
    fragment.onResume();
    fragment.onPause();
    fragment.onStop();
    fragment.onDestroyView();
    fragment.onDestroy();
    fragment.onDetach();

    testObserver.assertValues(
        FragmentEvent.ATTACH,
        FragmentEvent.CREATE,
        FragmentEvent.CREATE_VIEW,
        FragmentEvent.START,
        FragmentEvent.RESUME,
        FragmentEvent.PAUSE,
        FragmentEvent.STOP,
        FragmentEvent.DESTROY_VIEW,
        FragmentEvent.DESTROY,
        FragmentEvent.DETACH
    );
}
 
开发者ID:xufreshman,项目名称:RxLifeCycle,代码行数:31,代码来源:RxFragmentLifecycleTest.java


示例2: shouldSetCallBack

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
@Test
public void shouldSetCallBack() {
    SimpleDialogFragment fragment = SimpleDialogFragment.newInstance(
            "title",
            "message",
            "btn_positive",
            "btn_negative",
            "onBackPressed");

    SimpleDialogFragment.MsgDialogCallBack dialogCallBack = mock(SimpleDialogFragment.MsgDialogCallBack.class);
    fragment.setCallBackListener(dialogCallBack);
    FragmentTestUtil.startFragment(fragment);

    Dialog dialog = fragment.getDialog();
    (((AlertDialog) dialog).getButton(AlertDialog.BUTTON_POSITIVE)).performClick();
    verify(dialogCallBack).positiveClick(anyString());
}
 
开发者ID:SIGLUS,项目名称:lmis-moz-mobile,代码行数:18,代码来源:SimpleDialogFragmentTest.java


示例3: setUp

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    mockStockCardPresenter = mock(StockCardPresenter.class);
    RoboGuice.overrideApplicationInjector(RuntimeEnvironment.application, new AbstractModule() {
        @Override
        protected void configure() {
            bind(StockCardPresenter.class).toInstance(mockStockCardPresenter);
        }
    });
    fragment = new KitStockCardListFragment();
    FragmentTestUtil.startFragment(fragment);
}
 
开发者ID:SIGLUS,项目名称:lmis-moz-mobile,代码行数:13,代码来源:KitStockCardListFragmentTest.java


示例4: setUp

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    presenter = mock(SyncErrorsPresenter.class);
    RoboGuice.overrideApplicationInjector(RuntimeEnvironment.application, new AbstractModule() {
        @Override
        protected void configure() {
            bind(SyncErrorsPresenter.class).toInstance(presenter);
        }
    });

    fragment = new SyncDateBottomSheet();
    fragment.setArguments(SyncDateBottomSheet.getArgumentsToMe(1, 1));
    FragmentTestUtil.startFragment(fragment);
}
 
开发者ID:SIGLUS,项目名称:lmis-moz-mobile,代码行数:15,代码来源:SyncDateBottomSheetTest.java


示例5: setupDialog

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
private void setupDialog() {
    when(utilityService.isBlankText(any(TextView.class))).thenCallRealMethod();
    when(utilityService.sanitizedText(any(TextView.class))).thenCallRealMethod();

    SettingsFragment settingsFragment = new SettingsFragment();
    FragmentTestUtil.startVisibleFragment(settingsFragment);
    assertNotNull("fragment is null", settingsFragment);
    PreferenceScreen preferenceScreen = settingsFragment.getPreferenceScreen();
    initGatewayEditTextPreference(preferenceScreen);

    // TODO
    //gatewayEditTextPreference.onClick();
    assertTrue("should be visible", gatewayEditTextPreference.getDialog().isShowing());
}
 
开发者ID:openwebnet,项目名称:openwebnet-android,代码行数:15,代码来源:GatewayEditTextPreferenceTest.java


示例6: setUpPreferenceFragment

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
private PreferenceFragment setUpPreferenceFragment(Class<? extends PreferenceFragment> clazz) {
    PreferenceFragment instance;
    try {
         instance = clazz.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
        throw new RuntimeException(e);
    }
    FragmentTestUtil.startVisibleFragment(instance);
    return instance;
}
 
开发者ID:nightscout,项目名称:android-uploader,代码行数:11,代码来源:SettingsActivityTest.java


示例7: showProgress_shouldDisableMap

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
@Test
public void showProgress_shouldDisableMap() throws Exception {
    FragmentTestUtil.startFragment(mapFragment);
    mapFragment.getView().findViewById(R.id.map).setClickable(true);
    mapFragment.showProgress();
    assertThat(mapFragment.getView().findViewById(R.id.map)).isNotClickable();
}
 
开发者ID:mapzen,项目名称:open,代码行数:8,代码来源:MapFragmentTest.java


示例8: hideProgress_shouldHideProgressView

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
@Test
public void hideProgress_shouldHideProgressView() throws Exception {
    FragmentTestUtil.startFragment(mapFragment);
    mapFragment.showProgress();
    mapFragment.hideProgress();
    assertThat(mapFragment.getView().findViewById(R.id.progress)).isNotVisible();
}
 
开发者ID:mapzen,项目名称:open,代码行数:8,代码来源:MapFragmentTest.java


示例9: hideProgress_shouldEnableMap

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
@Test
public void hideProgress_shouldEnableMap() throws Exception {
    FragmentTestUtil.startFragment(mapFragment);
    mapFragment.getView().findViewById(R.id.map).setClickable(false);
    mapFragment.hideProgress();
    assertThat(mapFragment.getView().findViewById(R.id.map)).isClickable();
}
 
开发者ID:mapzen,项目名称:open,代码行数:8,代码来源:MapFragmentTest.java


示例10: findMe_shouldNotResetZoomAndPointNorthAfterMapPositionEvent

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
@Test
public void findMe_shouldNotResetZoomAndPointNorthAfterMapPositionEvent() throws Exception {
    FragmentTestUtil.startFragment(mapFragment);
    mapFragment.findMe();
    MapPosition mapPosition = new MapPosition();
    mapPosition.setZoomLevel(10);
    activity.getMap().events.fire(Map.POSITION_EVENT, mapPosition);
    mapFragment.findMe();
    assertThat(mapFragment.mapController.getZoomLevel()).isEqualTo(10);
}
 
开发者ID:mapzen,项目名称:open,代码行数:11,代码来源:MapFragmentTest.java


示例11: startFragment

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
private TestFragment startFragment() {
  TestFragment testFragment = new TestFragment();
  FragmentTestUtil.startFragment(testFragment, FakeActivity.class);
  return testFragment;
}
 
开发者ID:pinicius,项目名称:CAS2016,代码行数:6,代码来源:RosieFragmentTest.java


示例12: showProgress_shouldShowProgressView

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
@Test
public void showProgress_shouldShowProgressView() throws Exception {
    FragmentTestUtil.startFragment(mapFragment);
    mapFragment.showProgress();
    assertThat(mapFragment.getView().findViewById(R.id.progress)).isVisible();
}
 
开发者ID:mapzen,项目名称:open,代码行数:7,代码来源:MapFragmentTest.java


示例13: onActivityCreated_shouldDoStylesheetDownload

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
@Test
public void onActivityCreated_shouldDoStylesheetDownload() throws Exception {
    FragmentTestUtil.startFragment(mapFragment);
    Mockito.verify(styleDownLoader).download();
}
 
开发者ID:mapzen,项目名称:open,代码行数:6,代码来源:MapFragmentTest.java


示例14: loadAceHotelMockRoute

import org.robolectric.util.FragmentTestUtil; //导入依赖的package包/类
private void loadAceHotelMockRoute() {
    fragment.success(new Route(MOCK_ACE_HOTEL));
    FragmentTestUtil.startFragment(fragment);
    fragment.onResume();
}
 
开发者ID:mapzen,项目名称:open,代码行数:6,代码来源:RouteFragmentTest.java



注:本文中的org.robolectric.util.FragmentTestUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultTypes类代码示例发布时间:2022-05-23
下一篇:
Java RangeNotifier类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap