diff options
author | Andy McFadden <fadden@android.com> | 2011-07-20 15:15:44 -0700 |
---|---|---|
committer | Andy McFadden <fadden@android.com> | 2011-07-20 16:14:50 -0700 |
commit | dce6a0a89883ab3e76212a11a5a889407887718f (patch) | |
tree | 42055a7bed3f5a80c385630908c4f27320a3b222 /tests/src | |
parent | 6d5684cdf6886a46ee993c8ec986d306472cd5b0 (diff) | |
download | calendar-dce6a0a89883ab3e76212a11a5a889407887718f.tar.gz |
Partial support for BYSETPOS
This adds support for rules like FREQ=MONTHLY;BYDAY=SA,SU;BYSETPOS=x
(for the popular "first weekday of the month" sort of recurrence).
Implementing fully general support for BYSETPOS is a bigger task.
Bug 4946753
Change-Id: I437c0cf52bbed2a191729b3891c3afda62ffb633
Diffstat (limited to 'tests/src')
-rw-r--r-- | tests/src/com/android/calendarcommon/RecurrenceProcessorTest.java | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/tests/src/com/android/calendarcommon/RecurrenceProcessorTest.java b/tests/src/com/android/calendarcommon/RecurrenceProcessorTest.java index 9f6f13a..2ca2d35 100644 --- a/tests/src/com/android/calendarcommon/RecurrenceProcessorTest.java +++ b/tests/src/com/android/calendarcommon/RecurrenceProcessorTest.java @@ -378,7 +378,7 @@ public class RecurrenceProcessorTest extends TestCase { null /* rdate */, null /* exrule */, null /* exdate */, "20060101T000000", "20101231T000000", new String[]{ - "20060101T100000", + "20060101T100000", // TODO: this is wrong (bug in recurrence gen) "20060113T100000", "20061013T100000", "20070413T100000", @@ -392,6 +392,36 @@ public class RecurrenceProcessorTest extends TestCase { } @SmallTest + public void testMonthly14() throws Exception { + verifyRecurrence("20110103T100000", "FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=1,-1", + null /* rdate */, null /* exrule */, null /* exdate */, + "20110101T000000", "20110331T235959", + new String[]{ + "20110103T100000", + "20110131T100000", + "20110201T100000", + "20110228T100000", + "20110301T100000", + "20110331T100000", + }); + } + + @SmallTest + public void testMonthly15() throws Exception { + verifyRecurrence("20110703T100000", "FREQ=MONTHLY;BYDAY=SA,SU;BYSETPOS=2,-2", + null /* rdate */, null /* exrule */, null /* exdate */, + "20110701T000000", "20110931T235959", + new String[]{ + "20110703T100000", + "20110730T100000", + "20110807T100000", + "20110827T100000", + "20110904T100000", + "20110924T100000", + }); + } + + @SmallTest public void testWeekly0() throws Exception { verifyRecurrence("20060215T100000", "FREQ=WEEKLY;COUNT=3", null /* rdate */, null /* exrule */, null /* exdate */, |