Ported test_support_material.cpp from upstream slic3r.

Ported extension of ExtrusionEntityCollection::flatten() to disable
flattening of no_sort() collections.
This commit is contained in:
bubnikv 2019-10-17 19:09:24 +02:00
parent f9710eff08
commit 98a71a557b
12 changed files with 250 additions and 143 deletions

View file

@ -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);