| 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 #include "TestClassDef.h" |
| 9 | 10 |
| 10 // Include the implementation so we can make an appropriate template instance. | 11 // Include the implementation so we can make an appropriate template instance. |
| 11 #include "SkAdvancedTypefaceMetrics.h" | 12 #include "SkAdvancedTypefaceMetrics.h" |
| 12 | 13 |
| 13 using namespace skia_advanced_typeface_metrics_utils; | 14 using namespace skia_advanced_typeface_metrics_utils; |
| 14 | 15 |
| 15 // Negative values and zeros in a range plus trailing zeros. | 16 // Negative values and zeros in a range plus trailing zeros. |
| 16 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | 17 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
| 17 static const int16_t data1[] = {-1, 0, -3, 4, 5, 6, 7, 0, 0, 0, 8, 0, 0, 0, 0}; | 18 static const int16_t data1[] = {-1, 0, -3, 4, 5, 6, 7, 0, 0, 0, 8, 0, 0, 0, 0}; |
| 18 static const char* expected1 = "0[-1 0 -3 4 5 6 7 0 0 0 8]"; | 19 static const char* expected1 = "0[-1 0 -3 4 5 6 7 0 0 0 8]"; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 | 167 |
| 167 SkString stringResult = stringify_advance_data(result.get()); | 168 SkString stringResult = stringify_advance_data(result.get()); |
| 168 if (!stringResult.equals(fExpected)) { | 169 if (!stringResult.equals(fExpected)) { |
| 169 SkDebugf("Expected: %s\n Result: %s\n", fExpected, stringResult.c_s
tr()); | 170 SkDebugf("Expected: %s\n Result: %s\n", fExpected, stringResult.c_s
tr()); |
| 170 return false; | 171 return false; |
| 171 } | 172 } |
| 172 return true; | 173 return true; |
| 173 } | 174 } |
| 174 }; | 175 }; |
| 175 | 176 |
| 176 static void TestWArray(skiatest::Reporter* reporter) { | 177 DEF_TEST(WArray, reporter) { |
| 177 TestWData(reporter, data1, SK_ARRAY_COUNT(data1), NULL, 0, expected1); | 178 TestWData(reporter, data1, SK_ARRAY_COUNT(data1), NULL, 0, expected1); |
| 178 TestWData(reporter, data2, SK_ARRAY_COUNT(data2), NULL, 0, expected2); | 179 TestWData(reporter, data2, SK_ARRAY_COUNT(data2), NULL, 0, expected2); |
| 179 TestWData(reporter, data3, SK_ARRAY_COUNT(data3), NULL, 0, expected3); | 180 TestWData(reporter, data3, SK_ARRAY_COUNT(data3), NULL, 0, expected3); |
| 180 TestWData(reporter, data4, SK_ARRAY_COUNT(data4), NULL, 0, expected4); | 181 TestWData(reporter, data4, SK_ARRAY_COUNT(data4), NULL, 0, expected4); |
| 181 TestWData(reporter, data5, SK_ARRAY_COUNT(data5), NULL, 0, expected5); | 182 TestWData(reporter, data5, SK_ARRAY_COUNT(data5), NULL, 0, expected5); |
| 182 TestWData(reporter, data6, SK_ARRAY_COUNT(data6), NULL, 0, expected6); | 183 TestWData(reporter, data6, SK_ARRAY_COUNT(data6), NULL, 0, expected6); |
| 183 TestWData(reporter, data7, SK_ARRAY_COUNT(data7), NULL, 0, expected7); | 184 TestWData(reporter, data7, SK_ARRAY_COUNT(data7), NULL, 0, expected7); |
| 184 TestWData(reporter, data7, SK_ARRAY_COUNT(data7), subset7, | 185 TestWData(reporter, data7, SK_ARRAY_COUNT(data7), subset7, |
| 185 SK_ARRAY_COUNT(subset7), expectedSubset7); | 186 SK_ARRAY_COUNT(subset7), expectedSubset7); |
| 186 TestWData(reporter, data8, SK_ARRAY_COUNT(data8), NULL, 0, expected8); | 187 TestWData(reporter, data8, SK_ARRAY_COUNT(data8), NULL, 0, expected8); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 198 TestWData(reporter, data12, SK_ARRAY_COUNT(data12), NULL, 0, expected12); | 199 TestWData(reporter, data12, SK_ARRAY_COUNT(data12), NULL, 0, expected12); |
| 199 TestWData(reporter, data12, SK_ARRAY_COUNT(data12), subset12, | 200 TestWData(reporter, data12, SK_ARRAY_COUNT(data12), subset12, |
| 200 SK_ARRAY_COUNT(subset12), expectedSubset12); | 201 SK_ARRAY_COUNT(subset12), expectedSubset12); |
| 201 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), NULL, 0, expected13); | 202 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), NULL, 0, expected13); |
| 202 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13, | 203 TestWData(reporter, data13, SK_ARRAY_COUNT(data13), subset13, |
| 203 SK_ARRAY_COUNT(subset13), expectedSubset13); | 204 SK_ARRAY_COUNT(subset13), expectedSubset13); |
| 204 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), NULL, 0, expected14); | 205 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), NULL, 0, expected14); |
| 205 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14, | 206 TestWData(reporter, data14, SK_ARRAY_COUNT(data14), subset14, |
| 206 SK_ARRAY_COUNT(subset14), expectedSubset14); | 207 SK_ARRAY_COUNT(subset14), expectedSubset14); |
| 207 } | 208 } |
| 208 | |
| 209 #include "TestClassDef.h" | |
| 210 DEFINE_TESTCLASS("WArray", WArrayTest, TestWArray) | |
| OLD | NEW |