本文整理汇总了Java中org.robolectric.android.controller.ActivityController.start方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityController.start方法的具体用法?Java ActivityController.start怎么用?Java ActivityController.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.robolectric.android.controller.ActivityController
的用法示例。
在下文中一共展示了ActivityController.start方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testBindActivity
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test public void testBindActivity() throws Exception {
ActivityController controller = Robolectric.buildActivity(TestActivity.class).create().start();
NaviActivity activity = (NaviActivity) controller.get();
this.presenter.bind(activity);
controller.create();
//before activity start view is unbound
assertTrue(this.presenter.view == null);
controller.start();
//after activity started view has been bound automatically
assertTrue(this.presenter.view != null);
controller.destroy();
//before activity destroyed view is unbound
assertTrue(this.presenter.view == null);
}
示例2: testActivityObservableBindLifecycle
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test public void testActivityObservableBindLifecycle() throws Exception {
final Observable<Object> observable = PublishSubject.create().asObservable();
TestSubscriber<Object> testSubscriber = TestSubscriber.create();
ActivityController controller = Robolectric.buildActivity(TestActivity.class).create().start();
NaviActivity activity = (NaviActivity) controller.get();
this.presenter.bind(activity);
this.presenter.bindLifecycle(observable, testSubscriber);
controller.create();
assertFalse(testSubscriber.isUnsubscribed());
controller.start();
assertFalse(testSubscriber.isUnsubscribed());
controller.resume();
assertFalse(testSubscriber.isUnsubscribed());
controller.pause();
assertFalse(testSubscriber.isUnsubscribed());
controller.stop();
assertFalse(testSubscriber.isUnsubscribed());
controller.destroy();
testSubscriber.assertCompleted();
testSubscriber.assertUnsubscribed();
}
示例3: startWithProperty
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
private ActivityController startWithProperty(Property property)
{
long id = db.insertProperty(property);
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putLong("id", id);
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(PropertyViewActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
controller.visible();
controller.resume();
assertTrue(activity.isFinishing() == false);
String latestToast = ShadowToast.getTextOfLatestToast();
assertNull(latestToast);
return controller;
}
示例4: startWithMissingProperty
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test
public void startWithMissingProperty()
{
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putLong("id", 0);
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(PropertyWorksheetActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
assertTrue(activity.isFinishing());
String latestToast = ShadowToast.getTextOfLatestToast();
assertNotNull(latestToast);
}
示例5: startWithoutDescription
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test
public void startWithoutDescription()
{
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putInt("title", R.string.app_name);
bundle.putSerializable("items", new HashMap<String, Integer>());
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(ItemizeActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
assertTrue(activity.isFinishing());
String latestToast = ShadowToast.getTextOfLatestToast();
assertNotNull(latestToast);
}
示例6: startWithFile
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
private ActivityController startWithFile(File file) throws IOException
{
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putString("file", file.getAbsolutePath());
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(PictureViewActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
controller.visible();
controller.resume();
assertTrue(activity.isFinishing() == false);
String latestToast = ShadowToast.getTextOfLatestToast();
assertNull(latestToast);
return controller;
}
示例7: startWithoutTitle
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test
public void startWithoutTitle()
{
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putInt("description", R.string.app_name);
bundle.putSerializable("items", new HashMap<String, Integer>());
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(ItemizeActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
assertTrue(activity.isFinishing());
String latestToast = ShadowToast.getTextOfLatestToast();
assertNotNull(latestToast);
}
示例8: startWithNotes
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
private ActivityController startWithNotes(String notes)
{
Property property = new Property();
property.notes = notes;
long id = db.insertProperty(property);
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putLong("id", id);
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(PropertyNotesActivity.class, intent).create();
Activity activity = (Activity)controller.get();
assertTrue(activity.isFinishing() == false);
controller.start();
controller.visible();
controller.resume();
String latestToast = ShadowToast.getTextOfLatestToast();
assertNull(latestToast);
return controller;
}
示例9: startWithoutMap
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test
public void startWithoutMap()
{
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putInt("title", R.string.app_name);
bundle.putInt("description", R.string.app_name);
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(ItemizeActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
assertTrue(activity.isFinishing());
String latestToast = ShadowToast.getTextOfLatestToast();
assertNotNull(latestToast);
}
示例10: startWithoutProperty
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test
public void startWithoutProperty()
{
Intent intent = new Intent();
final Bundle bundle = new Bundle();
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(PropertyWorksheetActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
assertTrue(activity.isFinishing());
String latestToast = ShadowToast.getTextOfLatestToast();
assertNotNull(latestToast);
}
示例11: checkNoProperties
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test
public void checkNoProperties()
{
ActivityController controller = Robolectric.buildActivity(PropertiesListActivity.class).create();
Activity activity = (Activity)controller.get();
controller.start();
controller.visible();
controller.resume();
View helpText = activity.findViewById(R.id.helpText);
assertEquals(View.VISIBLE, helpText.getVisibility());
View list = activity.findViewById(R.id.list);
assertEquals(View.GONE, list.getVisibility());
}
示例12: startWithMissingProperty
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test
public void startWithMissingProperty()
{
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putLong("id", 0);
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(PropertyPicturesActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
assertTrue(activity.isFinishing());
String latestToast = ShadowToast.getTextOfLatestToast();
assertNotNull(latestToast);
}
示例13: startWithoutProperty
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test
public void startWithoutProperty()
{
Intent intent = new Intent();
final Bundle bundle = new Bundle();
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(PropertySummaryActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
controller.visible();
controller.resume();
assertTrue(activity.isFinishing());
String latestToast = ShadowToast.getTextOfLatestToast();
assertNotNull(latestToast);
}
示例14: startWithProperty
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
private ActivityController startWithProperty(Property property)
{
long id = db.insertProperty(property);
Intent intent = new Intent();
final Bundle bundle = new Bundle();
bundle.putLong("id", id);
intent.putExtras(bundle);
ActivityController controller = Robolectric.buildActivity(PropertyPicturesActivity.class, intent).create();
Activity activity = (Activity)controller.get();
controller.start();
controller.visible();
controller.resume();
assertTrue(activity.isFinishing() == false);
String latestToast = ShadowToast.getTextOfLatestToast();
assertNull(latestToast);
return controller;
}
示例15: clickAddLaunchesActivity
import org.robolectric.android.controller.ActivityController; //导入方法依赖的package包/类
@Test
public void clickAddLaunchesActivity()
{
ActivityController controller = Robolectric.buildActivity(PropertiesListActivity.class).create();
Activity activity = (Activity)controller.get();
controller.start();
controller.visible();
controller.resume();
shadowOf(activity).clickMenuItem(R.id.action_add);
assertTrue(activity.isFinishing() == false);
Intent next = shadowOf(activity).getNextStartedActivity();
ComponentName componentName = next.getComponent();
String name = componentName.flattenToShortString();
assertEquals("protect.rentalcalc/.PropertyViewActivity", name);
Bundle extras = next.getExtras();
assertNull(extras);
}