New functions for variable offsets of polygons / expolygons.

Test cases for the above.
Improvements of older test cases.
This commit is contained in:
bubnikv 2019-10-25 13:34:37 +02:00
parent 18bbefcd61
commit 5e8572a196
8 changed files with 565 additions and 27 deletions

View file

@ -95,7 +95,6 @@ SCENARIO(" Bridge flow specifics.", "[Flow]") {
SCENARIO("Flow: Flow math for non-bridges", "[Flow]") {
GIVEN("Nozzle Diameter of 0.4, a desired width of 1mm and layer height of 0.5") {
ConfigOptionFloatOrPercent width(1.0, false);
float spacing = 0.4f;
float nozzle_diameter = 0.4f;
float bridge_flow = 0.f;
float layer_height = 0.5f;
@ -119,7 +118,6 @@ SCENARIO("Flow: Flow math for non-bridges", "[Flow]") {
}
/// Check the min/max
GIVEN("Nozzle Diameter of 0.25") {
float spacing = 0.4f;
float nozzle_diameter = 0.25f;
float bridge_flow = 0.f;
float layer_height = 0.5f;
@ -161,7 +159,6 @@ SCENARIO("Flow: Flow math for non-bridges", "[Flow]") {
SCENARIO("Flow: Flow math for bridges", "[Flow]") {
GIVEN("Nozzle Diameter of 0.4, a desired width of 1mm and layer height of 0.5") {
auto width = ConfigOptionFloatOrPercent(1.0, false);
float spacing = 0.4f;
float nozzle_diameter = 0.4f;
float bridge_flow = 1.0f;
float layer_height = 0.5f;

View file

@ -14,8 +14,8 @@ using namespace Slic3r;
/// Helper method to find the tool used for the brim (always the first extrusion)
static int get_brim_tool(const std::string &gcode)
{
int brim_tool = -1;
int tool = -1;
int brim_tool = -1;
int tool = -1;
GCodeReader parser;
parser.parse_buffer(gcode, [&tool, &brim_tool] (Slic3r::GCodeReader &self, const Slic3r::GCodeReader::GCodeLine &line)
{
@ -29,7 +29,7 @@ static int get_brim_tool(const std::string &gcode)
return brim_tool;
}
TEST_CASE("Skirt height is honored") {
TEST_CASE("Skirt height is honored", "[Skirt]") {
DynamicPrintConfig config = Slic3r::DynamicPrintConfig::full_print_config();
config.set_deserialize({
{ "skirts", 1 },
@ -60,7 +60,7 @@ TEST_CASE("Skirt height is honored") {
REQUIRE(layers_with_skirt.size() == (size_t)config.opt_int("skirt_height"));
}
SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") {
SCENARIO("Original Slic3r Skirt/Brim tests", "[SkirtBrim]") {
GIVEN("A default configuration") {
DynamicPrintConfig config = Slic3r::DynamicPrintConfig::full_print_config();
config.set_num_extruders(4);
@ -73,7 +73,8 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") {
{ "first_layer_speed", "100%" },
// remove noise from top/solid layers
{ "top_solid_layers", 0 },
{ "bottom_solid_layers", 1 }
{ "bottom_solid_layers", 1 },
{ "start_gcode", "T[initial_tool]\n" }
});
WHEN("Brim width is set to 5") {
@ -120,25 +121,29 @@ 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}, {
config.set_deserialize({
{ "skirts", 0 },
{ "brim_width", 5 },
{ "perimeter_extruder", 2 },
{ "support_material_extruder", 3 }
});
{ "support_material_extruder", 3 },
{ "infill_extruder", 4 }
});
std::string gcode = Slic3r::Test::slice({TestMesh::cube_20x20x20}, config);
int tool = get_brim_tool(gcode);
REQUIRE(tool == config.opt_int("perimeter_extruder") - 1);
}
}
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 }
});
config.set_deserialize({
{ "skirts", 0 },
{ "brim_width", 5 },
{ "perimeter_extruder", 2 },
{ "support_material_extruder", 3 },
{ "infill_extruder", 4 },
{ "raft_layers", 1 }
});
std::string gcode = Slic3r::Test::slice({TestMesh::cube_20x20x20}, config);
int tool = get_brim_tool(gcode);
REQUIRE(tool == config.opt_int("support_material_extruder") - 1);
}
@ -200,6 +205,7 @@ SCENARIO("Original Slic3r Skirt/Brim tests", "[!mayfail]") {
{ "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
{ "start_gcode", "T[initial_tool]\n" }
});
THEN("overhang generates?") {