suppress unnecessary test output in release mode
This commit is contained in:
parent
6f7fa4bc09
commit
2a8c485b32
@ -325,7 +325,7 @@ static void recreate_object_from_rasters(const std::string &objname, float lh) {
|
||||
sla::RasterBase::Resolution res{2560, 1440};
|
||||
double disp_w = 120.96;
|
||||
double disp_h = 68.04;
|
||||
|
||||
|
||||
size_t cntr = 0;
|
||||
for (ExPolygons &layer : layers) {
|
||||
auto rst = create_raster(res, disp_w, disp_h);
|
||||
@ -334,26 +334,31 @@ static void recreate_object_from_rasters(const std::string &objname, float lh) {
|
||||
rst.draw(island);
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
std::fstream out(objname + std::to_string(cntr) + ".png", std::ios::out);
|
||||
out << rst.encode(sla::PNGRasterEncoder{});
|
||||
out.close();
|
||||
#endif
|
||||
|
||||
ExPolygons layer_ = sla::raster_to_polygons(rst);
|
||||
// float delta = scaled(std::min(rst.pixel_dimensions().h_mm,
|
||||
// rst.pixel_dimensions().w_mm)) / 2;
|
||||
|
||||
// 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.draw(layer_);
|
||||
svg.draw(layer, "green");
|
||||
svg.Close();
|
||||
#endif
|
||||
|
||||
double layera = 0., layera_ = 0.;
|
||||
for (auto &p : layer) layera += p.area();
|
||||
for (auto &p : layer_) layera_ += p.area();
|
||||
|
||||
#ifndef NDEBUG
|
||||
std::cout << cntr++ << std::endl;
|
||||
#endif
|
||||
double diff = std::abs(layera_ - layera);
|
||||
REQUIRE((diff <= 0.1 * layera || diff < scaled<double>(1.) * scaled<double>(1.)));
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user