Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(676)

Unified Diff: tests/DashPathEffectTest.cpp

Issue 1808303004: Revert of allow one zero length dash (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/utils/SkDashPathPriv.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/DashPathEffectTest.cpp
diff --git a/tests/DashPathEffectTest.cpp b/tests/DashPathEffectTest.cpp
index fa2395ef7585668258374dbea51b08ed3772df36..68fce9a142504bb9b5748674b7805756ad0d466f 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.
« no previous file with comments | « src/utils/SkDashPathPriv.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698