Test failure on thrown exception is already handled by the test framework.

This commit is contained in:
Matt Amos 2015-05-18 22:37:13 +01:00
parent 2bb50371ca
commit 26f233c505

View file

@ -19,52 +19,46 @@ const std::string geojson("{ \"type\": \"Feature\", \"properties\": { }, \"geome
TEST_CASE("agg_rasterizer_integer_overflow") {
SECTION("coordinates_do_not_overflow_and_polygon_is_rendered") {
try {
auto expected_color = mapnik::color("white");
auto expected_color = mapnik::color("white");
mapnik::Map m(256,256);
m.set_background(mapnik::color("black"));
mapnik::Map m(256,256);
m.set_background(mapnik::color("black"));
mapnik::feature_type_style s;
{
mapnik::rule r;
mapnik::polygon_symbolizer sym;
mapnik::put(sym, mapnik::keys::fill, expected_color);
mapnik::put(sym, mapnik::keys::clip, false);
r.append(std::move(sym));
s.add_rule(std::move(r));
}
m.insert_style("style",std::move(s));
mapnik::layer lyr("Layer");
lyr.styles().emplace_back("style");
{
auto ds = std::make_shared<mapnik::memory_datasource>(mapnik::parameters());
auto context = std::make_shared<mapnik::context_type>();
auto f = std::make_shared<mapnik::feature_impl>(context, 0);
REQUIRE(mapnik::json::from_geojson(geojson, *f));
ds->push(f);
lyr.set_datasource(ds);
}
m.add_layer(std::move(lyr));
// 17/20864/45265.png
m.zoom_to_box(mapnik::box2d<double>(-13658379.710221574,6197514.253362091,-13657768.213995293,6198125.749588372));
// works 15/5216/11316.png
//m.zoom_to_box(mapnik::box2d<double>(-13658379.710221574,6195679.764683247,-13655933.72531645,6198125.749588372));
mapnik::image_rgba8 im(256, 256);
{
mapnik::agg_renderer<mapnik::image_rgba8> ren(m, im);
ren.apply();
}
REQUIRE(im(128,128) == expected_color.rgba());
} catch (std::exception const &e) {
std::clog << e.what() << std::endl;
REQUIRE(false);
mapnik::feature_type_style s;
{
mapnik::rule r;
mapnik::polygon_symbolizer sym;
mapnik::put(sym, mapnik::keys::fill, expected_color);
mapnik::put(sym, mapnik::keys::clip, false);
r.append(std::move(sym));
s.add_rule(std::move(r));
}
m.insert_style("style",std::move(s));
mapnik::layer lyr("Layer");
lyr.styles().emplace_back("style");
{
auto ds = std::make_shared<mapnik::memory_datasource>(mapnik::parameters());
auto context = std::make_shared<mapnik::context_type>();
auto f = std::make_shared<mapnik::feature_impl>(context, 0);
REQUIRE(mapnik::json::from_geojson(geojson, *f));
ds->push(f);
lyr.set_datasource(ds);
}
m.add_layer(std::move(lyr));
// 17/20864/45265.png
m.zoom_to_box(mapnik::box2d<double>(-13658379.710221574,6197514.253362091,-13657768.213995293,6198125.749588372));
// works 15/5216/11316.png
//m.zoom_to_box(mapnik::box2d<double>(-13658379.710221574,6195679.764683247,-13655933.72531645,6198125.749588372));
mapnik::image_rgba8 im(256, 256);
{
mapnik::agg_renderer<mapnik::image_rgba8> ren(m, im);
ren.apply();
}
REQUIRE(im(128,128) == expected_color.rgba());
} // SECTION
} // TEST_CASE