mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 13:45:59 +08:00
cleaning tests
This commit is contained in:
parent
a3bdc74045
commit
6072f411f2
@ -482,7 +482,6 @@ public:
|
||||
bool
|
||||
arrange(size_t total_parts, const Vec2d &part_size, coordf_t dist, const BoundingBoxf* bb, Pointfs &positions)
|
||||
{
|
||||
std::cout << "calling geometry::arrange()\n";
|
||||
positions.clear();
|
||||
|
||||
Vec2d part = part_size;
|
||||
|
@ -17,7 +17,7 @@ bool file_exists(const std::string& name, const std::string& ext) {
|
||||
filename.append(".");
|
||||
filename.append(ext);
|
||||
|
||||
std::ifstream f(testfile(filename));
|
||||
std::ifstream f{ testfile(filename) };
|
||||
bool result {f.good()};
|
||||
f.close();
|
||||
|
||||
@ -42,7 +42,7 @@ void clean_array(size_t argc, char** argv) {
|
||||
|
||||
SCENARIO( "CLI Export Arguments", "[!mayfail]") {
|
||||
char* args_cli[20];
|
||||
std::vector<std::string> in_args;
|
||||
std::vector<std::string> in_args{};
|
||||
in_args.reserve(20);
|
||||
in_args.emplace_back("gui_test"s);
|
||||
in_args.emplace_back(testfile("test_cli/20mmbox.stl"s));
|
||||
@ -202,7 +202,7 @@ SCENARIO( "CLI Export Arguments", "[!mayfail]") {
|
||||
// Test the --center and --dont-arrange parameters.
|
||||
SCENARIO("CLI positioning arguments") {
|
||||
char* args_cli[20];
|
||||
std::vector<std::string> in_args;
|
||||
std::vector<std::string> in_args{};
|
||||
in_args.reserve(20);
|
||||
in_args.emplace_back("gui_test"s);
|
||||
GIVEN( " 3D Model for a 20mm box, centered around 0,0 and gcode export" ) {
|
||||
@ -210,7 +210,7 @@ SCENARIO("CLI positioning arguments") {
|
||||
in_args.emplace(in_args.cend()-1, "-g");
|
||||
in_args.emplace(in_args.cend()-1, "--load"s);
|
||||
in_args.emplace(in_args.cend()-1, testfile("test_cli/20mmbox_config.ini"));
|
||||
CLI cut;
|
||||
CLI cut{};
|
||||
|
||||
WHEN("--center is supplied with 40,40") {
|
||||
in_args.emplace(in_args.cend()-1, "--center");
|
||||
|
@ -22,16 +22,15 @@ bool test_if_solid_surface_filled(const ExPolygon& expolygon, double flow_spacin
|
||||
// REQUIRE(surface_width % distance == 0);
|
||||
//}
|
||||
Polylines test(const ExPolygon& poly, Fill &filler, const FillParams ¶ms){
|
||||
std::cout << "don't connect? " << (params.dont_connect ? "true" : "false") << "\n";
|
||||
Surface surface{ Slic3r::Surface((stPosTop | stDensSolid), poly) };
|
||||
return filler.fill_surface(&surface, params);
|
||||
}
|
||||
|
||||
TEST_CASE("Fill: Pattern Path Length") {
|
||||
Fill* filler = {Slic3r::Fill::new_from_type("rectilinear")};
|
||||
Fill* filler {Slic3r::Fill::new_from_type("rectilinear")};
|
||||
filler->angle = -(PI) / 2.0;
|
||||
filler->spacing = 5;
|
||||
FillParams params;
|
||||
FillParams params{};
|
||||
params.dont_adjust = true;
|
||||
params.density = filler->spacing / 50.0;
|
||||
//params.endpoints_overlap = false;
|
||||
@ -39,14 +38,14 @@ TEST_CASE("Fill: Pattern Path Length") {
|
||||
|
||||
|
||||
SECTION("Square") {
|
||||
Points test_set;
|
||||
Points test_set{};
|
||||
test_set.reserve(4);
|
||||
Points points {Point(0,0), Point(100,0), Point(100,100), Point(0,100)};
|
||||
Points points {Point{0,0}, Point{100,0}, Point{100,100}, Point{0,100}};
|
||||
for (size_t i = 0; i < 4; ++i) {
|
||||
std::transform(points.cbegin()+i, points.cend(), std::back_inserter(test_set), [] (const Point& a) -> Point { return Point::new_scale(a); } );
|
||||
std::transform(points.cbegin(), points.cbegin()+i, std::back_inserter(test_set), [] (const Point& a) -> Point { return Point::new_scale(a); } );
|
||||
Slic3r::ExPolygon expoly;
|
||||
expoly.contour = Slic3r::Polygon(test_set);
|
||||
Slic3r::ExPolygon expoly{};
|
||||
expoly.contour = Slic3r::Polygon{ test_set };
|
||||
Polylines paths {test(expoly, *filler, params)};
|
||||
REQUIRE(paths.size() == 1); // one continuous path
|
||||
|
||||
@ -59,8 +58,8 @@ TEST_CASE("Fill: Pattern Path Length") {
|
||||
}
|
||||
}
|
||||
SECTION("Diamond with endpoints on grid") {
|
||||
Points points {Point(0,0), Point(100,0), Point(150,50), Point(100,100), Point(0,100), Point(-50,50)};
|
||||
Points test_set;
|
||||
Points points {Point{0,0}, Point{100,0}, Point{150,50}, Point{100,100}, Point{0,100}, Point{-50,50}};
|
||||
Points test_set{};
|
||||
test_set.reserve(6);
|
||||
std::transform(points.cbegin(), points.cend(), std::back_inserter(test_set), [] (const Point& a) -> Point { return Point::new_scale(a); } );
|
||||
Slic3r::ExPolygon expoly;
|
||||
@ -70,12 +69,12 @@ TEST_CASE("Fill: Pattern Path Length") {
|
||||
}
|
||||
|
||||
SECTION("Square with hole") {
|
||||
Points square { Point(0,0), Point(100,0), Point(100,100), Point(0,100)};
|
||||
Points hole {Point(25,25), Point(75,25), Point(75,75), Point(25,75) };
|
||||
Points square { Point{0,0}, Point{100,0}, Point{100,100}, Point{0,100}};
|
||||
Points hole {Point{25,25}, Point{75,25}, Point{75,75}, Point{25,75} };
|
||||
std::reverse(hole.begin(), hole.end());
|
||||
|
||||
Points test_hole;
|
||||
Points test_square;
|
||||
Points test_hole{};
|
||||
Points test_square{};
|
||||
|
||||
std::transform(square.cbegin(), square.cend(), std::back_inserter(test_square), [] (const Point& a) -> Point { return Point::new_scale(a); } );
|
||||
std::transform(hole.cbegin(), hole.cend(), std::back_inserter(test_hole), [] (const Point& a) -> Point { return Point::new_scale(a); } );
|
||||
@ -85,7 +84,7 @@ TEST_CASE("Fill: Pattern Path Length") {
|
||||
FillParams params_local = params;
|
||||
params_local.density = filler->spacing / spacing;
|
||||
filler->angle = angle;
|
||||
Slic3r::ExPolygon e;
|
||||
Slic3r::ExPolygon e{};
|
||||
e.contour = Slic3r::Polygon(test_square);
|
||||
e.holes = Slic3r::Polygons(Slic3r::Polygon(test_hole));
|
||||
Polylines paths {test(e, *filler, params_local)};
|
||||
@ -115,8 +114,8 @@ TEST_CASE("Fill: Pattern Path Length") {
|
||||
filler_local->layer_id = 66;
|
||||
filler_local->z = 20.15;
|
||||
|
||||
Points points {Point(25771516,14142125),Point(14142138,25771515),Point(2512749,14142131),Point(14142125,2512749)};
|
||||
Slic3r::ExPolygon expoly;
|
||||
Points points {Point{25771516,14142125},Point{14142138,25771515},Point{2512749,14142131},Point{14142125,2512749}};
|
||||
Slic3r::ExPolygon expoly{};
|
||||
expoly.contour = Slic3r::Polygon(points);
|
||||
Polylines paths {test(expoly, *filler_local, params_local)};
|
||||
REQUIRE(paths.size() == 1); // one continuous path
|
||||
@ -129,21 +128,21 @@ TEST_CASE("Fill: Pattern Path Length") {
|
||||
|
||||
SECTION("Rotated Square") {
|
||||
Points square { Point::new_scale(0,0), Point::new_scale(50,0), Point::new_scale(50,50), Point::new_scale(0,50)};
|
||||
ExPolygon expolygon;
|
||||
ExPolygon expolygon{};
|
||||
expolygon.contour = Slic3r::Polygon(square);
|
||||
auto filler {Slic3r::Fill::new_from_type("rectilinear")};
|
||||
filler->bounding_box = expolygon.contour.bounding_box();
|
||||
filler->angle = 0;
|
||||
filler->angle = 0.F;
|
||||
|
||||
auto surface {Surface((stPosTop|stDensSolid), expolygon)};
|
||||
auto flow {Slic3r::Flow(0.69, 0.4, 0.50)};
|
||||
Surface surface {(stPosTop|stDensSolid), expolygon};
|
||||
Flow flow {0.69, 0.4, 0.50};
|
||||
|
||||
filler->spacing = flow.spacing();
|
||||
params.density = 1.0;
|
||||
|
||||
for (auto angle : { 0.0, 45.0}) {
|
||||
surface.expolygon.rotate(angle, Point(0,0));
|
||||
auto paths {filler->fill_surface(&surface, params)};
|
||||
surface.expolygon.rotate(angle, Point{0,0});
|
||||
Polylines paths = filler->fill_surface(&surface, params);
|
||||
REQUIRE(paths.size() == 1);
|
||||
}
|
||||
}
|
||||
@ -154,8 +153,8 @@ TEST_CASE("Fill: Pattern Path Length") {
|
||||
Point::new_scale(3116896, 20327272.01297),
|
||||
Point::new_scale(3116896, 9598327.01296997)
|
||||
};
|
||||
Slic3r::ExPolygon expolygon;
|
||||
expolygon.contour = Slic3r::Polygon(points);
|
||||
Slic3r::ExPolygon expolygon{};
|
||||
expolygon.contour = Slic3r::Polygon{ points };
|
||||
|
||||
REQUIRE(test_if_solid_surface_filled(expolygon, 0.55) == true);
|
||||
for (size_t i = 0; i <= 20; ++i)
|
||||
@ -166,23 +165,23 @@ TEST_CASE("Fill: Pattern Path Length") {
|
||||
}
|
||||
SECTION("Solid surface fill") {
|
||||
Points points {
|
||||
Point(59515297,5422499),Point(59531249,5578697),Point(59695801,6123186),
|
||||
Point(59965713,6630228),Point(60328214,7070685),Point(60773285,7434379),
|
||||
Point(61274561,7702115),Point(61819378,7866770),Point(62390306,7924789),
|
||||
Point(62958700,7866744),Point(63503012,7702244),Point(64007365,7434357),
|
||||
Point(64449960,7070398),Point(64809327,6634999),Point(65082143,6123325),
|
||||
Point(65245005,5584454),Point(65266967,5422499),Point(66267307,5422499),
|
||||
Point(66269190,8310081),Point(66275379,17810072),Point(66277259,20697500),
|
||||
Point(65267237,20697500),Point(65245004,20533538),Point(65082082,19994444),
|
||||
Point(64811462,19488579),Point(64450624,19048208),Point(64012101,18686514),
|
||||
Point(63503122,18415781),Point(62959151,18251378),Point(62453416,18198442),
|
||||
Point(62390147,18197355),Point(62200087,18200576),Point(61813519,18252990),
|
||||
Point(61274433,18415918),Point(60768598,18686517),Point(60327567,19047892),
|
||||
Point(59963609,19493297),Point(59695865,19994587),Point(59531222,20539379),
|
||||
Point(59515153,20697500),Point(58502480,20697500),Point(58502480,5422499)
|
||||
Point{59515297,5422499},Point{59531249,5578697},Point{59695801,6123186},
|
||||
Point{59965713,6630228},Point{60328214,7070685},Point{60773285,7434379},
|
||||
Point{61274561,7702115},Point{61819378,7866770},Point{62390306,7924789},
|
||||
Point{62958700,7866744},Point{63503012,7702244},Point{64007365,7434357},
|
||||
Point{64449960,7070398},Point{64809327,6634999},Point{65082143,6123325},
|
||||
Point{65245005,5584454},Point{65266967,5422499},Point{66267307,5422499},
|
||||
Point{66269190,8310081},Point{66275379,17810072},Point{66277259,20697500},
|
||||
Point{65267237,20697500},Point{65245004,20533538},Point{65082082,19994444},
|
||||
Point{64811462,19488579},Point{64450624,19048208},Point{64012101,18686514},
|
||||
Point{63503122,18415781},Point{62959151,18251378},Point{62453416,18198442},
|
||||
Point{62390147,18197355},Point{62200087,18200576},Point{61813519,18252990},
|
||||
Point{61274433,18415918},Point{60768598,18686517},Point{60327567,19047892},
|
||||
Point{59963609,19493297},Point{59695865,19994587},Point{59531222,20539379},
|
||||
Point{59515153,20697500},Point{58502480,20697500},Point{58502480,5422499}
|
||||
};
|
||||
Slic3r::ExPolygon expolygon;
|
||||
expolygon.contour = Slic3r::Polygon(points);
|
||||
expolygon.contour = Slic3r::Polygon{ points };
|
||||
|
||||
REQUIRE(test_if_solid_surface_filled(expolygon, 0.55) == true);
|
||||
REQUIRE(test_if_solid_surface_filled(expolygon, 0.55, PI/2.0) == true);
|
||||
@ -191,8 +190,8 @@ TEST_CASE("Fill: Pattern Path Length") {
|
||||
Points points {
|
||||
Point::new_scale(0,0),Point::new_scale(98,0),Point::new_scale(98,10), Point::new_scale(0,10)
|
||||
};
|
||||
Slic3r::ExPolygon expolygon;
|
||||
expolygon.contour = Slic3r::Polygon(points);
|
||||
Slic3r::ExPolygon expolygon{};
|
||||
expolygon.contour = Slic3r::Polygon{ points };
|
||||
|
||||
REQUIRE(test_if_solid_surface_filled(expolygon, 0.5, 45.0, 0.99) == true);
|
||||
}
|
||||
|
@ -19,17 +19,17 @@ SCENARIO("Extrusion width specifics", "[!mayfail]") {
|
||||
GIVEN("A config with a skirt, brim, some fill density, 3 perimeters, and 1 bottom solid layer and a 20mm cube mesh") {
|
||||
// this is a sharedptr
|
||||
DynamicPrintConfig* config {Slic3r::DynamicPrintConfig::new_from_defaults()};
|
||||
config->set_key_value("skirts", new ConfigOptionInt(1));
|
||||
config->set_key_value("brim_width", new ConfigOptionFloat(2));
|
||||
config->set_key_value("perimeters", new ConfigOptionInt(3));
|
||||
config->set_key_value("fill_density", new ConfigOptionPercent(40));
|
||||
config->set_key_value("first_layer_height", new ConfigOptionFloatOrPercent(100, true));
|
||||
config->set_key_value("skirts", new ConfigOptionInt{1});
|
||||
config->set_key_value{"brim_width", new ConfigOptionFloat{2}};
|
||||
config->set_key_value{"perimeters", new ConfigOptionInt{3}};
|
||||
config->set_key_value{"fill_density", new ConfigOptionPercent{40}};
|
||||
config->set_key_value{"first_layer_height", new ConfigOptionFloatOrPercent{100, true}};
|
||||
|
||||
WHEN("first layer width set to 2mm") {
|
||||
Slic3r::Model model;
|
||||
config->set_key_value("first_layer_extrusion_width", new ConfigOptionFloatOrPercent(2.0, false));
|
||||
config->set_key_value("first_layer_extrusion_width", new ConfigOptionFloatOrPercent{2.0, false});
|
||||
Print print;
|
||||
Slic3r::Test::init_print(print, { TestMesh::cube_20x20x20 }, model, config);
|
||||
Slic3r::Test::init_print{print, { TestMesh::cube_20x20x20 }, model, config};
|
||||
//std::cout << "model pos: " << model.objects.front()->instances.front()->get_offset().x() << ": " << model.objects.front()->instances.front()->get_offset().x() << "\n";
|
||||
//Print print;
|
||||
//for (auto* mo : model.objects)
|
||||
@ -47,9 +47,7 @@ SCENARIO("Extrusion width specifics", "[!mayfail]") {
|
||||
parser.parse_buffer(gcode_from_file, [&E_per_mm_bottom, layer_height] (Slic3r::GCodeReader& self, const Slic3r::GCodeReader::GCodeLine& line)
|
||||
{
|
||||
if (self.z() == Approx(layer_height).margin(0.01)) { // only consider first layer
|
||||
std::cout << "line on first layer : " << line.raw()<<"\n";
|
||||
if (line.extruding(self) && line.dist_XY(self) > 0) {
|
||||
std::cout << "line sextrusion : " << line.dist_E(self) << "\n";
|
||||
E_per_mm_bottom.emplace_back(line.dist_E(self) / line.dist_XY(self));
|
||||
}
|
||||
}
|
||||
@ -104,7 +102,7 @@ SCENARIO(" Bridge flow specifics.", "[!mayfail]") {
|
||||
/// spacing, etc
|
||||
SCENARIO("Flow: Flow math for non-bridges", "[!mayfail]") {
|
||||
GIVEN("Nozzle Diameter of 0.4, a desired width of 1mm and layer height of 0.5") {
|
||||
auto width {ConfigOptionFloatOrPercent(1.0, false)};
|
||||
auto width {ConfigOptionFloatOrPercent{1.0, false}};
|
||||
float spacing {0.4f};
|
||||
float nozzle_diameter {0.4f};
|
||||
float bridge_flow {1.0f};
|
||||
@ -112,12 +110,12 @@ SCENARIO("Flow: Flow math for non-bridges", "[!mayfail]") {
|
||||
|
||||
// Spacing for non-bridges is has some overlap
|
||||
THEN("External perimeter flow has a default spacing fixed to 1.05*nozzle_diameter") {
|
||||
Flow flow {Flow::new_from_config_width(frExternalPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f)};
|
||||
Flow flow {Flow::new_from_config_width(frExternalPerimeter, ConfigOptionFloatOrPercent{0, false}, nozzle_diameter, layer_height, 0.0f)};
|
||||
REQUIRE(flow.spacing() == Approx((1.05f*nozzle_diameter) - layer_height * (1.0 - PI / 4.0)));
|
||||
}
|
||||
|
||||
THEN("Internal perimeter flow has a default spacing fixed to 1.125*nozzle_diameter") {
|
||||
Flow flow {Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f)};
|
||||
Flow flow {Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent{0, false}, nozzle_diameter, layer_height, 0.0f)};
|
||||
REQUIRE(flow.spacing() == Approx((1.125*nozzle_diameter) - layer_height * (1.0 - PI / 4.0)));
|
||||
}
|
||||
THEN("Spacing for supplied width is 0.8927f") {
|
||||
@ -134,22 +132,22 @@ SCENARIO("Flow: Flow math for non-bridges", "[!mayfail]") {
|
||||
WHEN("layer height is set to 0.15") {
|
||||
layer_height = 5.f;
|
||||
THEN("Max width is respected.") {
|
||||
auto flow {Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f)};
|
||||
auto flow {Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent{0, false}, nozzle_diameter, layer_height, 0.0f)};
|
||||
REQUIRE(flow.width <= Approx(1.4*nozzle_diameter));
|
||||
}
|
||||
THEN("Min width is respected") {
|
||||
auto flow{ Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f) };
|
||||
auto flow{ Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent{0, false}, nozzle_diameter, layer_height, 0.0f) };
|
||||
REQUIRE(flow.width >= Approx(1.05*nozzle_diameter));
|
||||
}
|
||||
}
|
||||
WHEN("Layer height is set to 0.3") {
|
||||
layer_height = 0.01f;
|
||||
THEN("Max width is respected.") {
|
||||
auto flow{ Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f) };
|
||||
auto flow{ Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent{0, false}, nozzle_diameter, layer_height, 0.0f) };
|
||||
REQUIRE(flow.width <= Approx(1.4*nozzle_diameter));
|
||||
}
|
||||
THEN("Min width is respected.") {
|
||||
auto flow{ Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent(0, false), nozzle_diameter, layer_height, 0.0f) };
|
||||
auto flow{ Flow::new_from_config_width(frPerimeter, ConfigOptionFloatOrPercent{0, false}, nozzle_diameter, layer_height, 0.0f) };
|
||||
REQUIRE(flow.width >= Approx(1.05*nozzle_diameter));
|
||||
}
|
||||
}
|
||||
@ -175,7 +173,7 @@ SCENARIO("Flow: Flow math for non-bridges", "[!mayfail]") {
|
||||
/// Spacing, width calculation for bridge extrusions
|
||||
SCENARIO("Flow: Flow math for bridges", "[!mayfail]") {
|
||||
GIVEN("Nozzle Diameter of 0.4, a desired width of 1mm and layer height of 0.5") {
|
||||
auto width {ConfigOptionFloatOrPercent(1.0, false)};
|
||||
auto width {ConfigOptionFloatOrPercent{1.0, false}};
|
||||
auto spacing {0.4};
|
||||
auto nozzle_diameter {0.4};
|
||||
auto bridge_flow {1.0};
|
||||
|
@ -11,17 +11,17 @@ using namespace std::literals::string_literals;
|
||||
// can't understand what the test want to test: here we are overflowing the double capacity to break the lift logic...
|
||||
SCENARIO("lift() and unlift() behavior with large values of Z", "[!shouldfail]") {
|
||||
GIVEN("A config from a file and a single extruder.") {
|
||||
GCodeWriter writer;
|
||||
GCodeWriter writer{};
|
||||
GCodeConfig& config {writer.config};
|
||||
config.set_defaults();
|
||||
config.load(std::string(testfile_dir) + "test_gcodewriter/config_lift_unlift.ini"s);
|
||||
config.load(std::string{ testfile_dir } +"test_gcodewriter/config_lift_unlift.ini"s);
|
||||
|
||||
std::vector<unsigned int> extruder_ids {0};
|
||||
writer.set_extruders(extruder_ids);
|
||||
writer.set_extruder(0);
|
||||
|
||||
WHEN("Z is set to 9007199254740992") {
|
||||
double trouble_Z = 9007199254740992;
|
||||
double trouble_Z{ 9007199254740992 };
|
||||
writer.travel_to_z(trouble_Z);
|
||||
AND_WHEN("GcodeWriter::Lift() is called") {
|
||||
REQUIRE(writer.lift().size() > 0);
|
||||
@ -41,17 +41,17 @@ SCENARIO("lift() and unlift() behavior with large values of Z", "[!shouldfail]")
|
||||
|
||||
SCENARIO("lift() is not ignored after unlift() at normal values of Z") {
|
||||
GIVEN("A config from a file and a single extruder.") {
|
||||
GCodeWriter writer;
|
||||
GCodeWriter writer{};
|
||||
GCodeConfig& config {writer.config};
|
||||
config.set_defaults();
|
||||
config.load(std::string(testfile_dir) + "test_gcodewriter/config_lift_unlift.ini"s);
|
||||
config.load(std::string{ testfile_dir } +"test_gcodewriter/config_lift_unlift.ini"s);
|
||||
|
||||
std::vector<unsigned int> extruder_ids {0};
|
||||
writer.set_extruders(extruder_ids);
|
||||
writer.set_extruder(0);
|
||||
|
||||
WHEN("Z is set to 203") {
|
||||
double trouble_Z = 203;
|
||||
double trouble_Z{ 203 };
|
||||
writer.travel_to_z(trouble_Z);
|
||||
AND_WHEN("GcodeWriter::Lift() is called") {
|
||||
REQUIRE(writer.lift().size() > 0);
|
||||
@ -67,7 +67,7 @@ SCENARIO("lift() is not ignored after unlift() at normal values of Z") {
|
||||
}
|
||||
}
|
||||
WHEN("Z is set to 500003") {
|
||||
double trouble_Z = 500003;
|
||||
double trouble_Z{ 500003 };
|
||||
writer.travel_to_z(trouble_Z);
|
||||
AND_WHEN("GcodeWriter::Lift() is called") {
|
||||
REQUIRE(writer.lift().size() > 0);
|
||||
@ -83,7 +83,7 @@ SCENARIO("lift() is not ignored after unlift() at normal values of Z") {
|
||||
}
|
||||
}
|
||||
WHEN("Z is set to 10.3") {
|
||||
double trouble_Z = 10.3;
|
||||
double trouble_Z{ 10.3 };
|
||||
writer.travel_to_z(trouble_Z);
|
||||
AND_WHEN("GcodeWriter::Lift() is called") {
|
||||
REQUIRE(writer.lift().size() > 0);
|
||||
|
@ -13,36 +13,36 @@ using namespace Slic3r;
|
||||
|
||||
TEST_CASE("Polygon::contains works properly", ""){
|
||||
// this test was failing on Windows (GH #1950)
|
||||
auto polygon = Polygon(Points({
|
||||
Point(207802834,-57084522),
|
||||
Point(196528149,-37556190),
|
||||
Point(173626821,-25420928),
|
||||
Point(171285751,-21366123),
|
||||
Point(118673592,-21366123),
|
||||
Point(116332562,-25420928),
|
||||
Point(93431208,-37556191),
|
||||
Point(82156517,-57084523),
|
||||
Point(129714478,-84542120),
|
||||
Point(160244873,-84542120)
|
||||
}));
|
||||
auto point = Point(95706562, -57294774);
|
||||
Polygon polygon{ Points{
|
||||
Point{207802834,-57084522},
|
||||
Point{196528149,-37556190},
|
||||
Point{173626821,-25420928},
|
||||
Point{171285751,-21366123},
|
||||
Point{118673592,-21366123},
|
||||
Point{116332562,-25420928},
|
||||
Point{93431208,-37556191},
|
||||
Point{82156517,-57084523},
|
||||
Point{129714478,-84542120},
|
||||
Point{160244873,-84542120}
|
||||
} };
|
||||
Point point{ 95706562, -57294774 };
|
||||
REQUIRE(polygon.contains(point));
|
||||
}
|
||||
|
||||
SCENARIO("Intersections of line segments"){
|
||||
GIVEN("Integer coordinates"){
|
||||
auto line1 = Line(Point(5,15),Point(30,15));
|
||||
auto line2 = Line(Point(10,20), Point(10,10));
|
||||
Line line1{ Point{5,15},Point{30,15} };
|
||||
Line line2{ Point{10,20}, Point{10,10} };
|
||||
THEN("The intersection is valid"){
|
||||
Point point;
|
||||
line1.intersection(line2,&point);
|
||||
REQUIRE(Point(10,15) == point);
|
||||
REQUIRE(Point{ 10,15 } == point);
|
||||
}
|
||||
}
|
||||
|
||||
GIVEN("Scaled coordinates"){
|
||||
auto line1 = Line(Point(73.6310778185108/0.0000001, 371.74239268924/0.0000001), Point(73.6310778185108/0.0000001, 501.74239268924/0.0000001));
|
||||
auto line2 = Line(Point(75/0.0000001, 437.9853/0.0000001), Point(62.7484/0.0000001, 440.4223/0.0000001));
|
||||
Line line1{ Point{73.6310778185108 / 0.0000001, 371.74239268924 / 0.0000001}, Point{73.6310778185108 / 0.0000001, 501.74239268924 / 0.0000001} };
|
||||
Line line2{ Point{75 / 0.0000001, 437.9853 / 0.0000001}, Point{62.7484 / 0.0000001, 440.4223 / 0.0000001} };
|
||||
THEN("There is still an intersection"){
|
||||
Point point;
|
||||
REQUIRE(line1.intersection(line2,&point));
|
||||
@ -72,8 +72,8 @@ Tests for unused methods still written in perl
|
||||
'polygon_segment_having_point';
|
||||
}
|
||||
{
|
||||
auto point = Point(736310778.185108, 5017423926.8924);
|
||||
auto line = Line(Point((long int) 627484000, (long int) 3695776000), Point((long int) 750000000, (long int)3720147000));
|
||||
auto point = Point{736310778.185108, 5017423926.8924};
|
||||
auto line = Line(Point{(long int} 627484000, (long int) 3695776000), Point{(long int} 750000000, (long int)3720147000));
|
||||
//is Slic3r::Geometry::point_in_segment($point, $line), 0, 'point_in_segment';
|
||||
}
|
||||
|
||||
@ -129,41 +129,41 @@ SCENARIO("polygon_is_convex works"){
|
||||
|
||||
TEST_CASE("Creating a polyline generates the obvious lines"){
|
||||
auto polyline = Polyline();
|
||||
polyline.points = std::vector<Point>({Point(0, 0), Point(10, 0), Point(20, 0)});
|
||||
REQUIRE(polyline.lines().at(0).a == Point(0,0));
|
||||
REQUIRE(polyline.lines().at(0).b == Point(10,0));
|
||||
REQUIRE(polyline.lines().at(1).a == Point(10,0));
|
||||
REQUIRE(polyline.lines().at(1).b == Point(20,0));
|
||||
polyline.points = std::vector<Point>({Point{0, 0}, Point{10, 0}, Point{20, 0}});
|
||||
REQUIRE(polyline.lines().at(0).a == Point{0,0});
|
||||
REQUIRE(polyline.lines().at(0).b == Point{10,0});
|
||||
REQUIRE(polyline.lines().at(1).a == Point{10,0});
|
||||
REQUIRE(polyline.lines().at(1).b == Point{20,0});
|
||||
}
|
||||
|
||||
TEST_CASE("Splitting a Polygon generates a polyline correctly"){
|
||||
auto polygon = Polygon(std::vector<Point>({Point(0, 0), Point(10, 0), Point(5, 5)}));
|
||||
auto polygon = Polygon(std::vector<Point>({Point{0, 0}, Point{10, 0}, Point{5, 5}}));
|
||||
auto split = polygon.split_at_index(1);
|
||||
REQUIRE(split.points[0]==Point(10,0));
|
||||
REQUIRE(split.points[1]==Point(5,5));
|
||||
REQUIRE(split.points[2]==Point(0,0));
|
||||
REQUIRE(split.points[3]==Point(10,0));
|
||||
REQUIRE(split.points[0]==Point{10,0});
|
||||
REQUIRE(split.points[1]==Point{5,5});
|
||||
REQUIRE(split.points[2]==Point{0,0});
|
||||
REQUIRE(split.points[3]==Point{10,0});
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Bounding boxes are scaled appropriately"){
|
||||
auto bb = BoundingBox(std::vector<Point>({Point(0, 1), Point(10, 2), Point(20, 2)}));
|
||||
auto bb = BoundingBox(std::vector<Point>({Point{0, 1}, Point{10, 2}, Point{20, 2}}));
|
||||
bb.scale(2);
|
||||
REQUIRE(bb.min == Point(0,2));
|
||||
REQUIRE(bb.max == Point(40,4));
|
||||
REQUIRE(bb.min == Point{0,2});
|
||||
REQUIRE(bb.max == Point{40,4});
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("Offseting a line generates a polygon correctly"){
|
||||
Polyline tmp({ Point(10,10), Point(20,10) });
|
||||
Polyline tmp({ Point{10,10}, Point{20,10} });
|
||||
Polygon area = offset(tmp,5).at(0);
|
||||
REQUIRE(area.area() == Polygon(std::vector<Point>({Point(10,5),Point(20,5),Point(20,15),Point(10,15)})).area());
|
||||
REQUIRE(area.area() == Polygon(std::vector<Point>({Point{10,5},Point{20,5},Point{20,15},Point{10,15}})).area());
|
||||
}
|
||||
|
||||
SCENARIO("Circle Fit, TaubinFit with Newton's method") {
|
||||
GIVEN("A vector of Pointfs arranged in a half-circle with approximately the same distance R from some point") {
|
||||
Vec2d expected_center(-6, 0);
|
||||
Pointfs sample {Vec2d(6.0, 0), Vec2d(5.1961524, 3), Vec2d(3 ,5.1961524), Vec2d(0, 6.0), Vec2d(-3, 5.1961524), Vec2d(-5.1961524, 3), Vec2d(-6.0, 0)};
|
||||
Pointfs sample {Vec2d{6.0, 0}, Vec2d{5.1961524, 3}, Vec2d{3 ,5.1961524}, Vec2d{0, 6.0}, Vec2d{-3, 5.1961524}, Vec2d{-5.1961524, 3}, Vec2d{-6.0, 0}};
|
||||
std::transform(sample.begin(), sample.end(), sample.begin(), [expected_center] (const Vec2d& a) { return a + expected_center;});
|
||||
|
||||
WHEN("Circle fit is called on the entire array") {
|
||||
@ -190,9 +190,9 @@ SCENARIO("Circle Fit, TaubinFit with Newton's method") {
|
||||
}
|
||||
GIVEN("A vector of Pointfs arranged in a half-circle with approximately the same distance R from some point") {
|
||||
Vec2d expected_center(-3, 9);
|
||||
Pointfs sample {Vec2d(6.0, 0), Vec2d(5.1961524, 3), Vec2d(3 ,5.1961524),
|
||||
Vec2d(0, 6.0),
|
||||
Vec2d(3, 5.1961524), Vec2d(-5.1961524, 3), Vec2d(-6.0, 0)};
|
||||
Pointfs sample {Vec2d{6.0, 0}, Vec2d{5.1961524, 3}, Vec2d{3 ,5.1961524},
|
||||
Vec2d{0, 6.0},
|
||||
Vec2d{3, 5.1961524}, Vec2d{-5.1961524, 3}, Vec2d{-6.0, 0}};
|
||||
|
||||
std::transform(sample.begin(), sample.end(), sample.begin(), [expected_center] (const Vec2d& a) { return a + expected_center;});
|
||||
|
||||
@ -256,7 +256,7 @@ SCENARIO("Circle Fit, TaubinFit with Newton's method") {
|
||||
TEST_CASE("Chained path working correctly"){
|
||||
// if chained_path() works correctly, these points should be joined with no diagonal paths
|
||||
// (thus 26 units long)
|
||||
std::vector<Point> points = {Point(26,26),Point(52,26),Point(0,26),Point(26,52),Point(26,0),Point(0,52),Point(52,52),Point(52,0)};
|
||||
std::vector<Point> points = {Point{26,26},Point{52,26},Point{0,26},Point{26,52},Point{26,0},Point{0,52},Point{52,52},Point{52,0}};
|
||||
std::vector<Points::size_type> indices;
|
||||
Geometry::chained_path(points,indices);
|
||||
for(Points::size_type i = 0; i < indices.size()-1;i++){
|
||||
@ -267,27 +267,27 @@ TEST_CASE("Chained path working correctly"){
|
||||
|
||||
SCENARIO("Line distances"){
|
||||
GIVEN("A line"){
|
||||
auto line = Line(Point(0, 0), Point(20, 0));
|
||||
Line line{ Point{0, 0}, Point{20, 0} };
|
||||
THEN("Points on the line segment have 0 distance"){
|
||||
REQUIRE(Point(0, 0).distance_to(line) == 0);
|
||||
REQUIRE(Point(20, 0).distance_to(line) == 0);
|
||||
REQUIRE(Point(10, 0).distance_to(line) == 0);
|
||||
REQUIRE(Point{0, 0}.distance_to(line) == 0);
|
||||
REQUIRE(Point{20, 0}.distance_to(line) == 0);
|
||||
REQUIRE(Point{10, 0}.distance_to(line) == 0);
|
||||
|
||||
}
|
||||
THEN("Points off the line have the appropriate distance"){
|
||||
REQUIRE(Point(10, 10).distance_to(line) == 10);
|
||||
REQUIRE(Point(50, 0).distance_to(line) == 30);
|
||||
REQUIRE(Point{10, 10}.distance_to(line) == 10);
|
||||
REQUIRE(Point{50, 0}.distance_to(line) == 30);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCENARIO("Polygon convex/concave detection"){
|
||||
GIVEN(("A Square with dimension 100")){
|
||||
auto square = Polygon /*new_scale*/(std::vector<Point>({
|
||||
Point(100,100),
|
||||
Point(200,100),
|
||||
Point(200,200),
|
||||
Point(100,200)}));
|
||||
Polygon square/*new_scale*/{ std::vector<Point>{
|
||||
Point{100,100},
|
||||
Point{200,100},
|
||||
Point{200,200},
|
||||
Point{100,200}}};
|
||||
THEN("It has 4 convex points counterclockwise"){
|
||||
REQUIRE(square.concave_points(PI*4/3).size() == 0);
|
||||
REQUIRE(square.convex_points(PI*2/3).size() == 4);
|
||||
@ -299,24 +299,24 @@ SCENARIO("Polygon convex/concave detection"){
|
||||
}
|
||||
}
|
||||
GIVEN("A Square with an extra colinearvertex"){
|
||||
auto square = Polygon /*new_scale*/(std::vector<Point>({
|
||||
Point(150,100),
|
||||
Point(200,100),
|
||||
Point(200,200),
|
||||
Point(100,200),
|
||||
Point(100,100)}));
|
||||
Polygon square /*new_scale*/{ std::vector<Point>{
|
||||
Point{150,100},
|
||||
Point{200,100},
|
||||
Point{200,200},
|
||||
Point{100,200},
|
||||
Point{100,100}} };
|
||||
THEN("It has 4 convex points counterclockwise"){
|
||||
REQUIRE(square.concave_points(PI*4/3).size() == 0);
|
||||
REQUIRE(square.convex_points(PI*2/3).size() == 4);
|
||||
}
|
||||
}
|
||||
GIVEN("A Square with an extra collinear vertex in different order"){
|
||||
auto square = Polygon /*new_scale*/(std::vector<Point>({
|
||||
Point(200,200),
|
||||
Point(100,200),
|
||||
Point(100,100),
|
||||
Point(150,100),
|
||||
Point(200,100)}));
|
||||
Polygon square = Polygon /*new_scale*/{ std::vector<Point>{
|
||||
Point{200,200},
|
||||
Point{100,200},
|
||||
Point{100,100},
|
||||
Point{150,100},
|
||||
Point{200,100}} };
|
||||
THEN("It has 4 convex points counterclockwise"){
|
||||
REQUIRE(square.concave_points(PI*4/3).size() == 0);
|
||||
REQUIRE(square.convex_points(PI*2/3).size() == 4);
|
||||
@ -324,11 +324,11 @@ SCENARIO("Polygon convex/concave detection"){
|
||||
}
|
||||
|
||||
GIVEN("A triangle"){
|
||||
auto triangle = Polygon(std::vector<Point>({
|
||||
Point(16000170,26257364),
|
||||
Point(714223,461012),
|
||||
Point(31286371,461008)
|
||||
}));
|
||||
Polygon triangle{ std::vector<Point>{
|
||||
Point{16000170,26257364},
|
||||
Point{714223,461012},
|
||||
Point{31286371,461008}
|
||||
} };
|
||||
THEN("it has three convex vertices"){
|
||||
REQUIRE(triangle.concave_points(PI*4/3).size() == 0);
|
||||
REQUIRE(triangle.convex_points(PI*2/3).size() == 3);
|
||||
@ -336,12 +336,12 @@ SCENARIO("Polygon convex/concave detection"){
|
||||
}
|
||||
|
||||
GIVEN("A triangle with an extra collinear point"){
|
||||
auto triangle = Polygon(std::vector<Point>({
|
||||
Point(16000170,26257364),
|
||||
Point(714223,461012),
|
||||
Point(20000000,461012),
|
||||
Point(31286371,461012)
|
||||
}));
|
||||
Polygon triangle{ std::vector<Point>{
|
||||
Point{16000170,26257364},
|
||||
Point{714223,461012},
|
||||
Point{20000000,461012},
|
||||
Point{31286371,461012}
|
||||
} };
|
||||
THEN("it has three convex vertices"){
|
||||
REQUIRE(triangle.concave_points(PI*4/3).size() == 0);
|
||||
REQUIRE(triangle.convex_points(PI*2/3).size() == 3);
|
||||
@ -350,16 +350,16 @@ SCENARIO("Polygon convex/concave detection"){
|
||||
GIVEN("A polygon with concave vertices with angles of specifically 4/3pi"){
|
||||
// Two concave vertices of this polygon have angle = PI*4/3, so this test fails
|
||||
// if epsilon is not used.
|
||||
auto polygon = Polygon(std::vector<Point>({
|
||||
Point(60246458,14802768),Point(64477191,12360001),
|
||||
Point(63727343,11060995),Point(64086449,10853608),
|
||||
Point(66393722,14850069),Point(66034704,15057334),
|
||||
Point(65284646,13758387),Point(61053864,16200839),
|
||||
Point(69200258,30310849),Point(62172547,42483120),
|
||||
Point(61137680,41850279),Point(67799985,30310848),
|
||||
Point(51399866,1905506),Point(38092663,1905506),
|
||||
Point(38092663,692699),Point(52100125,692699)
|
||||
}));
|
||||
Polygon polygon{ std::vector<Point>{
|
||||
Point{60246458,14802768},Point{64477191,12360001},
|
||||
Point{63727343,11060995},Point{64086449,10853608},
|
||||
Point{66393722,14850069},Point{66034704,15057334},
|
||||
Point{65284646,13758387},Point{61053864,16200839},
|
||||
Point{69200258,30310849},Point{62172547,42483120},
|
||||
Point{61137680,41850279},Point{67799985,30310848},
|
||||
Point{51399866,1905506},Point{38092663,1905506},
|
||||
Point{38092663,692699},Point{52100125,692699}
|
||||
} };
|
||||
THEN("the correct number of points are detected"){
|
||||
REQUIRE(polygon.concave_points(PI*4/3).size() == 6);
|
||||
REQUIRE(polygon.convex_points(PI*2/3).size() == 10);
|
||||
@ -368,9 +368,9 @@ SCENARIO("Polygon convex/concave detection"){
|
||||
}
|
||||
|
||||
TEST_CASE("Triangle Simplification does not result in less than 3 points"){
|
||||
auto triangle = Polygon(std::vector<Point>({
|
||||
Point(16000170,26257364), Point(714223,461012), Point(31286371,461008)
|
||||
}));
|
||||
Polygon triangle{ std::vector<Point>{
|
||||
Point{16000170,26257364}, Point{714223,461012}, Point{31286371,461008}
|
||||
} };
|
||||
REQUIRE(triangle.simplify(250000).at(0).points.size() == 3);
|
||||
}
|
||||
|
||||
|
@ -8,12 +8,12 @@ using namespace Slic3r::Test;
|
||||
|
||||
SCENARIO("Model construction") {
|
||||
GIVEN("A Slic3r Model") {
|
||||
Model model;
|
||||
Model model{};
|
||||
TriangleMesh sample_mesh = make_cube(20,20,20);
|
||||
sample_mesh.repair();
|
||||
|
||||
DynamicPrintConfig *config = Slic3r::DynamicPrintConfig::new_from_defaults();
|
||||
Slic3r::Print print;
|
||||
Slic3r::Print print{};
|
||||
print.apply_config(*config);
|
||||
//Slic3r::Test::init_print(print, { sample_mesh }, model, config);
|
||||
|
||||
@ -44,7 +44,7 @@ SCENARIO("Model construction") {
|
||||
print.apply(model, *config);
|
||||
print.validate();
|
||||
THEN("Print works?") {
|
||||
std::string gcode_filepath("");
|
||||
std::string gcode_filepath{ "" };
|
||||
Slic3r::Test::gcode(gcode_filepath, print);
|
||||
std::cout << "gcode generation done\n";
|
||||
std::string gcode_from_file = read_to_string(gcode_filepath);
|
||||
|
@ -11,15 +11,11 @@ SCENARIO("PrintObject: Perimeter generation") {
|
||||
GIVEN("20mm cube and default config") {
|
||||
DynamicPrintConfig *config = Slic3r::DynamicPrintConfig::new_from_defaults();
|
||||
TestMesh m = TestMesh::cube_20x20x20;
|
||||
Model model;
|
||||
unsigned int event_counter = 0U;
|
||||
std::string stage;
|
||||
int value = 0;
|
||||
auto callback {[&event_counter, &stage, &value] (int a, const char* b) { stage = std::string(b); event_counter++; value = a; }};
|
||||
Model model{};
|
||||
config->set_key_value("fill_density", new ConfigOptionPercent(0));
|
||||
|
||||
WHEN("make_perimeters() is called") {
|
||||
Print print;
|
||||
Print print{};
|
||||
Slic3r::Test::init_print(print, { m }, model, config);
|
||||
PrintObject& object = *(print.objects().at(0));
|
||||
print.process();
|
||||
@ -36,8 +32,8 @@ SCENARIO("PrintObject: Perimeter generation") {
|
||||
}
|
||||
THEN("Every layer (but top) in region 0 has 3 paths in its perimeters list.") {
|
||||
LayerPtrs layers = object.layers();
|
||||
for (auto layer = layers.begin(); layer != layers.end() - 1; ++layer) {
|
||||
REQUIRE((*layer)->regions()[0]->perimeters.items_count() == 3);
|
||||
for (auto it_layer = layers.begin(); it_layer != layers.end() - 1; ++it_layer) {
|
||||
REQUIRE((*it_layer)->regions()[0]->perimeters.items_count() == 3);
|
||||
}
|
||||
}
|
||||
THEN("Top layer in region 0 has 1 path in its perimeters list (only 1 perimeter on top).") {
|
||||
@ -51,15 +47,12 @@ SCENARIO("Print: Skirt generation") {
|
||||
GIVEN("20mm cube and default config") {
|
||||
DynamicPrintConfig *config = Slic3r::DynamicPrintConfig::new_from_defaults();
|
||||
TestMesh m = TestMesh::cube_20x20x20;
|
||||
Slic3r::Model model;
|
||||
unsigned int event_counter = 0U;
|
||||
std::string stage;
|
||||
int value = 0;
|
||||
Slic3r::Model model{};
|
||||
config->set_key_value("skirt_height", new ConfigOptionInt(1));
|
||||
config->set_key_value("skirt_distance", new ConfigOptionFloat(1));
|
||||
WHEN("Skirts is set to 2 loops") {
|
||||
config->set_key_value("skirts", new ConfigOptionInt(2));
|
||||
Print print;
|
||||
Print print{};
|
||||
Slic3r::Test::init_print(print, { m }, model, config);
|
||||
print.process();
|
||||
THEN("Skirt Extrusion collection has 2 loops in it") {
|
||||
@ -74,14 +67,11 @@ SCENARIO("Print: Brim generation") {
|
||||
GIVEN("20mm cube and default config, 1mm first layer width") {
|
||||
DynamicPrintConfig *config = Slic3r::DynamicPrintConfig::new_from_defaults();
|
||||
TestMesh m = TestMesh::cube_20x20x20;
|
||||
Slic3r::Model model;
|
||||
unsigned int event_counter = 0U;
|
||||
std::string stage;
|
||||
int value = 0;
|
||||
Slic3r::Model model{};
|
||||
config->set_key_value("first_layer_extrusion_width", new ConfigOptionFloatOrPercent(1, false));
|
||||
WHEN("Brim is set to 3mm") {
|
||||
config->set_key_value("brim_width", new ConfigOptionFloat(3));
|
||||
Print print;
|
||||
Print print{};
|
||||
Slic3r::Test::init_print(print, { m }, model, config);
|
||||
print.process();
|
||||
THEN("Brim Extrusion collection has 3 loops in it") {
|
||||
@ -90,7 +80,7 @@ SCENARIO("Print: Brim generation") {
|
||||
}
|
||||
WHEN("Brim is set to 6mm") {
|
||||
config->set_key_value("brim_width", new ConfigOptionFloat(6));
|
||||
Print print;
|
||||
Print print{};
|
||||
Slic3r::Test::init_print(print, { m }, model, config);
|
||||
print.process();
|
||||
THEN("Brim Extrusion collection has 6 loops in it") {
|
||||
@ -100,7 +90,7 @@ SCENARIO("Print: Brim generation") {
|
||||
WHEN("Brim is set to 6mm, extrusion width 0.5mm") {
|
||||
config->set_key_value("brim_width", new ConfigOptionFloat(6));
|
||||
config->set_key_value("first_layer_extrusion_width", new ConfigOptionFloatOrPercent(0.5, false));
|
||||
Print print;
|
||||
Print print{};
|
||||
Slic3r::Test::init_print(print, { m }, model, config);
|
||||
print.process();
|
||||
double nbLoops = 6.0 / print.brim_flow().spacing();
|
||||
@ -108,5 +98,15 @@ SCENARIO("Print: Brim generation") {
|
||||
REQUIRE(print.brim().items_count() == floor(nbLoops));
|
||||
}
|
||||
}
|
||||
WHEN("Brim ears activated, 3mm") {
|
||||
config->set_key_value("brim_width", new ConfigOptionFloat(3));
|
||||
config->set_key_value("brim_ears", new ConfigOptionBool(true));
|
||||
Print print{};
|
||||
Slic3r::Test::init_print(print, { m }, model, config);
|
||||
print.process();
|
||||
THEN("Brim ears Extrusion collection has 4 extrusions in it") {
|
||||
REQUIRE(print.brim().items_count() == 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user