diff --git a/tests/Settings/TestGlobalStack.py b/tests/Settings/TestGlobalStack.py index 84d1de01b4..e0ce800eca 100644 --- a/tests/Settings/TestGlobalStack.py +++ b/tests/Settings/TestGlobalStack.py @@ -143,4 +143,25 @@ def test_deserializeVariant(filename, variant_id, container_registry): stack.deserialize(serialized) - assert stack.variant.getId() == variant_id \ No newline at end of file + assert stack.variant.getId() == variant_id + +## Tests whether the definition changes profile is being read properly from a +# global stack. +@pytest.mark.parametrize("filename, definition_changes_id", [ + ("Global.global.cfg", "empty"), + ("Global.stack.cfg", "empty"), + ("MachineLegacy.stack.cfg", "empty"), + ("OnlyDefinitionChanges.global.cfg", "some_instance"), + ("Complete.global.cfg", "some_material") +]) +def test_deserializeDefinitionChanges(filename, definition_changes_id, container_registry): + serialized = readStack(filename) + stack = cura.Settings.GlobalStack.GlobalStack("TestStack") + + #Mock the loading of the instance containers. + stack.findContainer = findSomeContainers + UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of. + + stack.deserialize(serialized) + + assert stack.variant.getId() == definition_changes_id \ No newline at end of file diff --git a/tests/Settings/stacks/OnlyDefinitionChanges.global.cfg b/tests/Settings/stacks/OnlyDefinitionChanges.global.cfg new file mode 100644 index 0000000000..39e2105b7d --- /dev/null +++ b/tests/Settings/stacks/OnlyDefinitionChanges.global.cfg @@ -0,0 +1,8 @@ +[general] +version = 3 +name = Only Definition Changes +id = OnlyDefinitionChanges + +[containers] +5 = some_instance +6 = some_definition