VCardImporterTests.java revision 4199c54c527330ac01699b176e7bca186a3aa3a4
1/*
2 * Copyright (C) 2009 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 *      http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package com.android.vcard.tests;
17
18import android.content.ContentValues;
19import android.provider.ContactsContract.Data;
20import android.provider.ContactsContract.CommonDataKinds.Email;
21import android.provider.ContactsContract.CommonDataKinds.Event;
22import android.provider.ContactsContract.CommonDataKinds.Note;
23import android.provider.ContactsContract.CommonDataKinds.Organization;
24import android.provider.ContactsContract.CommonDataKinds.Phone;
25import android.provider.ContactsContract.CommonDataKinds.Photo;
26import android.provider.ContactsContract.CommonDataKinds.StructuredName;
27import android.provider.ContactsContract.CommonDataKinds.StructuredPostal;
28import android.provider.ContactsContract.CommonDataKinds.Website;
29
30import com.android.vcard.VCardConfig;
31import com.android.vcard.tests.test_utils.ContentValuesVerifier;
32import com.android.vcard.tests.test_utils.ContentValuesVerifierElem;
33import com.android.vcard.tests.test_utils.PropertyNodesVerifierElem.TypeSet;
34
35import java.util.Arrays;
36
37public class VCardImporterTests extends VCardTestsBase {
38    // Push data into int array at first since values like 0x80 are
39    // interpreted as int by the compiler and casting all of them is
40    // cumbersome...
41    private static final int[] sPhotoIntArrayForComplicatedCase = {
42        0xff, 0xd8, 0xff, 0xe1, 0x0a, 0x0f, 0x45, 0x78, 0x69, 0x66, 0x00,
43        0x00, 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08, 0x00, 0x0d,
44        0x01, 0x0e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00,
45        0xaa, 0x01, 0x0f, 0x00, 0x02, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00,
46        0x00, 0xba, 0x01, 0x10, 0x00, 0x02, 0x00, 0x00, 0x00, 0x06, 0x00,
47        0x00, 0x00, 0xc2, 0x01, 0x12, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01,
48        0x00, 0x01, 0x00, 0x00, 0x01, 0x1a, 0x00, 0x05, 0x00, 0x00, 0x00,
49        0x01, 0x00, 0x00, 0x00, 0xc8, 0x01, 0x1b, 0x00, 0x05, 0x00, 0x00,
50        0x00, 0x01, 0x00, 0x00, 0x00, 0xd0, 0x01, 0x28, 0x00, 0x03, 0x00,
51        0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x01, 0x31, 0x00, 0x02,
52        0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xd8, 0x01, 0x32, 0x00,
53        0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, 0xe6, 0x02, 0x13,
54        0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x82,
55        0x98, 0x00, 0x02, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0xfa,
56        0x87, 0x69, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x01,
57        0x84, 0xc4, 0xa5, 0x00, 0x07, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00,
58        0x01, 0x08, 0x00, 0x00, 0x04, 0x1e, 0x32, 0x30, 0x30, 0x38, 0x31,
59        0x30, 0x32, 0x39, 0x31, 0x33, 0x35, 0x35, 0x33, 0x31, 0x00, 0x00,
60        0x44, 0x6f, 0x43, 0x6f, 0x4d, 0x6f, 0x00, 0x00, 0x44, 0x39, 0x30,
61        0x35, 0x69, 0x00, 0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01,
62        0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x44, 0x39, 0x30,
63        0x35, 0x69, 0x20, 0x56, 0x65, 0x72, 0x31, 0x2e, 0x30, 0x30, 0x00,
64        0x32, 0x30, 0x30, 0x38, 0x3a, 0x31, 0x30, 0x3a, 0x32, 0x39, 0x20,
65        0x31, 0x33, 0x3a, 0x35, 0x35, 0x3a, 0x34, 0x37, 0x00, 0x20, 0x20,
66        0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
67        0x00, 0x50, 0x72, 0x69, 0x6e, 0x74, 0x49, 0x4d, 0x00, 0x30, 0x33,
68        0x30, 0x30, 0x00, 0x00, 0x00, 0x06, 0x00, 0x01, 0x00, 0x14, 0x00,
69        0x14, 0x00, 0x02, 0x01, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00,
70        0x00, 0x34, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01,
71        0x00, 0x00, 0x00, 0x01, 0x10, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00,
72        0x11, 0x09, 0x00, 0x00, 0x27, 0x10, 0x00, 0x00, 0x0f, 0x0b, 0x00,
73        0x00, 0x27, 0x10, 0x00, 0x00, 0x05, 0x97, 0x00, 0x00, 0x27, 0x10,
74        0x00, 0x00, 0x08, 0xb0, 0x00, 0x00, 0x27, 0x10, 0x00, 0x00, 0x1c,
75        0x01, 0x00, 0x00, 0x27, 0x10, 0x00, 0x00, 0x02, 0x5e, 0x00, 0x00,
76        0x27, 0x10, 0x00, 0x00, 0x00, 0x8b, 0x00, 0x00, 0x27, 0x10, 0x00,
77        0x00, 0x03, 0xcb, 0x00, 0x00, 0x27, 0x10, 0x00, 0x00, 0x1b, 0xe5,
78        0x00, 0x00, 0x27, 0x10, 0x00, 0x28, 0x82, 0x9a, 0x00, 0x05, 0x00,
79        0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x6a, 0x82, 0x9d, 0x00, 0x05,
80        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0x72, 0x88, 0x22, 0x00,
81        0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x90, 0x00,
82        0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x30, 0x32, 0x32, 0x30, 0x90,
83        0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x03, 0x7a,
84        0x90, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x03,
85        0x8e, 0x91, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x01, 0x02,
86        0x03, 0x00, 0x91, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00,
87        0x00, 0x03, 0xa2, 0x92, 0x01, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x01,
88        0x00, 0x00, 0x03, 0xaa, 0x92, 0x02, 0x00, 0x05, 0x00, 0x00, 0x00,
89        0x01, 0x00, 0x00, 0x03, 0xb2, 0x92, 0x04, 0x00, 0x0a, 0x00, 0x00,
90        0x00, 0x01, 0x00, 0x00, 0x03, 0xba, 0x92, 0x05, 0x00, 0x05, 0x00,
91        0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0xc2, 0x92, 0x07, 0x00, 0x03,
92        0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x92, 0x08, 0x00,
93        0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x92, 0x09,
94        0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x92,
95        0x0a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0xca,
96        0x92, 0x7c, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
97        0x00, 0x92, 0x86, 0x00, 0x07, 0x00, 0x00, 0x00, 0x16, 0x00, 0x00,
98        0x03, 0xd2, 0xa0, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x04, 0x30,
99        0x31, 0x30, 0x30, 0xa0, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01,
100        0x00, 0x01, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00,
101        0x01, 0x00, 0x60, 0x00, 0x00, 0xa0, 0x03, 0x00, 0x03, 0x00, 0x00,
102        0x00, 0x01, 0x00, 0x48, 0x00, 0x00, 0xa0, 0x05, 0x00, 0x04, 0x00,
103        0x00, 0x00, 0x01, 0x00, 0x00, 0x04, 0x00, 0xa2, 0x0e, 0x00, 0x05,
104        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0xe8, 0xa2, 0x0f, 0x00,
105        0x05, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x03, 0xf0, 0xa2, 0x10,
106        0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0xa2,
107        0x17, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00,
108        0xa3, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00,
109        0x00, 0xa3, 0x01, 0x00, 0x07, 0x00, 0x00, 0x00, 0x01, 0x01, 0x00,
110        0x00, 0x00, 0xa4, 0x01, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00,
111        0x00, 0x00, 0x00, 0xa4, 0x02, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01,
112        0x00, 0x00, 0x00, 0x00, 0xa4, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00,
113        0x01, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x04, 0x00, 0x05, 0x00, 0x00,
114        0x00, 0x01, 0x00, 0x00, 0x03, 0xf8, 0xa4, 0x05, 0x00, 0x03, 0x00,
115        0x00, 0x00, 0x01, 0x00, 0x1d, 0x00, 0x00, 0xa4, 0x06, 0x00, 0x03,
116        0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x07, 0x00,
117        0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa4, 0x08,
118        0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xa4,
119        0x09, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
120        0xa4, 0x0a, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
121        0x00, 0xa4, 0x0c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02,
122        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x53, 0x00,
123        0x00, 0x27, 0x10, 0x00, 0x00, 0x01, 0x5e, 0x00, 0x00, 0x00, 0x64,
124        0x32, 0x30, 0x30, 0x38, 0x3a, 0x31, 0x30, 0x3a, 0x32, 0x39, 0x20,
125        0x31, 0x33, 0x3a, 0x35, 0x35, 0x3a, 0x33, 0x31, 0x00, 0x32, 0x30,
126        0x30, 0x38, 0x3a, 0x31, 0x30, 0x3a, 0x32, 0x39, 0x20, 0x31, 0x33,
127        0x3a, 0x35, 0x35, 0x3a, 0x34, 0x37, 0x00, 0x00, 0x00, 0x29, 0x88,
128        0x00, 0x00, 0x1b, 0x00, 0x00, 0x00, 0x02, 0xb2, 0x00, 0x00, 0x00,
129        0x64, 0x00, 0x00, 0x01, 0x5e, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00,
130        0x00, 0x00, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0x25, 0x00,
131        0x00, 0x00, 0x0a, 0x00, 0x00, 0x0e, 0x92, 0x00, 0x00, 0x03, 0xe8,
132        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x30, 0x30,
133        0x38, 0x31, 0x30, 0x32, 0x39, 0x31, 0x33, 0x35, 0x35, 0x33, 0x31,
134        0x00, 0x00, 0x20, 0x2a, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x2a,
135        0xe2, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
136        0x00, 0x01, 0x00, 0x02, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00,
137        0x04, 0x52, 0x39, 0x38, 0x00, 0x00, 0x02, 0x00, 0x07, 0x00, 0x00,
138        0x00, 0x04, 0x30, 0x31, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00,
139        0x06, 0x01, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x00, 0x06,
140        0x00, 0x00, 0x01, 0x1a, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01, 0x00,
141        0x00, 0x04, 0x6c, 0x01, 0x1b, 0x00, 0x05, 0x00, 0x00, 0x00, 0x01,
142        0x00, 0x00, 0x04, 0x74, 0x01, 0x28, 0x00, 0x03, 0x00, 0x00, 0x00,
143        0x01, 0x00, 0x02, 0x00, 0x00, 0x02, 0x01, 0x00, 0x04, 0x00, 0x00,
144        0x00, 0x01, 0x00, 0x00, 0x04, 0x7c, 0x02, 0x02, 0x00, 0x04, 0x00,
145        0x00, 0x00, 0x01, 0x00, 0x00, 0x05, 0x8b, 0x00, 0x00, 0x00, 0x00,
146        0x00, 0x00, 0x00, 0x48, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00,
147        0x48, 0x00, 0x00, 0x00, 0x01, 0xff, 0xd8, 0xff, 0xdb, 0x00, 0x84,
148        0x00, 0x20, 0x16, 0x18, 0x1c, 0x18, 0x14, 0x20, 0x1c, 0x1a, 0x1c,
149        0x24, 0x22, 0x20, 0x26, 0x30, 0x50, 0x34, 0x30, 0x2c, 0x2c, 0x30,
150        0x62, 0x46, 0x4a, 0x3a, 0x50, 0x74, 0x66, 0x7a, 0x78, 0x72, 0x66,
151        0x70, 0x6e, 0x80, 0x90, 0xb8, 0x9c, 0x80, 0x88, 0xae, 0x8a, 0x6e,
152        0x70, 0xa0, 0xda, 0xa2, 0xae, 0xbe, 0xc4, 0xce, 0xd0, 0xce, 0x7c,
153        0x9a, 0xe2, 0xf2, 0xe0, 0xc8, 0xf0, 0xb8, 0xca, 0xce, 0xc6, 0x01,
154        0x22, 0x24, 0x24, 0x30, 0x2a, 0x30, 0x5e, 0x34, 0x34, 0x5e, 0xc6,
155        0x84, 0x70, 0x84, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
156        0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
157        0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
158        0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6,
159        0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xc6, 0xff, 0xc0,
160        0x00, 0x11, 0x08, 0x00, 0x78, 0x00, 0xa0, 0x03, 0x01, 0x21, 0x00,
161        0x02, 0x11, 0x01, 0x03, 0x11, 0x01, 0xff, 0xc4, 0x01, 0xa2, 0x00,
162        0x00, 0x01, 0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00,
163        0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05,
164        0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x10, 0x00, 0x02, 0x01, 0x03,
165        0x03, 0x02, 0x04, 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01,
166        0x7d, 0x01, 0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31,
167        0x41, 0x06, 0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81,
168        0x91, 0xa1, 0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0,
169        0x24, 0x33, 0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19,
170        0x1a, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37,
171        0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a,
172        0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65,
173        0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
174        0x79, 0x7a, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92,
175        0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4,
176        0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6,
177        0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8,
178        0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda,
179        0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf1,
180        0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0x01, 0x00,
181        0x03, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00,
182        0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06,
183        0x07, 0x08, 0x09, 0x0a, 0x0b, 0x11, 0x00, 0x02, 0x01, 0x02, 0x04,
184        0x04, 0x03, 0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77,
185        0x00, 0x01, 0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12,
186        0x41, 0x51, 0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14,
187        0x42, 0x91, 0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, 0x15,
188        0x62, 0x72, 0xd1, 0x0a, 0x16, 0x24, 0x34, 0xe1, 0x25, 0xf1, 0x17,
189        0x18, 0x19, 0x1a, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37,
190        0x38, 0x39, 0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a,
191        0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65,
192        0x66, 0x67, 0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78,
193        0x79, 0x7a, 0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a,
194        0x92, 0x93, 0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3,
195        0xa4, 0xa5, 0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5,
196        0xb6, 0xb7, 0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7,
197        0xc8, 0xc9, 0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9,
198        0xda, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf2,
199        0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xff, 0xda, 0x00,
200        0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00,
201        0x14, 0x54, 0xaa, 0x2a, 0x46, 0x48, 0xa2, 0xa4, 0x55, 0xa6, 0x04,
202        0x8a, 0x29, 0xe0, 0x53, 0x10, 0xe0, 0x29, 0xc0, 0x50, 0x03, 0xb1,
203        0x46, 0x29, 0x80, 0x84, 0x52, 0x11, 0x40, 0x0d, 0x22, 0x9a, 0x45,
204        0x20, 0x23, 0x61, 0x51, 0x30, 0xa0, 0x08, 0xc8, 0xa8, 0xd8, 0x52,
205        0x02, 0x26, 0x15, 0x0b, 0x0a, 0x00, 0xb4, 0xa2, 0xa5, 0x5a, 0x00,
206        0x91, 0x45, 0x4a, 0xa2, 0x81, 0x92, 0x01, 0x4e, 0x02, 0x98, 0x87,
207        0x0a, 0x70, 0xa0, 0x07, 0x62, 0x8c, 0x50, 0x21, 0x0d, 0x25, 0x00,
208        0x34, 0x8a, 0x61, 0x14, 0x0c, 0x63, 0x0a, 0x89, 0x85, 0x00, 0x46,
209        0xd5, 0x1b, 0x52, 0x02, 0x16, 0xa8, 0x98, 0x50, 0x05, 0x94, 0xa9,
210        0x16, 0x80, 0x25, 0x5a, 0x95, 0x68, 0x18, 0xf1, 0x4f, 0x14, 0xc4,
211        0x3b, 0xb5, 0x22, 0xb6, 0x38, 0x34, 0x00, 0xe3, 0x22, 0x8e, 0xf4,
212        0x79, 0x8a, 0x7b, 0xd1, 0x71, 0x03, 0x30, 0xc7, 0x14, 0x83, 0xa5,
213        0x00, 0x06, 0x98, 0x68, 0x01, 0x8d, 0x51, 0x35, 0x03, 0x22, 0x6a,
214        0x8d, 0xa9, 0x01, 0x13, 0x54, 0x4d, 0x40, 0x13, 0xa5, 0x4a, 0x28,
215        0x02, 0x45, 0x35, 0x2a, 0x9a, 0x00, 0x78, 0x34, 0xf0, 0x69, 0x80,
216        0x34, 0x81, 0x45, 0x40, 0xce, 0x58, 0xe6, 0xa2, 0x4c, 0x06, 0xe4,
217        0xfa, 0xd1, 0x93, 0x50, 0x21, 0xca, 0xe4, 0x55, 0x84, 0x90, 0x30,
218        0xab, 0x8b, 0x18, 0xa6, 0x9a, 0x6a, 0xc4, 0x31, 0xaa, 0x26, 0xa0,
219        0x64, 0x4d, 0x51, 0xb5, 0x20, 0x23, 0x6a, 0x89, 0xa8, 0x02, 0x44,
220        0x35, 0x2a, 0x9a, 0x00, 0x95, 0x4d, 0x48, 0xa6, 0x80, 0x24, 0x53,
221        0x4e, 0xce, 0x05, 0x30, 0x2b, 0x3b, 0xee, 0x6a, 0x91, 0x5d, 0x76,
222        0x63, 0xbd, 0x65, 0x7d, 0x40, 0x66, 0x68, 0xa9, 0x02, 0x45, 0x2b,
223        0xb3, 0x9e, 0xb4, 0xc5, 0x6d, 0xad, 0x9a, 0xa0, 0x2c, 0x06, 0xc8,
224        0xcd, 0x04, 0xd6, 0xa2, 0x23, 0x63, 0x51, 0xb1, 0xa0, 0x64, 0x4d,
225        0x51, 0x93, 0x48, 0x08, 0xda, 0xa2, 0x6a, 0x00, 0x72, 0x1a, 0x99,
226        0x4d, 0x00, 0x48, 0xa6, 0xa4, 0x53, 0x4c, 0x07, 0x86, 0x03, 0xbd,
227        0x2b, 0x9c, 0xa7, 0x14, 0x98, 0x10, 0x85, 0x34, 0xe0, 0xa6, 0xb3,
228        0xb0, 0x0b, 0xb5, 0xa8, 0x0a, 0xd4, 0x58, 0x42, 0xed, 0x3e, 0x94,
229        0xd2, 0xa6, 0x8b, 0x01, 0x34, 0x44, 0xed, 0xe6, 0x9c, 0x4d, 0x6a,
230        0x80, 0x8d, 0x8d, 0x46, 0xc6, 0x80, 0x23, 0x63, 0x51, 0x9a, 0x06,
231        0x46, 0xd5, 0x13, 0x52, 0x01, 0x54, 0xd4, 0xaa, 0x68, 0x02, 0x40,
232        0x6a, 0x40, 0x78, 0xa0, 0x08, 0x59, 0xce, 0xee, 0xb5, 0x2a, 0x39,
233        0xd9, 0x59, 0xa7, 0xa8, 0x00, 0x73, 0xeb, 0x4e, 0x0e, 0x7d, 0x69,
234        0x5c, 0x05, 0xf3, 0x0f, 0xad, 0x1e, 0x61, 0xf5, 0xa7, 0x71, 0x0b,
235        0xe6, 0x35, 0x21, 0x90, 0xd3, 0xb8, 0x0e, 0x32, 0x10, 0x95, 0x10,
236        0x91, 0xb3, 0xd6, 0x9b, 0x60, 0x4b, 0x9c, 0x8a, 0x63, 0x1a, 0xb0,
237        0x18, 0x4d, 0x46, 0xc6, 0x80, 0x22, 0x6a, 0x61, 0xa4, 0x31, 0xaa,
238        0x6a, 0x55, 0x34, 0x01, 0x2a, 0x9a, 0x7e, 0x78, 0xa0, 0x08, 0x09,
239        0xf9, 0xaa, 0x58, 0xcf, 0xca, 0x6b, 0x3e, 0xa0, 0x00, 0xd3, 0x81,
240        0xa9, 0x01, 0x73, 0x46, 0x69, 0x80, 0xb9, 0xa4, 0xcd, 0x00, 0x2b,
241        0x1f, 0x92, 0xa3, 0x07, 0x9a, 0x6f, 0x70, 0x26, 0xcf, 0x14, 0xd2,
242        0x6b, 0x51, 0x0c, 0x63, 0x51, 0xb1, 0xa0, 0x08, 0xda, 0x98, 0x69,
243        0x0c, 0x8d, 0x4d, 0x4a, 0xa6, 0x80, 0x24, 0x53, 0x52, 0x03, 0xc5,
244        0x02, 0x21, 0x27, 0xe6, 0xa9, 0x23, 0x3f, 0x29, 0xac, 0xfa, 0x8c,
245        0x01, 0xe6, 0x9c, 0x0d, 0x48, 0x0a, 0x0d, 0x2e, 0x68, 0x01, 0x73,
246        0x49, 0x9a, 0x60, 0x2b, 0x1f, 0x92, 0x98, 0x3a, 0xd3, 0x7b, 0x81,
247        0x36, 0x78, 0xa6, 0x93, 0x5a, 0x88, 0x8c, 0x9a, 0x63, 0x1a, 0x00,
248        0x8c, 0xd3, 0x0d, 0x21, 0x91, 0x29, 0xa9, 0x14, 0xd0, 0x04, 0x8a,
249        0x69, 0xe0, 0xd3, 0x11, 0x1b, 0x1e, 0x6a, 0x48, 0xcf, 0xca, 0x6b,
250        0x3e, 0xa3, 0x10, 0x1a, 0x70, 0x35, 0x20, 0x38, 0x1a, 0x5c, 0xd2,
251        0x01, 0x73, 0x49, 0x9a, 0x60, 0x39, 0x8f, 0xca, 0x29, 0x8b, 0xf7,
252        0xaa, 0xba, 0x88, 0x96, 0x9a, 0x6b, 0x40, 0x18, 0xc6, 0xa3, 0x26,
253        0x80, 0x18, 0x69, 0xa6, 0x90, 0xc8, 0x14, 0xd4, 0x8a, 0x69, 0x80,
254        0xf0, 0x6a, 0x40, 0x68, 0x10, 0xbb, 0x41, 0xa7, 0xe3, 0x0b, 0xc5,
255        0x2b, 0x01, 0x10, 0xa7, 0x03, 0x59, 0x0c, 0x76, 0x69, 0x73, 0x40,
256        0x0b, 0x9a, 0x28, 0x11, 0x28, 0x19, 0x5e, 0x69, 0x02, 0x81, 0x5a,
257        0xd8, 0x00, 0xd3, 0x4d, 0x50, 0x0c, 0x6a, 0x8c, 0xd2, 0x01, 0xa6,
258        0x98, 0x69, 0x0c, 0xae, 0xa6, 0xa4, 0x06, 0x80, 0x1e, 0xa6, 0x9e,
259        0x0d, 0x31, 0x12, 0x03, 0x4f, 0x06, 0x80, 0x13, 0x60, 0x34, 0xd3,
260        0xc1, 0xa8, 0x92, 0x01, 0xf1, 0x8d, 0xdd, 0x69, 0xcc, 0xa1, 0x69,
261        0x5b, 0x4b, 0x80, 0x83, 0x93, 0x52, 0x04, 0x14, 0xe2, 0xae, 0x03,
262        0xa9, 0x0d, 0x68, 0x03, 0x4d, 0x34, 0xd0, 0x03, 0x0d, 0x30, 0xd2,
263        0x01, 0x86, 0x9a, 0x68, 0x19, 0x58, 0x1a, 0x78, 0xa4, 0x04, 0x8a,
264        0x69, 0xe0, 0xd3, 0x10, 0xe0, 0x69, 0xe0, 0xd0, 0x03, 0xc1, 0xa8,
265        0xdb, 0xad, 0x4c, 0x81, 0x12, 0x45, 0xd6, 0x9d, 0x25, 0x1d, 0x00,
266        0x6a, 0xf5, 0xa9, 0xe8, 0x80, 0x31, 0x29, 0x0d, 0x58, 0x08, 0x69,
267        0x86, 0x80, 0x1a, 0x69, 0x86, 0x90, 0x0c, 0x34, 0xd3, 0x48, 0x65,
268        0x51, 0x4f, 0x06, 0x98, 0x0f, 0x14, 0xf0, 0x68, 0x10, 0xf0, 0x69,
269        0xe0, 0xd0, 0x03, 0x81, 0xa5, 0x2b, 0x9a, 0x1a, 0xb8, 0x87, 0xa8,
270        0xdb, 0x4a, 0x46, 0x68, 0xb6, 0x80, 0x2a, 0xa8, 0x14, 0xea, 0x12,
271        0xb0, 0x05, 0x21, 0xa6, 0x02, 0x1a, 0x61, 0xa0, 0x06, 0x9a, 0x61,
272        0xa4, 0x31, 0x86, 0x9a, 0x69, 0x0c, 0xa8, 0x0d, 0x3c, 0x53, 0x01,
273        0xe2, 0x9e, 0x28, 0x10, 0xf1, 0x4e, 0x06, 0x98, 0x0f, 0x06, 0x9e,
274        0x0d, 0x02, 0x1c, 0x29, 0xc2, 0x80, 0x16, 0x96, 0x80, 0x0a, 0x4a,
275        0x00, 0x43, 0x4d, 0x34, 0x0c, 0x61, 0xa6, 0x1a, 0x40, 0x34, 0xd3,
276        0x4d, 0x21, 0x80, 0xff, 0xd9, 0xff, 0xdb, 0x00, 0x84, 0x00, 0x0a,
277        0x07, 0x07, 0x08, 0x07, 0x06, 0x0a, 0x08, 0x08, 0x08, 0x0b, 0x0a,
278        0x0a, 0x0b, 0x0e, 0x18, 0x10, 0x0e, 0x0d, 0x0d, 0x0e, 0x1d, 0x15,
279        0x16, 0x11, 0x18, 0x23, 0x1f, 0x25, 0x24, 0x22, 0x1f, 0x22, 0x21,
280        0x26, 0x2b, 0x37, 0x2f, 0x26, 0x29, 0x34, 0x29, 0x21, 0x22, 0x30,
281        0x41, 0x31, 0x34, 0x39, 0x3b, 0x3e, 0x3e, 0x3e, 0x25, 0x2e, 0x44,
282        0x49, 0x43, 0x3c, 0x48, 0x37, 0x3d, 0x3e, 0x3b, 0x01, 0x0a, 0x0b,
283        0x0b, 0x0e, 0x0d, 0x0e, 0x1c, 0x10, 0x10, 0x1c, 0x3b, 0x28, 0x22,
284        0x28, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
285        0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
286        0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
287        0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b,
288        0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0x3b, 0xff, 0xc0, 0x00, 0x11,
289        0x08, 0x00, 0x48, 0x00, 0x60, 0x03, 0x01, 0x21, 0x00, 0x02, 0x11,
290        0x01, 0x03, 0x11, 0x01, 0xff, 0xc4, 0x01, 0xa2, 0x00, 0x00, 0x01,
291        0x05, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
292        0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
293        0x08, 0x09, 0x0a, 0x0b, 0x10, 0x00, 0x02, 0x01, 0x03, 0x03, 0x02,
294        0x04, 0x03, 0x05, 0x05, 0x04, 0x04, 0x00, 0x00, 0x01, 0x7d, 0x01,
295        0x02, 0x03, 0x00, 0x04, 0x11, 0x05, 0x12, 0x21, 0x31, 0x41, 0x06,
296        0x13, 0x51, 0x61, 0x07, 0x22, 0x71, 0x14, 0x32, 0x81, 0x91, 0xa1,
297        0x08, 0x23, 0x42, 0xb1, 0xc1, 0x15, 0x52, 0xd1, 0xf0, 0x24, 0x33,
298        0x62, 0x72, 0x82, 0x09, 0x0a, 0x16, 0x17, 0x18, 0x19, 0x1a, 0x25,
299        0x26, 0x27, 0x28, 0x29, 0x2a, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39,
300        0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54,
301        0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67,
302        0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
303        0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93, 0x94,
304        0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6,
305        0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8,
306        0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9, 0xca,
307        0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe1, 0xe2,
308        0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf1, 0xf2, 0xf3,
309        0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0x01, 0x00, 0x03, 0x01,
310        0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x00, 0x00, 0x00,
311        0x00, 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
312        0x09, 0x0a, 0x0b, 0x11, 0x00, 0x02, 0x01, 0x02, 0x04, 0x04, 0x03,
313        0x04, 0x07, 0x05, 0x04, 0x04, 0x00, 0x01, 0x02, 0x77, 0x00, 0x01,
314        0x02, 0x03, 0x11, 0x04, 0x05, 0x21, 0x31, 0x06, 0x12, 0x41, 0x51,
315        0x07, 0x61, 0x71, 0x13, 0x22, 0x32, 0x81, 0x08, 0x14, 0x42, 0x91,
316        0xa1, 0xb1, 0xc1, 0x09, 0x23, 0x33, 0x52, 0xf0, 0x15, 0x62, 0x72,
317        0xd1, 0x0a, 0x16, 0x24, 0x34, 0xe1, 0x25, 0xf1, 0x17, 0x18, 0x19,
318        0x1a, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x35, 0x36, 0x37, 0x38, 0x39,
319        0x3a, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x53, 0x54,
320        0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x63, 0x64, 0x65, 0x66, 0x67,
321        0x68, 0x69, 0x6a, 0x73, 0x74, 0x75, 0x76, 0x77, 0x78, 0x79, 0x7a,
322        0x82, 0x83, 0x84, 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x92, 0x93,
323        0x94, 0x95, 0x96, 0x97, 0x98, 0x99, 0x9a, 0xa2, 0xa3, 0xa4, 0xa5,
324        0xa6, 0xa7, 0xa8, 0xa9, 0xaa, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7,
325        0xb8, 0xb9, 0xba, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, 0xc8, 0xc9,
326        0xca, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe2,
327        0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4,
328        0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xff, 0xda, 0x00, 0x0c, 0x03,
329        0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00, 0x9e, 0xd2,
330        0x2e, 0x07, 0x15, 0xaf, 0x6d, 0x08, 0xe2, 0xb3, 0x45, 0x1a, 0xf6,
331        0xd0, 0x00, 0x01, 0xc5, 0x68, 0x45, 0x17, 0x4a, 0xb4, 0x22, 0xe4,
332        0x70, 0x8c, 0x74, 0xa9, 0x3c, 0xa1, 0x8e, 0x95, 0x48, 0x96, 0x31,
333        0xe2, 0x18, 0xe9, 0x55, 0xa5, 0x8c, 0x7a, 0x50, 0x05, 0x0b, 0x88,
334        0x86, 0x0f, 0x15, 0x8f, 0x75, 0x1f, 0x26, 0x93, 0x19, 0x91, 0x77,
335        0x18, 0xc1, 0xac, 0x4b, 0xc8, 0xfa, 0xd6, 0x63, 0x37, 0x6d, 0x31,
336        0xb4, 0x73, 0x5b, 0x36, 0xa0, 0x1c, 0x50, 0x80, 0xd7, 0x83, 0xa0,
337        0xab, 0xd1, 0x62, 0xad, 0x09, 0x8f, 0x17, 0x29, 0x03, 0xb2, 0xcc,
338        0xe0, 0x77, 0x14, 0xa3, 0x56, 0xb3, 0x27, 0x1e, 0x67, 0xe9, 0x52,
339        0xea, 0xc6, 0x3a, 0x36, 0x48, 0xef, 0x3d, 0x27, 0x70, 0x22, 0x60,
340        0x47, 0x52, 0x69, 0xb2, 0xe2, 0xad, 0x3b, 0xea, 0x80, 0xa3, 0x38,
341        0xe0, 0xd6, 0x3d, 0xd8, 0x1c, 0xd0, 0xca, 0x46, 0x3d, 0xd0, 0x18,
342        0x35, 0x89, 0x78, 0xa3, 0x9a, 0xcd, 0x8c, 0xd2, 0xb3, 0x93, 0x2a,
343        0x2b, 0x66, 0xd5, 0xf1, 0x8a, 0x10, 0x1a, 0xd6, 0xf2, 0x03, 0x8a,
344        0x9e, 0xe6, 0xf4, 0x5a, 0xdb, 0xef, 0xfe, 0x23, 0xc0, 0xa7, 0x27,
345        0xcb, 0x16, 0xc4, 0xcc, 0xdd, 0xe2, 0x78, 0x9a, 0x69, 0x66, 0xcc,
346        0x99, 0xe1, 0x4d, 0x47, 0xba, 0xbc, 0xd9, 0x6a, 0xee, 0x26, 0x59,
347        0x59, 0x4d, 0xac, 0x69, 0x34, 0x52, 0xe5, 0x8f, 0x55, 0xad, 0x58,
348        0xae, 0x85, 0xc4, 0x22, 0x41, 0xdf, 0xad, 0x76, 0x61, 0xe5, 0x6f,
349        0x74, 0x45, 0x69, 0xdc, 0x00, 0x79, 0xac, 0x8b, 0xa6, 0xc9, 0x35,
350        0xd4, 0x34, 0x64, 0xdc, 0x37, 0x06, 0xb1, 0xae, 0x88, 0xc1, 0xac,
351        0xd8, 0xc9, 0x2c, 0xa6, 0xe0, 0x73, 0x5b, 0x36, 0xf3, 0x74, 0xe6,
352        0x84, 0x05, 0xe3, 0xa9, 0x47, 0x6a, 0x14, 0xb6, 0x49, 0x3d, 0x85,
353        0x3a, 0xee, 0xee, 0x2b, 0xa8, 0xe2, 0x6f, 0x30, 0x81, 0xe9, 0x8a,
354        0xca, 0xa4, 0xe2, 0xd3, 0x8b, 0x01, 0xb1, 0xf9, 0x04, 0x7f, 0xaf,
355        0x23, 0xf0, 0xa9, 0x54, 0x41, 0x9c, 0xfd, 0xa3, 0xf4, 0xae, 0x65,
356        0x18, 0xf7, 0x25, 0x8a, 0xe2, 0x02, 0x38, 0xb8, 0xfd, 0x2a, 0x7b,
357        0x5b, 0xa8, 0x6d, 0x6d, 0x5d, 0x9a, 0x5d, 0xcb, 0xbb, 0xd2, 0xb6,
358        0xa6, 0xa3, 0x19, 0x5e, 0xe2, 0x03, 0x7b, 0x1d, 0xc2, 0x17, 0x8d,
359        0xb8, 0xac, 0xfb, 0x89, 0x39, 0x35, 0xd6, 0x9a, 0x6a, 0xe8, 0x66,
360        0x55, 0xcb, 0xf5, 0xac, 0x7b, 0x96, 0xeb, 0x50, 0xc6, 0x88, 0x6d,
361        0x66, 0xe9, 0xcd, 0x6c, 0xdb, 0x4f, 0xd3, 0x9a, 0x00, 0x2f, 0xe6,
362        0xf9, 0xa3, 0xe7, 0xb5, 0x4a, 0x93, 0x7f, 0xa2, 0xc6, 0x73, 0xdc,
363        0xd7, 0x15, 0x55, 0xef, 0x48, 0x7d, 0x09, 0x52, 0x6e, 0x3a, 0xd4,
364        0xab, 0x2f, 0xbd, 0x61, 0x16, 0x0c, 0x73, 0x49, 0xc5, 0x24, 0x92,
365        0x7f, 0xa2, 0x63, 0xfd, 0xaa, 0xd6, 0x2f, 0x71, 0x0e, 0xb1, 0x93,
366        0xf7, 0x2d, 0xf5, 0xa4, 0x9e, 0x4e, 0xb5, 0xdd, 0x4b, 0xf8, 0x68,
367        0x4c, 0xcb, 0xb9, 0x93, 0xad, 0x65, 0xce, 0xd9, 0x26, 0xa9, 0x8d,
368        0x19, 0xf6, 0xf2, 0xf4, 0xe6, 0xb5, 0xad, 0xe7, 0xc6, 0x39, 0xa0,
369        0x18, 0xeb, 0xc9, 0x77, 0x6c, 0x35, 0x2a, 0x4b, 0xfe, 0x8a, 0x9c,
370        0xff, 0x00, 0x11, 0xae, 0x3a, 0x8b, 0xde, 0x61, 0xd0, 0x9e, 0x39,
371        0xb8, 0xeb, 0x53, 0xac, 0xb9, 0xae, 0x5b, 0x00, 0xf3, 0x27, 0x14,
372        0x92, 0xc9, 0xfe, 0x8a, 0x3f, 0xde, 0x35, 0xac, 0x3a, 0x88, 0x92,
373        0xcd, 0xb1, 0x6e, 0x7d, 0xcd, 0x32, 0x67, 0xeb, 0xcd, 0x7a, 0x14,
374        0xfe, 0x04, 0x26, 0x66, 0xce, 0xf9, 0x26, 0xb3, 0xe6, 0x6e, 0xb4,
375        0xd9, 0x48, 0xc8, 0x82, 0x4e, 0x07, 0x35, 0xa7, 0x6f, 0x2f, 0x02,
376        0x9a, 0x06, 0x5f, 0x8c, 0xa4, 0x83, 0x0e, 0x32, 0x2a, 0x69, 0xe3,
377        0xdd, 0x12, 0x08, 0x97, 0x85, 0xec, 0x2a, 0x2a, 0x42, 0xf1, 0x76,
378        0x26, 0xe4, 0x6a, 0x59, 0x0e, 0x18, 0x10, 0x6a, 0xd2, 0x89, 0x02,
379        0x6e, 0x2a, 0x71, 0xeb, 0x5c, 0x1c, 0x8c, 0xa6, 0x48, 0xbb, 0xdc,
380        0x61, 0x41, 0x35, 0x72, 0x28, 0x87, 0xd9, 0xf6, 0x4a, 0xb9, 0xe7,
381        0x38, 0xae, 0x8c, 0x3d, 0x36, 0xdd, 0xde, 0xc4, 0xb0, 0x21, 0x51,
382        0x76, 0xa8, 0xc0, 0xaa, 0x93, 0x31, 0xe6, 0xbb, 0x2d, 0x65, 0x61,
383        0x19, 0xd3, 0x1e, 0xb5, 0x46, 0x5a, 0x96, 0x5a, 0x30, 0xa0, 0x7e,
384        0x05, 0x69, 0x5b, 0xc9, 0xc6, 0x28, 0x40, 0xcd, 0x08, 0x64, 0x3c,
385        0x73, 0x57, 0xe1, 0x94, 0xf1, 0xcd, 0x5a, 0x21, 0x8c, 0xb9, 0x63,
386        0xe7, 0x67, 0x1d, 0xab, 0x40, 0xb1, 0xfb, 0x00, 0x1d, 0xf0, 0x2b,
387        0x99, 0x2d, 0x66, 0x3e, 0x88, 0x75, 0x81, 0x3f, 0x31, 0xf6, 0xab,
388        0x64, 0xd6, 0xb4, 0x17, 0xee, 0xd0, 0x9e, 0xe4, 0x32, 0x1a, 0xa7,
389        0x31, 0xad, 0x18, 0x14, 0x26, 0xef, 0x54, 0xa5, 0xa8, 0x65, 0xa3,
390        0x9c, 0x81, 0xfa, 0x56, 0x8c, 0x2d, 0xce, 0x68, 0x40, 0xcb, 0xf1,
391        0x37, 0xbd, 0x5e, 0x85, 0xea, 0xd1, 0x0c, 0xbb, 0x19, 0x56, 0x23,
392        0x20, 0x1f, 0xad, 0x5c, 0x42, 0x08, 0x03, 0xb5, 0x55, 0x91, 0x04,
393        0xc9, 0x80, 0x38, 0x00, 0x0a, 0x71, 0x34, 0x6c, 0x32, 0x27, 0xe9,
394        0x55, 0x25, 0x15, 0x2c, 0x68, 0xa3, 0x30, 0xeb, 0x54, 0xa5, 0x15,
395        0x0c, 0xd1, 0x00, 0xff, 0xd9};
396
397    /* package */ static final byte[] sPhotoByteArrayForComplicatedCase;
398
399    static {
400        final int length = sPhotoIntArrayForComplicatedCase.length;
401        sPhotoByteArrayForComplicatedCase = new byte[length];
402        for (int i = 0; i < length; i++) {
403            sPhotoByteArrayForComplicatedCase[i] = (byte)sPhotoIntArrayForComplicatedCase[i];
404        }
405    }
406
407    public void testV21SimpleCase1_Parsing() {
408        mVerifier.initForImportTest(V21, R.raw.v21_simple_1);
409        mVerifier.addPropertyNodesVerifierElem()
410                .addExpectedNodeWithOrder("N", "Ando;Roid;", Arrays.asList("Ando", "Roid", ""));
411    }
412
413    public void testV21SimpleCase1_Type_Generic() {
414        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_GENERIC, R.raw.v21_simple_1);
415        mVerifier.addContentValuesVerifierElem()
416                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
417                        .put(StructuredName.FAMILY_NAME, "Ando")
418                        .put(StructuredName.GIVEN_NAME, "Roid")
419                        .put(StructuredName.DISPLAY_NAME, "Roid Ando");
420    }
421
422    public void testV21SimpleCase1_Type_Japanese() {
423        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_simple_1);
424        mVerifier.addContentValuesVerifierElem()
425                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
426                        .put(StructuredName.FAMILY_NAME, "Ando")
427                        .put(StructuredName.GIVEN_NAME, "Roid")
428                        // If name-related strings only contains printable Ascii,
429                        // the order is remained to be US's:
430                        // "Prefix Given Middle Family Suffix"
431                        .put(StructuredName.DISPLAY_NAME, "Roid Ando");
432    }
433
434    public void testV21SimpleCase2() {
435        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_simple_2);
436        mVerifier.addContentValuesVerifierElem()
437                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
438                        .put(StructuredName.DISPLAY_NAME, "Ando Roid");
439    }
440
441    public void testV21SimpleCase3() {
442        mVerifier.initForImportTest(V21, R.raw.v21_simple_3);
443        mVerifier.addContentValuesVerifierElem()
444                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
445                        .put(StructuredName.FAMILY_NAME, "Ando")
446                        .put(StructuredName.GIVEN_NAME, "Roid")
447                        // "FN" field should be prefered since it should contain the original
448                        // order intended by the author of the file.
449                        .put(StructuredName.DISPLAY_NAME, "Ando Roid");
450    }
451
452    /**
453     * Tests ';' is properly handled by VCardParser implementation.
454     */
455    public void testV21BackslashCase_Parsing() {
456        mVerifier.initForImportTest(V21, R.raw.v21_backslash);
457        mVerifier.addPropertyNodesVerifierElem()
458                .addExpectedNodeWithOrder("VERSION", "2.1")
459                .addExpectedNodeWithOrder("N", ";A;B\\;C\\;;D;:E;\\\\;",
460                        Arrays.asList("", "A;B\\", "C\\;", "D", ":E", "\\\\", ""))
461                .addExpectedNodeWithOrder("FN", "A;B\\C\\;D:E\\\\");
462
463    }
464
465    /**
466     * Tests ContactStruct correctly ignores redundant fields in "N" property values and
467     * inserts name related data.
468     */
469    public void testV21BackslashCase() {
470        mVerifier.initForImportTest(V21, R.raw.v21_backslash);
471        mVerifier.addContentValuesVerifierElem()
472                .addExpected(StructuredName.CONTENT_ITEM_TYPE)
473                        // FAMILY_NAME is empty and removed in this test...
474                        .put(StructuredName.GIVEN_NAME, "A;B\\")
475                        .put(StructuredName.MIDDLE_NAME, "C\\;")
476                        .put(StructuredName.PREFIX, "D")
477                        .put(StructuredName.SUFFIX, ":E")
478                        .put(StructuredName.DISPLAY_NAME, "A;B\\C\\;D:E\\\\");
479    }
480
481    public void testOrgBeforTitle() {
482        mVerifier.initForImportTest(V21, R.raw.v21_org_before_title);
483        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
484        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
485                .put(StructuredName.DISPLAY_NAME, "Normal Guy");
486        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
487                .put(Organization.COMPANY, "Company")
488                .put(Organization.DEPARTMENT, "Organization Devision Room Sheet No.")
489                .put(Organization.TITLE, "Excellent Janitor")
490                .put(Organization.TYPE, Organization.TYPE_WORK);
491    }
492
493    public void testTitleBeforOrg() {
494        mVerifier.initForImportTest(V21, R.raw.v21_title_before_org);
495        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
496        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
497                .put(StructuredName.DISPLAY_NAME, "Nice Guy");
498        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
499                .put(Organization.COMPANY, "Marverous")
500                .put(Organization.DEPARTMENT, "Perfect Great Good Bad Poor")
501                .put(Organization.TITLE, "Cool Title")
502                .put(Organization.TYPE, Organization.TYPE_WORK);
503    }
504
505    /**
506     * Verifies that vCard importer correctly interpret "PREF" attribute to IS_PRIMARY.
507     * The data contain three cases: one "PREF", no "PREF" and multiple "PREF", in each type.
508     */
509    public void testV21PrefToIsPrimary() {
510        mVerifier.initForImportTest(V21, R.raw.v21_pref_handling);
511        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
512        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
513                .put(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)
514                .put(StructuredName.DISPLAY_NAME, "Smith");
515        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
516                .put(Phone.NUMBER, "1")
517                .put(Phone.TYPE, Phone.TYPE_HOME);
518        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
519                .put(Phone.NUMBER, "2")
520                .put(Phone.TYPE, Phone.TYPE_WORK)
521                .put(Phone.IS_PRIMARY, 1);
522        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
523                .put(Phone.NUMBER, "3")
524                .put(Phone.TYPE, Phone.TYPE_ISDN);
525        elem.addExpected(Email.CONTENT_ITEM_TYPE)
526                .put(Email.DATA, "test@example.com")
527                .put(Email.TYPE, Email.TYPE_HOME)
528                .put(Email.IS_PRIMARY, 1);
529        elem.addExpected(Email.CONTENT_ITEM_TYPE)
530                .put(Email.DATA, "test2@examination.com")
531                .put(Email.TYPE, Email.TYPE_MOBILE)
532                .put(Email.IS_PRIMARY, 1);
533        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
534                .put(Organization.COMPANY, "Company")
535                .put(Organization.TITLE, "Engineer")
536                .put(Organization.TYPE, Organization.TYPE_WORK);
537        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
538                .put(Organization.COMPANY, "Mystery")
539                .put(Organization.TITLE, "Blogger")
540                .put(Organization.TYPE, Organization.TYPE_WORK);
541        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
542                .put(Organization.COMPANY, "Poetry")
543                .put(Organization.TITLE, "Poet")
544                .put(Organization.TYPE, Organization.TYPE_WORK);
545    }
546
547    /**
548     * Tests all the properties in a complicated vCard are correctly parsed by the VCardParser.
549     */
550    public void testV21ComplicatedCase_Parsing() {
551        mVerifier.initForImportTest(V21, R.raw.v21_complicated);
552        mVerifier.addPropertyNodesVerifierElem()
553                .addExpectedNodeWithOrder("VERSION", "2.1")
554                .addExpectedNodeWithOrder("N", "Gump;Forrest;Hoge;Pos;Tao",
555                        Arrays.asList("Gump", "Forrest", "Hoge", "Pos", "Tao"))
556                .addExpectedNodeWithOrder("FN", "Joe Due")
557                .addExpectedNodeWithOrder("ORG", "Gump Shrimp Co.;Sales Dept.;Manager;Fish keeper",
558                        Arrays.asList("Gump Shrimp Co.", "Sales Dept.;Manager", "Fish keeper"))
559                .addExpectedNodeWithOrder("ROLE", "Fish Cake Keeper!")
560                .addExpectedNodeWithOrder("TITLE", "Shrimp Man")
561                .addExpectedNodeWithOrder("X-CLASS", "PUBLIC")
562                .addExpectedNodeWithOrder("TEL", "(111) 555-1212", new TypeSet("WORK", "VOICE"))
563                .addExpectedNodeWithOrder("TEL", "(404) 555-1212", new TypeSet("HOME", "VOICE"))
564                .addExpectedNodeWithOrder("TEL", "0311111111", new TypeSet("CELL"))
565                .addExpectedNodeWithOrder("TEL", "0322222222", new TypeSet("VIDEO"))
566                .addExpectedNodeWithOrder("TEL", "0333333333", new TypeSet("VOICE"))
567                .addExpectedNodeWithOrder("ADR",
568                        ";;100 Waters Edge;Baytown;LA;30314;United States of America",
569                        Arrays.asList("", "", "100 Waters Edge", "Baytown",
570                                "LA", "30314", "United States of America"),
571                                null, null, new TypeSet("WORK"), null)
572                .addExpectedNodeWithOrder("LABEL",
573                        "100 Waters Edge\r\nBaytown, LA 30314\r\nUnited  States of America",
574                        null, null, mContentValuesForQP, new TypeSet("WORK"), null)
575                .addExpectedNodeWithOrder("ADR",
576                        ";;42 Plantation St.;Baytown;LA;30314;United States of America",
577                        Arrays.asList("", "", "42 Plantation St.", "Baytown",
578                                "LA", "30314", "United States of America"), null, null,
579                                new TypeSet("HOME"), null)
580                .addExpectedNodeWithOrder("LABEL",
581                        "42 Plantation St.\r\nBaytown, LA 30314\r\nUnited  States of America",
582                        null, null, mContentValuesForQP,
583                        new TypeSet("HOME"), null)
584                .addExpectedNodeWithOrder("EMAIL", "forrestgump@walladalla.com",
585                        new TypeSet("PREF", "INTERNET"))
586                .addExpectedNodeWithOrder("EMAIL", "cell@example.com", new TypeSet("CELL"))
587                .addExpectedNodeWithOrder("NOTE", "The following note is the example from RFC 2045.")
588                .addExpectedNodeWithOrder("NOTE",
589                        "Now's the time for all folk to come to the aid of their country.",
590                        null, null, mContentValuesForQP, null, null)
591                .addExpectedNodeWithOrder("PHOTO", null,
592                        null, sPhotoByteArrayForComplicatedCase, mContentValuesForBase64V21,
593                        new TypeSet("JPEG"), null)
594                .addExpectedNodeWithOrder("X-ATTRIBUTE", "Some String")
595                .addExpectedNodeWithOrder("BDAY", "19800101")
596                .addExpectedNodeWithOrder("GEO", "35.6563854,139.6994233")
597                .addExpectedNodeWithOrder("URL", "http://www.example.com/")
598                .addExpectedNodeWithOrder("REV", "20080424T195243Z");
599    }
600
601    /**
602     * Checks ContactStruct correctly inserts values in a complicated vCard
603     * into ContentResolver.
604     */
605    public void testV21ComplicatedCase() {
606        mVerifier.initForImportTest(V21, R.raw.v21_complicated);
607        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
608        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
609                .put(StructuredName.FAMILY_NAME, "Gump")
610                .put(StructuredName.GIVEN_NAME, "Forrest")
611                .put(StructuredName.MIDDLE_NAME, "Hoge")
612                .put(StructuredName.PREFIX, "Pos")
613                .put(StructuredName.SUFFIX, "Tao")
614                .put(StructuredName.DISPLAY_NAME, "Joe Due");
615        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
616                .put(Organization.TYPE, Organization.TYPE_WORK)
617                .put(Organization.COMPANY, "Gump Shrimp Co.")
618                .put(Organization.DEPARTMENT, "Sales Dept.;Manager Fish keeper")
619                .put(Organization.TITLE, "Shrimp Man");
620        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
621                .put(Phone.TYPE, Phone.TYPE_WORK)
622                // Phone number is expected to be formated with NAMP format in default.
623                .put(Phone.NUMBER, "111-555-1212");
624        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
625                .put(Phone.TYPE, Phone.TYPE_HOME)
626                .put(Phone.NUMBER, "404-555-1212");
627        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
628                .put(Phone.TYPE, Phone.TYPE_MOBILE)
629                .put(Phone.NUMBER, "031-111-1111");
630        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
631                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
632                .put(Phone.LABEL, "VIDEO")
633                .put(Phone.NUMBER, "032-222-2222");
634        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
635                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
636                .put(Phone.LABEL, "VOICE")
637                .put(Phone.NUMBER, "033-333-3333");
638        elem.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
639                .put(StructuredPostal.TYPE, StructuredPostal.TYPE_WORK)
640                .put(StructuredPostal.COUNTRY, "United States of America")
641                .put(StructuredPostal.POSTCODE, "30314")
642                .put(StructuredPostal.REGION, "LA")
643                .put(StructuredPostal.CITY, "Baytown")
644                .put(StructuredPostal.STREET, "100 Waters Edge")
645                .put(StructuredPostal.FORMATTED_ADDRESS,
646                        "100 Waters Edge Baytown LA 30314 United States of America");
647        elem.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
648                .put(StructuredPostal.TYPE, StructuredPostal.TYPE_HOME)
649                .put(StructuredPostal.COUNTRY, "United States of America")
650                .put(StructuredPostal.POSTCODE, "30314")
651                .put(StructuredPostal.REGION, "LA")
652                .put(StructuredPostal.CITY, "Baytown")
653                .put(StructuredPostal.STREET, "42 Plantation St.")
654                .put(StructuredPostal.FORMATTED_ADDRESS,
655                        "42 Plantation St. Baytown LA 30314 United States of America");
656        elem.addExpected(Email.CONTENT_ITEM_TYPE)
657                // "TYPE=INTERNET" -> TYPE_CUSTOM + the label "INTERNET"
658                .put(Email.TYPE, Email.TYPE_CUSTOM)
659                .put(Email.LABEL, "INTERNET")
660                .put(Email.DATA, "forrestgump@walladalla.com")
661                .put(Email.IS_PRIMARY, 1);
662        elem.addExpected(Email.CONTENT_ITEM_TYPE)
663                .put(Email.TYPE, Email.TYPE_MOBILE)
664                .put(Email.DATA, "cell@example.com");
665        elem.addExpected(Note.CONTENT_ITEM_TYPE)
666                .put(Note.NOTE, "The following note is the example from RFC 2045.");
667        elem.addExpected(Note.CONTENT_ITEM_TYPE)
668                .put(Note.NOTE,
669                        "Now's the time for all folk to come to the aid of their country.");
670        elem.addExpected(Photo.CONTENT_ITEM_TYPE)
671                // No information about its image format can be inserted.
672                .put(Photo.PHOTO, sPhotoByteArrayForComplicatedCase);
673        elem.addExpected(Event.CONTENT_ITEM_TYPE)
674                .put(Event.START_DATE, "19800101")
675                .put(Event.TYPE, Event.TYPE_BIRTHDAY);
676        elem.addExpected(Website.CONTENT_ITEM_TYPE)
677                .put(Website.URL, "http://www.example.com/")
678                .put(Website.TYPE, Website.TYPE_HOMEPAGE);
679    }
680
681    public void testV30Simple_Parsing() {
682        mVerifier.initForImportTest(V30, R.raw.v30_simple);
683        mVerifier.addPropertyNodesVerifierElem()
684                .addExpectedNodeWithOrder("VERSION", "3.0")
685                .addExpectedNodeWithOrder("FN", "And Roid")
686                .addExpectedNodeWithOrder("N", "And;Roid;;;", Arrays.asList("And", "Roid", "", "", ""))
687                .addExpectedNodeWithOrder("ORG", "Open;Handset; Alliance",
688                        Arrays.asList("Open", "Handset", " Alliance"))
689                .addExpectedNodeWithOrder("SORT-STRING", "android")
690                .addExpectedNodeWithOrder("TEL", "0300000000", new TypeSet("PREF", "VOICE"))
691                .addExpectedNodeWithOrder("CLASS", "PUBLIC")
692                .addExpectedNodeWithOrder("X-GNO", "0")
693                .addExpectedNodeWithOrder("X-GN", "group0")
694                .addExpectedNodeWithOrder("X-REDUCTION", "0")
695                .addExpectedNodeWithOrder("REV", "20081031T065854Z");
696    }
697
698    public void testV30Simple() {
699        mVerifier.initForImportTest(V30, R.raw.v30_simple);
700        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
701        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
702                .put(StructuredName.FAMILY_NAME, "And")
703                .put(StructuredName.GIVEN_NAME, "Roid")
704                .put(StructuredName.DISPLAY_NAME, "And Roid")
705                .put(StructuredName.PHONETIC_GIVEN_NAME, "android");
706        elem.addExpected(Organization.CONTENT_ITEM_TYPE)
707                .put(Organization.COMPANY, "Open")
708                .put(Organization.DEPARTMENT, "Handset  Alliance")
709                .put(Organization.TYPE, Organization.TYPE_WORK);
710        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
711                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
712                .put(Phone.LABEL, "VOICE")
713                .put(Phone.NUMBER, "030-000-0000")
714                .put(Phone.IS_PRIMARY, 1);
715    }
716
717    public void testV21Japanese1_Parsing() {
718        // Though Japanese careers append ";;;;" at the end of the value of "SOUND",
719        // vCard 2.1/3.0 specification does not allow multiple values.
720        // Do not need to handle it as multiple values.
721        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_japanese_1);
722        mVerifier.addPropertyNodesVerifierElem()
723                .addExpectedNodeWithOrder("VERSION", "2.1", null, null, null, null, null)
724                .addExpectedNodeWithOrder("N", "\u5B89\u85E4\u30ED\u30A4\u30C9;;;;",
725                        Arrays.asList("\u5B89\u85E4\u30ED\u30A4\u30C9", "", "", "", ""),
726                        null, mContentValuesForSJis, null, null)
727                .addExpectedNodeWithOrder("SOUND",
728                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E;;;;",
729                        null, null, mContentValuesForSJis,
730                        new TypeSet("X-IRMC-N"), null)
731                .addExpectedNodeWithOrder("TEL", "0300000000", null, null, null,
732                        new TypeSet("VOICE", "PREF"), null);
733    }
734
735    private void testV21Japanese1Common(int resId, int vcardType, boolean japanese) {
736        mVerifier.initForImportTest(vcardType, resId);
737        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
738        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
739                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9")
740                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9")
741                // While vCard parser does not split "SOUND" property values,
742                // ContactStruct care it.
743                .put(StructuredName.PHONETIC_GIVEN_NAME,
744                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E");
745        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
746                // Phone number formatting is different.
747                .put(Phone.NUMBER, (japanese ? "03-0000-0000" : "030-000-0000"))
748                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
749                .put(Phone.LABEL, "VOICE")
750                .put(Phone.IS_PRIMARY, 1);
751    }
752
753    /**
754     * Verifies vCard with Japanese can be parsed correctly with
755     * {@link android.pim.vcard.VCardConfig#VCARD_TYPE_V21_GENERIC}.
756     */
757    public void testV21Japanese1_Type_Generic_Utf8() {
758        testV21Japanese1Common(
759                R.raw.v21_japanese_1, VCardConfig.VCARD_TYPE_V21_GENERIC, false);
760    }
761
762    /**
763     * Verifies vCard with Japanese can be parsed correctly with
764     * {@link android.pim.vcard.VCardConfig#VCARD_TYPE_V21_JAPANESE}.
765     */
766    public void testV21Japanese1_Type_Japanese_Sjis() {
767        testV21Japanese1Common(
768                R.raw.v21_japanese_1, VCardConfig.VCARD_TYPE_V21_JAPANESE, true);
769    }
770
771    /**
772     * Verifies vCard with Japanese can be parsed correctly with
773     * {@link android.pim.vcard.VCardConfig#VCARD_TYPE_V21_JAPANESE}.
774     * since vCard 2.1 specifies the charset of each line if it contains non-Ascii.
775     */
776    public void testV21Japanese1_Type_Japanese_Utf8() {
777        testV21Japanese1Common(
778                R.raw.v21_japanese_1, VCardConfig.VCARD_TYPE_V21_JAPANESE, true);
779    }
780
781    public void testV21Japanese2_Parsing() {
782        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_japanese_2);
783        mVerifier.addPropertyNodesVerifierElem()
784                .addExpectedNodeWithOrder("VERSION", "2.1")
785                .addExpectedNodeWithOrder("N", "\u5B89\u85E4;\u30ED\u30A4\u30C9\u0031;;;",
786                        Arrays.asList("\u5B89\u85E4", "\u30ED\u30A4\u30C9\u0031",
787                                "", "", ""),
788                        null, mContentValuesForSJis, null, null)
789                .addExpectedNodeWithOrder("FN", "\u5B89\u85E4\u0020\u30ED\u30A4\u30C9\u0020\u0031",
790                        null, null, mContentValuesForSJis, null, null)
791                .addExpectedNodeWithOrder("SOUND",
792                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73;\uFF9B\uFF72\uFF84\uFF9E\u0031;;;",
793                        null, null, mContentValuesForSJis,
794                        new TypeSet("X-IRMC-N"), null)
795                .addExpectedNodeWithOrder("ADR",
796                        ";\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
797                        "\u4E18\u753A\u0032\u0036\u002D\u0031\u30BB" +
798                        "\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC\u0036" +
799                        "\u968E;;;;150-8512;",
800                        Arrays.asList("",
801                                "\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
802                                "\u4E18\u753A\u0032\u0036\u002D\u0031\u30BB" +
803                                "\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC" +
804                                "\u0036\u968E", "", "", "", "150-8512", ""),
805                        null, mContentValuesForQPAndSJis, new TypeSet("HOME"), null)
806                .addExpectedNodeWithOrder("NOTE", "\u30E1\u30E2", null, null,
807                        mContentValuesForQPAndSJis, null, null);
808    }
809
810    public void testV21Japanese2_Type_Generic_Utf8() {
811        mVerifier.initForImportTest(V21, R.raw.v21_japanese_2);
812        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
813        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
814                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4")
815                .put(StructuredName.GIVEN_NAME, "\u30ED\u30A4\u30C9\u0031")
816                .put(StructuredName.DISPLAY_NAME,
817                        "\u5B89\u85E4\u0020\u30ED\u30A4\u30C9\u0020\u0031")
818                // ContactStruct should correctly split "SOUND" property into several elements,
819                // even though VCardParser side does not care it.
820                .put(StructuredName.PHONETIC_FAMILY_NAME, "\uFF71\uFF9D\uFF84\uFF9E\uFF73")
821                .put(StructuredName.PHONETIC_GIVEN_NAME, "\uFF9B\uFF72\uFF84\uFF9E\u0031");
822        elem.addExpected(StructuredPostal.CONTENT_ITEM_TYPE)
823                .put(StructuredPostal.POSTCODE, "150-8512")
824                .put(StructuredPostal.STREET,
825                        "\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
826                        "\u4E18\u753A\u0032\u0036\u002D\u0031\u30BB" +
827                        "\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC" +
828                        "\u0036\u968E")
829                .put(StructuredPostal.FORMATTED_ADDRESS,
830                        "\u6771\u4EAC\u90FD\u6E0B\u8C37\u533A\u685C" +
831                        "\u4E18\u753A\u0032\u0036\u002D\u0031\u30BB" +
832                        "\u30EB\u30EA\u30A2\u30F3\u30BF\u30EF\u30FC" +
833                        "\u0036\u968E 150-8512")
834                .put(StructuredPostal.TYPE, StructuredPostal.TYPE_HOME);
835        elem.addExpected(Note.CONTENT_ITEM_TYPE)
836                .put(Note.NOTE, "\u30E1\u30E2");
837    }
838
839    public void testV21MultipleEntryCase_Parse() {
840        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_multiple_entry);
841        mVerifier.addPropertyNodesVerifierElem()
842                .addExpectedNodeWithOrder("VERSION", "2.1")
843                .addExpectedNodeWithOrder("N", "\u5B89\u85E4\u30ED\u30A4\u30C9\u0033;;;;",
844                        Arrays.asList("\u5B89\u85E4\u30ED\u30A4\u30C9\u0033", "", "", "", ""),
845                        null, mContentValuesForSJis, null, null)
846                .addExpectedNodeWithOrder("SOUND",
847                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0033;;;;",
848                        null, null, mContentValuesForSJis,
849                        new TypeSet("X-IRMC-N"), null)
850                .addExpectedNodeWithOrder("TEL", "9", new TypeSet("X-NEC-SECRET"))
851                .addExpectedNodeWithOrder("TEL", "10", new TypeSet("X-NEC-HOTEL"))
852                .addExpectedNodeWithOrder("TEL", "11", new TypeSet("X-NEC-SCHOOL"))
853                .addExpectedNodeWithOrder("TEL", "12", new TypeSet("FAX", "HOME"));
854        mVerifier.addPropertyNodesVerifierElem()
855                .addExpectedNodeWithOrder("VERSION", "2.1")
856                .addExpectedNodeWithOrder("N", "\u5B89\u85E4\u30ED\u30A4\u30C9\u0034;;;;",
857                        Arrays.asList("\u5B89\u85E4\u30ED\u30A4\u30C9\u0034", "", "", "", ""),
858                        null, mContentValuesForSJis, null, null)
859                .addExpectedNodeWithOrder("SOUND",
860                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0034;;;;",
861                        null, null, mContentValuesForSJis,
862                        new TypeSet("X-IRMC-N"), null)
863                .addExpectedNodeWithOrder("TEL", "13", new TypeSet("MODEM"))
864                .addExpectedNodeWithOrder("TEL", "14", new TypeSet("PAGER"))
865                .addExpectedNodeWithOrder("TEL", "15", new TypeSet("X-NEC-FAMILY"))
866                .addExpectedNodeWithOrder("TEL", "16", new TypeSet("X-NEC-GIRL"));
867        mVerifier.addPropertyNodesVerifierElem()
868                .addExpectedNodeWithOrder("VERSION", "2.1")
869                .addExpectedNodeWithOrder("N", "\u5B89\u85E4\u30ED\u30A4\u30C9\u0035;;;;",
870                        Arrays.asList("\u5B89\u85E4\u30ED\u30A4\u30C9\u0035", "", "", "", ""),
871                        null, mContentValuesForSJis, null, null)
872                .addExpectedNodeWithOrder("SOUND",
873                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0035;;;;",
874                        null, null, mContentValuesForSJis,
875                        new TypeSet("X-IRMC-N"), null)
876                .addExpectedNodeWithOrder("TEL", "17", new TypeSet("X-NEC-BOY"))
877                .addExpectedNodeWithOrder("TEL", "18", new TypeSet("X-NEC-FRIEND"))
878                .addExpectedNodeWithOrder("TEL", "19", new TypeSet("X-NEC-PHS"))
879                .addExpectedNodeWithOrder("TEL", "20", new TypeSet("X-NEC-RESTAURANT"));
880    }
881
882    public void testV21MultipleEntryCase() {
883        mVerifier.initForImportTest(VCardConfig.VCARD_TYPE_V21_JAPANESE, R.raw.v21_multiple_entry);
884        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
885        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
886                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0033")
887                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0033")
888                .put(StructuredName.PHONETIC_GIVEN_NAME,
889                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0033");
890        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
891                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
892                .put(Phone.LABEL, "NEC-SECRET")
893                .put(Phone.NUMBER, "9");
894        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
895                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
896                .put(Phone.LABEL, "NEC-HOTEL")
897                .put(Phone.NUMBER, "10");
898        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
899                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
900                .put(Phone.LABEL, "NEC-SCHOOL")
901                .put(Phone.NUMBER, "11");
902        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
903                .put(Phone.TYPE, Phone.TYPE_FAX_HOME)
904                .put(Phone.NUMBER, "12");
905
906        elem = mVerifier.addContentValuesVerifierElem();
907        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
908                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0034")
909                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0034")
910                .put(StructuredName.PHONETIC_GIVEN_NAME,
911                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0034");
912        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
913                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
914                .put(Phone.LABEL, "MODEM")
915                .put(Phone.NUMBER, "13");
916        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
917                .put(Phone.TYPE, Phone.TYPE_PAGER)
918                .put(Phone.NUMBER, "14");
919        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
920                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
921                .put(Phone.LABEL, "NEC-FAMILY")
922                .put(Phone.NUMBER, "15");
923        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
924                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
925                .put(Phone.LABEL, "NEC-GIRL")
926                .put(Phone.NUMBER, "16");
927
928        elem = mVerifier.addContentValuesVerifierElem();
929        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
930                .put(StructuredName.FAMILY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0035")
931                .put(StructuredName.DISPLAY_NAME, "\u5B89\u85E4\u30ED\u30A4\u30C9\u0035")
932                .put(StructuredName.PHONETIC_GIVEN_NAME,
933                        "\uFF71\uFF9D\uFF84\uFF9E\uFF73\uFF9B\uFF72\uFF84\uFF9E\u0035");
934        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
935                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
936                .put(Phone.LABEL, "NEC-BOY")
937                .put(Phone.NUMBER, "17");
938        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
939                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
940                .put(Phone.LABEL, "NEC-FRIEND")
941                .put(Phone.NUMBER, "18");
942        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
943                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
944                .put(Phone.LABEL, "NEC-PHS")
945                .put(Phone.NUMBER, "19");
946        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
947                .put(Phone.TYPE, Phone.TYPE_CUSTOM)
948                .put(Phone.LABEL, "NEC-RESTAURANT")
949                .put(Phone.NUMBER, "20");
950    }
951
952    public void testIgnoreAgentV21_Parse() {
953        mVerifier.initForImportTest(V21, R.raw.v21_winmo_65);
954        ContentValues contentValuesForValue = new ContentValues();
955        contentValuesForValue.put("VALUE", "DATE");
956        mVerifier.addPropertyNodesVerifierElem()
957                .addExpectedNodeWithOrder("VERSION", "2.1")
958                .addExpectedNodeWithOrder("N", Arrays.asList("Example", "", "", "", ""))
959                .addExpectedNodeWithOrder("FN", "Example")
960                .addExpectedNodeWithOrder("ANNIVERSARY", "20091010", contentValuesForValue)
961                .addExpectedNodeWithOrder("AGENT", "")
962                .addExpectedNodeWithOrder("X-CLASS", "PUBLIC")
963                .addExpectedNodeWithOrder("X-REDUCTION", "")
964                .addExpectedNodeWithOrder("X-NO", "");
965    }
966
967    public void testIgnoreAgentV21() {
968        mVerifier.initForImportTest(V21, R.raw.v21_winmo_65);
969        ContentValuesVerifier verifier = new ContentValuesVerifier();
970        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
971        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
972                .put(StructuredName.FAMILY_NAME, "Example")
973                .put(StructuredName.DISPLAY_NAME, "Example");
974    }
975
976    public void testTolerateInvalidCommentLikeLineV21() {
977        mVerifier.initForImportTest(V21, R.raw.v21_invalid_comment_line);
978        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
979        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
980                .put(StructuredName.GIVEN_NAME, "Conference Call")
981                .put(StructuredName.DISPLAY_NAME, "Conference Call");
982        elem.addExpected(Note.CONTENT_ITEM_TYPE)
983                .put(Note.NOTE, "This is an (sharp ->#<- sharp) example. "
984                        + "This message must NOT be ignored.");
985    }
986
987    public void testPagerV30_Parse() {
988        mVerifier.initForImportTest(V30, R.raw.v30_comma_separated);
989        mVerifier.addPropertyNodesVerifierElem()
990                .addExpectedNodeWithOrder("VERSION", "3.0")
991                .addExpectedNodeWithOrder("N", Arrays.asList("F", "G", "M", "", ""))
992                .addExpectedNodeWithOrder("TEL", "6101231234@pagersample.com",
993                        new TypeSet("WORK", "MSG", "PAGER"));
994    }
995
996    public void testPagerV30() {
997        mVerifier.initForImportTest(V30, R.raw.v30_comma_separated);
998        ContentValuesVerifierElem elem = mVerifier.addContentValuesVerifierElem();
999        elem.addExpected(StructuredName.CONTENT_ITEM_TYPE)
1000                .put(StructuredName.FAMILY_NAME, "F")
1001                .put(StructuredName.MIDDLE_NAME, "M")
1002                .put(StructuredName.GIVEN_NAME, "G")
1003                .put(StructuredName.DISPLAY_NAME, "G M F");
1004        elem.addExpected(Phone.CONTENT_ITEM_TYPE)
1005                .put(Phone.TYPE, Phone.TYPE_PAGER)
1006                .put(Phone.NUMBER, "6101231234@pagersample.com");
1007    }
1008}
1009