Adjusted error message logic for logging path ids

This commit is contained in:
jakepruitt 2015-07-29 22:37:30 -04:00
parent af27af4af2
commit b4bc16751c
3 changed files with 10 additions and 9 deletions

View File

@ -490,7 +490,7 @@ void parse_path(svg_parser & parser, rapidxml::xml_node<char> 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 <path> with id '")

@ -1 +1 @@
Subproject commit 5b1fbae495f27c75c922e1b1fb8ca02fc236a04f
Subproject commit c7994e1027943c19f88a2bb65a4c745b05f32dd5

View File

@ -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 <path>");
REQUIRE(errors[6] == "unable to parse invalid svg <path> with id 'fail-path'");
REQUIRE(errors[7] == "parse_circle: Invalid radius");
REQUIRE(errors[8] == "Failed to parse <polygon> 'points'");
REQUIRE(errors[9] == "Failed to parse <polyline> '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 <path> with id 'fail-path'");
REQUIRE(errors[8] == "parse_circle: Invalid radius");
REQUIRE(errors[9] == "Failed to parse <polygon> 'points'");
REQUIRE(errors[10] == "Failed to parse <polyline> 'points'");
REQUIRE(errors[11] == "parse_ellipse: Invalid rx");
REQUIRE(errors[12] == "parse_ellipse: Invalid ry");
REQUIRE(errors[13] == "parse_rect: Invalid height");
}
}