mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-15 16:33:10 +00:00
Revive the disabled fff_print test suite (#14196)
* Fix null-deref and arranger bugs that gate headless slicing tests export_gcode dereferenced a null result out-param, enum serialization dereferenced a null keys_map, and get_arrange_polys left bed_idx unseeded so the arranger dropped items. All only affect the headless test/CLI path. * Fix the headless test harness and add G-code test helpers Use the real arranger, fix temp-file handling with an RAII guard, and add layers_with_role / max_z for inspecting sliced G-code. * Re-enable the Model construction test * Re-enable SupportMaterial tests and add an enforced-support test * Re-enable and extend PrintObject layer-height and perimeter tests * Re-enable Print skirt, brim, and solid-surface tests * Re-enable and extend PrintGCode tests Un-hide the basic scenario (dead-key fixes, reframes, trimmed trivia) and add initial-layer-height, sequential-order, and null-result export tests. * Re-enable and reframe the skirt/brim tests Detect skirt/brim by G-code role comment instead of a sentinel speed, and resolve the previously-unfinished skirt-enclosure test. * Replace the stale lift()/unlift() test with a z_hop test * Delete the stub and broken Flow tests
This commit is contained in:
@@ -6,68 +6,6 @@
|
||||
|
||||
using namespace Slic3r;
|
||||
|
||||
SCENARIO("lift() is not ignored after unlift() at normal values of Z", "[GCodeWriter][.]") {
|
||||
GIVEN("A config from a file and a single extruder.") {
|
||||
GCodeWriter writer;
|
||||
GCodeConfig &config = writer.config;
|
||||
config.load(std::string(TEST_DATA_DIR) + "/fff_print_tests/test_gcodewriter/config_lift_unlift.ini", ForwardCompatibilitySubstitutionRule::Disable);
|
||||
|
||||
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;
|
||||
writer.travel_to_z(trouble_Z);
|
||||
AND_WHEN("GcodeWriter::Lift() is called") {
|
||||
REQUIRE(writer.lazy_lift().size() > 0);
|
||||
AND_WHEN("Z is moved post-lift to the same delta as the config Z lift") {
|
||||
REQUIRE(writer.travel_to_z(trouble_Z + config.z_hop.values[0]).size() == 0);
|
||||
AND_WHEN("GCodeWriter::Unlift() is called") {
|
||||
REQUIRE(writer.unlift().size() == 0); // we're the same height so no additional move happens.
|
||||
THEN("GCodeWriter::Lift() emits gcode.") {
|
||||
REQUIRE(writer.lazy_lift().size() > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
WHEN("Z is set to 500003") {
|
||||
double trouble_Z = 500003;
|
||||
writer.travel_to_z(trouble_Z);
|
||||
AND_WHEN("GcodeWriter::Lift() is called") {
|
||||
REQUIRE(writer.lazy_lift().size() > 0);
|
||||
AND_WHEN("Z is moved post-lift to the same delta as the config Z lift") {
|
||||
REQUIRE(writer.travel_to_z(trouble_Z + config.z_hop.values[0]).size() == 0);
|
||||
AND_WHEN("GCodeWriter::Unlift() is called") {
|
||||
REQUIRE(writer.unlift().size() == 0); // we're the same height so no additional move happens.
|
||||
THEN("GCodeWriter::Lift() emits gcode.") {
|
||||
REQUIRE(writer.lazy_lift().size() > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
WHEN("Z is set to 10.3") {
|
||||
double trouble_Z = 10.3;
|
||||
writer.travel_to_z(trouble_Z);
|
||||
AND_WHEN("GcodeWriter::Lift() is called") {
|
||||
REQUIRE(writer.lazy_lift().size() > 0);
|
||||
AND_WHEN("Z is moved post-lift to the same delta as the config Z lift") {
|
||||
REQUIRE(writer.travel_to_z(trouble_Z + config.z_hop.values[0]).size() == 0);
|
||||
AND_WHEN("GCodeWriter::Unlift() is called") {
|
||||
REQUIRE(writer.unlift().size() == 0); // we're the same height so no additional move happens.
|
||||
THEN("GCodeWriter::Lift() emits gcode.") {
|
||||
REQUIRE(writer.lazy_lift().size() > 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// The test above will fail for trouble_Z == 9007199254740992, where trouble_Z + 1.5 will be rounded to trouble_Z + 2.0 due to double mantisa overflow.
|
||||
}
|
||||
}
|
||||
|
||||
SCENARIO("set_speed emits values with fixed-point output.", "[GCodeWriter]") {
|
||||
|
||||
GIVEN("GCodeWriter instance") {
|
||||
@@ -94,3 +32,28 @@ SCENARIO("set_speed emits values with fixed-point output.", "[GCodeWriter]") {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SCENARIO("z_hop lifts the nozzle when a lift is requested", "[GCodeWriter]") {
|
||||
GIVEN("A writer with the nozzle parked at Z = 10") {
|
||||
GCodeWriter writer;
|
||||
std::vector<unsigned int> extruder_ids { 0 };
|
||||
writer.set_extruders(extruder_ids);
|
||||
writer.set_extruder(0);
|
||||
writer.travel_to_z(10.0);
|
||||
|
||||
WHEN("z_hop is 1 and an eager lift is requested") {
|
||||
writer.config.z_hop.values = { 1.0 };
|
||||
std::string gcode = writer.eager_lift(LiftType::NormalLift);
|
||||
THEN("a Z move up by z_hop is emitted") {
|
||||
REQUIRE_THAT(gcode, Catch::Matchers::ContainsSubstring("Z11"));
|
||||
}
|
||||
}
|
||||
WHEN("z_hop is 0") {
|
||||
writer.config.z_hop.values = { 0.0 };
|
||||
std::string gcode = writer.eager_lift(LiftType::NormalLift);
|
||||
THEN("no lift is emitted") {
|
||||
REQUIRE(gcode.empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user