Search in sources :

Example 1 with FormUpdateMode

use of org.odk.collect.android.preferences.utilities.FormUpdateMode in project collect by opendatakit.

the class SettingsUtilsTest method getFormUpdateMode_whenProtocolIsGoogleDrive_andModeNotManual_returnsManual.

@Test
public void getFormUpdateMode_whenProtocolIsGoogleDrive_andModeNotManual_returnsManual() {
    Settings generalSettings = TestSettingsProvider.getUnprotectedSettings();
    Context context = getApplicationContext();
    generalSettings.save(ProjectKeys.KEY_PROTOCOL, ProjectKeys.PROTOCOL_GOOGLE_SHEETS);
    generalSettings.save(ProjectKeys.KEY_FORM_UPDATE_MODE, FormUpdateMode.PREVIOUSLY_DOWNLOADED_ONLY.getValue(context));
    FormUpdateMode formUpdateMode = SettingsUtils.getFormUpdateMode(context, generalSettings);
    assertThat(formUpdateMode, is(FormUpdateMode.MANUAL));
}
Also used : Context(android.content.Context) ApplicationProvider.getApplicationContext(androidx.test.core.app.ApplicationProvider.getApplicationContext) FormUpdateMode(org.odk.collect.android.preferences.utilities.FormUpdateMode) Settings(org.odk.collect.shared.settings.Settings) Test(org.junit.Test)

Aggregations

Context (android.content.Context)1 ApplicationProvider.getApplicationContext (androidx.test.core.app.ApplicationProvider.getApplicationContext)1 Test (org.junit.Test)1 FormUpdateMode (org.odk.collect.android.preferences.utilities.FormUpdateMode)1 Settings (org.odk.collect.shared.settings.Settings)1