fix test error on Windows ARM64

This commit is contained in:
SoftFever
2026-07-13 23:26:16 +08:00
parent 35ffe49b17
commit 2268544a68

View File

@@ -17,6 +17,16 @@
using namespace Slic3r;
using namespace Slic3r::Test;
// Arrange on a finite bed, not an unbounded InfiniteBed: the latter places items
// near INT64_MIN/4 (~2.3e18), which reaches ClipperLib's coordinate limit and throws
// "Coordinate outside allowed range" on Windows/arm64. A 500x500 bed keeps coordinates
// small while still covering large printers.
static void arrange_objects_on_test_bed(Model &model, const DynamicPrintConfig &config)
{
const BoundingBox bed{Point::new_scale(0., 0.), Point::new_scale(500., 500.)};
arrange_objects(model, bed, ArrangeParams{scaled(min_object_distance(config))});
}
SCENARIO("set_speed emits values with fixed-point output.", "[GCodeWriter]") {
GIVEN("GCodeWriter instance") {
@@ -245,8 +255,7 @@ TEST_CASE("Machine envelope emits max limit among used extruders", "[GCodeWriter
obj2->config.set_key_value("extruder", new ConfigOptionInt(2)); // 0-based index 1
Print print;
arrange_objects(model, InfiniteBed{},
ArrangeParams{scaled(min_object_distance(config))});
arrange_objects_on_test_bed(model, config);
for (auto* mo : model.objects) {
mo->ensure_on_bed();
print.auto_assign_extruders(mo);
@@ -358,7 +367,7 @@ TEST_CASE("EXTRUDER_LIMIT per-extruder clamping and max fallback", "[GCodeWriter
obj2->config.set_key_value("extruder", new ConfigOptionInt(2)); // 0-based index 1
Print print;
arrange_objects(model, InfiniteBed{}, ArrangeParams{scaled(min_object_distance(config))});
arrange_objects_on_test_bed(model, config);
for (auto* mo : model.objects) {
mo->ensure_on_bed();
print.auto_assign_extruders(mo);
@@ -583,7 +592,7 @@ SCENARIO("Change blocks carry consecutive toolchange ordinals without a duplicat
auto slice_to_gcode = [&]() {
Print print;
print.is_BBL_printer() = true;
arrange_objects(model, InfiniteBed{}, ArrangeParams{scaled(min_object_distance(config))});
arrange_objects_on_test_bed(model, config);
for (auto *mo : model.objects) {
mo->ensure_on_bed();
print.auto_assign_extruders(mo);
@@ -644,7 +653,7 @@ SCENARIO("Prime-tower visits without a filament change do not advance the toolch
Print print;
print.is_BBL_printer() = true;
arrange_objects(model, InfiniteBed{}, ArrangeParams{scaled(min_object_distance(config))});
arrange_objects_on_test_bed(model, config);
for (auto *mo : model.objects) {
mo->ensure_on_bed();
print.auto_assign_extruders(mo);