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