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