mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-09 14:55:03 -06:00
Add test for when instances have value and definition has resolve
The value of the instances should always get evaluated first. Contributes to issue CURA-3497.
This commit is contained in:
parent
759da2ab05
commit
86b288cc6e
1 changed files with 15 additions and 0 deletions
|
@ -448,6 +448,21 @@ def test_getPropertyResolveInInstance(global_stack):
|
|||
global_stack.userChanges = instance_containers[container_indices.UserChanges]
|
||||
assert global_stack.getProperty("material_bed_temperature", "value") == 5
|
||||
|
||||
## Tests whether the value in instances gets evaluated before the resolve in
|
||||
# definitions.
|
||||
def test_getPropertyInstancesBeforeResolve(global_stack):
|
||||
value = unittest.mock.MagicMock() #Sets just the value.
|
||||
value.getProperty = lambda key, property: 10 if (key == "material_bed_temperature" and property == "value") else None
|
||||
value.getMetaDataEntry = unittest.mock.MagicMock(return_value = "quality")
|
||||
resolve = unittest.mock.MagicMock() #Sets just the resolve.
|
||||
resolve.getProperty = lambda key, property: 7.5 if (key == "material_bed_temperature" and property == "resolve") else None
|
||||
|
||||
with unittest.mock.patch("cura.Settings.CuraContainerStack.DefinitionContainer", unittest.mock.MagicMock): #To guard against the type checking.
|
||||
global_stack.definition = resolve
|
||||
global_stack.quality = value
|
||||
|
||||
assert global_stack.getProperty("material_bed_temperature", "value") == 10
|
||||
|
||||
## Tests whether the resolve property is properly obtained in all cases.
|
||||
@pytest.mark.skip
|
||||
def test_getPropertyWithResolve(global_stack):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue