From 9a91eb9d6c3c28b54223dae453c9d456b0c87355 Mon Sep 17 00:00:00 2001 From: Andy McFadden Date: Thu, 20 Oct 2011 16:51:50 -0700 Subject: Support WKST in recurrence rules RFC 5545 says WKST is significant in weekly rules with nonzero intervals and BYDAY rules, and also in yearly rules with a BYWEEKNO part. Yearly with BYWEEKNO seems to be generally broken, so this only attempts to correct weekly recurrences. Bug 1641249 Change-Id: Icad8762be4685036fc50bed0cc75970e774a21a8 --- .../calendarcommon/RecurrenceProcessorTest.java | 52 +++++++++++++--------- 1 file changed, 30 insertions(+), 22 deletions(-) (limited to 'tests/src/com/android') diff --git a/tests/src/com/android/calendarcommon/RecurrenceProcessorTest.java b/tests/src/com/android/calendarcommon/RecurrenceProcessorTest.java index 21d2d52..ba5ec0c 100644 --- a/tests/src/com/android/calendarcommon/RecurrenceProcessorTest.java +++ b/tests/src/com/android/calendarcommon/RecurrenceProcessorTest.java @@ -547,18 +547,10 @@ public class RecurrenceProcessorTest extends TestCase { }); } - /** - * This test fails because of a bug in RecurrenceProcessor.expand(). We - * don't have time to fix the bug yet but we don't want to lose track of - * this test either. The "failing" prefix on the method name prevents this - * test from being run. Remove the "failing" prefix when the bug is fixed. - * - * @throws Exception - */ @SmallTest - public void failingTestWeekly9() throws Exception { + public void testWeekly9() throws Exception { verifyRecurrence("19970805T100000", - "FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=MO", + "FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU", // uses default WKST=MO null /* rdate */, null /* exrule */, null /* exdate */, "19970101T000000", "19980101T000000", new String[]{ @@ -611,6 +603,34 @@ public class RecurrenceProcessorTest extends TestCase { } } + /** + * Test repeating weekly event with dtstart and dtend (only one occurrence) + * See bug #3267616 + * @throws Exception + */ + @SmallTest + public void testWeekly13() throws Exception { + verifyRecurrence("20101117T150000", + "FREQ=WEEKLY;BYDAY=WE", + null /* rdate */, null /* exrule */, null /* exdate */, + "20101117T150000", "20101117T160000", + new String[]{ "20101117T150000" }); + } + + @SmallTest + public void testWeekly14() throws Exception { + verifyRecurrence("19970805T100000", + "FREQ=WEEKLY;INTERVAL=2;COUNT=4;BYDAY=TU,SU;WKST=TH", + null /* rdate */, null /* exrule */, null /* exdate */, + "19970101T000000", "19980101T000000", + new String[]{ + "19970805T100000", + "19970817T100000", + "19970819T100000", + "19970831T100000", + }); + } + @SmallTest public void testDaily0() throws Exception { verifyRecurrence("20060215T100000", "FREQ=DAILY;COUNT=3", @@ -2397,18 +2417,6 @@ public class RecurrenceProcessorTest extends TestCase { null /* last */); } - /** - * Test repeating weekly event with dtstart and dtend (only one occurrence) - * See bug #3267616 - * @throws Exception - */ - public void testWeekly13() throws Exception { - verifyRecurrence("20101117T150000", - "FREQ=WEEKLY;BYDAY=WE", - null /* rdate */, null /* exrule */, null /* exdate */, - "20101117T150000", "20101117T160000", - new String[]{ "20101117T150000" }); - } // These recurrence rules are used in the loop that measures the performance // of recurrence expansion. -- cgit v1.2.3