diff options
author | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-15 15:35:29 +0000 |
---|---|---|
committer | reed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-10-15 15:35:29 +0000 |
commit | cc8be77bc2371bba2ebb43102fa7a5ebc098a856 (patch) | |
tree | 46822325b9a6279fa51fdaeb11c5bc9fdfea2641 /tests | |
parent | 33e88b7b93e3b5282b205359368990d3f8b3fd04 (diff) |
add test for https://code.google.com/p/skia/issues/detail?id=1706
BUG=
Review URL: https://codereview.chromium.org/27344002
git-svn-id: http://skia.googlecode.com/svn/trunk@11774 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests')
-rw-r--r-- | tests/PathTest.cpp | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp index cd54a60054..23ed6eb453 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" |