fix: preset overrides on sidebar

This commit is contained in:
Ian Chua
2026-07-14 12:57:06 +08:00
parent 796080ff76
commit 86a4cec753
10 changed files with 181 additions and 71 deletions

View File

@@ -73,3 +73,19 @@ TEST_CASE("referenced_capabilities skips malformed manifest entries", "[PluginRe
CHECK(capability_names(referenced_capabilities(Preset::TYPE_PRINT, preset)) == std::vector<std::string>{"CapA"});
}
TEST_CASE("preset_type_for_capability names the preset type whose options reference the capability", "[PluginResolver]")
{
// Read out of the ConfigDef: slicing_pipeline_plugin is a print option, printer_agent a printer
// one. Declaring a plugin_type on an option is what puts its capability type on this map.
CHECK(preset_type_for_capability(PluginCapabilityType::SlicingPipeline) == Preset::TYPE_PRINT);
CHECK(preset_type_for_capability(PluginCapabilityType::PrinterConnection) == Preset::TYPE_PRINTER);
}
TEST_CASE("preset_type_for_capability leaves capability types no option accepts unowned", "[PluginResolver]")
{
// Nothing can reference these from a preset, so no preset can override them either: they read
// their config from the base config.json alone.
CHECK(preset_type_for_capability(PluginCapabilityType::Automation) == Preset::TYPE_INVALID);
CHECK(preset_type_for_capability(PluginCapabilityType::Unknown) == Preset::TYPE_INVALID);
}