Просмотр исходного кода

Ported test_support_material.cpp from upstream slic3r.
Ported extension of ExtrusionEntityCollection::flatten() to disable
flattening of no_sort() collections.

bubnikv 5 лет назад
Родитель
Сommit
98a71a557b

+ 13 - 1
src/libslic3r/Config.hpp

@@ -1554,7 +1554,19 @@ public:
     // Set a configuration value from a string, it will call an overridable handle_legacy() 
     // to resolve renamed and removed configuration keys.
     bool set_deserialize(const t_config_option_key &opt_key, const std::string &str, bool append = false);
-    struct SetDeserializeItem { std::string opt_key; std::string opt_value; bool append = false; };
+    struct SetDeserializeItem {
+    	SetDeserializeItem(const char *opt_key, const char *opt_value, bool append = false) : opt_key(opt_key), opt_value(opt_value), append(append) {}
+    	SetDeserializeItem(const std::string &opt_key, const std::string &opt_value, bool append = false) : opt_key(opt_key), opt_value(opt_value), append(append) {}
+    	SetDeserializeItem(const char *opt_key, const bool value, bool append = false) : opt_key(opt_key), opt_value(value ? "1" : "0"), append(append) {}
+    	SetDeserializeItem(const std::string &opt_key, const bool value, bool append = false) : opt_key(opt_key), opt_value(value ? "1" : "0"), append(append) {}
+    	SetDeserializeItem(const char *opt_key, const int value, bool append = false) : opt_key(opt_key), opt_value(std::to_string(value)), append(append) {}
+    	SetDeserializeItem(const std::string &opt_key, const int value, bool append = false) : opt_key(opt_key), opt_value(std::to_string(value)), append(append) {}
+    	SetDeserializeItem(const char *opt_key, const float value, bool append = false) : opt_key(opt_key), opt_value(std::to_string(value)), append(append) {}
+    	SetDeserializeItem(const std::string &opt_key, const float value, bool append = false) : opt_key(opt_key), opt_value(std::to_string(value)), append(append) {}
+    	SetDeserializeItem(const char *opt_key, const double value, bool append = false) : opt_key(opt_key), opt_value(std::to_string(value)), append(append) {}
+    	SetDeserializeItem(const std::string &opt_key, const double value, bool append = false) : opt_key(opt_key), opt_value(std::to_string(value)), append(append) {}
+    	std::string opt_key; std::string opt_value; bool append = false;
+    };
     bool set_deserialize(std::initializer_list<SetDeserializeItem> items);
 
     double get_abs_value(const t_config_option_key &opt_key) const;

+ 15 - 7
src/libslic3r/ExtrusionEntityCollection.cpp

@@ -126,18 +126,26 @@ size_t ExtrusionEntityCollection::items_count() const
 }
 
 // Returns a single vector of pointers to all non-collection items contained in this one.
-ExtrusionEntityCollection ExtrusionEntityCollection::flatten() const
+ExtrusionEntityCollection ExtrusionEntityCollection::flatten(bool preserve_ordering) const
 {
 	struct Flatten {
+		Flatten(bool preserve_ordering) : preserve_ordering(preserve_ordering) {}
 		ExtrusionEntityCollection out;
+		bool   					  preserve_ordering;
 		void recursive_do(const ExtrusionEntityCollection &collection) {
-			for (const ExtrusionEntity* entity : collection.entities)
-				if (entity->is_collection())
-					this->recursive_do(*static_cast<const ExtrusionEntityCollection*>(entity));
-				else
-					out.append(*entity);
+		    if (collection.no_sort && preserve_ordering) {
+		    	// Don't flatten whatever happens below this level.
+		    	out.append(collection);
+		    } else {
+				for (const ExtrusionEntity *entity : collection.entities)
+					if (entity->is_collection())
+						this->recursive_do(*static_cast<const ExtrusionEntityCollection*>(entity));
+					else
+						out.append(*entity);
+			}
 		}
-	} flatten;
+	} flatten(preserve_ordering);
+
 	flatten.recursive_do(*this);
     return flatten.out;
 }

+ 9 - 6
src/libslic3r/ExtrusionEntityCollection.hpp

@@ -15,17 +15,17 @@ public:
 
     ExtrusionEntitiesPtr entities;     // we own these entities
     bool no_sort;
-    ExtrusionEntityCollection(): no_sort(false) {};
+    ExtrusionEntityCollection(): no_sort(false) {}
     ExtrusionEntityCollection(const ExtrusionEntityCollection &other) : no_sort(other.no_sort) { this->append(other.entities); }
     ExtrusionEntityCollection(ExtrusionEntityCollection &&other) : entities(std::move(other.entities)), no_sort(other.no_sort) {}
     explicit ExtrusionEntityCollection(const ExtrusionPaths &paths);
     ExtrusionEntityCollection& operator=(const ExtrusionEntityCollection &other);
-    ExtrusionEntityCollection& operator=(ExtrusionEntityCollection &&other) 
+    ExtrusionEntityCollection& operator=(ExtrusionEntityCollection &&other)
         { this->entities = std::move(other.entities); this->no_sort = other.no_sort; return *this; }
     ~ExtrusionEntityCollection() { clear(); }
     explicit operator ExtrusionPaths() const;
     
-    bool is_collection() const { return true; };
+    bool is_collection() const { return true; }
     ExtrusionRole role() const override {
         ExtrusionRole out = erNone;
         for (const ExtrusionEntity *ee : entities) {
@@ -34,8 +34,8 @@ public:
         }
         return out;
     }
-    bool can_reverse() const { return !this->no_sort; };
-    bool empty() const { return this->entities.empty(); };
+    bool can_reverse() const { return !this->no_sort; }
+    bool empty() const { return this->entities.empty(); }
     void clear();
     void swap (ExtrusionEntityCollection &c);
     void append(const ExtrusionEntity &entity) { this->entities.emplace_back(entity.clone()); }
@@ -81,7 +81,10 @@ public:
     Polygons polygons_covered_by_spacing(const float scaled_epsilon = 0.f) const
         { Polygons out; this->polygons_covered_by_spacing(out, scaled_epsilon); return out; }
     size_t items_count() const;
-    ExtrusionEntityCollection flatten() const;
+    /// Returns a flattened copy of this ExtrusionEntityCollection. That is, all of the items in its entities vector are not collections.
+    /// You should be iterating over flatten().entities if you are interested in the underlying ExtrusionEntities (and don't care about hierarchy).
+    /// \param preserve_ordering Flag to method that will flatten if and only if the underlying collection is sortable when True (default: False).
+    ExtrusionEntityCollection flatten(bool preserve_ordering = false) const;
     double min_mm3_per_mm() const;
     double total_volume() const override { double volume=0.; for (const auto& ent : entities) volume+=ent->total_volume(); return volume; }
 

+ 1 - 0
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

+ 85 - 0
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());
+                        }
+                    }
+            }
+        }
+    }
+}

+ 3 - 3
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%" }
 			});

+ 1 - 1
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();

+ 15 - 15
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") {

+ 28 - 28
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 ");

+ 20 - 22
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);

Некоторые файлы не были показаны из-за большого количества измененных файлов