Search in sources :

Example 16 with RoboMenuItem

use of org.robolectric.fakes.RoboMenuItem in project android_packages_apps_Settings by omnirom.

the class ManageApplicationsTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mAppReset = new RoboMenuItem(R.id.reset_app_preferences);
    ReflectionHelpers.setStaticField(ApplicationsState.class, "sInstance", mState);
    when(mState.newSession(any())).thenReturn(mSession);
    mBgLooper = Looper.myLooper();
    when(mState.getBackgroundLooper()).thenReturn(mBgLooper);
    mFragment = new ManageApplications();
    ReflectionHelpers.setField(mFragment, "mLifecycle", new Lifecycle());
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) RoboMenuItem(org.robolectric.fakes.RoboMenuItem) Before(org.junit.Before)

Example 17 with RoboMenuItem

use of org.robolectric.fakes.RoboMenuItem in project android_packages_apps_Settings by SudaMod.

the class ManageApplicationsTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mAppReset = new RoboMenuItem(R.id.reset_app_preferences);
    ReflectionHelpers.setStaticField(ApplicationsState.class, "sInstance", mState);
    when(mState.newSession(any())).thenReturn(mSession);
    mBgLooper = Looper.myLooper();
    when(mState.getBackgroundLooper()).thenReturn(mBgLooper);
    mFragment = new ManageApplications();
    ReflectionHelpers.setField(mFragment, "mLifecycle", new Lifecycle());
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) RoboMenuItem(org.robolectric.fakes.RoboMenuItem) Before(org.junit.Before)

Example 18 with RoboMenuItem

use of org.robolectric.fakes.RoboMenuItem in project android_packages_apps_Settings by DirtyUnicorns.

the class ManageApplicationsTest method setUp.

@Before
public void setUp() {
    MockitoAnnotations.initMocks(this);
    mAppReset = new RoboMenuItem(R.id.reset_app_preferences);
    ReflectionHelpers.setStaticField(ApplicationsState.class, "sInstance", mState);
    when(mState.newSession(any())).thenReturn(mSession);
    mBgLooper = Looper.myLooper();
    when(mState.getBackgroundLooper()).thenReturn(mBgLooper);
    mFragment = new ManageApplications();
    ReflectionHelpers.setField(mFragment, "mLifecycle", new Lifecycle());
}
Also used : Lifecycle(com.android.settingslib.core.lifecycle.Lifecycle) RoboMenuItem(org.robolectric.fakes.RoboMenuItem) Before(org.junit.Before)

Example 19 with RoboMenuItem

use of org.robolectric.fakes.RoboMenuItem in project Detours-Android by TeamDetours.

the class Cafe_NavDrawer_ActivityTest method onNavigationItemSelected_ElseIsFalse.

@Test
public void onNavigationItemSelected_ElseIsFalse() throws Exception {
    MenuItem menuItem = new RoboMenuItem(R.id.ratings_asc);
    assertFalse(cafeActivity.onNavigationItemSelected(menuItem));
}
Also used : RoboMenuItem(org.robolectric.fakes.RoboMenuItem) MenuItem(android.view.MenuItem) RoboMenuItem(org.robolectric.fakes.RoboMenuItem) Test(org.junit.Test)

Example 20 with RoboMenuItem

use of org.robolectric.fakes.RoboMenuItem in project Detours-Android by TeamDetours.

the class Cafe_NavDrawer_ActivityTest method onNavigationItemSelected_RatingsIsTrue.

@Test
public void onNavigationItemSelected_RatingsIsTrue() throws Exception {
    MenuItem menuItem = new RoboMenuItem(R.id.nav_Rating3AndUp);
    assertTrue(cafeActivity.onNavigationItemSelected(menuItem));
}
Also used : RoboMenuItem(org.robolectric.fakes.RoboMenuItem) MenuItem(android.view.MenuItem) RoboMenuItem(org.robolectric.fakes.RoboMenuItem) Test(org.junit.Test)

Aggregations

RoboMenuItem (org.robolectric.fakes.RoboMenuItem)108 Test (org.junit.Test)101 MenuItem (android.view.MenuItem)72 SlowTest (io.github.hidroh.materialistic.test.suite.SlowTest)23 TargetApi (android.annotation.TargetApi)18 PopupMenu (android.widget.PopupMenu)18 ShadowPopupMenu (org.robolectric.shadows.ShadowPopupMenu)18 Context (android.content.Context)11 Intent (android.content.Intent)8 Before (org.junit.Before)7 Lifecycle (com.android.settingslib.core.lifecycle.Lifecycle)6 SuppressLint (android.annotation.SuppressLint)4 WebView (android.webkit.WebView)3 TestItem (io.github.hidroh.materialistic.test.TestItem)3 ShadowWebView (io.github.hidroh.materialistic.test.shadow.ShadowWebView)3 IOException (java.io.IOException)3 Bundle (android.os.Bundle)2 NonNull (android.support.annotation.NonNull)2 Fragment (android.support.v4.app.Fragment)2 RecyclerView (android.support.v7.widget.RecyclerView)2