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

Unified Diff: tests/PathTest.cpp

Issue 27344002: add test for https://code.google.com/p/skia/issues/detail?id=1706 (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 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 | « no previous file | 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 cd54a60054050cb0f73242b7c34f5ede50f28519..23ed6eb453c1fce5465278821d53b445579bf16d 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1,10 +1,10 @@
-
/*
* Copyright 2011 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
+
#include "Test.h"
#include "SkCanvas.h"
#include "SkPaint.h"
@@ -19,6 +19,50 @@
#include "SkTypes.h"
#include "SkWriter32.h"
+static void make_path0(SkPath* path) {
+ // from * https://code.google.com/p/skia/issues/detail?id=1706
+
+ path->moveTo(146.939f, 1012.84f);
+ path->lineTo(181.747f, 1009.18f);
+ path->lineTo(182.165f, 1013.16f);
+ path->lineTo(147.357f, 1016.82f);
+ path->lineTo(146.939f, 1012.84f);
+ path->close();
+}
+
+static void make_path1(SkPath* path) {
+ path->addRect(SkRect::MakeXYWH(10, 10, 10, 1));
+}
+
+typedef void (*PathProc)(SkPath*);
+
+/*
+ * Regression test: we used to crash (overwrite internal storage) during
+ * construction of the region when the path was INVERSE. That is now fixed,
+ * so test these regions (which used to assert/crash).
+ *
+ * https://code.google.com/p/skia/issues/detail?id=1706
+ */
+static void test_path_to_region(skiatest::Reporter* reporter) {
+ PathProc procs[] = {
+ make_path0,
+ make_path1,
+ };
+
+ SkRegion clip;
+ clip.setRect(0, 0, 1255, 1925);
+
+ for (size_t i = 0; i < SK_ARRAY_COUNT(procs); ++i) {
+ SkPath path;
+ procs[i](&path);
+
+ SkRegion rgn;
+ rgn.setPath(path, clip);
+ path.toggleInverseFillType();
+ rgn.setPath(path, clip);
+ }
+}
+
#if defined(WIN32)
#define SUPPRESS_VISIBILITY_WARNING
#else
@@ -2555,6 +2599,10 @@ static void TestPath(skiatest::Reporter* reporter) {
test_bad_cubic_crbug234190();
test_android_specific_behavior(reporter);
test_path_close_issue1474(reporter);
+
+ if (true) { // will remove when fix lands
+ test_path_to_region(reporter);
+ }
}
#include "TestClassDef.h"
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698