From bc4f73a7e8fc9a7a6095338450e320639ecbfc84 Mon Sep 17 00:00:00 2001 From: supermerill Date: Mon, 8 Jul 2019 17:24:17 +0200 Subject: [PATCH] AMF bugfix clean tests --- src/libslic3r/Format/AMF.cpp | 1 - src/test/GUI/test_cli.cpp | 2 +- src/test/libslic3r/test_denserinfill.cpp | 7 ++-- src/test/libslic3r/test_flow.cpp | 2 +- src/test/libslic3r/test_model.cpp | 5 +-- src/test/libslic3r/test_print.cpp | 5 +-- src/test/libslic3r/test_skirt_brim.cpp | 43 ++++++++++++------------ src/test/libslic3r/test_thin.cpp | 4 +-- src/test/test_data.cpp | 2 +- 9 files changed, 35 insertions(+), 36 deletions(-) diff --git a/src/libslic3r/Format/AMF.cpp b/src/libslic3r/Format/AMF.cpp index 6a7c84376..b72e6cab8 100644 --- a/src/libslic3r/Format/AMF.cpp +++ b/src/libslic3r/Format/AMF.cpp @@ -854,7 +854,6 @@ bool store_amf(std::string &path, Model *model, const DynamicPrintConfig *config mz_zip_archive archive; mz_zip_zero_struct(&archive); - mz_bool res = mz_zip_writer_init_file(&archive, path.c_str(), 0); if (!open_zip_writer(&archive, path)) return false; std::stringstream stream; diff --git a/src/test/GUI/test_cli.cpp b/src/test/GUI/test_cli.cpp index b3c00d5ca..c114749e6 100644 --- a/src/test/GUI/test_cli.cpp +++ b/src/test/GUI/test_cli.cpp @@ -1,5 +1,5 @@ -#define CATCH_CONFIG_DISABLE +//#define CATCH_CONFIG_DISABLE #include #include diff --git a/src/test/libslic3r/test_denserinfill.cpp b/src/test/libslic3r/test_denserinfill.cpp index d6e3ab8a0..e701b30fb 100644 --- a/src/test/libslic3r/test_denserinfill.cpp +++ b/src/test/libslic3r/test_denserinfill.cpp @@ -1,5 +1,5 @@ -#define CATCH_CONFIG_DISABLE +//#define CATCH_CONFIG_DISABLE #include #include "../test_data.hpp" @@ -24,7 +24,6 @@ SCENARIO("denser infills: ") config->set_key_value("infill_dense", new ConfigOptionBool(true)); config->set_key_value("infill_dense_algo", new ConfigOptionEnum(dfaEnlarged)); config->save("C:\\Users\\Admin\\Desktop\\config_def.ini"); - std::cout << "dense infill : " << config->opt_bool("infill_dense") << "\n"; Slic3r::Test::init_print(print, { Slic3r::Test::TestMesh::di_5mm_center_notch }, model, config, false); print.process(); PrintObject& object = *(print.objects().at(0)); @@ -66,7 +65,7 @@ SCENARIO("denser infills: ") srfSparse = srfDense; srfDense = &object.layers()[21]->regions()[0]->fill_surfaces.surfaces[0]; } - std::cout << "sparse area = " << unscaled(unscaled(srfSparse->area())) << " , dense area = " << unscaled(unscaled(srfDense->area())) << "\n"; + //std::cout << "sparse area = " << unscaled(unscaled(srfSparse->area())) << " , dense area = " << unscaled(unscaled(srfDense->area())) << "\n"; REQUIRE(unscaled(unscaled(srfSparse->area())) > unscaled(unscaled(srfDense->area()))); REQUIRE(object.layers()[22]->regions()[0]->fills.entities.size() == 2); //sparse + solid-bridge REQUIRE(object.layers()[22]->regions()[0]->fill_surfaces.surfaces.size() == 2); @@ -94,7 +93,6 @@ SCENARIO("denser infills: ") config->set_key_value("infill_dense", new ConfigOptionBool(true)); config->set_key_value("infill_dense_algo", new ConfigOptionEnum(dfaAutomatic)); config->save("C:\\Users\\Admin\\Desktop\\config_def.ini"); - std::cout << "dense infill : " << config->opt_bool("infill_dense") << "\n"; Slic3r::Test::init_print(print, { Slic3r::Test::TestMesh::di_10mm_notch }, model, config, false); print.process(); PrintObject& object = *(print.objects().at(0)); @@ -157,7 +155,6 @@ SCENARIO("denser infills: ") config->set_key_value("infill_dense", new ConfigOptionBool(true)); config->set_key_value("infill_dense_algo", new ConfigOptionEnum(dfaAutoNotFull)); config->save("C:\\Users\\Admin\\Desktop\\config_def.ini"); - std::cout << "dense infill : " << config->opt_bool("infill_dense") << "\n"; Slic3r::Test::init_print(print, { Slic3r::Test::TestMesh::di_10mm_notch }, model, config, false); print.process(); PrintObject& object = *(print.objects().at(0)); diff --git a/src/test/libslic3r/test_flow.cpp b/src/test/libslic3r/test_flow.cpp index e1af421dd..d97640728 100644 --- a/src/test/libslic3r/test_flow.cpp +++ b/src/test/libslic3r/test_flow.cpp @@ -1,5 +1,5 @@ -#define CATCH_CONFIG_DISABLE +//#define CATCH_CONFIG_DISABLE #include diff --git a/src/test/libslic3r/test_model.cpp b/src/test/libslic3r/test_model.cpp index f23d0ce28..2c52e752e 100644 --- a/src/test/libslic3r/test_model.cpp +++ b/src/test/libslic3r/test_model.cpp @@ -1,5 +1,5 @@ -#define CATCH_CONFIG_DISABLE +//#define CATCH_CONFIG_DISABLE #include #include "../../libslic3r/Config.hpp" @@ -35,7 +35,8 @@ SCENARIO("Model construction") { REQUIRE(mo->volumes.front()->is_modifier() == false); } THEN("Mesh is equivalent to input mesh.") { - REQUIRE(sample_mesh.vertices() == mo->volumes.front()->mesh.vertices()); + TriangleMesh trimesh = mo->volumes.front()->mesh(); + REQUIRE(sample_mesh.vertices() == trimesh.vertices()); } ModelInstance* inst = mo->add_instance(); inst->set_rotation(Vec3d(0,0,0)); diff --git a/src/test/libslic3r/test_print.cpp b/src/test/libslic3r/test_print.cpp index fcaa3e261..5aef41384 100644 --- a/src/test/libslic3r/test_print.cpp +++ b/src/test/libslic3r/test_print.cpp @@ -1,5 +1,5 @@ -#define CATCH_CONFIG_DISABLE +//#define CATCH_CONFIG_DISABLE #include #include @@ -11,11 +11,12 @@ using namespace Slic3r; using namespace std::literals; SCENARIO("PrintObject: Perimeter generation") { - GIVEN("20mm cube and default config") { + GIVEN("20mm cube and default config & 0.3 layer height") { DynamicPrintConfig *config = Slic3r::DynamicPrintConfig::new_from_defaults(); TestMesh m = TestMesh::cube_20x20x20; Model model{}; config->set_key_value("fill_density", new ConfigOptionPercent(0)); + config->set_deserialize("layer_height", "0.3"); WHEN("make_perimeters() is called") { Print print{}; diff --git a/src/test/libslic3r/test_skirt_brim.cpp b/src/test/libslic3r/test_skirt_brim.cpp index 39b89ff89..7bbffb864 100644 --- a/src/test/libslic3r/test_skirt_brim.cpp +++ b/src/test/libslic3r/test_skirt_brim.cpp @@ -1,5 +1,5 @@ -#define CATCH_CONFIG_DISABLE +//#define CATCH_CONFIG_DISABLE #include #include "../test_data.hpp" @@ -396,28 +396,29 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { } } - WHEN("Object is plated with overhang support and a brim") { - config->set_deserialize("layer_height", "0.4"); - config->set_deserialize("first_layer_height", "0.4"); - config->set_deserialize("skirts", "1"); - config->set_deserialize("skirt_distance", "0"); - config->set_deserialize("support_material_speed", "99"); - config->set_deserialize("perimeter_extruder", "1"); - config->set_deserialize("support_material_extruder", "2"); - config->set_deserialize("cooling", "0"); // to prevent speeds to be altered - config->set_deserialize("first_layer_speed", "100%"); // to prevent speeds to be altered + //TODO review this test that fail because "there are no layer" and it test nothing anyway + //WHEN("Object is plated with overhang support and a brim") { + // config->set_deserialize("layer_height", "0.4"); + // config->set_deserialize("first_layer_height", "0.4"); + // config->set_deserialize("skirts", "1"); + // config->set_deserialize("skirt_distance", "0"); + // config->set_deserialize("support_material_speed", "99"); + // config->set_deserialize("perimeter_extruder", "1"); + // config->set_deserialize("support_material_extruder", "2"); + // config->set_deserialize("cooling", "0"); // to prevent speeds to be altered + // config->set_deserialize("first_layer_speed", "100%"); // to prevent speeds to be altered - Slic3r::Model model; - Print print{}; - Slic3r::Test::init_print(print, { TestMesh::overhang }, model, config, false); - print.process(); - - config->set_deserialize("support_material", "true"); // to prevent speeds to be altered + // Slic3r::Model model; + // Print print{}; + // Slic3r::Test::init_print(print, { TestMesh::overhang }, model, config, false); + // print.process(); + // + // config->set_deserialize("support_material", "true"); // to prevent speeds to be altered - THEN("skirt length is large enough to contain object with support") { - REQUIRE(true); //TODO - } - } + // THEN("skirt length is large enough to contain object with support") { + // REQUIRE(true); //TODO + // } + //} WHEN("Large minimum skirt length is used.") { config->set_deserialize("min_skirt_length", "20"); auto gcode {std::stringstream("")}; diff --git a/src/test/libslic3r/test_thin.cpp b/src/test/libslic3r/test_thin.cpp index fb2adabc9..5b7a6257d 100644 --- a/src/test/libslic3r/test_thin.cpp +++ b/src/test/libslic3r/test_thin.cpp @@ -1,5 +1,5 @@ -#define CATCH_CONFIG_DISABLE +//#define CATCH_CONFIG_DISABLE #include #include "../test_data.hpp" @@ -105,7 +105,7 @@ SCENARIO("thin walls: ") Lines lines = res[0].lines(); double min_angle = 1, max_angle = -1; //std::cout << "first angle=" << lines[0].ccw(lines[1].b) << "\n"; - for (int idx = 2; idx < lines.size()-2; idx++){ + for (int idx = 1; idx < lines.size()-1; idx++){ double angle = lines[idx - 1].ccw(lines[idx].b); if (std::abs(angle) - EPSILON < 0) angle = 0; //if (angle < 0) std::cout << unscale_(lines[idx - 1].a.x()) << ":" << unscale_(lines[idx - 1].a.y()) << " -> " << unscale_(lines[idx - 1].b.x()) << ":" << unscale_(lines[idx - 1].b.y()) << " -> " << unscale_(lines[idx].b.x()) << ":" << unscale_(lines[idx].b.y()) << "\n"; diff --git a/src/test/test_data.cpp b/src/test/test_data.cpp index 9fd92e388..f7bdc127a 100644 --- a/src/test/test_data.cpp +++ b/src/test/test_data.cpp @@ -294,7 +294,7 @@ void init_print(Print& print, std::initializer_list meshes, Slic3r::Mo print.apply(model, *config); std::string err = print.validate(); - std::cout << "validate result : " << err << ", mempty print? " << print.empty() << "\n"; + //std::cout << "validate result : " << err << ", mempty print? " << print.empty() << "\n"; } void init_print(Print& print, std::initializer_list meshes, Slic3r::Model& model, DynamicPrintConfig* _config, bool comments) {