Java 类org.robolectric.shadows.ShadowPreference 实例源码

项目:AluShare    文件:PreferencesTest.java   
@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());

}
项目:AluShare    文件:PreferencesTest.java   
@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());
}
项目:FullRobolectricTestSample    文件:Robolectric.java   
public static ShadowPreference shadowOf(Preference instance) {
  return (ShadowPreference) shadowOf_(instance);
}