aboutsummaryrefslogtreecommitdiff
path: root/tests/src/com/android
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2011-07-12 17:05:30 -0700
committerAndy McFadden <fadden@android.com>2011-07-15 16:31:44 -0700
commite29edf9b71fbec8a7c7f0b523ca105a377632989 (patch)
tree3b2de55f6a4b63190c315d9309a81a7675273dce /tests/src/com/android
parent747abc3833aec07827fa6b831e58f78e72c139d1 (diff)
downloadcalendar-e29edf9b71fbec8a7c7f0b523ca105a377632989.tar.gz
Added some RecurrenceSet tests
Adds a few more tests for RecurrenceSet. Also, fix the RecurrenceSet TAG. Change-Id: I429cbea065e2b5d8d3a97662e54b9428ad8be257
Diffstat (limited to 'tests/src/com/android')
-rw-r--r--tests/src/com/android/calendarcommon/RecurrenceSetTest.java44
1 files changed, 44 insertions, 0 deletions
diff --git a/tests/src/com/android/calendarcommon/RecurrenceSetTest.java b/tests/src/com/android/calendarcommon/RecurrenceSetTest.java
index 8382db8..5b29fc3 100644
--- a/tests/src/com/android/calendarcommon/RecurrenceSetTest.java
+++ b/tests/src/com/android/calendarcommon/RecurrenceSetTest.java
@@ -59,6 +59,50 @@ public class RecurrenceSetTest extends TestCase {
null, null, 1250812800000L, "UTC", "P2D", 1);
}
+ // Test multi-rule RRULE.
+ @SmallTest
+ public void testRecurrenceSet3() throws Exception {
+ String recurrence = "DTSTART;VALUE=DATE:20090821\n"
+ + "RRULE:FREQ=YEARLY;WKST=SU\n"
+ + "RRULE:FREQ=MONTHLY;COUNT=3\n"
+ + "DURATION:P2H";
+ verifyPopulateContentValues(recurrence, "FREQ=YEARLY;WKST=SU\nFREQ=MONTHLY;COUNT=3", null,
+ null, null, 1250812800000L, "UTC", "P2H", 1 /*allDay*/);
+ // allDay=1 just means the start time is 00:00:00 UTC.
+ }
+
+ // Test RDATE with VALUE=DATE.
+ @SmallTest
+ public void testRecurrenceSet4() throws Exception {
+ String recurrence = "DTSTART;TZID=America/Los_Angeles:20090821T010203\n"
+ + "RDATE;TZID=America/Los_Angeles;VALUE=DATE:20110601,20110602,20110603\n"
+ + "DURATION:P2H";
+ verifyPopulateContentValues(recurrence, null,
+ //"TZID=America/Los_Angeles;VALUE=DATE:20110601,20110602,20110603",
+ "America/Los_Angeles;20110601,20110602,20110603", // incorrect
+ null, null, 1250841723000L, "America/Los_Angeles", "P2H", 0 /*allDay*/);
+ // allDay=1 just means the start time is 00:00:00 UTC.
+ }
+
+ // Check generation of duration from events in different time zones.
+ @SmallTest
+ public void testRecurrenceSet5() throws Exception {
+ String recurrence = "DTSTART;TZID=America/Los_Angeles:20090821T070000\n"
+ + "DTEND;TZID=America/New_York:20090821T110000\n"
+ + "RRULE:FREQ=YEARLY\n";
+ verifyPopulateContentValues(recurrence, "FREQ=YEARLY", null,
+ null, null, 1250863200000L, "America/Los_Angeles", "P3600S" /*P1H*/, 0 /*allDay*/);
+ // TODO: would like to use P1H for duration
+
+ String recurrence2 = "DTSTART;TZID=America/New_York:20090821T100000\n"
+ + "DTEND;TZID=America/Los_Angeles:20090821T080000\n"
+ + "RRULE:FREQ=YEARLY\n";
+ verifyPopulateContentValues(recurrence, "FREQ=YEARLY", null,
+ null, null, 1250863200000L, "America/Los_Angeles", "P3600S" /*P1H*/, 0 /*allDay*/);
+ // TODO: should we rigorously define which tzid becomes the "event timezone"?
+ }
+
+
// run populateContentValues and verify the results
private void verifyPopulateContentValues(String recurrence, String rrule, String rdate,
String exrule, String exdate, long dtstart, String tzid, String duration, int allDay)