Loading src/androidTest/java/at/bitfire/ical4android/AndroidCompatTimeZoneRegistryTest.kt +13 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ package at.bitfire.ical4android import net.fortuna.ical4j.model.DefaultTimeZoneRegistryFactory import net.fortuna.ical4j.model.TimeZone import net.fortuna.ical4j.model.TimeZoneRegistry import org.junit.Assert.* import org.junit.Assume Loading Loading @@ -41,6 +42,18 @@ class AndroidCompatTimeZoneRegistryTest { ) } @Test fun getTimeZone_Existing_ButNotInIcal4j() { val reg = AndroidCompatTimeZoneRegistry(object: TimeZoneRegistry { override fun register(timezone: TimeZone?) = throw NotImplementedError() override fun register(timezone: TimeZone?, update: Boolean) = throw NotImplementedError() override fun clear() = throw NotImplementedError() override fun getTimeZone(id: String?) = null }) assertNull(reg.getTimeZone("Europe/Berlin")) } @Test fun getTimeZone_Existing_Kiev() { Assume.assumeFalse(systemKnowsKyiv) Loading src/main/java/at/bitfire/ical4android/AndroidCompatTimeZoneRegistry.kt +2 −2 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ class AndroidCompatTimeZoneRegistry( Example: getTimeZone("Europe/Kiev") returns a TimeZone with TZID:Europe/Kyiv since ical4j/3.2.5, but most Android devices don't now Europe/Kyiv yet. */ val tz = base.getTimeZone(id) if (tz.id != androidTzId) { val tz: TimeZone? = base.getTimeZone(id) if (tz != null && tz.id != androidTzId) { Ical4Android.log.warning("Using Android TZID $androidTzId instead of ical4j ${tz.id}") // create a copy of the VTIMEZONE so that we don't modify the original registry values (which are not immutable) Loading Loading
src/androidTest/java/at/bitfire/ical4android/AndroidCompatTimeZoneRegistryTest.kt +13 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ package at.bitfire.ical4android import net.fortuna.ical4j.model.DefaultTimeZoneRegistryFactory import net.fortuna.ical4j.model.TimeZone import net.fortuna.ical4j.model.TimeZoneRegistry import org.junit.Assert.* import org.junit.Assume Loading Loading @@ -41,6 +42,18 @@ class AndroidCompatTimeZoneRegistryTest { ) } @Test fun getTimeZone_Existing_ButNotInIcal4j() { val reg = AndroidCompatTimeZoneRegistry(object: TimeZoneRegistry { override fun register(timezone: TimeZone?) = throw NotImplementedError() override fun register(timezone: TimeZone?, update: Boolean) = throw NotImplementedError() override fun clear() = throw NotImplementedError() override fun getTimeZone(id: String?) = null }) assertNull(reg.getTimeZone("Europe/Berlin")) } @Test fun getTimeZone_Existing_Kiev() { Assume.assumeFalse(systemKnowsKyiv) Loading
src/main/java/at/bitfire/ical4android/AndroidCompatTimeZoneRegistry.kt +2 −2 Original line number Diff line number Diff line Loading @@ -51,8 +51,8 @@ class AndroidCompatTimeZoneRegistry( Example: getTimeZone("Europe/Kiev") returns a TimeZone with TZID:Europe/Kyiv since ical4j/3.2.5, but most Android devices don't now Europe/Kyiv yet. */ val tz = base.getTimeZone(id) if (tz.id != androidTzId) { val tz: TimeZone? = base.getTimeZone(id) if (tz != null && tz.id != androidTzId) { Ical4Android.log.warning("Using Android TZID $androidTzId instead of ical4j ${tz.id}") // create a copy of the VTIMEZONE so that we don't modify the original registry values (which are not immutable) Loading