當前位置: 首頁>>代碼示例>>Java>>正文


Java ShadowActivity.getNextStartedActivityForResult方法代碼示例

本文整理匯總了Java中org.robolectric.shadows.ShadowActivity.getNextStartedActivityForResult方法的典型用法代碼示例。如果您正苦於以下問題:Java ShadowActivity.getNextStartedActivityForResult方法的具體用法?Java ShadowActivity.getNextStartedActivityForResult怎麽用?Java ShadowActivity.getNextStartedActivityForResult使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.robolectric.shadows.ShadowActivity的用法示例。


在下文中一共展示了ShadowActivity.getNextStartedActivityForResult方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testContextMenu1

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void testContextMenu1() {
    adapter.updateDataSet(contacts);
    RecyclerView.ViewHolder viewHolder = adapter.onCreateViewHolder(recyclerView, 0);
    adapter.onBindViewHolder(viewHolder, 0);
    try {
        viewHolder.itemView.performLongClick(); // Danke Robolectric. NullPointer weil irgendwas mit Menu buggy..
    } catch (NullPointerException e) {
        //Nichts tun.
    }

    RoboMenuItem item = new RoboMenuItem(R.id.context_tab_show_in_contacts);
    item.setGroupId(R.id.context_tab_contact_group);
    fragment.onContextItemSelected(item);
    ShadowActivity a = Shadows.shadowOf(activity);
    Intent i  = a.getNextStartedActivityForResult().intent;
    assertNotNull(i);

}
 
開發者ID:weichweich,項目名稱:AluShare,代碼行數:20,代碼來源:ContactTabFragmentTest.java

示例2: launchFormEntryForSavedForm

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
private static void launchFormEntryForSavedForm(ShadowActivity homeActivityShadow,
                                                Intent savedFormsIntent,
                                                FormRecordListActivity savedFormsActivity) {
    ShadowEnvironment.setExternalStorageState(Environment.MEDIA_MOUNTED);

    ShadowActivity formRecordShadow = Shadows.shadowOf(savedFormsActivity);
    homeActivityShadow.receiveResult(savedFormsIntent,
            formRecordShadow.getResultCode(),
            formRecordShadow.getResultIntent());
    ShadowActivity.IntentForResult formEntryIntent =
            homeActivityShadow.getNextStartedActivityForResult();
    Robolectric.buildActivity(FormEntryActivity.class)
                    .withIntent(formEntryIntent.intent)
                    .create().start().resume().get();

    Robolectric.flushBackgroundThreadScheduler();
    Robolectric.flushForegroundThreadScheduler();

    assertNotNull(FormEntryActivity.mFormController);
}
 
開發者ID:dimagi,項目名稱:commcare-android,代碼行數:21,代碼來源:FormRecordListActivityTest.java

示例3: testContextMenu4

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void testContextMenu4() {
    adapter.updateDataSet(contacts);
    RecyclerView.ViewHolder viewHolder = adapter.onCreateViewHolder(recyclerView, 0);
    adapter.onBindViewHolder(viewHolder, 0);
    try {
        viewHolder.itemView.performLongClick(); // Danke Robolectric. NullPointer weil irgendwas mit Menu buggy..
    } catch (NullPointerException e) {
        //Nichts tun.
    }

    Contact contact = contacts.get(0);
    RoboMenuItem item = new RoboMenuItem(R.id.context_tab_contact_link_to_contact);
    item.setGroupId(R.id.context_tab_contact_group);
    fragment.onContextItemSelected(item);

    android.support.v7.app.AlertDialog dialog = (android.support.v7.app.AlertDialog) ShadowAlertDialog.getLatestDialog();
    ListView listView = dialog.getListView();
    Shadows.shadowOf(listView).performItemClick(0);
    ShadowActivity shadowActivity = Shadows.shadowOf(activity);
    Intent i = shadowActivity.getNextStartedActivityForResult().intent;
    assertNotNull(i);

    fragment.onContextItemSelected(item);
    dialog = (android.support.v7.app.AlertDialog) ShadowAlertDialog.getLatestDialog();
    listView = dialog.getListView();
    Shadows.shadowOf(listView).performItemClick(1);
    i = shadowActivity.getNextStartedActivityForResult().intent;
    assertNotNull(i);
}
 
開發者ID:weichweich,項目名稱:AluShare,代碼行數:31,代碼來源:ContactTabFragmentTest.java

示例4: testSelectPicVidIntent

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void testSelectPicVidIntent(){
    chatDispatcher.selectPicVidIntent();
    ShadowActivity shadowActivity = Shadows.shadowOf(chatActivity);
    ShadowActivity.IntentForResult intent = shadowActivity.getNextStartedActivityForResult();
    assertTrue( intent.getClass().getName().equals(ChatActivity.class.getName()));
}
 
開發者ID:weichweich,項目名稱:AluShare,代碼行數:8,代碼來源:ChatDispatcherTest.java

