mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-12 20:47:36 +00:00
test: stop littering the working directory with debug files (#14785)
This commit is contained in:
@@ -229,7 +229,7 @@ TEST_CASE("halfcone test", "[halfcone]") {
|
||||
indexed_triangle_set m = sla::get_mesh(br, 45);
|
||||
|
||||
its_merge_vertices(m);
|
||||
its_write_obj(m, "Halfcone.obj");
|
||||
write_debug_obj("sla_print/Halfcone.obj", m);
|
||||
}
|
||||
|
||||
TEST_CASE("Test concurrency")
|
||||
|
||||
@@ -13,7 +13,7 @@ TEST_CASE("Overhanging point should be supported", "[SupGen]") {
|
||||
// Pyramid with 45 deg slope
|
||||
TriangleMesh mesh = make_pyramid(10.f, 10.f);
|
||||
mesh.rotate_y(float(PI));
|
||||
mesh.WriteOBJFile("Pyramid.obj");
|
||||
write_debug_obj("sla_supptgen/Pyramid.obj", mesh);
|
||||
|
||||
sla::SupportPoints pts = calc_support_pts(mesh);
|
||||
|
||||
@@ -55,7 +55,7 @@ TEST_CASE("Overhanging horizontal surface should be supported", "[SupGen]") {
|
||||
|
||||
TriangleMesh mesh = make_cube(width, depth, height);
|
||||
mesh.translate(0., 0., 5.); // lift up
|
||||
mesh.WriteOBJFile("Cuboid.obj");
|
||||
write_debug_obj("sla_supptgen/Cuboid.obj", mesh);
|
||||
|
||||
sla::SupportPointGenerator::Config cfg;
|
||||
sla::SupportPoints pts = calc_support_pts(mesh, cfg);
|
||||
@@ -81,7 +81,7 @@ TEST_CASE("Overhanging edge should be supported", "[SupGen]") {
|
||||
TriangleMesh mesh = make_prism(width, depth, height);
|
||||
mesh.rotate_y(float(PI)); // rotate on its back
|
||||
mesh.translate(0., 0., height);
|
||||
mesh.WriteOBJFile("Prism.obj");
|
||||
write_debug_obj("sla_supptgen/Prism.obj", mesh);
|
||||
|
||||
sla::SupportPointGenerator::Config cfg;
|
||||
sla::SupportPoints pts = calc_support_pts(mesh, cfg);
|
||||
@@ -106,7 +106,7 @@ TEST_CASE("Hollowed cube should be supported from the inside", "[SupGen][Hollowe
|
||||
|
||||
hollow_mesh(mesh, HollowingConfig{});
|
||||
|
||||
mesh.WriteOBJFile("cube_hollowed.obj");
|
||||
write_debug_obj("sla_supptgen/cube_hollowed.obj", mesh);
|
||||
|
||||
auto bb = mesh.bounding_box();
|
||||
auto h = float(bb.max.z() - bb.min.z());
|
||||
@@ -129,7 +129,7 @@ TEST_CASE("Two parallel plates should be supported", "[SupGen][Hollowed]")
|
||||
mesh_high.translate(0., 0., 10.); // lift up
|
||||
mesh.merge(mesh_high);
|
||||
|
||||
mesh.WriteOBJFile("parallel_plates.obj");
|
||||
write_debug_obj("sla_supptgen/parallel_plates.obj", mesh);
|
||||
|
||||
sla::SupportPointGenerator::Config cfg;
|
||||
sla::SupportPoints pts = calc_support_pts(mesh, cfg);
|
||||
|
||||
@@ -47,8 +47,9 @@ void test_support_model_collision(const std::string &obj_filename,
|
||||
notouch = notouch && area(intersections) < PI * pinhead_r * pinhead_r;
|
||||
}
|
||||
|
||||
/*if (!notouch) */export_failed_case(support_slices, byproducts);
|
||||
|
||||
if (!notouch)
|
||||
export_failed_case(support_slices, byproducts);
|
||||
|
||||
REQUIRE(notouch);
|
||||
}
|
||||
|
||||
@@ -62,11 +63,11 @@ void export_failed_case(const std::vector<ExPolygons> &support_slices, const Sup
|
||||
std::stringstream ss;
|
||||
if (!intersections.empty()) {
|
||||
ss << byproducts.obj_fname << std::setprecision(4) << n << ".svg";
|
||||
SVG svg(ss.str());
|
||||
svg.draw(sup_slice, "green");
|
||||
svg.draw(mod_slice, "blue");
|
||||
svg.draw(intersections, "red");
|
||||
svg.Close();
|
||||
write_debug_svg("sla/" + ss.str(), [&](SVG &svg) {
|
||||
svg.draw(sup_slice, "green");
|
||||
svg.draw(mod_slice, "blue");
|
||||
svg.draw(intersections, "red");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,8 +75,8 @@ void export_failed_case(const std::vector<ExPolygons> &support_slices, const Sup
|
||||
byproducts.supporttree.retrieve_full_mesh(its);
|
||||
TriangleMesh m{its};
|
||||
m.merge(byproducts.input_mesh);
|
||||
m.WriteOBJFile((Catch::getResultCapture().getCurrentTestName() + "_" +
|
||||
byproducts.obj_fname).c_str());
|
||||
write_debug_obj("sla/" + Catch::getResultCapture().getCurrentTestName() +
|
||||
"_" + byproducts.obj_fname, m);
|
||||
}
|
||||
|
||||
void test_supports(const std::string &obj_filename,
|
||||
@@ -350,13 +351,11 @@ void check_raster_transformations(sla::RasterBase::Orientation o, sla::RasterBas
|
||||
REQUIRE((w < res.width_px && h < res.height_px));
|
||||
|
||||
auto px = raster.read_pixel(w, h);
|
||||
|
||||
if (px != FullWhite) {
|
||||
std::fstream outf("out.png", std::ios::out);
|
||||
|
||||
outf << raster.encode(sla::PNGRasterEncoder());
|
||||
}
|
||||
|
||||
|
||||
if (px != FullWhite)
|
||||
write_debug_stream("sla/raster_transform_mismatch.png",
|
||||
[&] { return raster.encode(sla::PNGRasterEncoder()); });
|
||||
|
||||
REQUIRE(px == FullWhite);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user