Browse Source

Add test for hasUserValue returning false

When a value is not in user changes or in quality changes, it is no longer a user value so it shouldn't get marked as one.

Contributes to issue CURA-3497.
Ghostkeeper 8 years ago
parent
commit
2c9e115488
1 changed files with 10 additions and 0 deletions
  1. 10 0
      tests/Settings/TestGlobalStack.py

+ 10 - 0
tests/Settings/TestGlobalStack.py

@@ -473,6 +473,16 @@ def test_hasUserValueQualityChanges(global_stack):
     assert not global_stack.hasUserValue("infill_sparse_density")
     assert not global_stack.hasUserValue("")
 
+##  Tests whether a container in some other place on the stack is correctly not
+#   recognised as user value.
+def test_hasNoUserValue(global_stack):
+    container = unittest.mock.MagicMock()
+    container.getMetaDataEntry = unittest.mock.MagicMock(return_value = "quality")
+    container.hasProperty = lambda key, property: key == "layer_height" #Only have the layer_height property set.
+    global_stack.quality = container
+
+    assert not global_stack.hasUserValue("layer_height") #However this container is quality, so it's not a user value.
+
 ##  Tests whether inserting a container is properly forbidden.
 def test_insertContainer(global_stack):
     with pytest.raises(InvalidOperationError):