示例5: testSelectFileIntent

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void testSelectFileIntent(){
    chatDispatcher.selectFileIntent();
    ShadowActivity shadowActivity = Shadows.shadowOf(chatActivity);
    ShadowActivity.IntentForResult intent = shadowActivity.getNextStartedActivityForResult();
    assertTrue(intent.getClass().getName().equals(ChatActivity.class.getName()));
}
 
開發者ID:weichweich,項目名稱:AluShare,代碼行數:8,代碼來源:ChatDispatcherTest.java

示例6: testTakePictureIntent

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void testTakePictureIntent(){
    chatDispatcher.takePictureIntent();
    ShadowActivity shadowActivity = Shadows.shadowOf(chatActivity);
    ShadowActivity.IntentForResult intent = shadowActivity.getNextStartedActivityForResult();
    assertTrue( intent.getClass().getName().equals(ChatActivity.class.getName()));
}
 
開發者ID:weichweich,項目名稱:AluShare,代碼行數:8,代碼來源:ChatDispatcherTest.java

示例7: testTakeVideoIntent

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void testTakeVideoIntent(){
    chatDispatcher.takeVideoIntent();
    ShadowActivity shadowActivity = Shadows.shadowOf(chatActivity);
    ShadowActivity.IntentForResult intent = shadowActivity.getNextStartedActivityForResult();
    assertTrue( intent.getClass().getName().equals(ChatActivity.class.getName()));
}
 
開發者ID:weichweich,項目名稱:AluShare,代碼行數:8,代碼來源:ChatDispatcherTest.java

示例8: showInterstitial_shouldStartActivityWithIntent

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void showInterstitial_shouldStartActivityWithIntent() throws Exception {
    subject.loadInterstitial(context, customEventInterstitialListener, localExtras,
            serverExtras);
    subject.showInterstitial();

    ShadowActivity shadowActivity = shadowOf_(context);
    Intent intent = shadowActivity.getNextStartedActivityForResult().intent;

    assertThat(intent.getComponent().getClassName())
            .isEqualTo("com.mopub.mobileads.MraidActivity");
    assertThat(intent.getExtras().get(HTML_RESPONSE_BODY_KEY)).isEqualTo(EXPECTED_HTML_DATA);
    assertThat(intent.getFlags() & Intent.FLAG_ACTIVITY_NEW_TASK).isNotEqualTo(0);
}
 
開發者ID:JSafaiyeh,項目名稱:Fabric-Example-App-Android,代碼行數:15,代碼來源:MraidInterstitialTest.java

示例9: assertNextStartedActivityForResult

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
/**
 * Generic method for asserting next started activity along with
 * the custom transition animation override
 *
 * @param currentActivity   The current activity
 * @param nextActivityClass The class of the newly started activity
 * @param requestCode       The request code
 */
protected Intent assertNextStartedActivityForResult(
        BaseFragmentActivity currentActivity,
        Class<? extends Activity> nextActivityClass, int requestCode) {
    ShadowActivity shadowActivity = Shadows.shadowOf(currentActivity);
    ShadowActivity.IntentForResult intentForResult =
            shadowActivity.getNextStartedActivityForResult();
    assertNotNull(intentForResult);
    assertThat(intentForResult.intent).hasComponent(
            currentActivity, nextActivityClass);
    assertEquals(requestCode, intentForResult.requestCode);
    return intentForResult.intent;
}
 
開發者ID:edx,項目名稱:edx-app-android,代碼行數:21,代碼來源:BaseFragmentActivityTest.java

示例10: prepSavedFormsActivity

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
private static ShadowActivity prepSavedFormsActivity(Intent savedFormsIntent) {
    StandardHomeActivity homeActivity =
            Robolectric.buildActivity(StandardHomeActivity.class).create().get();
    ShadowActivity homeActivityShadow = Shadows.shadowOf(homeActivity);
    homeActivityShadow.startActivityForResult(savedFormsIntent,
            StandardHomeActivity.GET_INCOMPLETE_FORM);

    // Call this to remove activity from stack, so we can access future activities...
    homeActivityShadow.getNextStartedActivityForResult();

    return homeActivityShadow;
}
 
開發者ID:dimagi,項目名稱:commcare-android,代碼行數:13,代碼來源:FormRecordListActivityTest.java

示例11: shouldOpenContactsOnClick

import org.robolectric.shadows.ShadowActivity; //導入方法依賴的package包/類
@Test
public void shouldOpenContactsOnClick() {
    ImageButton contactPickerButton = (ImageButton) contactPickerFragment.getView().findViewById(contact_picker_button);
    contactPickerButton.performClick();

    ShadowActivity shadowActivity = shadowOf(contactPickerFragment.getActivity());
    ShadowActivity.IntentForResult startedIntentForResult = shadowActivity.getNextStartedActivityForResult();
    Intent intent = startedIntentForResult.intent;

    assertThat(intent.getAction(), equalTo(ACTION_GET_CONTENT));
    assertThat(intent.getType(), equalTo(CONTENT_ITEM_TYPE));
}
 
開發者ID:PanicInitiative,項目名稱:PanicButton,代碼行數:13,代碼來源:ContactPickerFragmentTest.java


注:本文中的org.robolectric.shadows.ShadowActivity.getNextStartedActivityForResult方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。