Add test for when there's no resolve in definitions

It must not attempt to execute a resolve function then.

Contributes to issue CURA-3497.
This commit is contained in:
Ghostkeeper 2017-04-11 09:43:07 +02:00
parent 12d1db8f19
commit 0a7bcc4277
No known key found for this signature in database
GPG key ID: C5F96EE2BC0F7E75

View file

@ -402,6 +402,15 @@ def test_getPropertyFallThrough(global_stack):
global_stack.userChanges = mock_layer_heights[container_indexes.UserChanges] global_stack.userChanges = mock_layer_heights[container_indexes.UserChanges]
assert global_stack.getProperty("layer_height", "value") == container_indexes.UserChanges assert global_stack.getProperty("layer_height", "value") == container_indexes.UserChanges
## In definitions, test whether having no resolve allows us to find the value.
def test_getPropertyNoResolveInDefinition(global_stack):
value = unittest.mock.MagicMock() #Just sets the value for bed temperature.
value.getProperty = lambda key, property: 10 if (key == "material_bed_temperature" and property == "value") else None
with unittest.mock.patch("cura.Settings.CuraContainerStack.DefinitionContainer", unittest.mock.MagicMock): #To guard against the type checking.
global_stack.definition = value
assert global_stack.getProperty("material_bed_temperature", "value") == 10 #No resolve, so fall through to value.
## In definitions, when the value is asked and there is a resolve function, it ## In definitions, when the value is asked and there is a resolve function, it
# must get the resolve first. # must get the resolve first.
def test_getPropertyResolveInDefinition(global_stack): def test_getPropertyResolveInDefinition(global_stack):