Read setup wizard theme from system properties
Test: cd tests/robotests && mma Bug: 62060286 Change-Id: I285638736efa63314fa3e055f72ac021bce40bfe
This commit is contained in:
@@ -16,21 +16,35 @@
|
||||
|
||||
package com.android.settings;
|
||||
|
||||
import static com.android.settings.testutils.ResIdSubject.assertResId;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
import android.content.Intent;
|
||||
|
||||
import com.android.settings.testutils.shadow.SettingsShadowSystemProperties;
|
||||
import com.android.settings.testutils.SettingsRobolectricTestRunner;
|
||||
import com.android.setupwizardlib.util.WizardManagerHelper;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.robolectric.annotation.Config;
|
||||
|
||||
import static com.google.common.truth.Truth.assertThat;
|
||||
|
||||
@RunWith(SettingsRobolectricTestRunner.class)
|
||||
@Config(manifest = TestConfig.MANIFEST_PATH, sdk = TestConfig.SDK_VERSION)
|
||||
@Config(
|
||||
manifest = TestConfig.MANIFEST_PATH,
|
||||
sdk = TestConfig.SDK_VERSION,
|
||||
shadows = {
|
||||
SettingsShadowSystemProperties.class
|
||||
})
|
||||
public class SetupWizardUtilsTest {
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
SettingsShadowSystemProperties.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCopySetupExtras() throws Throwable {
|
||||
Intent fromIntent = new Intent();
|
||||
@@ -44,4 +58,24 @@ public class SetupWizardUtilsTest {
|
||||
assertThat(toIntent.getBooleanExtra(WizardManagerHelper.EXTRA_USE_IMMERSIVE_MODE, false))
|
||||
.isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTheme_withIntentExtra_shouldReturnExtraTheme() {
|
||||
SettingsShadowSystemProperties.set(SetupWizardUtils.SYSTEM_PROP_SETUPWIZARD_THEME,
|
||||
WizardManagerHelper.THEME_GLIF);
|
||||
Intent intent = new Intent();
|
||||
intent.putExtra(WizardManagerHelper.EXTRA_THEME, WizardManagerHelper.THEME_GLIF_V2);
|
||||
|
||||
assertResId(SetupWizardUtils.getTheme(intent)).isEqualTo(R.style.GlifV2Theme);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetTheme_withEmptyIntent_shouldReturnSystemProperty() {
|
||||
SettingsShadowSystemProperties.set(SetupWizardUtils.SYSTEM_PROP_SETUPWIZARD_THEME,
|
||||
WizardManagerHelper.THEME_GLIF_V2_LIGHT);
|
||||
Intent intent = new Intent();
|
||||
|
||||
assertResId(SetupWizardUtils.getTheme(intent)).isEqualTo(R.style.GlifV2Theme_Light);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user