| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/svg/SVGPathParser.h" | 5 #include "core/svg/SVGPathParser.h" |
| 6 | 6 |
| 7 #include "core/svg/SVGPathStringBuilder.h" | 7 #include "core/svg/SVGPathStringBuilder.h" |
| 8 #include "core/svg/SVGPathStringSource.h" | 8 #include "core/svg/SVGPathStringSource.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| 11 namespace blink { | 11 namespace blink { |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 bool parsePath(const char* input, String& output) { | 15 bool parsePath(const char* input, String& output) { |
| 16 String inputString(input); | 16 String inputString(input); |
| 17 SVGPathStringSource source(inputString); | 17 SVGPathStringSource source(inputString); |
| 18 SVGPathStringBuilder builder; | 18 SVGPathStringBuilder builder; |
| 19 bool hadError = SVGPathParser::parsePath(source, builder); | 19 bool hadError = SVGPathParser::parsePath(source, builder); |
| 20 output = builder.result(); | 20 output = builder.result(); |
| 21 // Coerce a null result to empty. | 21 // Coerce a null result to empty. |
| 22 if (output.isNull()) | 22 if (output.isNull()) |
| 23 output = emptyString(); | 23 output = emptyString; |
| 24 return hadError; | 24 return hadError; |
| 25 } | 25 } |
| 26 | 26 |
| 27 #define VALID(input, expected) \ | 27 #define VALID(input, expected) \ |
| 28 { \ | 28 { \ |
| 29 String output; \ | 29 String output; \ |
| 30 EXPECT_TRUE(parsePath(input, output)); \ | 30 EXPECT_TRUE(parsePath(input, output)); \ |
| 31 EXPECT_EQ(expected, output); \ | 31 EXPECT_EQ(expected, output); \ |
| 32 } | 32 } |
| 33 | 33 |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 EXPECT_ERROR("M0,0 A10,10 0 #,0 20,20", 14u, SVGParseStatus::ExpectedArcFlag); | 179 EXPECT_ERROR("M0,0 A10,10 0 #,0 20,20", 14u, SVGParseStatus::ExpectedArcFlag); |
| 180 EXPECT_ERROR("M0,0 A10,10 0 0,# 20,20", 16u, SVGParseStatus::ExpectedArcFlag); | 180 EXPECT_ERROR("M0,0 A10,10 0 0,# 20,20", 16u, SVGParseStatus::ExpectedArcFlag); |
| 181 EXPECT_ERROR("M0,0 A10,10 0 0,2 20,20", 16u, SVGParseStatus::ExpectedArcFlag); | 181 EXPECT_ERROR("M0,0 A10,10 0 0,2 20,20", 16u, SVGParseStatus::ExpectedArcFlag); |
| 182 } | 182 } |
| 183 | 183 |
| 184 #undef EXPECT_ERROR | 184 #undef EXPECT_ERROR |
| 185 | 185 |
| 186 } // namespace | 186 } // namespace |
| 187 | 187 |
| 188 } // namespace blink | 188 } // namespace blink |
| OLD | NEW |