diff options
author | tamasmeszaros <meszaros.q@gmail.com> | 2020-04-28 22:11:54 +0300 |
---|---|---|
committer | tamasmeszaros <meszaros.q@gmail.com> | 2020-04-28 22:11:54 +0300 |
commit | 2a8c485b32c2342954771328bac27f78f10de444 (patch) | |
tree | 723c3b57f44d7b7be86fe1b9c33dc618da763b09 /tests | |
parent | 6f7fa4bc09ce174350186a47dfc21754bb659d85 (diff) |
suppress unnecessary test output in release mode
Diffstat (limited to 'tests')
-rw-r--r-- | tests/libslic3r/test_marchingsquares.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/libslic3r/test_marchingsquares.cpp b/tests/libslic3r/test_marchingsquares.cpp index 9912ff2ca..e9e016157 100644 --- a/tests/libslic3r/test_marchingsquares.cpp +++ b/tests/libslic3r/test_marchingsquares.cpp @@ -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.))); |