diff options
author | bubnikv <bubnikv@gmail.com> | 2019-10-17 20:09:24 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-10-17 20:09:24 +0300 |
commit | 98a71a557b756cfa9dd0e138947953d43ec85205 (patch) | |
tree | 61b3bd47bac011be4ff9246a94811d2a25edb565 /tests | |
parent | f9710eff088efff90175a4341a91008f0162f9d7 (diff) |
Ported test_support_material.cpp from upstream slic3r.
Ported extension of ExtrusionEntityCollection::flatten() to disable
flattening of no_sort() collections.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/fff_print/CMakeLists.txt | 1 | ||||
-rw-r--r-- | tests/fff_print/test_extrusion_entity.cpp | 85 | ||||
-rw-r--r-- | tests/fff_print/test_flow.cpp | 6 | ||||
-rw-r--r-- | tests/fff_print/test_model.cpp | 2 | ||||
-rw-r--r-- | tests/fff_print/test_print.cpp | 30 | ||||
-rw-r--r-- | tests/fff_print/test_printgcode.cpp | 56 | ||||
-rw-r--r-- | tests/fff_print/test_printobject.cpp | 42 | ||||
-rw-r--r-- | tests/fff_print/test_skirt_brim.cpp | 98 | ||||
-rw-r--r-- | tests/fff_print/test_support_material.cpp | 22 |
9 files changed, 213 insertions, 129 deletions
diff --git a/tests/fff_print/CMakeLists.txt b/tests/fff_print/CMakeLists.txt index 6a1f50fe4..703d5b3cf 100644 --- a/tests/fff_print/CMakeLists.txt +++ b/tests/fff_print/CMakeLists.txt @@ -3,6 +3,7 @@ add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests.cpp test_data.cpp test_data.hpp + test_extrusion_entity.cpp test_fill.cpp test_flow.cpp test_gcodewriter.cpp diff --git a/tests/fff_print/test_extrusion_entity.cpp b/tests/fff_print/test_extrusion_entity.cpp new file mode 100644 index 000000000..9bef52a5c --- /dev/null +++ b/tests/fff_print/test_extrusion_entity.cpp @@ -0,0 +1,85 @@ +#include <catch2/catch.hpp> + +#include <cstdlib> + +#include "libslic3r/ExtrusionEntityCollection.hpp" +#include "libslic3r/ExtrusionEntity.hpp" +#include "libslic3r/Point.hpp" +#include "libslic3r/libslic3r.h" + +#include "test_data.hpp" + +using namespace Slic3r; + +static inline Slic3r::Point random_point(float LO=-50, float HI=50) +{ + Vec2f pt = Vec2f(LO, LO) + (Vec2d(rand(), rand()) * (HI-LO) / RAND_MAX).cast<float>(); + return pt.cast<coord_t>(); +} + +// build a sample extrusion entity collection with random start and end points. +static Slic3r::ExtrusionPath random_path(size_t length = 20, float LO = -50, float HI = 50) +{ + ExtrusionPath t {erPerimeter, 1.0, 1.0, 1.0}; + for (size_t j = 0; j < length; ++ j) + t.polyline.append(random_point(LO, HI)); + return t; +} + +static Slic3r::ExtrusionPaths random_paths(size_t count = 10, size_t length = 20, float LO = -50, float HI = 50) +{ + Slic3r::ExtrusionPaths p; + for (size_t i = 0; i < count; ++ i) + p.push_back(random_path(length, LO, HI)); + return p; +} + +SCENARIO("ExtrusionEntityCollection: Polygon flattening", "[ExtrusionEntity]") { + srand(0xDEADBEEF); // consistent seed for test reproducibility. + + // Generate one specific random path set and save it for later comparison + Slic3r::ExtrusionPaths nosort_path_set = random_paths(); + + Slic3r::ExtrusionEntityCollection sub_nosort; + sub_nosort.append(nosort_path_set); + sub_nosort.no_sort = true; + + Slic3r::ExtrusionEntityCollection sub_sort; + sub_sort.no_sort = false; + sub_sort.append(random_paths()); + + GIVEN("A Extrusion Entity Collection with a child that has one child that is marked as no-sort") { + Slic3r::ExtrusionEntityCollection sample; + Slic3r::ExtrusionEntityCollection output; + + sample.append(sub_sort); + sample.append(sub_nosort); + sample.append(sub_sort); + + WHEN("The EEC is flattened with default options (preserve_order=false)") { + output = sample.flatten(); + THEN("The output EEC contains no Extrusion Entity Collections") { + CHECK(std::count_if(output.entities.cbegin(), output.entities.cend(), [=](const ExtrusionEntity* e) {return e->is_collection();}) == 0); + } + } + WHEN("The EEC is flattened with preservation (preserve_order=true)") { + output = sample.flatten(true); + THEN("The output EECs contains one EEC.") { + CHECK(std::count_if(output.entities.cbegin(), output.entities.cend(), [=](const ExtrusionEntity* e) {return e->is_collection();}) == 1); + } + AND_THEN("The ordered EEC contains the same order of elements than the original") { + // find the entity in the collection + for (auto e : output.entities) + if (e->is_collection()) { + ExtrusionEntityCollection *temp = dynamic_cast<ExtrusionEntityCollection*>(e); + // check each Extrusion path against nosort_path_set to see if the first and last match the same + CHECK(nosort_path_set.size() == temp->entities.size()); + for (size_t i = 0; i < nosort_path_set.size(); ++ i) { + CHECK(temp->entities[i]->first_point() == nosort_path_set[i].first_point()); + CHECK(temp->entities[i]->last_point() == nosort_path_set[i].last_point()); + } + } + } + } + } +} diff --git a/tests/fff_print/test_flow.cpp b/tests/fff_print/test_flow.cpp index 43614d209..584fb8dd7 100644 --- a/tests/fff_print/test_flow.cpp +++ b/tests/fff_print/test_flow.cpp @@ -20,9 +20,9 @@ SCENARIO("Extrusion width specifics", "[!mayfail]") { // this is a sharedptr DynamicPrintConfig config = Slic3r::DynamicPrintConfig::full_print_config(); config.set_deserialize({ - { "brim_width", "2" }, - { "skirts", "1" }, - { "perimeters", "3" }, + { "brim_width", 2 }, + { "skirts", 1 }, + { "perimeters", 3 }, { "fill_density", "40%" }, { "first_layer_height", "100%" } }); diff --git a/tests/fff_print/test_model.cpp b/tests/fff_print/test_model.cpp index 88966d774..3378a8363 100644 --- a/tests/fff_print/test_model.cpp +++ b/tests/fff_print/test_model.cpp @@ -40,7 +40,7 @@ SCENARIO("Model construction", "[Model]") { REQUIRE((p2 - p1).norm() < EPSILON); } } - Slic3r::ModelInstance *model_instance = model_object->add_instance(); + model_object->add_instance(); model.arrange_objects(PrintConfig::min_object_distance(&config)); model.center_instances_around_point(Slic3r::Vec2d(100, 100)); model_object->ensure_on_bed(); diff --git a/tests/fff_print/test_print.cpp b/tests/fff_print/test_print.cpp index 81d79022b..d0faff544 100644 --- a/tests/fff_print/test_print.cpp +++ b/tests/fff_print/test_print.cpp @@ -12,7 +12,7 @@ SCENARIO("PrintObject: Perimeter generation", "[PrintObject]") { GIVEN("20mm cube and default config") { WHEN("make_perimeters() is called") { Slic3r::Print print; - Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { { "fill_density", "0" } }); + Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { { "fill_density", 0 } }); const PrintObject &object = *print.objects().front(); THEN("67 layers exist in the model") { REQUIRE(object.layers().size() == 66); @@ -34,9 +34,9 @@ SCENARIO("Print: Skirt generation", "[Print]") { WHEN("Skirts is set to 2 loops") { Slic3r::Print print; Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { - { "skirt_height", "1" }, - { "skirt_distance", "1" }, - { "skirts", "2"} + { "skirt_height", 1 }, + { "skirt_distance", 1 }, + { "skirts", 2 } }); THEN("Skirt Extrusion collection has 2 loops in it") { REQUIRE(print.skirt().items_count() == 2); @@ -50,10 +50,10 @@ SCENARIO("Print: Changing number of solid surfaces does not cause all surfaces t GIVEN("sliced 20mm cube and config with top_solid_surfaces = 2 and bottom_solid_surfaces = 1") { Slic3r::DynamicPrintConfig config = Slic3r::DynamicPrintConfig::full_print_config(); config.set_deserialize({ - { "top_solid_layers", "2" }, - { "bottom_solid_layers", "1" }, - { "layer_height", "0.5" }, // get a known number of layers - { "first_layer_height", "0.5" } + { "top_solid_layers", 2 }, + { "bottom_solid_layers", 1 }, + { "layer_height", 0.5 }, // get a known number of layers + { "first_layer_height", 0.5 } }); Slic3r::Print print; Slic3r::Model model; @@ -94,8 +94,8 @@ SCENARIO("Print: Brim generation", "[Print]") { WHEN("Brim is set to 3mm") { Slic3r::Print print; Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { - { "first_layer_extrusion_width", "1" }, - { "brim_width", "3" } + { "first_layer_extrusion_width", 1 }, + { "brim_width", 3 } }); THEN("Brim Extrusion collection has 3 loops in it") { REQUIRE(print.brim().items_count() == 3); @@ -104,8 +104,8 @@ SCENARIO("Print: Brim generation", "[Print]") { WHEN("Brim is set to 6mm") { Slic3r::Print print; Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { - { "first_layer_extrusion_width", "1" }, - { "brim_width", "6" } + { "first_layer_extrusion_width", 1 }, + { "brim_width", 6 } }); THEN("Brim Extrusion collection has 6 loops in it") { REQUIRE(print.brim().items_count() == 6); @@ -114,9 +114,9 @@ SCENARIO("Print: Brim generation", "[Print]") { WHEN("Brim is set to 6mm, extrusion width 0.5mm") { Slic3r::Print print; Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { - { "first_layer_extrusion_width", "1" }, - { "brim_width", "6" }, - { "first_layer_extrusion_width", "0.5" } + { "first_layer_extrusion_width", 1 }, + { "brim_width", 6 }, + { "first_layer_extrusion_width", 0.5 } }); print.process(); THEN("Brim Extrusion collection has 12 loops in it") { diff --git a/tests/fff_print/test_printgcode.cpp b/tests/fff_print/test_printgcode.cpp index ec406c0ca..5f47cfb77 100644 --- a/tests/fff_print/test_printgcode.cpp +++ b/tests/fff_print/test_printgcode.cpp @@ -21,10 +21,10 @@ SCENARIO( "PrintGCode basic functionality", "[PrintGCode]") { Slic3r::Print print; Slic3r::Model model; Slic3r::Test::init_print({TestMesh::cube_20x20x20}, print, model, { - { "layer_height", "0.2" }, - { "first_layer_height", "0.2" }, - { "first_layer_extrusion_width", "0" }, - { "gcode_comments", "1" }, + { "layer_height", 0.2 }, + { "first_layer_height", 0.2 }, + { "first_layer_extrusion_width", 0 }, + { "gcode_comments", true }, { "start_gcode", "" } }); std::string gcode = Slic3r::Test::gcode(print); @@ -86,13 +86,13 @@ SCENARIO( "PrintGCode basic functionality", "[PrintGCode]") { Slic3r::Print print; Slic3r::Model model; Slic3r::Test::init_print({TestMesh::cube_20x20x20,TestMesh::cube_20x20x20}, print, model, { - { "first_layer_extrusion_width", "0" }, - { "first_layer_height", "0.3" }, - { "layer_height", "0.2" }, - { "support_material", "0" }, - { "raft_layers", "0" }, - { "complete_objects", "1" }, - { "gcode_comments", "1" }, + { "first_layer_extrusion_width", 0 }, + { "first_layer_height", 0.3 }, + { "layer_height", 0.2 }, + { "support_material", false }, + { "raft_layers", 0 }, + { "complete_objects", true }, + { "gcode_comments", true }, { "between_objects_gcode", "; between-object-gcode" } }); std::string gcode = Slic3r::Test::gcode(print); @@ -154,10 +154,10 @@ SCENARIO( "PrintGCode basic functionality", "[PrintGCode]") { } WHEN("the output is executed with support material") { std::string gcode = ::Test::slice({TestMesh::cube_20x20x20}, { - { "first_layer_extrusion_width", "0" }, - { "support_material", "1" }, - { "raft_layers", "3" }, - { "gcode_comments", "1" } + { "first_layer_extrusion_width", 0 }, + { "support_material", true }, + { "raft_layers", 3 }, + { "gcode_comments", true } }); THEN("Some text output is generated.") { REQUIRE(gcode.size() > 0); @@ -194,8 +194,8 @@ SCENARIO( "PrintGCode basic functionality", "[PrintGCode]") { } WHEN("Cooling is enabled and the fan is disabled.") { std::string gcode = ::Test::slice({ TestMesh::cube_20x20x20 }, { - { "cooling", "1" }, - { "disable_fan_first_layers", "5" } + { "cooling", true }, + { "disable_fan_first_layers", 5 } }); THEN("GCode to disable fan is emitted."){ REQUIRE(gcode.find("M107") != std::string::npos); @@ -204,8 +204,8 @@ SCENARIO( "PrintGCode basic functionality", "[PrintGCode]") { WHEN("end_gcode exists with layer_num and layer_z") { std::string gcode = ::Test::slice({ TestMesh::cube_20x20x20 }, { { "end_gcode", "; Layer_num [layer_num]\n; Layer_z [layer_z]" }, - { "layer_height", "0.1" }, - { "first_layer_height", "0.1" } + { "layer_height", 0.1 }, + { "first_layer_height", 0.1 } }); THEN("layer_num and layer_z are processed in the end gcode") { REQUIRE(gcode.find("; Layer_num 199") != std::string::npos); @@ -226,11 +226,11 @@ SCENARIO( "PrintGCode basic functionality", "[PrintGCode]") { config.set_num_extruders(4); config.set_deserialize({ { "start_gcode", "; Extruder [current_extruder]" }, - { "infill_extruder", "2" }, - { "solid_infill_extruder", "2" }, - { "perimeter_extruder", "2" }, - { "support_material_extruder", "2" }, - { "support_material_interface_extruder", "2" } + { "infill_extruder", 2 }, + { "solid_infill_extruder", 2 }, + { "perimeter_extruder", 2 }, + { "support_material_extruder", 2 }, + { "support_material_interface_extruder", 2 } }); std::string gcode = Slic3r::Test::slice({TestMesh::cube_20x20x20}, config); THEN("current_extruder is processed in the start gcode and set for second extruder") { @@ -241,11 +241,11 @@ SCENARIO( "PrintGCode basic functionality", "[PrintGCode]") { WHEN("layer_num represents the layer's index from z=0") { std::string gcode = ::Test::slice({ TestMesh::cube_20x20x20, TestMesh::cube_20x20x20 }, { - { "complete_objects", "1" }, - { "gcode_comments", "1" }, + { "complete_objects", true }, + { "gcode_comments", true }, { "layer_gcode", ";Layer:[layer_num] ([layer_z] mm)" }, - { "layer_height", "1.0" }, - { "first_layer_height", "1.0" } + { "layer_height", 1.0 }, + { "first_layer_height", 1.0 } }); // End of the 1st object. size_t pos = gcode.find(";Layer:19 "); diff --git a/tests/fff_print/test_printobject.cpp b/tests/fff_print/test_printobject.cpp index 5c8a0ffe7..e7c441e8c 100644 --- a/tests/fff_print/test_printobject.cpp +++ b/tests/fff_print/test_printobject.cpp @@ -10,18 +10,13 @@ using namespace Slic3r::Test; SCENARIO("PrintObject: object layer heights", "[PrintObject]") { GIVEN("20mm cube and default initial config, initial layer height of 2mm") { - Slic3r::DynamicPrintConfig config = Slic3r::DynamicPrintConfig::full_print_config(); - TestMesh m = TestMesh::cube_20x20x20; - Slic3r::Model model; - - config.set_deserialize("first_layer_height", "2"); - WHEN("generate_object_layers() is called for 2mm layer heights and nozzle diameter of 3mm") { - config.opt_float("nozzle_diameter", 0) = 3; - config.opt_float("layer_height") = 2.0; Slic3r::Print print; - Slic3r::Test::init_print({m}, print, model, config); - print.process(); + Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { + { "first_layer_height", 2 }, + { "layer_height", 2 }, + { "nozzle_diameter", 3 } + }); const std::vector<Slic3r::Layer*> &layers = print.objects().front()->layers(); THEN("The output vector has 10 entries") { REQUIRE(layers.size() == 10); @@ -35,11 +30,12 @@ SCENARIO("PrintObject: object layer heights", "[PrintObject]") { } } WHEN("generate_object_layers() is called for 10mm layer heights and nozzle diameter of 11mm") { - config.opt_float("nozzle_diameter", 0) = 11; - config.opt_float("layer_height") = 10; Slic3r::Print print; - Slic3r::Test::init_print({m}, print, model, config); - print.process(); + Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { + { "first_layer_height", 2 }, + { "layer_height", 10 }, + { "nozzle_diameter", 11 } + }); const std::vector<Slic3r::Layer*> &layers = print.objects().front()->layers(); THEN("The output vector has 3 entries") { REQUIRE(layers.size() == 3); @@ -52,11 +48,12 @@ SCENARIO("PrintObject: object layer heights", "[PrintObject]") { } } WHEN("generate_object_layers() is called for 15mm layer heights and nozzle diameter of 16mm") { - config.opt_float("nozzle_diameter", 0) = 16; - config.opt_float("layer_height") = 15.0; Slic3r::Print print; - Slic3r::Test::init_print({m}, print, model, config); - print.process(); + Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { + { "first_layer_height", 2 }, + { "layer_height", 15 }, + { "nozzle_diameter", 16 } + }); const std::vector<Slic3r::Layer*> &layers = print.objects().front()->layers(); THEN("The output vector has 2 entries") { REQUIRE(layers.size() == 2); @@ -70,11 +67,12 @@ SCENARIO("PrintObject: object layer heights", "[PrintObject]") { } #if 0 WHEN("generate_object_layers() is called for 15mm layer heights and nozzle diameter of 5mm") { - config.opt_float("nozzle_diameter", 0) = 5; - config.opt_float("layer_height") = 15.0; Slic3r::Print print; - Slic3r::Test::init_print({m}, print, model, config); - print.process(); + Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, { + { "first_layer_height", 2 }, + { "layer_height", 15 }, + { "nozzle_diameter", 5 } + }); const std::vector<Slic3r::Layer*> &layers = print.objects().front()->layers(); THEN("The layer height is limited to 5mm.") { CHECK(layers.size() == 5); diff --git a/tests/fff_print/test_skirt_brim.cpp b/tests/fff_print/test_skirt_brim.cpp index 831782cdf..e57940575 100644 --- a/tests/fff_print/test_skirt_brim.cpp +++ b/tests/fff_print/test_skirt_brim.cpp @@ -32,12 +32,12 @@ static int get_brim_tool(const std::string &gcode) TEST_CASE("Skirt height is honored") { DynamicPrintConfig config = Slic3r::DynamicPrintConfig::full_print_config(); config.set_deserialize({ - { "skirts", "1" }, - { "skirt_height", "5" }, - { "perimeters", "0" }, - { "support_material_speed", "99" }, + { "skirts", 1 }, + { "skirt_height", 5 }, + { "perimeters", 0 }, + { "support_material_speed", 99 }, // avoid altering speeds unexpectedly - { "cooling", "0" }, + { "cooling", false }, { "first_layer_speed", "100%" } }); @@ -65,22 +65,22 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { DynamicPrintConfig config = Slic3r::DynamicPrintConfig::full_print_config(); config.set_num_extruders(4); config.set_deserialize({ - { "support_material_speed", "99" }, - { "first_layer_height", "0.3" }, - { "gcode_comments", "1" }, + { "support_material_speed", 99 }, + { "first_layer_height", 0.3 }, + { "gcode_comments", true }, // avoid altering speeds unexpectedly - { "cooling", "0" }, + { "cooling", false }, { "first_layer_speed", "100%" }, // remove noise from top/solid layers - { "top_solid_layers", "0" }, - { "bottom_solid_layers", "1" } + { "top_solid_layers", 0 }, + { "bottom_solid_layers", 1 } }); WHEN("Brim width is set to 5") { config.set_deserialize({ - { "perimeters", "0" }, - { "skirts", "0" }, - { "brim_width", "5" } + { "perimeters", 0 }, + { "skirts", 0 }, + { "brim_width", 5 } }); THEN("Brim is generated") { std::string gcode = Slic3r::Test::slice({TestMesh::cube_20x20x20}, config); @@ -100,8 +100,8 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { WHEN("Skirt area is smaller than the brim") { config.set_deserialize({ - { "skirts", "1" }, - { "brim_width", "10"} + { "skirts", 1 }, + { "brim_width", 10} }); THEN("Gcode generates") { REQUIRE(! Slic3r::Test::slice({TestMesh::cube_20x20x20}, config).empty()); @@ -110,8 +110,8 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { WHEN("Skirt height is 0 and skirts > 0") { config.set_deserialize({ - { "skirts", "2" }, - { "skirt_height", "0"} + { "skirts", 2 }, + { "skirt_height", 0 } }); THEN("Gcode generates") { REQUIRE(! Slic3r::Test::slice({TestMesh::cube_20x20x20}, config).empty()); @@ -121,10 +121,10 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { WHEN("Perimeter extruder = 2 and support extruders = 3") { THEN("Brim is printed with the extruder used for the perimeters of first object") { std::string gcode = Slic3r::Test::slice({TestMesh::cube_20x20x20}, { - { "skirts", "0" }, - { "brim_width", "5" }, - { "perimeter_extruder", "2" }, - { "support_material_extruder", "3" } + { "skirts", 0 }, + { "brim_width", 5 }, + { "perimeter_extruder", 2 }, + { "support_material_extruder", 3 } }); int tool = get_brim_tool(gcode); REQUIRE(tool == config.opt_int("perimeter_extruder") - 1); @@ -133,11 +133,11 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { WHEN("Perimeter extruder = 2, support extruders = 3, raft is enabled") { THEN("brim is printed with same extruder as skirt") { std::string gcode = Slic3r::Test::slice({TestMesh::cube_20x20x20}, { - { "skirts", "0" }, - { "brim_width", "5" }, - { "perimeter_extruder", "2" }, - { "support_material_extruder", "3" }, - { "raft_layers", "1" } + { "skirts", 0 }, + { "brim_width", 5 }, + { "perimeter_extruder", 2 }, + { "support_material_extruder", 3 }, + { "raft_layers", 1 } }); int tool = get_brim_tool(gcode); REQUIRE(tool == config.opt_int("support_material_extruder") - 1); @@ -145,9 +145,9 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { } WHEN("brim width to 1 with layer_width of 0.5") { config.set_deserialize({ - { "skirts", "0" }, - { "first_layer_extrusion_width", "0.5" }, - { "brim_width", "1" } + { "skirts", 0 }, + { "first_layer_extrusion_width", 0.5 }, + { "brim_width", 1 } }); THEN("2 brim lines") { Slic3r::Print print; @@ -159,11 +159,11 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { #if 0 WHEN("brim ears on a square") { config.set_deserialize({ - { "skirts", "0" }, - { "first_layer_extrusion_width", "0.5" }, - { "brim_width", "1" }, - { "brim_ears", "1" }, - { "brim_ears_max_angle", "91" } + { "skirts", 0 }, + { "first_layer_extrusion_width", 0.5 }, + { "brim_width", 1 }, + { "brim_ears", 1 }, + { "brim_ears_max_angle", 91 } }); Slic3r::Print print; Slic3r::Test::init_and_process_print({TestMesh::cube_20x20x20}, print, config); @@ -174,11 +174,11 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { WHEN("brim ears on a square but with a too small max angle") { config.set_deserialize({ - { "skirts", "0" }, - { "first_layer_extrusion_width", "0.5" }, - { "brim_width", "1" }, - { "brim_ears", "1" }, - { "brim_ears_max_angle", "89" } + { "skirts", 0 }, + { "first_layer_extrusion_width", 0.5 }, + { "brim_width", 1 }, + { "brim_ears", 1 }, + { "brim_ears_max_angle", 89 } }); THEN("no brim") { Slic3r::Print print; @@ -190,15 +190,15 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") { WHEN("Object is plated with overhang support and a brim") { config.set_deserialize({ - { "layer_height", "0.4" }, - { "first_layer_height", "0.4" }, - { "skirts", "1" }, - { "skirt_distance", "0" }, - { "support_material_speed", "99" }, - { "perimeter_extruder", "1" }, - { "support_material_extruder", "2" }, - { "infill_extruder", "3" }, // ensure that a tool command gets emitted. - { "cooling", "0" }, // to prevent speeds to be altered + { "layer_height", 0.4 }, + { "first_layer_height", 0.4 }, + { "skirts", 1 }, + { "skirt_distance", 0 }, + { "support_material_speed", 99 }, + { "perimeter_extruder", 1 }, + { "support_material_extruder", 2 }, + { "infill_extruder", 3 }, // ensure that a tool command gets emitted. + { "cooling", false }, // to prevent speeds to be altered { "first_layer_speed", "100%" }, // to prevent speeds to be altered }); diff --git a/tests/fff_print/test_support_material.cpp b/tests/fff_print/test_support_material.cpp index 1ccc83aa0..0a38d138e 100644 --- a/tests/fff_print/test_support_material.cpp +++ b/tests/fff_print/test_support_material.cpp @@ -11,8 +11,8 @@ TEST_CASE("SupportMaterial: Three raft layers created", "[SupportMaterial]") { Slic3r::Print print; Slic3r::Test::init_and_process_print({ TestMesh::cube_20x20x20 }, print, { - { "support_material", "1" }, - { "raft_layers", "3" } + { "support_material", 1 }, + { "raft_layers", 3 } }); REQUIRE(print.objects().front()->support_layers().size() == 3); } @@ -72,9 +72,9 @@ SCENARIO("SupportMaterial: support_layers_z and contact_distance", "[SupportMate WHEN("First layer height = 0.4") { Slic3r::Print print; Slic3r::Test::init_and_process_print({ mesh }, print, { - { "support_material", "1" }, - { "layer_height", "0.2" }, - { "first_layer_height", "0.4" }, + { "support_material", 1 }, + { "layer_height", 0.2 }, + { "first_layer_height", 0.4 }, }); bool a, b, c, d; check(print, a, b, c, d); @@ -86,9 +86,9 @@ SCENARIO("SupportMaterial: support_layers_z and contact_distance", "[SupportMate WHEN("Layer height = 0.2 and, first layer height = 0.3") { Slic3r::Print print; Slic3r::Test::init_and_process_print({ mesh }, print, { - { "support_material", "1" }, - { "layer_height", "0.2" }, - { "first_layer_height", "0.3" }, + { "support_material", 1 }, + { "layer_height", 0.2 }, + { "first_layer_height", 0.3 }, }); bool a, b, c, d; check(print, a, b, c, d); @@ -100,9 +100,9 @@ SCENARIO("SupportMaterial: support_layers_z and contact_distance", "[SupportMate WHEN("Layer height = nozzle_diameter[0]") { Slic3r::Print print; Slic3r::Test::init_and_process_print({ mesh }, print, { - { "support_material", "1" }, - { "layer_height", "0.2" }, - { "first_layer_height", "0.3" }, + { "support_material", 1 }, + { "layer_height", 0.2 }, + { "first_layer_height", 0.3 }, }); bool a, b, c, d; check(print, a, b, c, d); |