Add test for whether resolve wins in definition

I'm splitting the test below up into pieces. It'll be removed eventually, when I've made all of these separate tests.

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

View file

@ -402,6 +402,17 @@ 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, when the value is asked and there is a resolve function, it
# must get the resolve first.
def test_getPropertyResolveInDefinition(global_stack):
resolve_and_value = unittest.mock.MagicMock() #Sets the resolve and value for bed temperature.
resolve_and_value.getProperty = lambda key, property: (7.5 if property == "resolve" else 5) if (key == "material_bed_temperature") else None #7.5 resolve, 5 value.
with unittest.mock.patch("cura.Settings.CuraContainerStack.DefinitionContainer", unittest.mock.MagicMock): #To guard against the type checking.
global_stack.definition = resolve_and_value
assert global_stack.getProperty("material_bed_temperature", "value") == 7.5 #Resolve wins in the definition.
## Tests whether the resolve property is properly obtained in all cases.
@pytest.mark.skip @pytest.mark.skip
def test_getPropertyWithResolve(global_stack): def test_getPropertyWithResolve(global_stack):
#Define some containers for the stack. #Define some containers for the stack.