Adding test for gradient xlink:href

- refs #3005
This commit is contained in:
jakepruitt 2015-07-30 12:48:23 -04:00
parent 9f4db6c855
commit 8982938270
2 changed files with 19 additions and 1 deletions

@ -1 +1 @@
Subproject commit c7994e1027943c19f88a2bb65a4c745b05f32dd5
Subproject commit 28be586d71b24fe1bcdf70bc9ba37dc4f63860fc

View file

@ -681,4 +681,22 @@ TEST_CASE("SVG parser") {
transform *= agg::trans_affine_translation(240,155);
REQUIRE(attrs[1].fill_gradient.get_transform() == transform);
}
SECTION("SVG <gradient> with xlink:href")
{
std::string svg_name("./test/data/svg/gradient-xhref.svg");
std::shared_ptr<mapnik::marker const> marker = mapnik::marker_cache::instance().find(svg_name, false);
REQUIRE(marker);
REQUIRE(marker->is<mapnik::marker_svg>());
mapnik::marker_svg const& svg = mapnik::util::get<mapnik::marker_svg>(*marker);
auto bbox = svg.bounding_box();
REQUIRE(bbox == mapnik::box2d<double>(20,20,460,230));
auto storage = svg.get_data();
REQUIRE(storage);
auto const& attrs = storage->attributes();
REQUIRE(attrs.size() == 2 );
REQUIRE(attrs[0].fill_gradient.get_gradient_type() == mapnik::LINEAR);
REQUIRE(attrs[1].fill_gradient.get_gradient_type() == mapnik::LINEAR);
REQUIRE(attrs[1].fill_gradient.has_stop());
}
}