aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/ParsePathTest.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2016-02-09 10:30:22 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2016-02-09 10:30:22 -0800
commitf1d415188ffb4c34e2886c2cfceb363a148333f1 (patch)
tree07cbfee906d827a1f4731d68812c45d46ea78c29 /tests/ParsePathTest.cpp
parent719c48050127b2a18793bbcfa0dc49c2df5f080a (diff)
Add unit test to feed valid SVG sequences to make sure that
path strings can be parsed without returning an error. Draw the output through Skia and SVG to make sure they are parsed correctly. R=fmalita@chromium.org BUG=skia:4549 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1675053002 Review URL: https://codereview.chromium.org/1675053002
Diffstat (limited to 'tests/ParsePathTest.cpp')
-rw-r--r--tests/ParsePathTest.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/ParsePathTest.cpp b/tests/ParsePathTest.cpp
index 561eed04b5..fa239c2b3d 100644
--- a/tests/ParsePathTest.cpp
+++ b/tests/ParsePathTest.cpp
@@ -71,3 +71,20 @@ DEF_TEST(ParsePath_invalid, r) {
bool success = SkParsePath::FromSVGString("M 5", &path);
REPORTER_ASSERT(r, !success);
}
+
+#include "random_parse_path.h"
+#include "SkRandom.h"
+
+DEF_TEST(ParsePathRandom, r) {
+ SkRandom rand;
+ for (int index = 0; index < 1000; ++index) {
+ SkPath path, path2;
+ SkString spec;
+ uint32_t count = rand.nextRangeU(0, 10);
+ for (uint32_t i = 0; i < count; ++i) {
+ spec.append(MakeRandomParsePathPiece(&rand));
+ }
+ bool success = SkParsePath::FromSVGString(spec.c_str(), &path);
+ REPORTER_ASSERT(r, success);
+ }
+}