Add tests for setting property on user changes of extruder stack

Setting a property directly should put it in the user changes.

Contributes to issue CURA-3497.
This commit is contained in:
Ghostkeeper 2017-03-24 17:52:53 +01:00
parent fe95755f75
commit 129f01aa24
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -308,6 +308,18 @@ def test_setMaterialByIdDoesntExist(extruder_stack):
with pytest.raises(KeyError):
extruder_stack.setMaterialById("some_material") #Container registry is empty now.
## Tests setting properties directly on the extruder stack.
@pytest.mark.parametrize("key, property, value, output_value", [
("layer_height", "value", "0.1337", 0.1337),
("foo", "value", "100", 100),
("support_enabled", "value", "True", True),
("layer_height", "default_value", 0.1337, 0.1337),
("layer_height", "is_bright_pink", "of course", "of course")
])
def test_setPropertyUser(key, property, value, output_value, extruder_stack):
extruder_stack.setProperty(key, value, property)
assert extruder_stack.userChanges.getProperty(key, property) == output_value
## Tests setting qualities by specifying an ID of a quality that exists.
def test_setQualityByIdExists(extruder_stack, container_registry):
original_container_registry = UM.Settings.ContainerStack._containerRegistry