From adb93507c81ab55eca102a8dc6bce11dd2ddd5f3 Mon Sep 17 00:00:00 2001 From: Ghostkeeper Date: Fri, 30 Jun 2017 08:42:39 +0200 Subject: [PATCH] Set material_diameter setting in approximate material diameter test Instead of the metadata entry, which was a previous implementation of the function. This is essentially just an update of the test. Contributes to issue CURA-2822. --- tests/Settings/TestGlobalStack.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/Settings/TestGlobalStack.py b/tests/Settings/TestGlobalStack.py index 3cac17fa3a..df9f31dc64 100755 --- a/tests/Settings/TestGlobalStack.py +++ b/tests/Settings/TestGlobalStack.py @@ -12,6 +12,7 @@ from UM.Settings.InstanceContainer import InstanceContainer #To test against the from UM.Settings.SettingInstance import InstanceState import UM.Settings.ContainerRegistry import UM.Settings.ContainerStack +import UM.Settings.SettingDefinition #To add settings to the definition. ## Fake container registry that always provides all containers you ask of. @pytest.yield_fixture() @@ -100,7 +101,9 @@ def test_addExtruder(global_stack): ]) def test_approximateMaterialDiameter(diameter, approximate_diameter, global_stack): global_stack.definition = DefinitionContainer(container_id = "TestDefinition") - global_stack.definition._metadata["material_diameter"] = str(diameter) + material_diameter = UM.Settings.SettingDefinition.SettingDefinition(key = "material_diameter", container = global_stack.definition) + material_diameter.addSupportedProperty("value", UM.Settings.SettingDefinition.DefinitionPropertyType.Any, default = diameter) + global_stack.definition.definitions.append(material_diameter) assert float(global_stack.approximateMaterialDiameter) == approximate_diameter ## Tests getting the material diameter when there is no material diameter.