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

Side by Side Diff: tests/ParsePathTest.cpp

Issue 1675053002: test parsepath (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: unused variable Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « src/utils/SkParsePath.cpp ('k') | tools/random_parse_path.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 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 "SkParsePath.h" 8 #include "SkParsePath.h"
9 #include "Test.h" 9 #include "Test.h"
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 test_to_from(reporter, p); 64 test_to_from(reporter, p);
65 } 65 }
66 66
67 DEF_TEST(ParsePath_invalid, r) { 67 DEF_TEST(ParsePath_invalid, r) {
68 SkPath path; 68 SkPath path;
69 // This is an invalid SVG string, but the test verifies that we do not 69 // This is an invalid SVG string, but the test verifies that we do not
70 // crash. 70 // crash.
71 bool success = SkParsePath::FromSVGString("M 5", &path); 71 bool success = SkParsePath::FromSVGString("M 5", &path);
72 REPORTER_ASSERT(r, !success); 72 REPORTER_ASSERT(r, !success);
73 } 73 }
74
75 #include "random_parse_path.h"
76 #include "SkRandom.h"
77
78 DEF_TEST(ParsePathRandom, r) {
79 SkRandom rand;
80 for (int index = 0; index < 1000; ++index) {
81 SkPath path, path2;
82 SkString spec;
83 uint32_t count = rand.nextRangeU(0, 10);
84 for (uint32_t i = 0; i < count; ++i) {
85 spec.append(MakeRandomParsePathPiece(&rand));
86 }
87 bool success = SkParsePath::FromSVGString(spec.c_str(), &path);
88 REPORTER_ASSERT(r, success);
89 }
90 }
OLDNEW
« no previous file with comments | « src/utils/SkParsePath.cpp ('k') | tools/random_parse_path.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698