aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/DashPathEffectTest.cpp
diff options
context:
space:
mode:
authorGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-18 17:38:34 +0000
committerGravatar commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>2014-03-18 17:38:34 +0000
commitaf5346a39cf2412eeb2da7339a51e44ae68dd677 (patch)
treec4b4e9a76d9c1399e196f3aad0cb14b3dd9858e1 /tests/DashPathEffectTest.cpp
parente5957f67d00c04c0fbf88809df510426e74fe40a (diff)
Add reg test for http://crbug.com/348821
BUG=348821 R=reed@google.com, mtklein@google.com Author: mtklein@chromium.org Review URL: https://codereview.chromium.org/189373008 git-svn-id: http://skia.googlecode.com/svn/trunk@13852 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'tests/DashPathEffectTest.cpp')
-rw-r--r--tests/DashPathEffectTest.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/DashPathEffectTest.cpp b/tests/DashPathEffectTest.cpp
new file mode 100644
index 0000000000..1e53058de8
--- /dev/null
+++ b/tests/DashPathEffectTest.cpp
@@ -0,0 +1,21 @@
+#include "Test.h"
+
+#include "SkDashPathEffect.h"
+#include "SkWriteBuffer.h"
+
+// crbug.com/348821 was rooted in SkDashPathEffect refusing to flatten and unflatten itself when
+// 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 the bad fInitialDashLength = -1 path.
+ SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, count, phase));
+
+ // NULL -> refuses to work with flattening framework.
+ REPORTER_ASSERT(r, dash->getFactory() != NULL);
+
+ SkWriteBuffer buffer;
+ buffer.writeFlattenable(dash);
+ REPORTER_ASSERT(r, buffer.bytesWritten() > 12); // We'd write 12 if broken, >=40 if not.
+}