diff options
author | reed <reed@google.com> | 2015-03-13 08:48:26 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-03-13 08:48:27 -0700 |
commit | c1b11f1db69bea8d64ebf656ae92ea9ec6dbb40f (patch) | |
tree | 4a35f5ca94bb701f4c203f81b755c4d76f105958 /tests | |
parent | f7076a13e2d4269903b34ef2780e1c84723e4477 (diff) |
Handle paths that do not report empty, but have no edges.
patch from issue 999963005 at patchset 1 (http://crrev.com/999963005#ps1)
BUG=skia:3527
Review URL: https://codereview.chromium.org/1008883002
Diffstat (limited to 'tests')
-rw-r--r-- | tests/CanvasTest.cpp | 16 | ||||
-rw-r--r-- | tests/RegionTest.cpp | 8 |
2 files changed, 24 insertions, 0 deletions
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp index 98cfbc158d..23d49834c2 100644 --- a/tests/CanvasTest.cpp +++ b/tests/CanvasTest.cpp @@ -747,3 +747,19 @@ DEF_TEST(Canvas_SaveState, reporter) { canvas.restore(); REPORTER_ASSERT(reporter, 1 == canvas.getSaveCount()); } + +DEF_TEST(Canvas_ClipEmptyPath, reporter) { + SkCanvas canvas(10, 10); + canvas.save(); + SkPath path; + canvas.clipPath(path); + canvas.restore(); + canvas.save(); + path.moveTo(5, 5); + canvas.clipPath(path); + canvas.restore(); + canvas.save(); + path.moveTo(7, 7); + canvas.clipPath(path); // should not assert here + canvas.restore(); +} diff --git a/tests/RegionTest.cpp b/tests/RegionTest.cpp index ae58ae6e2e..acb81809de 100644 --- a/tests/RegionTest.cpp +++ b/tests/RegionTest.cpp @@ -5,6 +5,7 @@ * found in the LICENSE file. */ +#include "SkPath.h" #include "SkRandom.h" #include "SkRegion.h" #include "Test.h" @@ -91,6 +92,13 @@ static void test_empties(skiatest::Reporter* reporter) { REPORTER_ASSERT(reporter, !empty.contains(empty2)); REPORTER_ASSERT(reporter, !valid.contains(empty)); REPORTER_ASSERT(reporter, !empty.contains(valid)); + + SkPath emptyPath; + emptyPath.moveTo(1, 5); + emptyPath.close(); + SkRegion openClip; + openClip.setRect(-16000, -16000, 16000, 16000); + empty.setPath(emptyPath, openClip); // should not assert } enum { |