mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-10 20:41:41 +00:00
* fix: initialize Print::m_isBBLPrinter
Built outside the GUI/CLI (headless tests, embedded use) the member was read
uninitialized: is_BBL_printer()/wipe_tower_type() feed it into ToolOrdering,
which then non-deterministically dropped per-feature filament assignments.
Default it to false, the value the GUI and CLI already assign for non-Bambu
printers.
* docs(test): add the fff_print testing contract
tests/fff_print/README.md codifies how the suite is organized: one file per
subsystem (each owning both in-memory and emitted-G-code assertions), flat
behavioral test names with a single [Subsystem] tag, a robust-tests guide,
the shared helpers, and an add-a-test checklist. Linked from tests/CLAUDE.md.
* test(fff_print): reorganize the suite to the contract and add coverage
Bring every subsystem into one file per the README: rename the test_data
harness to test_helpers; consolidate skirt/brim; split multi-filament and
cooling into their own files; disperse the test_printgcode grab-bag and the
end-to-end smoke scenario into focused tests; fold test_gcode into
test_gcodewriter. Standardize names and tags, align cube tests on the cube()
helper, and de-qualify the flagship files.
New coverage: multi-filament per-feature and per-object routing; a skirt/brim
behavior matrix (the #14333 rework, including brim ears, with regression
coverage for #14319 and #14366); resolved extrusion-width and config
comments; custom-G-code placeholders; fan control and speed-marker
consumption.
Re-enable three slice tests previously tagged [NotWorking]: the clipper
"Coordinate outside allowed range" error that disabled them was specific to a
past CI runner environment and no longer reproduces.
* test(fff_print): tag arm64-flaky skirt/brim tests NotWorking
Four skirt/brim slice tests intermittently throw ClipperLib's "Coordinate
outside allowed range" on the macOS and Windows arm64 CI toolchains (an FP
divergence, not a slicing bug; see PR #14207). Linux x86_64 and aarch64 are
unaffected. Tag them [NotWorking] so ctest -LE NotWorking skips them.
* test(fff_print): re-enable the arm64 skirt/brim tests
These were tagged [NotWorking] as a stopgap when myfork's daily-driver build
combined them with the cross-platform CI on a base that predated upstream's
m_origin fix (99dea01cc3). With upstream merged in, Print::m_origin is
initialized and the "Coordinate outside allowed range" throw is gone, so the
tests pass on macOS/Windows arm64. Drop the tags.
96 lines
4.1 KiB
C++
96 lines
4.1 KiB
C++
#include <catch2/catch_all.hpp>
|
|
|
|
#include "libslic3r/GCodeReader.hpp"
|
|
#include "libslic3r/Layer.hpp"
|
|
|
|
#include "test_helpers.hpp" // get access to init_print, etc
|
|
|
|
using namespace Slic3r::Test;
|
|
using namespace Slic3r;
|
|
|
|
TEST_CASE("Three raft layers are created", "[SupportMaterial]")
|
|
{
|
|
Slic3r::Print print;
|
|
Slic3r::Test::init_and_process_print({ cube(20) }, print, {
|
|
{ "enable_support", 1 },
|
|
{ "raft_layers", 3 }
|
|
});
|
|
REQUIRE(print.objects().front()->support_layers().size() == 3);
|
|
}
|
|
|
|
TEST_CASE("Enforced support layers are generated", "[SupportMaterial]")
|
|
{
|
|
// enforce_support_layers forces support on the first N layers even with support off.
|
|
Slic3r::Print baseline;
|
|
Slic3r::Test::init_and_process_print({ TestMesh::overhang }, baseline, {
|
|
{ "enable_support", 0 },
|
|
{ "enforce_support_layers", 0 }
|
|
});
|
|
REQUIRE(baseline.objects().front()->support_layers().empty());
|
|
|
|
Slic3r::Print enforced;
|
|
Slic3r::Test::init_and_process_print({ TestMesh::overhang }, enforced, {
|
|
{ "enable_support", 0 },
|
|
{ "enforce_support_layers", 100 }
|
|
});
|
|
REQUIRE(enforced.objects().front()->support_layers().size() > 0);
|
|
}
|
|
|
|
SCENARIO("Support layer Z honors contact distance", "[SupportMaterial]")
|
|
{
|
|
// Box h = 20mm, hole bottom at 5mm, hole height 10mm (top edge at 15mm).
|
|
TriangleMesh mesh = Slic3r::Test::mesh(Slic3r::Test::TestMesh::cube_with_hole);
|
|
mesh.rotate_x(float(M_PI / 2));
|
|
|
|
auto check = [](Slic3r::Print &print, bool &first_support_layer_height_ok, bool &layer_height_minimum_ok, bool &layer_height_maximum_ok)
|
|
{
|
|
ConstSupportLayerPtrsAdaptor support_layers = print.objects().front()->support_layers();
|
|
|
|
first_support_layer_height_ok = support_layers.front()->print_z == print.config().initial_layer_print_height.value;
|
|
|
|
layer_height_minimum_ok = true;
|
|
layer_height_maximum_ok = true;
|
|
double min_layer_height = print.config().min_layer_height.values.front();
|
|
double max_layer_height = print.config().nozzle_diameter.values.front();
|
|
if (print.config().max_layer_height.values.front() > EPSILON)
|
|
max_layer_height = std::min(max_layer_height, print.config().max_layer_height.values.front());
|
|
for (size_t i = 1; i < support_layers.size(); ++ i) {
|
|
if (support_layers[i]->print_z - support_layers[i - 1]->print_z < min_layer_height - EPSILON)
|
|
layer_height_minimum_ok = false;
|
|
if (support_layers[i]->print_z - support_layers[i - 1]->print_z > max_layer_height + EPSILON)
|
|
layer_height_maximum_ok = false;
|
|
}
|
|
};
|
|
|
|
GIVEN("A print object having one modelObject") {
|
|
WHEN("Layer height = 0.2 and first layer height = 0.4") {
|
|
Slic3r::Print print;
|
|
Slic3r::Test::init_and_process_print({ mesh }, print, {
|
|
{ "enable_support", 1 },
|
|
{ "layer_height", 0.2 },
|
|
{ "initial_layer_print_height", 0.4 },
|
|
{ "dont_support_bridges", false },
|
|
});
|
|
bool first_layer_ok, layer_min_ok, layer_max_ok;
|
|
check(print, first_layer_ok, layer_min_ok, layer_max_ok);
|
|
THEN("First layer height is honored") { REQUIRE(first_layer_ok == true); }
|
|
THEN("No null or negative support layers") { REQUIRE(layer_min_ok == true); }
|
|
THEN("No layers thicker than nozzle diameter") { REQUIRE(layer_max_ok == true); }
|
|
}
|
|
WHEN("Layer height = 0.2 and first layer height = 0.3") {
|
|
Slic3r::Print print;
|
|
Slic3r::Test::init_and_process_print({ mesh }, print, {
|
|
{ "enable_support", 1 },
|
|
{ "layer_height", 0.2 },
|
|
{ "initial_layer_print_height", 0.3 },
|
|
{ "dont_support_bridges", false },
|
|
});
|
|
bool first_layer_ok, layer_min_ok, layer_max_ok;
|
|
check(print, first_layer_ok, layer_min_ok, layer_max_ok);
|
|
THEN("First layer height is honored") { REQUIRE(first_layer_ok == true); }
|
|
THEN("No null or negative support layers") { REQUIRE(layer_min_ok == true); }
|
|
THEN("No layers thicker than nozzle diameter") { REQUIRE(layer_max_ok == true); }
|
|
}
|
|
}
|
|
}
|