| 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkPaint.h" | 9 #include "SkPaint.h" |
| 10 #include "SkParse.h" | 10 #include "SkParse.h" |
| (...skipping 3417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3428 a.lineTo(1, 2); | 3428 a.lineTo(1, 2); |
| 3429 REPORTER_ASSERT(reporter, a == b); | 3429 REPORTER_ASSERT(reporter, a == b); |
| 3430 } | 3430 } |
| 3431 | 3431 |
| 3432 static void compare_dump(skiatest::Reporter* reporter, const SkPath& path, bool
force, | 3432 static void compare_dump(skiatest::Reporter* reporter, const SkPath& path, bool
force, |
| 3433 bool dumpAsHex, const char* str) { | 3433 bool dumpAsHex, const char* str) { |
| 3434 SkDynamicMemoryWStream wStream; | 3434 SkDynamicMemoryWStream wStream; |
| 3435 path.dump(&wStream, force, dumpAsHex); | 3435 path.dump(&wStream, force, dumpAsHex); |
| 3436 SkAutoDataUnref data(wStream.copyToData()); | 3436 SkAutoDataUnref data(wStream.copyToData()); |
| 3437 REPORTER_ASSERT(reporter, data->size() == strlen(str)); | 3437 REPORTER_ASSERT(reporter, data->size() == strlen(str)); |
| 3438 REPORTER_ASSERT(reporter, !memcmp(data->data(), str, strlen(str))); | 3438 if (strlen(str) > 0) { |
| 3439 REPORTER_ASSERT(reporter, !memcmp(data->data(), str, strlen(str))); |
| 3440 } else { |
| 3441 REPORTER_ASSERT(reporter, data->data() == NULL || !memcmp(data->data(),
str, strlen(str))); |
| 3442 } |
| 3439 } | 3443 } |
| 3440 | 3444 |
| 3441 static void test_dump(skiatest::Reporter* reporter) { | 3445 static void test_dump(skiatest::Reporter* reporter) { |
| 3442 SkPath p; | 3446 SkPath p; |
| 3443 compare_dump(reporter, p, false, false, ""); | 3447 compare_dump(reporter, p, false, false, ""); |
| 3444 compare_dump(reporter, p, true, false, ""); | 3448 compare_dump(reporter, p, true, false, ""); |
| 3445 p.moveTo(1, 2); | 3449 p.moveTo(1, 2); |
| 3446 p.lineTo(3, 4); | 3450 p.lineTo(3, 4); |
| 3447 compare_dump(reporter, p, false, false, "path.moveTo(1, 2);\n" | 3451 compare_dump(reporter, p, false, false, "path.moveTo(1, 2);\n" |
| 3448 "path.lineTo(3, 4);\n"); | 3452 "path.lineTo(3, 4);\n"); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3623 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); | 3627 test_addEmptyPath(reporter, SkPath::kExtend_AddPathMode); |
| 3624 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); | 3628 test_addEmptyPath(reporter, SkPath::kAppend_AddPathMode); |
| 3625 test_conicTo_special_case(reporter); | 3629 test_conicTo_special_case(reporter); |
| 3626 test_get_point(reporter); | 3630 test_get_point(reporter); |
| 3627 test_contains(reporter); | 3631 test_contains(reporter); |
| 3628 PathTest_Private::TestPathTo(reporter); | 3632 PathTest_Private::TestPathTo(reporter); |
| 3629 PathRefTest_Private::TestPathRef(reporter); | 3633 PathRefTest_Private::TestPathRef(reporter); |
| 3630 test_dump(reporter); | 3634 test_dump(reporter); |
| 3631 test_path_crbugskia2820(reporter); | 3635 test_path_crbugskia2820(reporter); |
| 3632 } | 3636 } |
| OLD | NEW |