diff options
| author | Marc Blank <mblank@google.com> | 2010-02-02 16:56:44 -0800 |
|---|---|---|
| committer | Marc Blank <mblank@google.com> | 2010-02-03 14:41:45 -0800 |
| commit | 6f3013b78708321879728c28db044ab233cb2016 (patch) | |
| tree | c57760f56f71f88c9d5120d37b4dac14a26cd3bb /tests | |
| parent | 8bb0ee3b924f6b0e948733dacac3228f88bd50dc (diff) | |
| download | android_packages_apps_Email-6f3013b78708321879728c28db044ab233cb2016.tar.gz android_packages_apps_Email-6f3013b78708321879728c28db044ab233cb2016.tar.bz2 android_packages_apps_Email-6f3013b78708321879728c28db044ab233cb2016.zip | |
Build proper TimeZoneInformation strings for upsync; fix bugs
* Create full TZI strings for upload of events (previously, we
omitted DST information)
* Add documentation to some unit tests
* Put in correct logic for determining if upload needed
* Fix problem w/ parsing empty tags
Change-Id: I268ce8a2db30b3cfdf0e44f6a78befd6bd933243
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java | 40 |
1 files changed, 31 insertions, 9 deletions
diff --git a/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java b/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java index 379c40259..cb97e86be 100644 --- a/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java +++ b/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java @@ -20,13 +20,23 @@ import android.test.AndroidTestCase; import java.util.TimeZone; +/** + * Tests of EAS Calendar Utilities + * You can run this entire test case with: + * runtest -c com.android.exchange.utility.CalendarUtilitiesTests email + * + * Please see RFC2445 for RRULE definition + * http://www.ietf.org/rfc/rfc2445.txt + */ + public class CalendarUtilitiesTests extends AndroidTestCase { // Some prebuilt time zones, Base64 encoded (as they arrive from EAS) - private static final String ISRAEL_STANDARD_TIME = - "iP///ygARwBNAFQAKwAwADIAOgAwADAAKQAgAEoAZQByAHUAcwBhAGwAZQBtAAAAAAAAAAAAAAAAAAAAAAAA" + - "AAAAAAAAAAkAAAAFAAIAAAAAAAAAAAAAACgARwBNAFQAKwAwADIAOgAwADAAKQAgAEoAZQByAHUAcwBhAGwA" + - "ZQBtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMABQAFAAIAAAAAAAAAxP///w=="; + // More time zones to be added over time + + // Not all time zones are appropriate for testing. For example, ISRAEL_STANDARD_TIME cannot be + // used because DST is determined from year to year in a non-standard way (related to the lunar + // calendar); therefore, the test would only work during the year in which it was created private static final String INDIA_STANDARD_TIME = "tv7//0kAbgBkAGkAYQAgAFMAdABhAG4AZABhAHIAZAAgAFQAaQBtAGUAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEkAbgBkAGkAYQAgAEQAYQB5AGwAaQBnAGgAdAAgAFQAaQBtAGUA" + @@ -56,19 +66,20 @@ public class CalendarUtilitiesTests extends AndroidTestCase { } public void testParseTimeZoneEndToEnd() { - TimeZone tz = CalendarUtilities.parseTimeZone(PACIFIC_STANDARD_TIME); + TimeZone tz = CalendarUtilities.tziStringToTimeZone(PACIFIC_STANDARD_TIME); assertEquals("Pacific Standard Time", tz.getDisplayName()); - tz = CalendarUtilities.parseTimeZone(INDIA_STANDARD_TIME); + tz = CalendarUtilities.tziStringToTimeZone(INDIA_STANDARD_TIME); assertEquals("India Standard Time", tz.getDisplayName()); - tz = CalendarUtilities.parseTimeZone(ISRAEL_STANDARD_TIME); - assertEquals("Israel Standard Time", tz.getDisplayName()); } public void testGenerateEasDayOfWeek() { String byDay = "TU;WE;SA"; + // TU = 4, WE = 8; SA = 64; assertEquals("76", CalendarUtilities.generateEasDayOfWeek(byDay)); + // MO = 2, TU = 4; WE = 8; TH = 16; FR = 32 byDay = "MO;TU;WE;TH;FR"; assertEquals("62", CalendarUtilities.generateEasDayOfWeek(byDay)); + // SU = 1 byDay = "SU"; assertEquals("1", CalendarUtilities.generateEasDayOfWeek(byDay)); } @@ -81,7 +92,18 @@ public class CalendarUtilitiesTests extends AndroidTestCase { assertNull(CalendarUtilities.tokenFromRrule(rrule, "UNTIL=")); } -// TODO In progress + // Tests in progress... + +// public void testTimeZoneToTziString() { +// for (String timeZoneId: TimeZone.getAvailableIDs()) { +// TimeZone timeZone = TimeZone.getTimeZone(timeZoneId); +// if (timeZone != null) { +// String tzs = CalendarUtilities.timeZoneToTziString(timeZone); +// TimeZone newTimeZone = CalendarUtilities.tziStringToTimeZone(tzs); +// System.err.println("In: " + timeZone.getDisplayName() + ", Out: " + newTimeZone.getDisplayName()); +// } +// } +// } // public void testParseTimeZone() { // GregorianCalendar cal = getTestCalendar(parsedTimeZone, dstStart); // cal.add(GregorianCalendar.MINUTE, -1); |
