Fix utility that retrieves tokens from RRULEs
* The utility wasn't handling commas properly, causing the referenced bug * Fixed the utility and updated the relevant test case Bug: 2515488 Change-Id: Id229e50fcaaed1a0142db301eedaaba9209bed13
This commit is contained in:
parent
90299163a3
commit
befa974de8
@ -917,7 +917,7 @@ public class CalendarUtilities {
|
||||
char c;
|
||||
do {
|
||||
c = rrule.charAt(end++);
|
||||
if (!Character.isLetterOrDigit(c) || (end == len)) {
|
||||
if ((c == ';') || (end == len)) {
|
||||
if (end == len) end++;
|
||||
return rrule.substring(start, end -1);
|
||||
}
|
||||
|
@ -17,8 +17,8 @@
|
||||
package com.android.exchange.utility;
|
||||
|
||||
import com.android.email.R;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.TestUtils;
|
||||
import com.android.email.Utility;
|
||||
import com.android.email.mail.Address;
|
||||
import com.android.email.provider.EmailContent.Account;
|
||||
import com.android.email.provider.EmailContent.Attachment;
|
||||
@ -93,11 +93,11 @@ public class CalendarUtilitiesTests extends AndroidTestCase {
|
||||
}
|
||||
|
||||
public void testGenerateEasDayOfWeek() {
|
||||
String byDay = "TU;WE;SA";
|
||||
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";
|
||||
byDay = "MO,TU,WE,TH,FR";
|
||||
assertEquals("62", CalendarUtilities.generateEasDayOfWeek(byDay));
|
||||
// SU = 1
|
||||
byDay = "SU";
|
||||
@ -109,6 +109,7 @@ public class CalendarUtilitiesTests extends AndroidTestCase {
|
||||
assertEquals("DAILY", CalendarUtilities.tokenFromRrule(rrule, "FREQ="));
|
||||
assertEquals("1", CalendarUtilities.tokenFromRrule(rrule, "INTERVAL="));
|
||||
assertEquals("17", CalendarUtilities.tokenFromRrule(rrule, "BYMONTHDAY="));
|
||||
assertEquals("WE,TH,SA", CalendarUtilities.tokenFromRrule(rrule, "BYDAY="));
|
||||
assertNull(CalendarUtilities.tokenFromRrule(rrule, "UNTIL="));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user