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

Unified Diff: tests/RoundRectTest.cpp

Issue 921163003: fix more tricky-float cases in SkRRect validate (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« src/core/SkRRect.cpp ('K') | « src/core/SkRRect.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/RoundRectTest.cpp
diff --git a/tests/RoundRectTest.cpp b/tests/RoundRectTest.cpp
index b67718a6b1fa491463bc7a335980f797edcf9373..cff3e8f35ad5bc498390c2ddd992f97db2314549 100644
--- a/tests/RoundRectTest.cpp
+++ b/tests/RoundRectTest.cpp
@@ -9,6 +9,27 @@
#include "SkRRect.h"
#include "Test.h"
+static void test_tricky_radii_crbug_458522(skiatest::Reporter* reporter) {
+ SkRRect rr;
+ const SkRect bounds = { 3709, 3709, 3709 + 7402, 3709 + 29825 };
+ const SkScalar rad = 12814;
+ const SkVector vec[] = { { rad, rad }, { 0, rad }, { rad, rad }, { 0, rad } };
+ rr.setRectRadii(bounds, vec);
+}
+
+static void test_empty_crbug_458524(skiatest::Reporter* reporter) {
+ SkRRect rr;
+ const SkRect bounds = { 3709, 3709, 3709 + 7402, 3709 + 29825 };
+ const SkScalar rad = 40;
+ rr.setRectXY(bounds, rad, rad);
+
+ SkRRect other;
+ SkMatrix matrix;
+ matrix.setScale(0, 1);
+ rr.transform(matrix, &other);
+ REPORTER_ASSERT(reporter, SkRRect::kEmpty_Type == other.getType());
+}
+
static const SkScalar kWidth = 100.0f;
static const SkScalar kHeight = 100.0f;
@@ -621,4 +642,6 @@ DEF_TEST(RoundRect, reporter) {
test_round_rect_contains_rect(reporter);
test_round_rect_transform(reporter);
test_issue_2696(reporter);
+ test_tricky_radii_crbug_458522(reporter);
+ test_empty_crbug_458524(reporter);
}
« src/core/SkRRect.cpp ('K') | « src/core/SkRRect.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698