OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Test.h" | 8 #include "Test.h" |
9 | 9 |
10 // Include the implementation so we can make an appropriate template instance. | 10 // Include the implementation so we can make an appropriate template instance. |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 // Enough don't cares to breakup something. | 94 // Enough don't cares to breakup something. |
95 // Test rules: a 0 1 2 3 4 5 | 95 // Test rules: a 0 1 2 3 4 5 |
96 static const int16_t data14[] = {1, 0, 0, 0, 0, 2}; | 96 static const int16_t data14[] = {1, 0, 0, 0, 0, 2}; |
97 static const char* expected14 = "0[1] 5[2]"; | 97 static const char* expected14 = "0[1] 5[2]"; |
98 static const uint32_t subset14[] = {0, 5}; | 98 static const uint32_t subset14[] = {0, 5}; |
99 static const char* expectedSubset14 = "0[1] 5[2]"; | 99 static const char* expectedSubset14 = "0[1] 5[2]"; |
100 | 100 |
101 static SkString stringify_advance_data(SkAdvancedTypefaceMetrics::AdvanceMetric<
int16_t>* data) { | 101 static SkString stringify_advance_data(SkAdvancedTypefaceMetrics::AdvanceMetric<
int16_t>* data) { |
102 SkString result; | 102 SkString result; |
103 bool leadingSpace = false; | 103 bool leadingSpace = false; |
104 while (data != NULL) { | 104 while (data != nullptr) { |
105 if (leadingSpace) { | 105 if (leadingSpace) { |
106 result.append(" "); | 106 result.append(" "); |
107 } else { | 107 } else { |
108 leadingSpace = true; | 108 leadingSpace = true; |
109 } | 109 } |
110 switch(data->fType) { | 110 switch(data->fType) { |
111 case SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t>::kRun: | 111 case SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t>::kRun: |
112 result.appendf("%d %d %d", data->fStartId, data->fEndId, data->fAdvanc
e[0]); | 112 result.appendf("%d %d %d", data->fStartId, data->fEndId, data->fAdvanc
e[0]); |
113 break; | 113 break; |
114 case SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t>::kRange: | 114 case SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t>::kRange: |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 SkString stringResult = stringify_advance_data(result); | 167 SkString stringResult = stringify_advance_data(result); |
168 if (!stringResult.equals(fExpected)) { | 168 if (!stringResult.equals(fExpected)) { |
169 SkDebugf("Expected: %s\n Result: %s\n", fExpected, stringResult.c_s
tr()); | 169 SkDebugf("Expected: %s\n Result: %s\n", fExpected, stringResult.c_s
tr()); |
170 return false; | 170 return false; |
171 } | 171 } |
172 return true; | 172 return true; |
173 } | 173 } |
174 }; | 174 }; |
175 | 175 |
176 DEF_TEST(WArray, reporter) { | 176 DEF_TEST(WArray, reporter) { |
177 TestWData(reporter, data1, SK_ARRAY_COUNT(data1), NULL, 0, expected1); | 177 TestWData(reporter, data1, SK_ARRAY_COUNT(data1), nullptr, 0, expected1); |
178 TestWData(reporter, data2, SK_ARRAY_COUNT(data2), NULL, 0, expected2); | 178 TestWData(reporter, data2, SK_ARRAY_COUNT(data2), nullptr, 0, expected2); |
179 TestWData(reporter, data3, SK_ARRAY_COUNT(data3), NULL, 0, expected3); | 179 TestWData(reporter, data3, SK_ARRAY_COUNT(data3), nullptr, 0, expected3); |
180 TestWData(reporter, data4, SK_ARRAY_COUNT(data4), NULL, 0, expected4); | 180 TestWData(reporter, data4, SK_ARRAY_COUNT(data4), nullptr, 0, expected4); |
181 TestWData(reporter, data5, SK_ARRAY_COUNT(data5), NULL, 0, expected5); | 181 TestWData(reporter, data5, SK_ARRAY_COUNT(data5), nullptr, 0, expected5); |
182 TestWData(reporter, data6, SK_ARRAY_COUNT(data6), NULL, 0, expected6); | 182 TestWData(reporter, data6, SK_ARRAY_COUNT(data6), nullptr, 0, expected6); |
183 TestWData(reporter, data7, SK_ARRAY_COUNT(data7), NULL, 0, expected7); | 183 TestWData(reporter, data7, SK_ARRAY_COUNT(data7), nullptr, 0, expected7); |
184 TestWData(reporter, data7, SK_ARRAY_COUNT(data7), subset7, | 184 TestWData(reporter, data7, SK_ARRAY_COUNT(data7), subset7, |
185 SK_ARRAY_COUNT(subset7), expectedSubset7); | 185 SK_ARRAY_COUNT(subset7), expectedSubset7); |
186 TestWData(reporter, data8, SK_ARRAY_COUNT(data8), NULL, 0, expected8); | 186 TestWData(reporter, data8, SK_ARRAY_COUNT(data8), nullptr, 0, expected8); |
187 TestWData(reporter, data8, SK_ARRAY_COUNT(data8), subset8, | 187 TestWData(reporter, data8, SK_ARRAY_COUNT(data8), subset8, |
188 SK_ARRAY_COUNT(subset8), expectedSubset8); | 188 SK_ARRAY_COUNT(subset8), expectedSubset8); |
189 TestWData(reporter, data9, SK_ARRAY_COUNT(data9), NULL, 0, expected9); | 189 TestWData(reporter, data9, SK_ARRAY_COUNT(data9), nullptr, 0, expected9); |
190 TestWData(reporter, data9, SK_ARRAY_COUNT(data9), subset9, | 190 TestWData(reporter, data9, SK_ARRAY_COUNT(data9), subset9, |
191 SK_ARRAY_COUNT(subset9), expectedSubset9); | 191 SK_ARRAY_COUNT(subset9), expectedSubset9); |
192 TestWData(reporter, data10, SK_ARRAY_COUNT(data10), NULL, 0, expected10); | 192 TestWData(reporter, data10, SK_ARRAY_COUNT(data10), nullptr, 0, expected10); |
193 TestWData(reporter, data10, SK_ARRAY_COUNT(data10), subset10, | 193 TestWData(reporter, data10, SK_ARRAY_COUNT(data10), subset10, |
194 SK_ARRAY_COUNT(subset10), expectedSubset10); | 194 SK_ARRAY_COUNT(subset10), expectedSubset10); |
195 TestWData(reporter, data11, SK_ARRAY_COUNT(data11), NULL, 0, expected11); | 195 TestWData(reporter, data11, SK_ARRAY_COUNT(data11), nullptr, 0, expected11); |
196 TestWData(reporter, data11, SK_ARRAY_COUNT(data11), subset11, | 196 TestWData(reporter, data11, SK_ARRAY_COUNT(data11), subset11, |
197 SK_ARRAY_COUNT(subset11), expectedSubset11); | 197 SK_ARRAY_COUNT(subset11), expectedSubset11); |
198 TestWData(reporter, data12, SK_ARRAY_COUNT(data12), NULL, 0, expected12); | 198 TestWData(reporter, data12, SK_ARRAY_COUNT(data12), nullptr, 0, expected12); |
199 TestWData(reporter, data12, SK_ARRAY_COUNT(data12), subset12, | 199 TestWData(reporter, data12, SK_ARRAY_COUNT(data12), subset12, |
200 SK_ARRAY_COUNT(subset12), expectedSubset12); | 200 SK_ARRAY_COUNT(subset12), expectedSubset12); |
201 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), NULL, 0, expected13); | 201 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), nullptr, 0, expected13); |
202 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13, | 202 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13, |
203 SK_ARRAY_COUNT(subset13), expectedSubset13); | 203 SK_ARRAY_COUNT(subset13), expectedSubset13); |
204 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), NULL, 0, expected14); | 204 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), nullptr, 0, expected14); |
205 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14, | 205 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14, |
206 SK_ARRAY_COUNT(subset14), expectedSubset14); | 206 SK_ARRAY_COUNT(subset14), expectedSubset14); |
207 } | 207 } |
OLD | NEW |