suppress unnecessary test output in release mode
This commit is contained in:
parent
6f7fa4bc09
commit
2a8c485b32
@ -334,9 +334,11 @@ static void recreate_object_from_rasters(const std::string &objname, float lh) {
|
|||||||
rst.draw(island);
|
rst.draw(island);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
std::fstream out(objname + std::to_string(cntr) + ".png", std::ios::out);
|
std::fstream out(objname + std::to_string(cntr) + ".png", std::ios::out);
|
||||||
out << rst.encode(sla::PNGRasterEncoder{});
|
out << rst.encode(sla::PNGRasterEncoder{});
|
||||||
out.close();
|
out.close();
|
||||||
|
#endif
|
||||||
|
|
||||||
ExPolygons layer_ = sla::raster_to_polygons(rst);
|
ExPolygons layer_ = sla::raster_to_polygons(rst);
|
||||||
// float delta = scaled(std::min(rst.pixel_dimensions().h_mm,
|
// float delta = scaled(std::min(rst.pixel_dimensions().h_mm,
|
||||||
@ -344,16 +346,19 @@ static void recreate_object_from_rasters(const std::string &objname, float lh) {
|
|||||||
|
|
||||||
// layer_ = expolygons_simplify(layer_, delta);
|
// layer_ = expolygons_simplify(layer_, delta);
|
||||||
|
|
||||||
|
#ifndef NDEBUG
|
||||||
SVG svg(objname + std::to_string(cntr) + ".svg", BoundingBox(Point{0, 0}, Point{scaled(disp_w), scaled(disp_h)}));
|
SVG svg(objname + std::to_string(cntr) + ".svg", BoundingBox(Point{0, 0}, Point{scaled(disp_w), scaled(disp_h)}));
|
||||||
svg.draw(layer_);
|
svg.draw(layer_);
|
||||||
svg.draw(layer, "green");
|
svg.draw(layer, "green");
|
||||||
svg.Close();
|
svg.Close();
|
||||||
|
#endif
|
||||||
|
|
||||||
double layera = 0., layera_ = 0.;
|
double layera = 0., layera_ = 0.;
|
||||||
for (auto &p : layer) layera += p.area();
|
for (auto &p : layer) layera += p.area();
|
||||||
for (auto &p : layer_) layera_ += p.area();
|
for (auto &p : layer_) layera_ += p.area();
|
||||||
|
#ifndef NDEBUG
|
||||||
std::cout << cntr++ << std::endl;
|
std::cout << cntr++ << std::endl;
|
||||||
|
#endif
|
||||||
double diff = std::abs(layera_ - layera);
|
double diff = std::abs(layera_ - layera);
|
||||||
REQUIRE((diff <= 0.1 * layera || diff < scaled<double>(1.) * scaled<double>(1.)));
|
REQUIRE((diff <= 0.1 * layera || diff < scaled<double>(1.) * scaled<double>(1.)));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user