mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-06-20 19:04:06 +00:00
* fix(libnest2d): skip the excluded-region alignment pass when there are none NfpPlacer::finalAlign(), run from clearItems() and the destructor, always ran the "find a best position inside the NFP of fixed items" pass even when no items are fixed. With nothing to avoid, calcnfp() computes the inner-fit NFP of the pile and can feed clipper a coordinate outside its allowed range. On Linux/clang the value stays in range so it went unnoticed; on MSVC the clipper "Coordinate outside allowed range" exception escapes the noexcept destructor and aborts the process (exit 0xC0000409). Build the excluded set up front and only run the pass when it is non-empty. The block exists solely to keep the pile clear of fixed items (excluded regions / wipe tower), so it is a no-op when there are none and the wipe-tower behaviour is unchanged. * test(libnest2d): remove dead nesting tests and split the suite by feature Seven of the suite's hidden [.] test cases drove code paths Orca abandoned at the BambuStudio fork: BottomLeftPlacer (used nowhere in src/) and the stock default NfpPlacer backend, which returns zero bins in Orca. They have been red since the fork and are never registered with ctest. Remove them. Split the 1,000-line libnest2d_tests_main.cpp into per-feature files, per the repo convention, sharing a header for the no-fit-polygon backend setup that every translation unit must agree on (ODR): libnest2d_tests.cpp Item and nest() basics test_geometry.cpp geometry primitives test_nfp.cpp no-fit-polygon machinery libnest2d_test_utils.hpp shared includes and the NFP backend specialisation Along the way: drop a debug exportSVG() helper that only wrote a file on test failure (so the suite never leaves stray assets), convert the deprecated Catch::Approx to WithinRel/WithinAbs matchers, and give the tests descriptive names. * test(libnest2d): add NfpPlacer unit tests NfpPlacer is the placement engine the arranger drives, but the suite only covered the geometry primitives. Add a fixture and five tests that exercise pack()/accept() directly: a single item lands in the bin, an oversized item is rejected, the first item is seeded for every starting point, many items pack without overlap, and the rotation candidates are searched. This lifts nfpplacer.hpp line coverage from 42% to 87% in the libnest2d suite. * test(libslic3r): add arrangement::arrange() integration coverage The libnest2d suite cannot reach Orca's real nesting entry point because it does not link libslic3r. Add test_arrange.cpp driving arrangement::arrange(): items land on the bed and within bounds, do not overlap, are spaced by their inflation, an oversized item stays unplaced, overflow spills onto virtual beds, an empty input is a no-op, and the DONT_ALIGN and USER_DEFINED final-alignment paths are exercised. A self-test guards the overlap check the other cases use.