mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 15:37:27 -06:00
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:
parent
12d1db8f19
commit
0a7bcc4277
1 changed files with 9 additions and 0 deletions
|
@ -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):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue