当前位置: 首页>>代码示例>>Java>>正文


Java SupportFragmentTestUtil.startVisibleFragment方法代码示例

本文整理汇总了Java中org.robolectric.shadows.support.v4.SupportFragmentTestUtil.startVisibleFragment方法的典型用法代码示例。如果您正苦于以下问题:Java SupportFragmentTestUtil.startVisibleFragment方法的具体用法?Java SupportFragmentTestUtil.startVisibleFragment怎么用?Java SupportFragmentTestUtil.startVisibleFragment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.robolectric.shadows.support.v4.SupportFragmentTestUtil的用法示例。


在下文中一共展示了SupportFragmentTestUtil.startVisibleFragment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testPendingItem

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testPendingItem() {
    Bundle args = new Bundle();
    args.putParcelable(ItemFragment.EXTRA_ITEM, new TestItem() {
        @Override
        public Item[] getKidItems() {
            return new Item[]{new TestItem() {
                @Override
                public int getLocalRevision() {
                    return -1;
                }
            }};
        }

        @Override
        public int getKidCount() {
            return 1;
        }
    });
    Fragment fragment = Fragment.instantiate(RuntimeEnvironment.application,
            ItemFragment.class.getName(), args);
    SupportFragmentTestUtil.startVisibleFragment(fragment, ItemFragmentMultiPageTest.TestItemActivity.class,
            R.id.content_frame);
    recyclerView = (RecyclerView) fragment.getView().findViewById(R.id.recycler_view);
    adapter = (SinglePageItemRecyclerViewAdapter) recyclerView.getAdapter();
}
 
开发者ID:hidroh,项目名称:materialistic,代码行数:27,代码来源:ItemFragmentSinglePageTest.java

示例2: testProfileImageUpdation_onGlobalAccountEvent

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testProfileImageUpdation_onGlobalAccountEvent() {
    final NavigationFragment fragment = new NavigationFragment();
    SupportFragmentTestUtil.startVisibleFragment(fragment);
    final View view = fragment.getView();
    assertNotNull(view);

    final ImageView profileImage = (ImageView) view.findViewById(R.id.profile_image);
    assertNotNull(profileImage);

    // Assert: Profile pic not updated when a non-logged in user's account object is broadcasted
    Drawable previousDrawable = profileImage.getDrawable();
    Account account = configureMockAccount("not_logged_in_user");
    EventBus.getDefault().post(new AccountDataLoadedEvent(account));
    assertEquals(previousDrawable, profileImage.getDrawable());

    // Assert: Profile pic is updated when a logged-in user's account object is broadcasted
    UserPrefs userPrefs = RoboGuice.getInjector(context).getInstance(UserPrefs.class);
    final String loggedInUser = userPrefs.getProfile().username;
    account = configureMockAccount(loggedInUser);
    EventBus.getDefault().post(new AccountDataLoadedEvent(account));
    assertNotEquals(previousDrawable, profileImage.getDrawable());
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:24,代码来源:NavigationFragmentTest.java

示例3: uiLessShouldFail

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test() public void uiLessShouldFail() {
  try {
    SupportFragmentTestUtil.startVisibleFragment(new UiLessFragment());
    Assert.fail("Exception expected");
  } catch (IllegalStateException e) {
    Assert.assertEquals(
        "It seems that you are using "+UiLessFragment.class.getCanonicalName()+" as headless (UI less) fragment (because onViewCreated() has not been called or maybe delegation misses that part). Having a Presenter without a View (UI) doesn't make sense. Simply use an usual fragment instead of an MvpFragment if you want to use a UI less Fragment",
        e.getMessage());
  }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:FragmentMvpDelegateUiLessMvpFragmentTest.java

示例4: setUp

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Before
public void setUp() {
    DummyDataSet.copyDataSet("ASDB_Tabs.db");
    chatHelper = HelperFactory.getChatHelper(context);
    contactHelper = HelperFactory.getContacHelper(context);
    contacts = contactHelper.getContacts();

    fragment = TestFragment.createInstance(TestFragment.TYPE_CONTACT_TAB);
    SupportFragmentTestUtil.startVisibleFragment(fragment);
    adapter = (ContactTabRecyclerAdapter) fragment.getAdapter();
    manager = fragment.getLayoutManager();
    recyclerView = fragment.getRecyclerView();
}
 
开发者ID:weichweich,项目名称:AluShare,代码行数:14,代码来源:ContactTabAdapterViewholderTest.java

示例5: setUp

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    DummyDataSet.copyDataSet("ASDB_Tabs.db");
    helper = HelperFactory.getFileHelper(context);
    files = helper.getFiles();

    fragment = TestFragment.createInstance(TestFragment.TYPE_FILE_TAB);
    SupportFragmentTestUtil.startVisibleFragment(fragment);

    adapter = (FileTabRecyclerAdapter) fragment.getAdapter();
    manager = fragment.getLayoutManager();
    recyclerView = fragment.getRecyclerView();


}
 
开发者ID:weichweich,项目名称:AluShare,代码行数:16,代码来源:FileTabAdapterViewholderTest.java

示例6: setUp

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Before
public void setUp() {
    DummyDataSet.copyDataSet("ASDB_Tabs.db");
    contactHelper = HelperFactory.getContacHelper(context);
    chatHelper = HelperFactory.getChatHelper(context);
    dataHelper = HelperFactory.getDataHelper(context);
    chats = chatHelper.getChats();

    fragment = TestFragment.createInstance(TestFragment.TYPE_CHAT_TAB);
    SupportFragmentTestUtil.startVisibleFragment(fragment);

    adapter = (ChatTabRecyclerAdapter) fragment.getAdapter();
    manager = fragment.getLayoutManager();
    recyclerView = fragment.getRecyclerView();
}
 
开发者ID:weichweich,项目名称:AluShare,代码行数:16,代码来源:ChatTabAdapterViewholderTest.java

示例7: initializeTest

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
/**
 * Testing initialization
 */
@Test
public void initializeTest() {
    CourseUnitWebViewFragment fragment = CourseUnitWebViewFragment.newInstance(getHtmlUnit());
    SupportFragmentTestUtil.startVisibleFragment(fragment);
    View view = fragment.getView();
    assertNotNull(view);

    View courseUnitWebView = view.findViewById(R.id.webview);
    assertNotNull(courseUnitWebView);
    assertThat(courseUnitWebView).isInstanceOf(WebView.class);
    WebView webView = (WebView) courseUnitWebView;
    assertTrue(webView.getSettings().getJavaScriptEnabled());
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:17,代码来源:CourseUnitWebViewFragmentTest.java

示例8: initializeTest

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
/**
 * Testing initialization
 */
@Test
public void initializeTest() {
    CourseUnitVideoFragment fragment = CourseUnitVideoFragment.newInstance(getVideoUnit(), false, false);
    SupportFragmentTestUtil.startVisibleFragment(fragment, FragmentUtilActivity.class, 1);
    assertTrue(fragment.getRetainInstance());

    View view = fragment.getView();
    assertNotNull(view);
    View messageContainer = view.findViewById(R.id.message_container);
    assertNotNull(messageContainer);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:15,代码来源:CourseUnitVideoFragmentTest.java

示例9: orientationChangeTest

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
/**
 * Testing orientation changes
 */
@Test
public void orientationChangeTest() {
    CourseUnitVideoFragment fragment = CourseUnitVideoFragment.newInstance(getVideoUnit(), false, false);
    SupportFragmentTestUtil.startVisibleFragment(fragment, FragmentUtilActivity.class, 1);
    assertNotEquals(Configuration.ORIENTATION_LANDSCAPE,
            fragment.getResources().getConfiguration().orientation);

    testOrientationChange(fragment, Configuration.ORIENTATION_LANDSCAPE);
    testOrientationChange(fragment, Configuration.ORIENTATION_PORTRAIT);
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:14,代码来源:CourseUnitVideoFragmentTest.java

示例10: startFragment

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
protected void startFragment(@NonNull final FragmentT fragment) {
    this.presenter = mock(getPresenterType());
    fragment.presenter = presenter;
    SupportFragmentTestUtil.startVisibleFragment(fragment, HostActivity.class, android.R.id.content);
    this.fragment = fragment;
    this.view = fragment.view;
}
 
开发者ID:edx,项目名称:edx-app-android,代码行数:8,代码来源:PresenterFragmentTest.java

示例11: correctUi

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test public void correctUi() {
  SupportFragmentTestUtil.startVisibleFragment(new CorrectUiFragment());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:4,代码来源:FragmentMvpDelegateUiLessMvpFragmentTest.java

示例12: testFragment

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Test
public void testFragment() {
    Assert.assertNotNull(mPresenter);
    SupportFragmentTestUtil.startVisibleFragment(mFragment);
    verify(mPresenter).onViewCreated();
}
 
开发者ID:mkoslacz,项目名称:Moviper,代码行数:7,代码来源:ColorWidgetFragmentUnitTest.java

示例13: setup

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Before
public void setup()  {
    fragment = MeasuringFragment.newInstance();
    SupportFragmentTestUtil.startVisibleFragment(fragment);
}
 
开发者ID:HRVBand,项目名称:hrv-band,代码行数:6,代码来源:MeasuringFragmentTest.java

示例14: setup

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Before
public void setup()  {
    fragment = MeasuredRRFragment.newInstance(parameter);
    SupportFragmentTestUtil.startVisibleFragment(fragment);
}
 
开发者ID:HRVBand,项目名称:hrv-band,代码行数:6,代码来源:MeasureRRFragmentTest.java

示例15: setup

import org.robolectric.shadows.support.v4.SupportFragmentTestUtil; //导入方法依赖的package包/类
@Before
public void setup()  {
    fragment = MeasuredDetailsEditFragment.newInstance();
    SupportFragmentTestUtil.startVisibleFragment(fragment);
}
 
开发者ID:HRVBand,项目名称:hrv-band,代码行数:6,代码来源:MeasuredDetailsEditFragmentTest.java


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