OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "Test.h" | 8 #include "Test.h" |
9 | 9 |
10 #include "SkDashPathEffect.h" | 10 #include "SkDashPathEffect.h" |
11 #include "SkWriteBuffer.h" | 11 #include "SkWriteBuffer.h" |
| 12 #include "SkStrokeRec.h" |
12 | 13 |
13 // crbug.com/348821 was rooted in SkDashPathEffect refusing to flatten and unfla
tten itself when | 14 // crbug.com/348821 was rooted in SkDashPathEffect refusing to flatten and unfla
tten itself when |
14 // fInitialDashLength < 0 (a signal the effect is nonsense). Here we test that
it flattens. | 15 // fInitialDashLength < 0 (a signal the effect is nonsense). Here we test that
it flattens. |
15 | 16 |
16 DEF_TEST(DashPathEffectTest_crbug_348821, r) { | 17 DEF_TEST(DashPathEffectTest_crbug_348821, r) { |
17 SkScalar intervals[] = { 1.76934361e+36f, 2.80259693e-45f }; // Values from
bug. | 18 SkScalar intervals[] = { 1.76934361e+36f, 2.80259693e-45f }; // Values from
bug. |
18 const int count = 2; | 19 const int count = 2; |
19 SkScalar phase = SK_ScalarInfinity; // Used to force the bad fInitialDashLe
ngth = -1 path. | 20 SkScalar phase = SK_ScalarInfinity; // Used to force the bad fInitialDashLe
ngth = -1 path. |
20 SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, coun
t, phase)); | 21 SkAutoTUnref<SkDashPathEffect> dash(SkDashPathEffect::Create(intervals, coun
t, phase)); |
21 | 22 |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 if (i < 2) { | 80 if (i < 2) { |
80 REPORTER_ASSERT(r, actualResult == testCases[j].fExpectedRes
ult); | 81 REPORTER_ASSERT(r, actualResult == testCases[j].fExpectedRes
ult); |
81 } else { | 82 } else { |
82 // On the third pass all the lines should be outside the tra
nslated cull rect | 83 // On the third pass all the lines should be outside the tra
nslated cull rect |
83 REPORTER_ASSERT(r, !actualResult); | 84 REPORTER_ASSERT(r, !actualResult); |
84 } | 85 } |
85 } | 86 } |
86 } | 87 } |
87 } | 88 } |
88 } | 89 } |
OLD | NEW |