mirror of
https://github.com/zxing/zxing.git
synced 2025-03-05 20:48:51 -08:00
Add iCal support, plus many small changes suggested by code inspection -- mostly making things less visible for now
git-svn-id: https://zxing.googlecode.com/svn/trunk@502 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
parent
3feb56ece3
commit
42940c4580
|
@ -28,7 +28,7 @@ import java.util.Vector;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class AddressBookAUResultParser extends ResultParser {
|
||||
final class AddressBookAUResultParser extends ResultParser {
|
||||
|
||||
public static AddressBookParsedResult parse(Result result) {
|
||||
String rawText = result.getText();
|
||||
|
|
|
@ -28,7 +28,7 @@ import com.google.zxing.Result;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class AddressBookDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||
final class AddressBookDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||
|
||||
public static AddressBookParsedResult parse(Result result) {
|
||||
String rawText = result.getText();
|
||||
|
|
|
@ -27,7 +27,7 @@ import java.util.Vector;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class BizcardResultParser extends AbstractDoCoMoResultParser {
|
||||
final class BizcardResultParser extends AbstractDoCoMoResultParser {
|
||||
|
||||
// Yes, we extend AbstractDoCoMoResultParser since the format is very much
|
||||
// like the DoCoMo MECARD format, but this is not technically one of
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.google.zxing.Result;
|
|||
/**
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class BookmarkDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||
final class BookmarkDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||
|
||||
private BookmarkDoCoMoResultParser() {
|
||||
}
|
||||
|
|
|
@ -35,6 +35,8 @@ public final class CalendarParsedResult extends ParsedResult {
|
|||
String attendee,
|
||||
String title) {
|
||||
super(ParsedResultType.CALENDAR);
|
||||
validateDate(start);
|
||||
validateDate(end);
|
||||
this.summary = summary;
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
|
@ -88,4 +90,28 @@ public final class CalendarParsedResult extends ParsedResult {
|
|||
return result.toString();
|
||||
}
|
||||
|
||||
private static void validateDate(String date) {
|
||||
if (date != null) {
|
||||
if (date.length() != 16) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
for (int i = 0; i < 8; i++) {
|
||||
if (!Character.isDigit(date.charAt(i))) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
if (date.charAt(8) != 'T') {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
for (int i = 9; i < 15; i++) {
|
||||
if (!Character.isDigit(date.charAt(i))) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
if (date.charAt(15) != 'Z') {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -26,7 +26,7 @@ import java.util.Hashtable;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class EmailAddressResultParser extends ResultParser {
|
||||
final class EmailAddressResultParser extends ResultParser {
|
||||
|
||||
public static EmailAddressParsedResult parse(Result result) {
|
||||
String rawText = result.getText();
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.google.zxing.Result;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||
final class EmailDoCoMoResultParser extends AbstractDoCoMoResultParser {
|
||||
|
||||
public static EmailAddressParsedResult parse(Result result) {
|
||||
String rawText = result.getText();
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.zxing.Result;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class GeoResultParser extends ResultParser {
|
||||
final class GeoResultParser extends ResultParser {
|
||||
|
||||
private GeoResultParser() {
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ import com.google.zxing.Result;
|
|||
/**
|
||||
* <p>Abstract class representing the result of decoding a barcode, as more than
|
||||
* a String -- as some type of structured data. This might be a subclass which represents
|
||||
* a URL, or an e-mail address. {@link #parseReaderResult(Result)} will turn a raw
|
||||
* a URL, or an e-mail address. {@link ResultParser#parseResult(Result)} will turn a raw
|
||||
* decoded string into the most appropriate type of structured representation.</p>
|
||||
*
|
||||
* <p>Thanks to Jeff Griffin for proposing rewrite of these classes that relies less
|
||||
|
@ -43,12 +43,11 @@ public abstract class ParsedResult {
|
|||
|
||||
public abstract String getDisplayResult();
|
||||
|
||||
|
||||
public String toString() {
|
||||
return getDisplayResult();
|
||||
}
|
||||
|
||||
protected static void maybeAppend(String value, StringBuffer result) {
|
||||
static void maybeAppend(String value, StringBuffer result) {
|
||||
if (value != null) {
|
||||
// Don't add a newline before the first value
|
||||
if (result.length() > 0) {
|
||||
|
@ -58,7 +57,7 @@ public abstract class ParsedResult {
|
|||
}
|
||||
}
|
||||
|
||||
protected static void maybeAppend(String[] value, StringBuffer result) {
|
||||
static void maybeAppend(String[] value, StringBuffer result) {
|
||||
if (value != null) {
|
||||
for (int i = 0; i < value.length; i++) {
|
||||
if (result.length() > 0) {
|
||||
|
|
|
@ -53,6 +53,8 @@ public abstract class ResultParser {
|
|||
return result;
|
||||
} else if ((result = BizcardResultParser.parse(theResult)) != null) {
|
||||
return result;
|
||||
} else if ((result = VEventResultParser.parse(theResult)) != null) {
|
||||
return result;
|
||||
} else if ((result = TelResultParser.parse(theResult)) != null) {
|
||||
return result;
|
||||
} else if ((result = SMSMMSResultParser.parse(theResult)) != null) {
|
||||
|
@ -108,7 +110,7 @@ public abstract class ResultParser {
|
|||
return escaped;
|
||||
}
|
||||
|
||||
protected static String urlDecode(String escaped) {
|
||||
static String urlDecode(String escaped) {
|
||||
|
||||
// No we can't use java.net.URLDecoder here. JavaME doesn't have it.
|
||||
if (escaped == null) {
|
||||
|
@ -199,7 +201,7 @@ public abstract class ResultParser {
|
|||
return true;
|
||||
}
|
||||
|
||||
protected static Hashtable parseNameValuePairs(String uri) {
|
||||
static Hashtable parseNameValuePairs(String uri) {
|
||||
int paramStart = uri.indexOf('?');
|
||||
if (paramStart < 0) {
|
||||
return null;
|
||||
|
|
|
@ -31,7 +31,7 @@ import java.util.Hashtable;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class SMSMMSResultParser extends ResultParser {
|
||||
final class SMSMMSResultParser extends ResultParser {
|
||||
|
||||
private SMSMMSResultParser() {
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.google.zxing.Result;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class TelResultParser extends ResultParser {
|
||||
final class TelResultParser extends ResultParser {
|
||||
|
||||
private TelResultParser() {
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ import com.google.zxing.Result;
|
|||
*
|
||||
* @author dswitkin@google.com (Daniel Switkin)
|
||||
*/
|
||||
public final class UPCResultParser extends ResultParser {
|
||||
final class UPCResultParser extends ResultParser {
|
||||
|
||||
private UPCResultParser() {
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ import com.google.zxing.Result;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class URIResultParser extends ResultParser {
|
||||
final class URIResultParser extends ResultParser {
|
||||
|
||||
private URIResultParser() {
|
||||
}
|
||||
|
@ -64,7 +64,8 @@ public final class URIResultParser extends ResultParser {
|
|||
* need to know when a string is obviously not a URI.
|
||||
*/
|
||||
static boolean isBasicallyValidURI(String uri) {
|
||||
return uri != null && uri.indexOf(' ') < 0 && (uri.indexOf(':') >= 0 || uri.indexOf('.') >= 0);
|
||||
return uri != null && uri.indexOf(' ') < 0 && uri.indexOf('\n') < 0 &&
|
||||
(uri.indexOf(':') >= 0 || uri.indexOf('.') >= 0);
|
||||
}
|
||||
|
||||
}
|
|
@ -25,7 +25,7 @@ import com.google.zxing.Result;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class URLTOResultParser {
|
||||
final class URLTOResultParser {
|
||||
|
||||
private URLTOResultParser() {
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ import java.util.Vector;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class VCardResultParser extends ResultParser {
|
||||
final class VCardResultParser extends ResultParser {
|
||||
|
||||
private VCardResultParser() {
|
||||
}
|
||||
|
@ -65,7 +65,7 @@ public final class VCardResultParser extends ResultParser {
|
|||
if (i < 0) {
|
||||
break;
|
||||
}
|
||||
if (rawText.charAt(i - 1) != '\n') {
|
||||
if (i > 0 && rawText.charAt(i - 1) != '\n') {
|
||||
// then this didn't start a new token, we matched in the middle of something
|
||||
i++;
|
||||
continue;
|
||||
|
@ -103,7 +103,7 @@ public final class VCardResultParser extends ResultParser {
|
|||
return toStringArray(matches);
|
||||
}
|
||||
|
||||
private static String matchSingleVCardPrefixedField(String prefix, String rawText) {
|
||||
static String matchSingleVCardPrefixedField(String prefix, String rawText) {
|
||||
String[] values = matchVCardPrefixedField(prefix, rawText);
|
||||
return values == null ? null : values[0];
|
||||
}
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* Copyright 2008 ZXing authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.google.zxing.client.result;
|
||||
|
||||
import com.google.zxing.Result;
|
||||
|
||||
/**
|
||||
* Partially implements the iCalendar format's "VEVENT" format for specifying a
|
||||
* calendar event. See RFC 2445. This supports SUMMARY, DTSTART and DTEND fields.
|
||||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
final class VEventResultParser extends ResultParser {
|
||||
|
||||
private VEventResultParser() {
|
||||
}
|
||||
|
||||
public static CalendarParsedResult parse(Result result) {
|
||||
String rawText = result.getText();
|
||||
if (rawText == null) {
|
||||
return null;
|
||||
}
|
||||
int vEventStart = rawText.indexOf("BEGIN:VEVENT");
|
||||
int vEventEnd = rawText.indexOf("END:VEVENT");
|
||||
if (vEventStart < 0 || vEventEnd < 0) {
|
||||
return null;
|
||||
}
|
||||
rawText = rawText.substring(vEventStart + 14, vEventEnd); // skip over BEGIN:VEVENT\r\n at start
|
||||
|
||||
String summary = VCardResultParser.matchSingleVCardPrefixedField("SUMMARY", rawText);
|
||||
String start = VCardResultParser.matchSingleVCardPrefixedField("DTSTART", rawText);
|
||||
String end = VCardResultParser.matchSingleVCardPrefixedField("DTEND", rawText);
|
||||
try {
|
||||
return new CalendarParsedResult(summary, start, end, null, null, null);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -26,7 +26,7 @@ import com.google.zxing.client.result.SMSParsedResult;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class MobileTagMMSResultParser extends AbstractMobileTagResultParser {
|
||||
final class MobileTagMMSResultParser extends AbstractMobileTagResultParser {
|
||||
|
||||
public static final String SERVICE_TYPE = "05";
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.google.zxing.Result;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class MobileTagRichWebResultParser extends AbstractMobileTagResultParser {
|
||||
final class MobileTagRichWebResultParser extends AbstractMobileTagResultParser {
|
||||
|
||||
public static final String SERVICE_TYPE = "54";
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.zxing.client.result.SMSParsedResult;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class MobileTagSMSResultParser extends AbstractMobileTagResultParser {
|
||||
final class MobileTagSMSResultParser extends AbstractMobileTagResultParser {
|
||||
|
||||
public static final String SERVICE_TYPE = "03";
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.zxing.client.result.CalendarParsedResult;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class MobileTagSimpleCalendarResultParser extends AbstractMobileTagResultParser {
|
||||
final class MobileTagSimpleCalendarResultParser extends AbstractMobileTagResultParser {
|
||||
|
||||
public static final String SERVICE_TYPE = "07";
|
||||
|
||||
|
@ -50,7 +50,11 @@ public final class MobileTagSimpleCalendarResultParser extends AbstractMobileTag
|
|||
String attendee = matches[4];
|
||||
String title = matches[5];
|
||||
|
||||
return new CalendarParsedResult(summary, start, end, location, attendee, title);
|
||||
try {
|
||||
return new CalendarParsedResult(summary, start, end, location, attendee, title);
|
||||
} catch (IllegalArgumentException iae) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static String expandDateString(String date) {
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.zxing.client.result.AddressBookParsedResult;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class MobileTagSimpleContactResultParser extends AbstractMobileTagResultParser {
|
||||
final class MobileTagSimpleContactResultParser extends AbstractMobileTagResultParser {
|
||||
|
||||
public static final String SERVICE_TYPE = "02";
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.zxing.client.result.URIParsedResult;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class MobileTagSimpleWebResultParser extends AbstractMobileTagResultParser {
|
||||
final class MobileTagSimpleWebResultParser extends AbstractMobileTagResultParser {
|
||||
|
||||
public static final String SERVICE_TYPE = "04";
|
||||
private static final String[] URI_PREFIXES = {
|
||||
|
|
|
@ -26,7 +26,7 @@ import com.google.zxing.client.result.TelParsedResult;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class MobileTagTelResultParser extends AbstractMobileTagResultParser {
|
||||
final class MobileTagTelResultParser extends AbstractMobileTagResultParser {
|
||||
|
||||
public static final String SERVICE_TYPE = "01";
|
||||
|
||||
|
|
|
@ -29,9 +29,9 @@ public final class NDEFSmartPosterParsedResult extends ParsedResult {
|
|||
public static final int ACTION_SAVE = 1;
|
||||
public static final int ACTION_OPEN = 2;
|
||||
|
||||
private String title;
|
||||
private String uri;
|
||||
private int action;
|
||||
private final String title;
|
||||
private final String uri;
|
||||
private final int action;
|
||||
|
||||
NDEFSmartPosterParsedResult(int action, String uri, String title) {
|
||||
super(ParsedResultType.NDEF_SMART_POSTER);
|
||||
|
|
|
@ -29,7 +29,7 @@ import com.google.zxing.Result;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class NDEFSmartPosterResultParser extends AbstractNDEFResultParser {
|
||||
final class NDEFSmartPosterResultParser extends AbstractNDEFResultParser {
|
||||
|
||||
public static NDEFSmartPosterParsedResult parse(Result result) {
|
||||
byte[] bytes = result.getRawBytes();
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.google.zxing.client.result.TextParsedResult;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class NDEFTextResultParser extends AbstractNDEFResultParser {
|
||||
final class NDEFTextResultParser extends AbstractNDEFResultParser {
|
||||
|
||||
public static TextParsedResult parse(Result result) {
|
||||
byte[] bytes = result.getRawBytes();
|
||||
|
|
|
@ -25,7 +25,7 @@ import com.google.zxing.client.result.URIParsedResult;
|
|||
*
|
||||
* @author srowen@google.com (Sean Owen)
|
||||
*/
|
||||
public final class NDEFURIResultParser extends AbstractNDEFResultParser {
|
||||
final class NDEFURIResultParser extends AbstractNDEFResultParser {
|
||||
|
||||
private static final String[] URI_PREFIXES = {
|
||||
null,
|
||||
|
|
|
@ -111,7 +111,7 @@ public abstract class GridSampler {
|
|||
* @param points actual points in x1,y1,...,xn,yn form
|
||||
* @throws ReaderException if an endpoint is lies outside the image boundaries
|
||||
*/
|
||||
protected static void checkAndNudgePoints(MonochromeBitmapSource image, float[] points) throws ReaderException {
|
||||
static void checkAndNudgePoints(MonochromeBitmapSource image, float[] points) throws ReaderException {
|
||||
int width = image.getWidth();
|
||||
int height = image.getHeight();
|
||||
// Check and nudge points from start until we see some that are OK:
|
||||
|
|
|
@ -71,7 +71,7 @@ final class DataBlock {
|
|||
// (where n may be 0) have 1 less byte. Figure out where these start.
|
||||
// TODO(bbrown): There is only one case where there is a difference for Data Matrix for size 144
|
||||
int longerBlocksTotalCodewords = result[0].codewords.length;
|
||||
int shorterBlocksTotalCodewords = longerBlocksTotalCodewords - 1;
|
||||
//int shorterBlocksTotalCodewords = longerBlocksTotalCodewords - 1;
|
||||
|
||||
int longerBlocksNumDataCodewords = longerBlocksTotalCodewords - ecBlocks.getECCodewords();
|
||||
int shorterBlocksNumDataCodewords = longerBlocksNumDataCodewords - 1;
|
||||
|
|
|
@ -231,7 +231,7 @@ final class DecodedBitStreamParser {
|
|||
result.append((char) (cValues[i] + 224));
|
||||
upperShift = false;
|
||||
} else {
|
||||
result.append((char) cValues[i] + 96);
|
||||
result.append((char) (cValues[i] + 96));
|
||||
}
|
||||
} else {
|
||||
throw new ReaderException("Invalid shift value");
|
||||
|
@ -296,7 +296,7 @@ final class DecodedBitStreamParser {
|
|||
result.append((char) (cValues[i] + 128));
|
||||
upperShift = false;
|
||||
} else {
|
||||
result.append((char) cValues[i]);
|
||||
result.append(cValues[i]);
|
||||
}
|
||||
} else if (shift == 2) {
|
||||
// Shift 2 for Text is the same encoding as C40
|
||||
|
@ -406,7 +406,7 @@ final class DecodedBitStreamParser {
|
|||
if ((edifactValue & 32) == 0) { // no 1 in the leading (6th) bit
|
||||
edifactValue |= 64; // Add a leading 01 to the 6 bit binary value
|
||||
}
|
||||
result.append((char) edifactValue);
|
||||
result.append(edifactValue);
|
||||
}
|
||||
}
|
||||
} while (!unlatch && bits.available() > 0);
|
||||
|
@ -428,7 +428,6 @@ final class DecodedBitStreamParser {
|
|||
} else {
|
||||
count = 250 * (d1 - 249) + bits.readBits(8);
|
||||
}
|
||||
char[] readBytes = new char[count];
|
||||
for (int i = 0; i < count; i++) {
|
||||
result.append(unrandomize255State((char) bits.readBits(8), count));
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ import java.util.Hashtable;
|
|||
public abstract class AbstractOneDReader implements OneDReader {
|
||||
|
||||
private static final int INTEGER_MATH_SHIFT = 8;
|
||||
public static final int PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << INTEGER_MATH_SHIFT;
|
||||
static final int PATTERN_MATCH_RESULT_SCALE_FACTOR = 1 << INTEGER_MATH_SHIFT;
|
||||
|
||||
public final Result decode(MonochromeBitmapSource image) throws ReaderException {
|
||||
return decode(image, null);
|
||||
|
|
|
@ -111,7 +111,14 @@ public final class ParsedReaderResultTestCase extends TestCase {
|
|||
doTestResult("BEGIN:VCARD\r\nN:Owen;Sean\r\nEND:VCARD", ParsedResultType.ADDRESSBOOK);
|
||||
doTestResult("BEGIN:VCARD\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD", ParsedResultType.ADDRESSBOOK);
|
||||
doTestResult("BEGIN:VCARD\r\nADR;HOME:123 Main St\r\nVERSION:2.1\r\nN:Owen;Sean\r\nEND:VCARD", ParsedResultType.ADDRESSBOOK);
|
||||
doTestResult("BEGIN:VCARD", ParsedResultType.URI);
|
||||
doTestResult("BEGIN:VCARD", ParsedResultType.URI); // yeah we end up guessing "URI" here
|
||||
}
|
||||
|
||||
public void testVEvent() {
|
||||
doTestResult("BEGIN:VCALENDAR\r\nBEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456Z\r\nDTEND:20080505T234555Z\r\nEND:VEVENT\r\nEND:VCALENDAR", ParsedResultType.CALENDAR);
|
||||
doTestResult("BEGIN:VEVENT\r\nSUMMARY:foo\r\nDTSTART:20080504T123456Z\r\nDTEND:20080505T234555Z\r\nEND:VEVENT", ParsedResultType.CALENDAR);
|
||||
doTestResult("BEGIN:VEVENT\r\nDTEND:20080505T\r\nEND:VEVENT", ParsedResultType.TEXT);
|
||||
doTestResult("BEGIN:VEVENT", ParsedResultType.URI); // See above note on why this is URI
|
||||
}
|
||||
|
||||
public void testSMS() {
|
||||
|
@ -174,11 +181,13 @@ public final class ParsedReaderResultTestCase extends TestCase {
|
|||
assertEquals(type, result.getType());
|
||||
}
|
||||
|
||||
/*
|
||||
private static void doTestResult(byte[] rawBytes, ParsedResultType type) {
|
||||
Result fakeResult = new Result(null, rawBytes, null, null);
|
||||
ParsedResult result = ResultParser.parseResult(fakeResult);
|
||||
assertNotNull(result);
|
||||
assertEquals(type, result.getType());
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
Loading…
Reference in a new issue