aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2015-09-09 13:20:49 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-09-09 13:20:49 -0700
commit6651a3238dd6affa4276ada42ab613abf1d42d1d (patch)
treeadd6859c39d7ec8091b4d23ab18e900f7fef2137 /tests
parent809e5afdd95962465a51e3dbab707abf9d594fab (diff)
Reland of more zero-length changes for svg compatibility (patchset #1 id:1 of https://codereview.chromium.org/1334543002/ )
Reason for revert: DEPS should be fixed now Original issue's description: > Revert of more zero-length changes for svg compatibility (patchset #6 id:100001 of https://codereview.chromium.org/1330623003/ ) > > Reason for revert: > breaks DEPS > > Original issue's description: > > more zero-length changes for svg compatibility > > > > If a path contains a moveTo followed by a line or curve, > > even if the line or curve has no length, SVG expects > > the end caps to draw if the cap style is round or square. > > > > Fredrik Söderquist attached a patch to the chrome bug > > (slightly modified here) that fixes layout test failures > > resulting from deleting special-case code in SVG > > dealing with zero-length path segments. > > > > R=reed@google.com,fs@opera.com > > BUG=22974 > > > > Committed: https://skia.googlesource.com/skia/+/62fb1ba1786863e545c89839b5706ad5151cec15 > > TBR=fs@opera.com,reed@google.com > NOPRESUBMIT=true > NOTREECHECKS=true > NOTRY=true > BUG=22974 > > Committed: https://skia.googlesource.com/skia/+/5ca4fa3846067a47e88d35ace895df3ebe3ec2a5 TBR=fs@opera.com,reed@google.com NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=22974 Review URL: https://codereview.chromium.org/1314833004
Diffstat (limited to 'tests')
-rw-r--r--tests/EmptyPathTest.cpp19
1 files changed, 17 insertions, 2 deletions
diff --git a/tests/EmptyPathTest.cpp b/tests/EmptyPathTest.cpp
index c4f011a0dc..060ef8d237 100644
--- a/tests/EmptyPathTest.cpp
+++ b/tests/EmptyPathTest.cpp
@@ -54,7 +54,13 @@ static void drawAndTest(skiatest::Reporter* reporter, const SkPath& path,
}
}
-static void iter_paint(skiatest::Reporter* reporter, const SkPath& path, bool shouldDraw) {
+enum DrawCaps {
+ kDontDrawCaps,
+ kDrawCaps
+};
+
+static void iter_paint(skiatest::Reporter* reporter, const SkPath& path, bool shouldDraw,
+ DrawCaps drawCaps) {
static const SkPaint::Cap gCaps[] = {
SkPaint::kButt_Cap,
SkPaint::kRound_Cap,
@@ -73,6 +79,11 @@ static void iter_paint(skiatest::Reporter* reporter, const SkPath& path, bool sh
for (size_t cap = 0; cap < SK_ARRAY_COUNT(gCaps); ++cap) {
for (size_t join = 0; join < SK_ARRAY_COUNT(gJoins); ++join) {
for (size_t style = 0; style < SK_ARRAY_COUNT(gStyles); ++style) {
+ if (drawCaps && SkPaint::kButt_Cap != gCaps[cap]
+ && SkPaint::kFill_Style != gStyles[style]) {
+ continue;
+ }
+
SkPaint paint;
paint.setStrokeWidth(SkIntToScalar(10));
@@ -127,10 +138,14 @@ static void test_emptydrawing(skiatest::Reporter* reporter) {
if (doClose) {
path.close();
}
+ /* zero length segments and close following moves draw round and square caps */
+ bool allowCaps = make_L == gMakeProc[i] || make_Q == gMakeProc[i]
+ || make_C == gMakeProc[i] || make_MZM == gMakeProc[i];
+ allowCaps |= SkToBool(doClose);
for (size_t fill = 0; fill < SK_ARRAY_COUNT(gFills); ++fill) {
path.setFillType(gFills[fill]);
bool shouldDraw = path.isInverseFillType();
- iter_paint(reporter, path, shouldDraw);
+ iter_paint(reporter, path, shouldDraw, allowCaps ? kDrawCaps : kDontDrawCaps);
}
}
}