From b4bc16751c2eb41a1bca25cc225f887a5ad63d7d Mon Sep 17 00:00:00 2001 From: jakepruitt Date: Wed, 29 Jul 2015 22:37:30 -0400 Subject: [PATCH] Adjusted error message logic for logging path ids --- src/svg/svg_parser.cpp | 2 +- test/data | 2 +- test/unit/svg/svg_parser_test.cpp | 15 ++++++++------- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/src/svg/svg_parser.cpp b/src/svg/svg_parser.cpp index 1d5a4410c..293235268 100644 --- a/src/svg/svg_parser.cpp +++ b/src/svg/svg_parser.cpp @@ -490,7 +490,7 @@ void parse_path(svg_parser & parser, rapidxml::xml_node const* node) if (!mapnik::svg::parse_path(value, parser.path_)) { auto const* id_attr = node->first_attribute("xml:id"); - if (id_attr != nullptr) id_attr = node->first_attribute("id"); + if (id_attr == nullptr) id_attr = node->first_attribute("id"); if (id_attr) { parser.error_messages_.push_back(std::string("unable to parse invalid svg with id '") diff --git a/test/data b/test/data index 5b1fbae49..c7994e102 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 5b1fbae495f27c75c922e1b1fb8ca02fc236a04f +Subproject commit c7994e1027943c19f88a2bb65a4c745b05f32dd5 diff --git a/test/unit/svg/svg_parser_test.cpp b/test/unit/svg/svg_parser_test.cpp index 5f5772de3..f73783488 100644 --- a/test/unit/svg/svg_parser_test.cpp +++ b/test/unit/svg/svg_parser_test.cpp @@ -112,7 +112,7 @@ TEST_CASE("SVG parser") { if (!p.parse_from_string(svg_str)) { auto const& errors = p.error_messages(); - REQUIRE(errors.size() == 13); + REQUIRE(errors.size() == 14); REQUIRE(errors[0] == "parse_rect: Invalid width"); REQUIRE(errors[1] == "Failed to parse double: \"FAIL\""); REQUIRE(errors[2] == "parse_rect: Invalid height"); @@ -120,12 +120,13 @@ TEST_CASE("SVG parser") { REQUIRE(errors[4] == "parse_rect: Invalid ry"); REQUIRE(errors[5] == "unable to parse invalid svg "); REQUIRE(errors[6] == "unable to parse invalid svg with id 'fail-path'"); - REQUIRE(errors[7] == "parse_circle: Invalid radius"); - REQUIRE(errors[8] == "Failed to parse 'points'"); - REQUIRE(errors[9] == "Failed to parse 'points'"); - REQUIRE(errors[10] == "parse_ellipse: Invalid rx"); - REQUIRE(errors[11] == "parse_ellipse: Invalid ry"); - REQUIRE(errors[12] == "parse_rect: Invalid height"); + REQUIRE(errors[7] == "unable to parse invalid svg with id 'fail-path'"); + REQUIRE(errors[8] == "parse_circle: Invalid radius"); + REQUIRE(errors[9] == "Failed to parse 'points'"); + REQUIRE(errors[10] == "Failed to parse 'points'"); + REQUIRE(errors[11] == "parse_ellipse: Invalid rx"); + REQUIRE(errors[12] == "parse_ellipse: Invalid ry"); + REQUIRE(errors[13] == "parse_rect: Invalid height"); } }