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

Unified Diff: tests/PathOpsTightBoundsTest.cpp

Issue 2394443004: tight bounds optimization (Closed)
Patch Set: fix reversed boolean logic Created 4 years, 2 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
« no previous file with comments | « src/pathops/SkPathOpsTightBounds.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/PathOpsTightBoundsTest.cpp
diff --git a/tests/PathOpsTightBoundsTest.cpp b/tests/PathOpsTightBoundsTest.cpp
index 953756170bd0ea9490e0de8aa044f10ee2ce0fe2..8fd0fdb453c658b60eb133231c2a85248af715a7 100644
--- a/tests/PathOpsTightBoundsTest.cpp
+++ b/tests/PathOpsTightBoundsTest.cpp
@@ -120,3 +120,71 @@ DEF_TEST(PathOpsTightBoundsQuads, reporter) {
}
testRunner.render();
}
+
+DEF_TEST(PathOpsTightBoundsMove, reporter) {
+ SkPath path;
+ path.moveTo(10, 10);
+ path.close();
+ path.moveTo(20, 20);
+ path.lineTo(20, 20);
+ path.close();
+ path.moveTo(15, 15);
+ path.lineTo(15, 15);
+ path.close();
+ const SkRect& bounds = path.getBounds();
+ SkRect tight;
+ REPORTER_ASSERT(reporter, TightBounds(path, &tight));
+ REPORTER_ASSERT(reporter, bounds == tight);
+}
+
+DEF_TEST(PathOpsTightBoundsMoveOne, reporter) {
+ SkPath path;
+ path.moveTo(20, 20);
+ const SkRect& bounds = path.getBounds();
+ SkRect tight;
+ REPORTER_ASSERT(reporter, TightBounds(path, &tight));
+ REPORTER_ASSERT(reporter, bounds == tight);
+}
+
+DEF_TEST(PathOpsTightBoundsMoveTwo, reporter) {
+ SkPath path;
+ path.moveTo(20, 20);
+ path.moveTo(40, 40);
+ const SkRect& bounds = path.getBounds();
+ SkRect tight;
+ REPORTER_ASSERT(reporter, TightBounds(path, &tight));
+ REPORTER_ASSERT(reporter, bounds == tight);
+}
+
+DEF_TEST(PathOpsTightBoundsTiny, reporter) {
+ SkPath path;
+ path.moveTo(1, 1);
+ path.quadTo(1.000001f, 1, 1, 1);
+ const SkRect& bounds = path.getBounds();
+ SkRect tight;
+ REPORTER_ASSERT(reporter, TightBounds(path, &tight));
+ SkRect moveBounds = {1, 1, 1, 1};
+ REPORTER_ASSERT(reporter, bounds != tight);
+ REPORTER_ASSERT(reporter, moveBounds == tight);
+}
+
+DEF_TEST(PathOpsTightBoundsWellBehaved, reporter) {
+ SkPath path;
+ path.moveTo(1, 1);
+ path.quadTo(2, 3, 4, 5);
+ const SkRect& bounds = path.getBounds();
+ SkRect tight;
+ REPORTER_ASSERT(reporter, TightBounds(path, &tight));
+ REPORTER_ASSERT(reporter, bounds == tight);
+}
+
+DEF_TEST(PathOpsTightBoundsIllBehaved, reporter) {
+ SkPath path;
+ path.moveTo(1, 1);
+ path.quadTo(4, 3, 2, 2);
+ const SkRect& bounds = path.getBounds();
+ SkRect tight;
+ REPORTER_ASSERT(reporter, TightBounds(path, &tight));
+ REPORTER_ASSERT(reporter, bounds != tight);
+}
+
« no previous file with comments | « src/pathops/SkPathOpsTightBounds.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698