aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/DashPathEffectTest.cpp
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-03-18 05:10:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-03-18 05:10:23 -0700
commit6f0749cfc7f93880bd6b8acfdc61900cda4a81fe (patch)
tree0fb054893ced56e90a8baf02400744b45a5b2321 /tests/DashPathEffectTest.cpp
parent5e1a24808415df2748822e8082e21a361362cdfe (diff)
Revert of allow one zero length dash (patchset #8 id:140001 of https://codereview.chromium.org/1805963002/ )
Reason for revert: Causes the dash bench to crash. Example crash: https://build.chromium.org/p/client.skia/builders/Perf-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release/builds/5581/steps/nanobench/logs/stdio Original issue's description: > allow one zero length dash > > If the constructed stroke that represents a dash has a > single dash of length zero, and the end cap is square or > round, draw the cap. > > The old code initialized the initial dash length to zero, > making it ambiguous whether the first length is zero or > not. > > R=robertphillips@google.com > BUG=583299 > GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1805963002 > > Committed: https://skia.googlesource.com/skia/+/5e1a24808415df2748822e8082e21a361362cdfe TBR=robertphillips@google.com,reed@google.com,caryclark@google.com # Skipping CQ checks because original CL landed less than 1 days ago. NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=583299 Review URL: https://codereview.chromium.org/1808303004
Diffstat (limited to 'tests/DashPathEffectTest.cpp')
-rw-r--r--tests/DashPathEffectTest.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/DashPathEffectTest.cpp b/tests/DashPathEffectTest.cpp
index fa2395ef75..68fce9a142 100644
--- a/tests/DashPathEffectTest.cpp
+++ b/tests/DashPathEffectTest.cpp
@@ -12,15 +12,20 @@
#include "SkStrokeRec.h"
// crbug.com/348821 was rooted in SkDashPathEffect refusing to flatten and unflatten itself when
-// the effect is nonsense. Here we test that it fails when passed nonsense parameters.
+// fInitialDashLength < 0 (a signal the effect is nonsense). Here we test that it flattens.
DEF_TEST(DashPathEffectTest_crbug_348821, r) {
SkScalar intervals[] = { 1.76934361e+36f, 2.80259693e-45f }; // Values from bug.
const int count = 2;
- SkScalar phase = SK_ScalarInfinity; // Used to force a nonsense effect.
+ SkScalar phase = SK_ScalarInfinity; // Used to force the bad fInitialDashLength = -1 path.
SkAutoTUnref<SkPathEffect> dash(SkDashPathEffect::Create(intervals, count, phase));
- REPORTER_ASSERT(r, dash == nullptr);
+ // nullptr -> refuses to work with flattening framework.
+ REPORTER_ASSERT(r, dash->getFactory() != nullptr);
+
+ SkWriteBuffer buffer;
+ buffer.writeFlattenable(dash);
+ REPORTER_ASSERT(r, buffer.bytesWritten() > 12); // We'd write 12 if broken, >=40 if not.
}
// Test out the asPoint culling behavior.