Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: tests/GrShapeTest.cpp

Issue 1929643002: Detect empty (r)rects in GrShape. (Closed) Base URL: https://chromium.googlesource.com/skia.git@volatileshape
Patch Set: a->an Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/gpu/GrShape.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 an 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();
566 TestCase dashAndStrokeEmptyRectCase(emptyRect, dashAndStroke);
567 dashAndStrokeEmptyRectCase.compare(reporter, fillEmptyCase,
568 TestCase::kAllSame_ComparisonExpecation);
556 } 569 }
557 570
558 DEF_TEST(GrShape, reporter) { 571 DEF_TEST(GrShape, reporter) {
559 sk_sp<SkPathEffect> dashPE = make_dash(); 572 sk_sp<SkPathEffect> dashPE = make_dash();
560 573
561 for (auto rr : { SkRRect::MakeRect(SkRect::MakeWH(10, 10)), 574 for (auto rr : { SkRRect::MakeRect(SkRect::MakeWH(10, 10)),
562 SkRRect::MakeRectXY(SkRect::MakeWH(10, 10), 3, 4)}) { 575 SkRRect::MakeRectXY(SkRect::MakeWH(10, 10), 3, 4)}) {
563 test_basic(reporter, rr); 576 test_basic(reporter, rr);
564 test_dash_fill(reporter, rr); 577 test_dash_fill(reporter, rr);
565 test_null_dash(reporter, rr); 578 test_null_dash(reporter, rr);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 } 682 }
670 } 683 }
671 684
672 // Test a volatile empty path. 685 // Test a volatile empty path.
673 test_volatile_path(reporter, SkPath(), true); 686 test_volatile_path(reporter, SkPath(), true);
674 687
675 test_empty_shape(reporter); 688 test_empty_shape(reporter);
676 } 689 }
677 690
678 #endif 691 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrShape.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698