Merge "Use flag to control the hierarchy tree changes" into main
This commit is contained in:
@@ -19,14 +19,18 @@ package com.android.settings.regionalpreferences;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import android.content.Context;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settings.testutils.ResourcesUtils;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -37,6 +41,8 @@ public class FirstDayOfWeekControllerTest {
|
||||
private String mCacheProviderContent = "";
|
||||
private Locale mCacheLocale;
|
||||
|
||||
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mApplicationContext = ApplicationProvider.getApplicationContext();
|
||||
@@ -54,6 +60,7 @@ public class FirstDayOfWeekControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getSummary_hasProviderValue_resultIsWed() {
|
||||
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "und-u-fw-wed");
|
||||
|
||||
@@ -64,6 +71,7 @@ public class FirstDayOfWeekControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getSummary_hasProviderValue_resultIsSat() {
|
||||
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "und-u-fw-sat");
|
||||
|
||||
@@ -74,6 +82,7 @@ public class FirstDayOfWeekControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getSummary_noProviderValueButHasDefaultLocaleWithSubtag_resultIsSat() {
|
||||
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "");
|
||||
Locale.setDefault(Locale.forLanguageTag("en-US-u-fw-sat"));
|
||||
@@ -85,6 +94,7 @@ public class FirstDayOfWeekControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getSummary_noProviderValueAndDefaultLocaleWithoutSubtag_resultIsdefault() {
|
||||
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "");
|
||||
Locale.setDefault(Locale.forLanguageTag("en-US"));
|
||||
|
@@ -23,22 +23,30 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.LocaleList;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import com.android.settings.flags.Flags;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
public class NumberingSystemControllerTest {
|
||||
private Context mApplicationContext;
|
||||
private NumberingSystemController mController;
|
||||
|
||||
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mApplicationContext = ApplicationProvider.getApplicationContext();
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getAvailabilityStatus_noLocale_unavailable() {
|
||||
LocaleList.setDefault(LocaleList.forLanguageTags("en-US,zh-Hant-TW"));
|
||||
mController = new NumberingSystemController(mApplicationContext, "key");
|
||||
@@ -49,6 +57,7 @@ public class NumberingSystemControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getAvailabilityStatus_hasLocaleWithNumberingSystems_available() {
|
||||
// ar-JO has different numbering system.
|
||||
LocaleList.setDefault(LocaleList.forLanguageTags("en-US,zh-Hant-TW,ar-JO"));
|
||||
|
@@ -19,14 +19,18 @@ package com.android.settings.regionalpreferences;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
import android.content.Context;
|
||||
import android.platform.test.annotations.DisableFlags;
|
||||
import android.platform.test.flag.junit.SetFlagsRule;
|
||||
import android.provider.Settings;
|
||||
|
||||
import androidx.test.core.app.ApplicationProvider;
|
||||
|
||||
import com.android.settings.flags.Flags;
|
||||
import com.android.settings.testutils.ResourcesUtils;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Locale;
|
||||
@@ -37,6 +41,8 @@ public class TemperatureUnitControllerTest {
|
||||
private String mCacheProviderContent = "";
|
||||
private Locale mCacheLocale;
|
||||
|
||||
@Rule public final SetFlagsRule mSetFlagsRule = new SetFlagsRule();
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
mApplicationContext = ApplicationProvider.getApplicationContext();
|
||||
@@ -54,6 +60,7 @@ public class TemperatureUnitControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getSummary_hasProviderValue_resultIsCelsius() {
|
||||
RegionalPreferenceTestUtils.setSettingsProviderContent(
|
||||
mApplicationContext, "und-u-mu-celsius");
|
||||
@@ -65,6 +72,7 @@ public class TemperatureUnitControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getSummary_hasProviderValue_resultIsFahrenheit() {
|
||||
RegionalPreferenceTestUtils.setSettingsProviderContent(
|
||||
mApplicationContext, "und-u-mu-fahrenhe");
|
||||
@@ -76,6 +84,7 @@ public class TemperatureUnitControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getSummary_noProviderValueButHasDefaultLocaleWithSubtag_resultIsFahrenheit() {
|
||||
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "");
|
||||
Locale.setDefault(Locale.forLanguageTag("en-US-u-mu-fahrenhe"));
|
||||
@@ -87,6 +96,7 @@ public class TemperatureUnitControllerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
@DisableFlags(Flags.FLAG_REGIONAL_PREFERENCES_API_ENABLED)
|
||||
public void getSummary_noProviderValueAndDefaultLocaleWithoutSubtag_resultIsDefault() {
|
||||
RegionalPreferenceTestUtils.setSettingsProviderContent(mApplicationContext, "");
|
||||
Locale.setDefault(Locale.forLanguageTag("en-US"));
|
||||
|
Reference in New Issue
Block a user