aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2014-08-28 14:04:55 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-08-28 14:04:55 -0700
commitb17c1291085e50819c0c46aae783067c30a67516 (patch)
tree4bb2b5b1de8db25b8a19ae27bc5ebaedbf8ae9b0 /tests
parent4e4b935d526f5720b3f15c4742eef84d49ebb984 (diff)
Add dirty_after_edit to SkPath::moveTo. Add commented out test case that triggers assert.
BUG=skia:1460 R=reed@google.com Author: bsalomon@google.com Review URL: https://codereview.chromium.org/517023003
Diffstat (limited to 'tests')
-rw-r--r--tests/PathTest.cpp29
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 0de64b06fe..57587c4a35 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -1504,7 +1504,19 @@ static void test_conservativelyContains(skiatest::Reporter* reporter) {
SkIntToScalar(20),
SkIntToScalar(5))));
- // same as above path and first test but with an extra moveTo.
+
+ // Test that multiple move commands do not cause asserts.
+
+ // At the time of writing, this would not modify cached convexity. This caused an assert while
+ // checking conservative containment again. http://skbug.com/1460
+ path.moveTo(SkIntToScalar(100), SkIntToScalar(100));
+#if 0
+ REPORTER_ASSERT(reporter, path.conservativelyContainsRect(SkRect::MakeXYWH(SkIntToScalar(50), 0,
+ SkIntToScalar(10),
+ SkIntToScalar(10))));
+#endif
+
+ // Same as above path and first test but with an extra moveTo.
path.reset();
path.moveTo(100, 100);
path.moveTo(0, 0);
@@ -1515,6 +1527,21 @@ static void test_conservativelyContains(skiatest::Reporter* reporter) {
SkIntToScalar(10),
SkIntToScalar(10))));
+ // Test that multiple move commands do not cause asserts and that the function
+ // is not confused by the multiple moves.
+ path.reset();
+ path.moveTo(0, 0);
+ path.lineTo(SkIntToScalar(100), 0);
+ path.lineTo(0, SkIntToScalar(100));
+ path.moveTo(0, SkIntToScalar(200));
+ path.lineTo(SkIntToScalar(100), SkIntToScalar(200));
+ path.lineTo(0, SkIntToScalar(300));
+
+ REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(
+ SkRect::MakeXYWH(SkIntToScalar(50), 0,
+ SkIntToScalar(10),
+ SkIntToScalar(10))));
+
path.reset();
path.lineTo(100, 100);
REPORTER_ASSERT(reporter, !path.conservativelyContainsRect(SkRect::MakeXYWH(0, 0, 1, 1)));