Merge "Allow alternative time zone ID to be set device's zone." am: 2cd0b0aadf am: 87273aab56

Original change: https://android-review.googlesource.com/c/platform/packages/apps/Settings/+/1652336

Change-Id: I8cce932794d13dd8f9424883b9521a823583f335
This commit is contained in:
Almaz Mingaleev
2021-03-30 09:39:21 +00:00
committed by Automerger Merge Worker
7 changed files with 64 additions and 27 deletions

View File

@@ -92,4 +92,23 @@ public class TimeZoneDataTest {
.containsExactly("US", "GB");
assertThat(timeZoneData.lookupCountryCodesForZoneId("Unknown/Secret_City2")).isEmpty();
}
@Test
public void lookupCountryCodesForNonCanonicalZoneId_returnsCurrentZone() {
TimeZoneData timeZoneData = new TimeZoneData(mCountryZonesFinder);
CountryTimeZones greenland = mock(CountryTimeZones.class);
when(greenland.getCountryIso()).thenReturn("gl");
when(greenland.getTimeZoneMappings()).thenReturn(Arrays.asList(
TimeZoneMapping.createForTests(
"America/Nuuk",
true /* showInPicker */,
null /* notUsedAfter */,
Arrays.asList("America/Godthab"))));
when(mCountryZonesFinder.lookupCountryTimeZonesForZoneId("America/Godthab"))
.thenReturn(Arrays.asList(greenland));
assertThat(timeZoneData.lookupCountryCodesForZoneId("America/Godthab"))
.containsExactly("GL");
}
}