diff options
author | Marc Blank <mblank@google.com> | 2011-05-27 12:48:00 -0700 |
---|---|---|
committer | Marc Blank <mblank@google.com> | 2011-08-01 14:55:25 -0700 |
commit | f352bc9f29cacc61b195069e48d5c8b868660694 (patch) | |
tree | ccf6aff5d8833c856fa3a820004300fd1f44da0a /tests/src | |
parent | 6aa35f65d70f476367b3ee951b4470662a296fa1 (diff) | |
download | android_packages_apps_Exchange-f352bc9f29cacc61b195069e48d5c8b868660694.tar.gz android_packages_apps_Exchange-f352bc9f29cacc61b195069e48d5c8b868660694.tar.bz2 android_packages_apps_Exchange-f352bc9f29cacc61b195069e48d5c8b868660694.zip |
Review recurrence code and fix issues
* Turns out there were a couple of unusual cases that we weren't
handling correctly, including the referenced bug
* Reworked some of the code, and added test cases for these
unusual cases.
Bug: 4452794
Change-Id: I02734aefd895bccb8fb2bdcecc3539b1cb06adfd
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java b/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java index c9adf90b..1fcf5763 100644 --- a/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java +++ b/tests/src/com/android/exchange/utility/CalendarUtilitiesTests.java @@ -647,12 +647,18 @@ public class CalendarUtilitiesTests extends SyncAdapterTestCase<CalendarSyncAdap assertEquals("FREQ=WEEKLY;BYDAY=TU,FR", rrule); // The last Saturday of the month rrule = CalendarUtilities.rruleFromRecurrence( - 3 /*Monthly/DayofWeek*/, 0, 0, 64 /*Sat*/, 0, 5 /*Last*/, 0, null); - assertEquals("FREQ=MONTHLY;BYDAY=-1SA", rrule); + 1 /*Weekly*/, 0, 0, 64 /*Sat*/, 0, 5 /*Last*/, 0, null); + assertEquals("FREQ=WEEKLY;BYDAY=-1SA", rrule); // The third Wednesday and Thursday of the month rrule = CalendarUtilities.rruleFromRecurrence( - 3 /*Monthly/DayofWeek*/, 0, 0, 24 /*Wed&Thu*/, 0, 3 /*3rd*/, 0, null); - assertEquals("FREQ=MONTHLY;BYDAY=3WE,3TH", rrule); + 1 /*Weekly*/, 0, 0, 24 /*Wed&Thu*/, 0, 3 /*3rd*/, 0, null); + assertEquals("FREQ=WEEKLY;BYDAY=3WE,3TH", rrule); + rrule = CalendarUtilities.rruleFromRecurrence( + 3 /*Monthly/Day*/, 0, 0, 127 /*LastDay*/, 0, 0, 0, null); + assertEquals("FREQ=MONTHLY;BYMONTHDAY=-1", rrule); + rrule = CalendarUtilities.rruleFromRecurrence( + 3 /*Monthly/Day*/, 0, 0, 62 /*M-F*/, 0, 5 /*Last week*/, 0, null); + assertEquals("FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1", rrule); // The 14th of the every month rrule = CalendarUtilities.rruleFromRecurrence( 2 /*Monthly/Date*/, 0, 0, 0, 14 /*14th*/, 0, 0, null); @@ -696,8 +702,10 @@ public class CalendarUtilitiesTests extends SyncAdapterTestCase<CalendarSyncAdap testSingleRecurrenceFromRrule(adapter, "FREQ=WEEKLY;COUNT=2;INTERVAL=1;BYDAY=MO"); testSingleRecurrenceFromRrule(adapter, "FREQ=WEEKLY;BYDAY=TU,FR"); - testSingleRecurrenceFromRrule(adapter, "FREQ=MONTHLY;BYDAY=-1SA"); - testSingleRecurrenceFromRrule(adapter, "FREQ=MONTHLY;BYDAY=3WE,3TH"); + testSingleRecurrenceFromRrule(adapter, "FREQ=WEEKLY;BYDAY=-1SA"); + testSingleRecurrenceFromRrule(adapter, "FREQ=WEEKLY;BYDAY=3WE,3TH"); + testSingleRecurrenceFromRrule(adapter, "FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-1"); + testSingleRecurrenceFromRrule(adapter, "FREQ=MONTHLY;BYMONTHDAY=17"); testSingleRecurrenceFromRrule(adapter, "FREQ=YEARLY;BYMONTHDAY=31;BYMONTH=10"); testSingleRecurrenceFromRrule(adapter, "FREQ=YEARLY;BYDAY=1TU;BYMONTH=6"); } |