@Test public void testAboutClick() { Preference about = fragment.getPreferenceScreen().findPreference("about"); ShadowPreference shadowPreference = Shadows.shadowOf(about); shadowPreference.click(); AlertDialog dialog = (AlertDialog) ShadowDialog.getLatestDialog(); Button b = dialog.getButton(AlertDialog.BUTTON_POSITIVE); b.performClick(); assertFalse(dialog.isShowing()); }
@Test public void testStartTutorialTest() { Preference tut = fragment.getPreferenceScreen().findPreference("start_tutorial"); ShadowPreference shadowPreference = Shadows.shadowOf(tut); shadowPreference.click(); ShadowActivity a = Shadows.shadowOf(activity); Intent i = a.getNextStartedActivity(); assertEquals(TutorialActivity.class.getName(),i.getComponent().getClassName()); }
public static ShadowPreference shadowOf(Preference instance) { return (ShadowPreference) shadowOf_(instance); }