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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 static bool getAdvance(void* tc, int gId, int16_t* advance) { | 158 static bool getAdvance(void* tc, int gId, int16_t* advance) { |
159 TestWData* testCase = (TestWData*)tc; | 159 TestWData* testCase = (TestWData*)tc; |
160 if (gId >= 0 && gId < testCase->fAdvancesLen) { | 160 if (gId >= 0 && gId < testCase->fAdvancesLen) { |
161 *advance = testCase->fAdvances[gId]; | 161 *advance = testCase->fAdvances[gId]; |
162 return true; | 162 return true; |
163 } | 163 } |
164 return false; | 164 return false; |
165 } | 165 } |
166 | 166 |
167 bool RunTest() { | 167 bool RunTest() { |
168 SkTScopedPtr<SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t> > result; | 168 SkAutoTDelete<SkAdvancedTypefaceMetrics::AdvanceMetric<int16_t> > result
; |
169 result.reset(getAdvanceData((void*)this, fAdvancesLen, fSubset, fSubsetL
en, getAdvance)); | 169 result.reset(getAdvanceData((void*)this, fAdvancesLen, fSubset, fSubsetL
en, getAdvance)); |
170 | 170 |
171 SkString stringResult = stringify_advance_data(result.get()); | 171 SkString stringResult = stringify_advance_data(result.get()); |
172 if (!stringResult.equals(fExpected)) { | 172 if (!stringResult.equals(fExpected)) { |
173 printf("Expected: %s\n Result: %s\n", fExpected, stringResult.c_str
()); | 173 printf("Expected: %s\n Result: %s\n", fExpected, stringResult.c_str
()); |
174 return false; | 174 return false; |
175 } | 175 } |
176 return true; | 176 return true; |
177 } | 177 } |
178 }; | 178 }; |
(...skipping 26 matching lines...) Expand all Loading... |
205 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), NULL, 0, expected13); | 205 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), NULL, 0, expected13); |
206 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13, | 206 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13, |
207 SK_ARRAY_COUNT(subset13), expectedSubset13); | 207 SK_ARRAY_COUNT(subset13), expectedSubset13); |
208 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), NULL, 0, expected14); | 208 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), NULL, 0, expected14); |
209 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14, | 209 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14, |
210 SK_ARRAY_COUNT(subset14), expectedSubset14); | 210 SK_ARRAY_COUNT(subset14), expectedSubset14); |
211 } | 211 } |
212 | 212 |
213 #include "TestClassDef.h" | 213 #include "TestClassDef.h" |
214 DEFINE_TESTCLASS("WArray", WArrayTest, TestWArray) | 214 DEFINE_TESTCLASS("WArray", WArrayTest, TestWArray) |
OLD | NEW |