Index: tests/DashPathEffectTest.cpp |
diff --git a/tests/DashPathEffectTest.cpp b/tests/DashPathEffectTest.cpp |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3c39f21d960b58f727a622d7afcf76a808b22ef5 |
--- /dev/null |
+++ b/tests/DashPathEffectTest.cpp |
@@ -0,0 +1,22 @@ |
+#include "Test.h" |
+ |
+#include "SkDashPathEffect.h" |
+#include "SkWriteBuffer.h" |
+ |
+#define ASSERT(x) REPORTER_ASSERT(r, x) |
reed1
2014/03/18 14:33:06
Hmm, I find this confusing at the call-sites, as y
|
+ |
+// 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)); |
+ |
+ ASSERT(dash->getFactory() != NULL); // NULL -> refuses to work with flattening framework. |
+ |
+ SkWriteBuffer buffer; |
+ buffer.writeFlattenable(dash); |
+ ASSERT(buffer.bytesWritten() > 12); // We'd write 12 if broken, >=40 if not. |
+} |