summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorDaisuke Miyakawa <dmiyakawa@google.com>2009-11-05 09:43:19 +0900
committerDaisuke Miyakawa <dmiyakawa@google.com>2009-11-05 09:44:42 +0900
commit26ee0ae9de37e50b790a0a7b7bddb1d27d5b1214 (patch)
treefa47f71fc0aaca5db07aa8a151e280a5a087736a /tests
parent0d55daffc31c123dcf83f6db85f8198854ddc564 (diff)
downloadframeworks_base-26ee0ae9de37e50b790a0a7b7bddb1d27d5b1214.zip
frameworks_base-26ee0ae9de37e50b790a0a7b7bddb1d27d5b1214.tar.gz
frameworks_base-26ee0ae9de37e50b790a0a7b7bddb1d27d5b1214.tar.bz2
Make vCard importer handle "PAGER" phone number correctly.
Add tests for it. Internal issue number: 2239492
Diffstat (limited to 'tests')
-rw-r--r--tests/AndroidTests/res/raw/v30_comma_separated.vcf5
-rw-r--r--tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java35
2 files changed, 34 insertions, 6 deletions
diff --git a/tests/AndroidTests/res/raw/v30_comma_separated.vcf b/tests/AndroidTests/res/raw/v30_comma_separated.vcf
new file mode 100644
index 0000000..98a7f20
--- /dev/null
+++ b/tests/AndroidTests/res/raw/v30_comma_separated.vcf
@@ -0,0 +1,5 @@
+BEGIN:VCARD
+VERSION:3.0
+N:F;G;M;;
+TEL;TYPE=PAGER,WORK,MSG:6101231234@pagersample.com
+END:VCARD
diff --git a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java
index 1aa334a..f447c77 100644
--- a/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java
+++ b/tests/AndroidTests/src/com/android/unit_tests/vcard/VCardImporterTests.java
@@ -18,7 +18,6 @@ package com.android.unit_tests.vcard;
import android.content.ContentValues;
import android.pim.vcard.VCardConfig;
-import android.pim.vcard.VCardParser_V21;
import android.pim.vcard.exception.VCardException;
import android.provider.ContactsContract.Data;
import android.provider.ContactsContract.CommonDataKinds.Email;
@@ -35,7 +34,6 @@ import com.android.unit_tests.R;
import com.android.unit_tests.vcard.PropertyNodesVerifierElem.TypeSet;
import java.io.IOException;
-import java.io.InputStream;
import java.util.Arrays;
public class VCardImporterTests extends VCardTestsBase {
@@ -866,8 +864,9 @@ public class VCardImporterTests extends VCardTestsBase {
}
public void testV21Japanese2_Type_Generic_Utf8() throws IOException, VCardException {
- ImportVerifierElem verifier = new ImportVerifierElem();
- verifier.addExpected(StructuredName.CONTENT_ITEM_TYPE)
+ ImportVerifier verifier = new ImportVerifier();
+ ImportVerifierElem elem = verifier.addImportVerifierElem();
+ elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
.put(StructuredName.FAMILY_NAME, "\u5B89\u85E4")
.put(StructuredName.GIVEN_NAME, "\u30ED\u30A4\u30C9\u0031")
.put(StructuredName.DISPLAY_NAME,
@@ -877,7 +876,7 @@ public class VCardImporterTests extends VCardTestsBase {
.put(StructuredName.PHONETIC_FAMILY_NAME, "\uFF71\uFF9D\uFF84\uFF9E\uFF73")
.put(StructuredName.PHONETIC_GIVEN_NAME, "\uFF9B\uFF72\uFF84\uFF9E\u0031");
- verifier.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
+ elem.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
.put(StructuredPostal.POSTCODE, "150-8512")
.put(StructuredPostal.NEIGHBORHOOD,
"\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
@@ -890,7 +889,7 @@ public class VCardImporterTests extends VCardTestsBase {
"\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC" +
"\u0036\u968E 150-8512")
.put(StructuredPostal.TYPE, StructuredPostal.TYPE_HOME);
- verifier.addExpected(Note.CONTENT_ITEM_TYPE)
+ elem.addExpected(Note.CONTENT_ITEM_TYPE)
.put(Note.NOTE, "\u30E1\u30E2");
verifier.verify(R.raw.v21_japanese_2, VCardConfig.VCARD_TYPE_V21_GENERIC_UTF8);
}
@@ -1013,4 +1012,28 @@ public class VCardImporterTests extends VCardTestsBase {
.put(Phone.NUMBER, "20");
verifier.verify(R.raw.v21_multiple_entry, VCardConfig.VCARD_TYPE_V21_JAPANESE_SJIS);
}
+
+ public void testPagerV30_Parse() throws IOException, VCardException {
+ PropertyNodesVerifier verifier = new PropertyNodesVerifier(this);
+ verifier.addPropertyNodesVerifierElem()
+ .addNodeWithOrder("VERSION", "3.0")
+ .addNodeWithOrder("N", Arrays.asList("F", "G", "M", "", ""))
+ .addNodeWithOrder("TEL", "6101231234@pagersample.com",
+ new TypeSet("WORK", "MSG", "PAGER"));
+ verifier.verify(R.raw.v30_comma_separated, VCardConfig.VCARD_TYPE_V30_GENERIC_UTF8);
+ }
+
+ public void testPagerV30() throws IOException, VCardException {
+ ImportVerifier verifier = new ImportVerifier();
+ ImportVerifierElem elem = verifier.addImportVerifierElem();
+ elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
+ .put(StructuredName.FAMILY_NAME, "F")
+ .put(StructuredName.MIDDLE_NAME, "M")
+ .put(StructuredName.GIVEN_NAME, "G")
+ .put(StructuredName.DISPLAY_NAME, "G M F");
+ elem.addExpected(Phone.CONTENT_ITEM_TYPE)
+ .put(Phone.TYPE, Phone.TYPE_PAGER)
+ .put(Phone.NUMBER, "6101231234@pagersample.com");
+ verifier.verify(R.raw.v30_comma_separated, VCardConfig.VCARD_TYPE_V30_GENERIC_UTF8);
+ }
}