OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |