Fix loading a multi-toolhead 3MF that has no filament_self_index (#16331)

This commit is contained in:
Kris Austin
2026-10-09 22:07:33 -03:00
committed by GitHub
parent 1466c0e57f
commit 4a20168742
2 changed files with 20 additions and 3 deletions
@@ -5888,6 +5888,21 @@ TEST_CASE("A project saved with pressure advance per filament applies it to ever
check_double_vector(petg.opt<ConfigOptionFloatsNullable>("filament_flow_ratio")->values, { 0.97 });
}
TEST_CASE("A multi-toolhead project saved without filament self indices loads every filament", "[Preset][Bundle]")
{
const std::vector<std::string> colors = { "#FF0000", "#000000", "#FFFFFF", "#FFFF00" };
DynamicPrintConfig config = DynamicPrintConfig::full_print_config();
config.opt<ConfigOptionStrings>("filament_colour")->values = colors;
config.opt<ConfigOptionFloats>("nozzle_diameter")->values = std::vector<double>(colors.size(), 0.4);
config.option<ConfigOptionBool>("single_extruder_multi_material")->value = false;
Preset::normalize(config);
PresetBundle bundle;
REQUIRE_NOTHROW(bundle.load_config_model("test.3mf", std::move(config)));
CHECK(bundle.filament_presets.size() == colors.size());
CHECK(bundle.project_config.opt<ConfigOptionStrings>("filament_colour")->values == colors);
}
TEST_CASE("A system preset resolves by name from the bundled profiles", "[Preset][Bundle]")
{
ScopedTemporaryDir temp_dir;