Add test for layer_num value being the layer index

This commit is contained in:
Nick Neisen 2019-08-30 16:38:06 -06:00 committed by Joseph Lenox
parent 5f40e723a5
commit 46cd5689bc

View File

@ -248,6 +248,25 @@ SCENARIO( "PrintGCode basic functionality") {
} }
} }
WHEN("layer_num represents the layer's index from z=0") {
config->set("layer_gcode", ";Layer:[layer_num] ([layer_z] mm)");
config->set("layer_height", 1.0);
config->set("first_layer_height", 1.0);
Slic3r::Model model;
auto print {Slic3r::Test::init_print({TestMesh::cube_20x20x20,TestMesh::cube_20x20x20}, model, config)};
Slic3r::Test::gcode(gcode, print);
auto exported {gcode.str()};
int count = 2;
for(int pos = 0; pos != std::string::npos; count--)
pos = exported.find(";Layer:38 (20 mm)", pos+1);
THEN("layer_num and layer_z are processed in the end gcode") {\
REQUIRE(count == -1);
}
}
gcode.clear(); gcode.clear();
} }
} }