fff_print: a maintainable testing framework (proposal + coverage) (#14426)

* 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.
This commit is contained in:
raistlin7447
2026-07-06 09:24:24 -05:00
committed by GitHub
parent a1ff45284c
commit 29f31b9b38
21 changed files with 1260 additions and 1034 deletions

View File

@@ -12,14 +12,14 @@
#include <chrono>
//#include "test_options.hpp"
#include "test_data.hpp"
#include "test_helpers.hpp"
using namespace Slic3r;
using namespace std;
static inline TriangleMesh make_cube() { return make_cube(20., 20, 20); }
SCENARIO( "TriangleMesh: Basic mesh statistics") {
SCENARIO("Basic mesh statistics", "[TriangleMesh]") {
GIVEN( "A 20mm cube, built from constexpr std::array" ) {
std::vector<Vec3f> vertices { {20,20,0}, {20,0,0}, {0,0,0}, {0,20,0}, {20,20,20}, {0,20,20}, {0,0,20}, {20,0,20} };
std::vector<Vec3i32> facets { {0,1,2}, {0,2,3}, {4,5,6}, {4,6,7}, {0,4,7}, {0,7,1}, {1,7,6}, {1,6,2}, {2,6,5}, {2,5,3}, {4,0,3}, {4,3,5} };
@@ -71,7 +71,7 @@ SCENARIO( "TriangleMesh: Basic mesh statistics") {
}
}
SCENARIO( "TriangleMesh: Transformation functions affect mesh as expected.") {
SCENARIO("Transformation functions affect the mesh as expected", "[TriangleMesh]") {
GIVEN( "A 20mm cube with one corner on the origin") {
auto cube = make_cube();
@@ -134,7 +134,7 @@ SCENARIO( "TriangleMesh: Transformation functions affect mesh as expected.") {
}
}
SCENARIO( "TriangleMesh: slice behavior.") {
SCENARIO("Slice behavior", "[TriangleMesh]") {
GIVEN( "A 20mm cube with one corner on the origin") {
auto cube = make_cube();
@@ -177,7 +177,7 @@ SCENARIO( "TriangleMesh: slice behavior.") {
}
}
SCENARIO( "make_xxx functions produce meshes.") {
SCENARIO("make_xxx functions produce meshes", "[TriangleMesh]") {
GIVEN("make_cube() function") {
WHEN("make_cube() is called with arguments 20,20,20") {
TriangleMesh cube = make_cube(20,20,20);
@@ -232,7 +232,7 @@ SCENARIO( "make_xxx functions produce meshes.") {
}
}
SCENARIO( "TriangleMesh: split functionality.") {
SCENARIO("Split functionality", "[TriangleMesh]") {
GIVEN( "A 20mm cube with one corner on the origin") {
auto cube = make_cube();
WHEN( "The mesh is split into its component parts.") {
@@ -260,7 +260,7 @@ SCENARIO( "TriangleMesh: split functionality.") {
}
}
SCENARIO( "TriangleMesh: Mesh merge functions") {
SCENARIO("Mesh merge functions", "[TriangleMesh]") {
GIVEN( "Two 20mm cubes, each with one corner on the origin") {
auto cube = make_cube();
TriangleMesh cube2(cube);
@@ -274,7 +274,7 @@ SCENARIO( "TriangleMesh: Mesh merge functions") {
}
}
SCENARIO( "TriangleMeshSlicer: Cut behavior.") {
SCENARIO("Cut behavior", "[TriangleMesh]") {
GIVEN( "A 20mm cube with one corner on the origin") {
auto cube = make_cube();
WHEN( "Object is cut at the bottom") {
@@ -302,7 +302,7 @@ SCENARIO( "TriangleMeshSlicer: Cut behavior.") {
}
}
#ifdef TEST_PERFORMANCE
TEST_CASE("Regression test for issue #4486 - files take forever to slice") {
TEST_CASE("Large mesh slices within the time budget (#4486)", "[TriangleMesh][Regression]") {
TriangleMesh mesh;
DynamicPrintConfig config = Slic3r::DynamicPrintConfig::full_print_config();
mesh.ReadSTLFile(std::string(testfile_dir) + "test_trianglemesh/4486/100_000.stl");
@@ -329,7 +329,7 @@ TEST_CASE("Regression test for issue #4486 - files take forever to slice") {
#endif // TEST_PERFORMANCE
#ifdef BUILD_PROFILE
TEST_CASE("Profile test for issue #4486 - files take forever to slice") {
TEST_CASE("Large mesh slicing profile (#4486)", "[TriangleMesh][Profile]") {
TriangleMesh mesh;
DynamicPrintConfig config = Slic3r::DynamicPrintConfig::full_print_config();
mesh.ReadSTLFile(std::string(testfile_dir) + "test_trianglemesh/4486/10_000.stl");