mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-02 08:31:13 +00:00
CalibPressureAdvancePattern::line_width_first_layer() returned the raw initial_layer_line_width, so a value of 0 (which means "use the default") fed 0 into the Flow spacing math and threw FlowErrorNegativeSpacing, crashing the whole app when slicing a PA pattern calibration. Mirror the guard already present in the sibling line_width(): when the configured width is non-positive, fall back to auto_extrusion_width. Add a libslic3r regression test covering the width resolution. Fixes #13188
41 lines
1.2 KiB
C++
41 lines
1.2 KiB
C++
#include <catch2/catch_all.hpp>
|
|
|
|
#include "libslic3r/calib.hpp"
|
|
#include "libslic3r/Model.hpp"
|
|
#include "libslic3r/TriangleMesh.hpp"
|
|
#include "libslic3r/PrintConfig.hpp"
|
|
|
|
using namespace Slic3r;
|
|
|
|
namespace {
|
|
|
|
// The width-resolution getters are protected; expose them so the resolution can be asserted directly.
|
|
struct PaPatternProbe : public CalibPressureAdvancePattern
|
|
{
|
|
using CalibPressureAdvancePattern::CalibPressureAdvancePattern;
|
|
using CalibPressureAdvancePattern::line_width;
|
|
using CalibPressureAdvancePattern::line_width_first_layer;
|
|
};
|
|
|
|
} // namespace
|
|
|
|
TEST_CASE("Zero calibration line width resolves to a positive default", "[Calib][Regression]")
|
|
{
|
|
DynamicPrintConfig config = DynamicPrintConfig::full_print_config();
|
|
config.set_deserialize_strict({
|
|
{"line_width", "0"},
|
|
{"initial_layer_line_width", "0"},
|
|
});
|
|
|
|
Model model;
|
|
model.add_object("cube", "", make_cube(20, 20, 20))->add_instance();
|
|
|
|
Calib_Params params;
|
|
params.mode = CalibMode::Calib_PA_Pattern;
|
|
|
|
PaPatternProbe pattern(params, config, /* is_bbl_machine */ true, *model.objects.front(), Vec3d(0, 0, 0));
|
|
|
|
REQUIRE(pattern.line_width() > 0.);
|
|
REQUIRE(pattern.line_width_first_layer() > 0.);
|
|
}
|