OLD | NEW |
---|---|
(Empty) | |
1 #include "Test.h" | |
2 | |
3 #include "SkDashPathEffect.h" | |
4 #include "SkWriteBuffer.h" | |
5 | |
6 #define ASSERT(x) REPORTER_ASSERT(r, x) | |
7 | |
8 // crbug.com/348821 was rooted in SkDashPathEffect refusing to flatten and unfla tten itself when | |
9 // fInitialDashLength < 0 (a signal the effect is nonsense). Here we test that it flattens. | |
10 | |
11 DEF_TEST(DashPathEffectTest_crbug_348821, r) { | |
12 SkScalar intervals[] = { 1.76934361e+36f, 2.80259693e-45f }; // Values from bug. | |
13 const int count = 2; | |
reed1
2014/03/07 14:52:59
I *thought* the bug was triggered by count < 0 ...
mtklein
2014/03/07 15:00:10
Nope. This is the path effect:
(gdb) p *this
$1
| |
14 SkScalar phase = 1.0f/0.0f; // Used to force the bad fInitialDashLength = - 1 path. | |
reed1
2014/03/07 14:52:59
you may get compiler warnings about this construct
mtklein
2014/03/07 15:00:10
Duh, right. Done.
| |
15 SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, coun t, phase)); | |
16 | |
17 ASSERT(dash->getFactory() != NULL); // NULL -> refuses to work with flatten ing framework. | |
18 | |
19 SkWriteBuffer buffer; | |
20 buffer.writeFlattenable(dash); | |
21 ASSERT(buffer.bytesWritten() > 12); // We'd write 12 if broken, >=40 if not . | |
22 } | |
OLD | NEW |