From 42bf2303e0dd4423c33a9b00208f0f33c281175d Mon Sep 17 00:00:00 2001 From: artemp Date: Fri, 31 Jul 2015 11:35:02 +0200 Subject: [PATCH] fix parse_double_optional_percent grammar and update tests --- src/svg/svg_parser.cpp | 2 +- test/unit/svg/svg_parser_test.cpp | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index f57451e44..06c720298 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -149,7 +149,7 @@ double parse_double_optional_percent(T & error_messages, const char* str, bool & double val = 0.0; if (!parse(str, str + std::strlen(str),double_[ref(val)=_1, ref(percent) = false] - >> -char_('%')[ref(val)/100.0, ref(percent) = true])) + >> -char_('%')[ref(val) /= 100.0, ref(percent) = true])) { error_messages.emplace_back("Failed to parse double (optional %) from " + std::string(str)); } diff --git a/test/unit/svg/svg_parser_test.cpp b/test/unit/svg/svg_parser_test.cpp index a390bb4ad..e71a974ec 100644 --- a/test/unit/svg/svg_parser_test.cpp +++ b/test/unit/svg/svg_parser_test.cpp @@ -750,9 +750,9 @@ TEST_CASE("SVG parser") { REQUIRE(attrs[0].fill_gradient.has_stop()); attrs[0].fill_gradient.get_control_points(x1, y1, x2, y2, r); REQUIRE(x1 == 0); - REQUIRE(y1 == 25); - REQUIRE(x2 == 10); - REQUIRE(y2 == 10); - REQUIRE(r == 75); + REQUIRE(y1 == 0.25); + REQUIRE(x2 == 0.10); + REQUIRE(y2 == 0.10); + REQUIRE(r == 0.75); } }