aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/PathTest.cpp
diff options
context:
space:
mode:
authorGravatar Cary Clark <caryclark@skia.org>2018-04-12 14:00:24 -0400
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-04-12 20:45:32 +0000
commit88ba9710b5e93a3a2e15e205f6979d245e76a127 (patch)
tree19f669565d257c7cb8f2544d12ac7e51e027f0d8 /tests/PathTest.cpp
parentb809efbbfae3efc1f5940a34f36cb07bf46166c5 (diff)
son of path is rect bug
This variation tricks SkPath::isRect by exploiting that the implementation resets the point pointer to process the close verb, and using the reset pointer to walk over a series of points that don't move. In addition to fixing this, rename variables to make the line creation more obvious, since left, right, and friends, are not the left and right. R=robertphillips@google.com Bug: 824145,skia:7792 Change-Id: If8ebbc3eedd270652670d6e111a5bc02e61f0eec Reviewed-on: https://skia-review.googlesource.com/121122 Reviewed-by: Robert Phillips <robertphillips@google.com> Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'tests/PathTest.cpp')
-rw-r--r--tests/PathTest.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 4d250283cf..b96b93ccfe 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -4977,4 +4977,13 @@ DEF_TEST(Path_isRect, reporter) {
SkPoint points17[] = { {75, 10}, {75, 75}, {150, 75}, {150, 150}, {75, 150}, {75, 10} };
path = makePath(points17, SK_ARRAY_COUNT(points17), true);
REPORTER_ASSERT(reporter, !path.isRect(&rect, nullptr, nullptr));
+ // isolated from skbug.com/7792 comment 19
+ SkPath::Verb verbs19[] = { SkPath::kMove_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
+ SkPath::kLine_Verb, SkPath::kLine_Verb, SkPath::kLine_Verb,
+ SkPath::kLine_Verb, SkPath::kClose_Verb, SkPath::kMove_Verb,
+ SkPath::kLine_Verb, SkPath::kLine_Verb };
+ SkPoint points19[] = { {75, 75}, {75, 75}, {75, 75}, {75, 75}, {150, 75}, {150, 150},
+ {75, 150}, {10, 10}, {30, 10}, {10, 30} };
+ path = makePath2(points19, verbs19, SK_ARRAY_COUNT(verbs19));
+ REPORTER_ASSERT(reporter, !path.isRect(&rect, nullptr, nullptr));
}