Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 <initializer_list> | 8 #include <initializer_list> |
| 9 #include <functional> | 9 #include <functional> |
| 10 #include "Test.h" | 10 #include "Test.h" |
| (...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 543 stroke.setStyle(SkPaint::kStroke_Style); | 543 stroke.setStyle(SkPaint::kStroke_Style); |
| 544 TestCase strokeEmptyCase(emptyPath2, stroke); | 544 TestCase strokeEmptyCase(emptyPath2, stroke); |
| 545 strokeEmptyCase.compare(reporter, fillEmptyCase, TestCase::kAllSame_Comparis onExpecation); | 545 strokeEmptyCase.compare(reporter, fillEmptyCase, TestCase::kAllSame_Comparis onExpecation); |
| 546 | 546 |
| 547 // Dashing and stroking an empty path should have no effect | 547 // Dashing and stroking an empty path should have no effect |
| 548 SkPath emptyPath3; | 548 SkPath emptyPath3; |
| 549 SkPaint dashAndStroke; | 549 SkPaint dashAndStroke; |
| 550 dashAndStroke.setPathEffect(make_dash()); | 550 dashAndStroke.setPathEffect(make_dash()); |
| 551 dashAndStroke.setStrokeWidth(2.f); | 551 dashAndStroke.setStrokeWidth(2.f); |
| 552 dashAndStroke.setStyle(SkPaint::kStroke_Style); | 552 dashAndStroke.setStyle(SkPaint::kStroke_Style); |
| 553 TestCase dashAndStrokeEmptyCase(emptyPath3, stroke); | 553 TestCase dashAndStrokeEmptyCase(emptyPath3, dashAndStroke); |
| 554 dashAndStrokeEmptyCase.compare(reporter, fillEmptyCase, | 554 dashAndStrokeEmptyCase.compare(reporter, fillEmptyCase, |
| 555 TestCase::kAllSame_ComparisonExpecation); | 555 TestCase::kAllSame_ComparisonExpecation); |
| 556 | |
| 557 // A shape made from a empty rrect should behave the same as an empty path. | |
| 558 SkRRect emptyRRect = SkRRect::MakeRect(SkRect::MakeEmpty()); | |
| 559 REPORTER_ASSERT(reporter, emptyRRect.getType() == SkRRect::kEmpty_Type); | |
| 560 TestCase dashAndStrokeEmptyRRectCase(emptyRRect, dashAndStroke); | |
| 561 dashAndStrokeEmptyRRectCase.compare(reporter, fillEmptyCase, | |
| 562 TestCase::kAllSame_ComparisonExpecation) ; | |
| 563 | |
| 564 // Same for a rect. | |
| 565 SkRect emptyRect = SkRect::MakeEmpty(); | |
|
robertphillips
2016/04/27 20:22:26
I don't think this check re emptyRRect is useful h
bsalomon
2016/04/27 20:26:46
Done.
| |
| 566 REPORTER_ASSERT(reporter, emptyRRect.getType() == SkRRect::kEmpty_Type); | |
| 567 TestCase dashAndStrokeEmptyRectCase(emptyRect, dashAndStroke); | |
| 568 dashAndStrokeEmptyRectCase.compare(reporter, fillEmptyCase, | |
| 569 TestCase::kAllSame_ComparisonExpecation); | |
| 556 } | 570 } |
| 557 | 571 |
| 558 DEF_TEST(GrShape, reporter) { | 572 DEF_TEST(GrShape, reporter) { |
| 559 sk_sp<SkPathEffect> dashPE = make_dash(); | 573 sk_sp<SkPathEffect> dashPE = make_dash(); |
| 560 | 574 |
| 561 for (auto rr : { SkRRect::MakeRect(SkRect::MakeWH(10, 10)), | 575 for (auto rr : { SkRRect::MakeRect(SkRect::MakeWH(10, 10)), |
| 562 SkRRect::MakeRectXY(SkRect::MakeWH(10, 10), 3, 4)}) { | 576 SkRRect::MakeRectXY(SkRect::MakeWH(10, 10), 3, 4)}) { |
| 563 test_basic(reporter, rr); | 577 test_basic(reporter, rr); |
| 564 test_dash_fill(reporter, rr); | 578 test_dash_fill(reporter, rr); |
| 565 test_null_dash(reporter, rr); | 579 test_null_dash(reporter, rr); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 669 } | 683 } |
| 670 } | 684 } |
| 671 | 685 |
| 672 // Test a volatile empty path. | 686 // Test a volatile empty path. |
| 673 test_volatile_path(reporter, SkPath(), true); | 687 test_volatile_path(reporter, SkPath(), true); |
| 674 | 688 |
| 675 test_empty_shape(reporter); | 689 test_empty_shape(reporter); |
| 676 } | 690 } |
| 677 | 691 |
| 678 #endif | 692 #endif |
| OLD | NEW |