Index: tests/PathTest.cpp |
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp |
index 0de64b06febf5a145245bfa0a9f64eec0229a00e..57587c4a35f9258a74abbb67e24794667c3539cd 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))); |