Java Code Examples for android.support.test.espresso.DataInteraction#check()

The following examples show how to use android.support.test.espresso.DataInteraction#check() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 6 votes vote down vote up
public static void verifyLocaleSettings(Context context)
{
    // verify the mode selector
    DataInteraction modePref = onData(allOf( is(instanceOf(Preference.class)), withKey("app_locale_mode")))
            .inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))));
    modePref.check(assertEnabled);

    AppSettings.LocaleMode mode = AppSettings.loadLocaleModePref(context);
    DataInteraction modePref_text = modePref.onChildView(allOf(withClassName(is(TextView.class.getName())), withText(mode.getDisplayString())));
    modePref_text.check(assertShown);

    // verify the language selector
    DataInteraction langPref = onData(allOf(is(instanceOf(Preference.class)), withKey("app_locale")))
            .inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))));
    langPref.check(assertShown);

    if (mode == AppSettings.LocaleMode.SYSTEM_LOCALE)
        langPref.check(assertDisabled);       // language disabled for system mode
    else langPref.check(assertEnabled);

    String lang = getLocaleDisplayString(context, AppSettings.loadLocalePref(context));
    DataInteraction langPref_text = langPref.onChildView(allOf(withClassName(is(TextView.class.getName())), withText(lang)));
    langPref_text.check(assertShown);
}
 
Example 2
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyGeneralSettings_dataSource(Context context)
{
    DataInteraction dataSourcePref = onData(allOf( is(instanceOf(Preference.class)), withKey("appwidget_0_general_calculator")) ).inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))));
    dataSourcePref.check(assertEnabled);

    SuntimesCalculatorDescriptor dataSource = WidgetSettings.loadCalculatorModePref(context, 0);
    DataInteraction dataSourcePref_text = dataSourcePref.onChildView(allOf(withClassName(is(TextView.class.getName())), withText(dataSource.getName())));
    dataSourcePref_text.check(assertShown);
}
 
Example 3
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyPlacesSettings_gpsTimeLimit(Context context)
{
    DataInteraction gpsTimePref = onData(
            allOf( is(instanceOf(Preference.class)), withKey("getFix_maxElapsed")) )
            .inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))));
    gpsTimePref.check(assertEnabled);
    // TODO: verify correct setting
}
 
Example 4
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyPlacesSettings_gpsMaxAge(Context context)
{
    DataInteraction gpsAgePref = onData(
            allOf( is(instanceOf(Preference.class)), withKey("getFix_maxAge")) )
            .inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))) );
    gpsAgePref.check(assertEnabled);
    // TODO: verify correct setting
}
 
Example 5
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyUISettings_lightmap(Context context)
{
    DataInteraction lightmapPref = onData(allOf(is(instanceOf(Preference.class)), withKey("app_ui_showlightmap"))).inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))));
    lightmapPref.check(assertEnabled);

    DataInteraction lightmapPref_checkBox = lightmapPref.onChildView(withClassName(is(CheckBox.class.getName())));
    if (AppSettings.loadShowLightmapPref(context))
        lightmapPref_checkBox.check(assertChecked);
    else lightmapPref_checkBox.check(assertNotChecked);
}
 
Example 6
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyUISettings_uiWarnings(Context context)
{
    DataInteraction warningPref = onData(allOf( is(instanceOf(Preference.class)), withKey("app_ui_showwarnings"))).inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))) );
    warningPref.check(assertEnabled);

    DataInteraction warningPref_checkBox = warningPref.onChildView(withClassName(is(CheckBox.class.getName())));
    if (AppSettings.loadShowWarningsPref(context))
        warningPref_checkBox.check(assertChecked);
    else warningPref_checkBox.check(assertNotChecked);
}
 
Example 7
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyUISettings_noteTap(Context context)
{
    DataInteraction notetapPref = onData(allOf( is(instanceOf(Preference.class)), withKey("app_ui_notetapaction"))).inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))));
    notetapPref.check(assertEnabled);

    //AppSettings.ClockTapAction action = AppSettings.loadNoteTapActionPref(context);
    //DataInteraction notetapPref_text = notetapPref.onChildView(allOf(withClassName(is(TextView.class.getName())), withText(containsString(action.getDisplayString()))));
    //notetapPref_text.check(assertShown);
    // TODO
}
 
Example 8
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyUISettings_dateTap(Context context)
{
    DataInteraction datetapPref = onData(allOf( is(instanceOf(Preference.class)), withKey("app_ui_datetapaction"))).inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))) );
    datetapPref.check(assertEnabled);

    //AppSettings.DateTapAction action = AppSettings.loadDateTapActionPref(context);
    //DataInteraction datetapPref_text = datetapPref.onChildView(allOf(withClassName(is(TextView.class.getName())), withText(containsString(action.getDisplayString()))));
    //datetapPref_text.check(assertShown);
    // TODO
}
 
Example 9
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyUISettings_clockTap(Context context)
{
    DataInteraction clocktapPref = onData(allOf( is(instanceOf(Preference.class)), withKey("app_ui_clocktapaction"))).inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))) );
    clocktapPref.check(assertEnabled);

    //AppSettings.ClockTapAction action = AppSettings.loadClockTapActionPref(context);
    //DataInteraction clocktapPref_text = clocktapPref.onChildView(allOf(withClassName(is(TextView.class.getName())), withText(containsString(action.getDisplayString()))));
    //clocktapPref_text.check(assertShown);
    // TODO
}
 
Example 10
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyUISettings_timeFormatMode(Context context)
{
    DataInteraction formatPref = onData(allOf( is(instanceOf(Preference.class)), withKey("appwidget_0_appearance_timeformatmode"))).inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))));
    formatPref.check(assertEnabled);

    WidgetSettings.TimeFormatMode mode = WidgetSettings.loadTimeFormatModePref(context, 0);
    String modeSummary = String.format(SuntimesSettingsActivity.timeFormatPrefSummary(mode, context), mode.getDisplayString());
    DataInteraction formatPref_text = formatPref.onChildView(allOf(withClassName(is(TextView.class.getName())), withText(modeSummary)));
    formatPref_text.check(assertShown);
}
 
Example 11
Source File: SuntimesSettingsActivityTest.java    From SuntimesWidget with GNU General Public License v3.0 5 votes vote down vote up
public static void verifyUISettings_theme(Activity activity)
{
    DataInteraction themePref = onData(allOf( is(instanceOf(Preference.class)), withKey("app_appearance_theme"))).inAdapterView(allOf(hasFocus(), is(instanceOf(ListView.class))));
    themePref.check(assertEnabled);

    String themeName = AppSettings.loadThemePref(activity);
    String themeDisplay = getThemeDisplayString(activity, themeName);
    DataInteraction themePref_text = themePref.onChildView(allOf(withClassName(is(TextView.class.getName())), withText(themeDisplay)));
    themePref_text.check(assertShown);
}