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

Unified Diff: tests/PathTest.cpp

Issue 60203002: use quads for mixed radius rrects (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: remove float slop; add test Created 7 years, 1 month 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/SkPath.cpp ('K') | « src/core/SkPath.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathTest.cpp
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index f6c2a7ae6e231681c32cc91a1256ecaf79fc59e9..2dbf5c695e99039d9ef9d05619011afa9d0a7549 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -14,6 +14,7 @@
#include "SkPathEffect.h"
#include "SkRandom.h"
#include "SkReader32.h"
+#include "SkRRect.h"
#include "SkSize.h"
#include "SkSurface.h"
#include "SkTypes.h"
@@ -2572,6 +2573,33 @@ static void test_empty(skiatest::Reporter* reporter, const SkPath& p) {
REPORTER_ASSERT(reporter, !(p != empty));
}
+static void test_rrect_is_convex(skiatest::Reporter* reporter, SkPath* path) {
+ REPORTER_ASSERT(reporter, path->isConvex());
+ path->setConvexity(SkPath::kUnknown_Convexity);
+ REPORTER_ASSERT(reporter, path->isConvex());
+ path->reset();
+}
+
+static void test_rrect(skiatest::Reporter* reporter) {
+ SkPath p;
+ SkRRect rr;
+ SkVector radii[] = {{1, 2}, {3, 4}, {5, 6}, {7, 8}};
+ SkRect r = {10, 20, 30, 40};
+ rr.setRectRadii(r, radii);
+ p.addRRect(rr);
+ test_rrect_is_convex(reporter, &p);
+ p.addRRect(rr, SkPath::kCCW_Direction);
+ test_rrect_is_convex(reporter, &p);
+ p.addRoundRect(r, &radii[0].fX);
+ test_rrect_is_convex(reporter, &p);
+ p.addRoundRect(r, &radii[0].fX, SkPath::kCCW_Direction);
+ test_rrect_is_convex(reporter, &p);
+ p.addRoundRect(r, radii[1].fX, radii[1].fY);
+ test_rrect_is_convex(reporter, &p);
+ p.addRoundRect(r, radii[1].fX, radii[1].fY, SkPath::kCCW_Direction);
+ test_rrect_is_convex(reporter, &p);
+}
+
static void TestPath(skiatest::Reporter* reporter) {
SkTSize<SkScalar>::Make(3,4);
@@ -2673,6 +2701,7 @@ static void TestPath(skiatest::Reporter* reporter) {
test_gen_id(reporter);
test_path_close_issue1474(reporter);
test_path_to_region(reporter);
+ test_rrect(reporter);
}
#include "TestClassDef.h"
« src/core/SkPath.cpp ('K') | « src/core/SkPath.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698