mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-19 23:19:13 +08:00
Add tests for hasUserValue
These fail at the moment because they also depend on being able to change the stack, which isn't implemented yet. Contributes to issue CURA-3497.
This commit is contained in:
parent
8a3ab6d289
commit
bf2050479b
@ -186,4 +186,34 @@ def test_deserializeDefinition(filename, definition_id, container_registry):
|
|||||||
|
|
||||||
stack.deserialize(serialized)
|
stack.deserialize(serialized)
|
||||||
|
|
||||||
assert stack.definition.getId() == definition_id
|
assert stack.definition.getId() == definition_id
|
||||||
|
|
||||||
|
## Tests whether the hasUserValue returns true for settings that are changed in
|
||||||
|
# the user-changes container.
|
||||||
|
def test_hasUserValueUserChanges():
|
||||||
|
user_changes = unittest.mock.MagicMock()
|
||||||
|
def hasProperty(key, property):
|
||||||
|
return key == "layer_height" and property == "value" #Only have the layer_height property set.
|
||||||
|
user_changes.hasProperty = hasProperty
|
||||||
|
|
||||||
|
stack = cura.Settings.GlobalStack.GlobalStack("TestStack")
|
||||||
|
stack.userChanges = user_changes
|
||||||
|
|
||||||
|
assert not stack.hasUserValue("infill_sparse_density")
|
||||||
|
assert stack.hasUserValue("layer_height")
|
||||||
|
assert not stack.hasUserValue("")
|
||||||
|
|
||||||
|
## Tests whether the hasUserValue returns true for settings that are changed in
|
||||||
|
# the quality-changes container.
|
||||||
|
def test_hasUserValueQualityChanges():
|
||||||
|
quality_changes = unittest.mock.MagicMock()
|
||||||
|
def hasProperty(key, property):
|
||||||
|
return key == "layer_height" and property == "value" #Only have the layer_height property set.
|
||||||
|
quality_changes.hasProperty = hasProperty
|
||||||
|
|
||||||
|
stack = cura.Settings.GlobalStack.GlobalStack("TestStack")
|
||||||
|
stack.qualityChanges = quality_changes
|
||||||
|
|
||||||
|
assert not stack.hasUserValue("infill_sparse_density")
|
||||||
|
assert stack.hasUserValue("layer_height")
|
||||||
|
assert not stack.hasUserValue("")
|
Loading…
x
Reference in New Issue
Block a user