mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 07:33:57 -06:00
Add test for detecting quality changes
I should try to re-use a bit of code here because there's going to be a lot of these. Contributes to issue CURA-3497.
This commit is contained in:
parent
2eed596280
commit
09a3b90dcc
2 changed files with 32 additions and 2 deletions
|
@ -43,10 +43,32 @@ def test_deserializeUserChanges(filename, user_changes_id, container_registry):
|
||||||
serialized = file_handle.read()
|
serialized = file_handle.read()
|
||||||
stack = cura.Settings.GlobalStack.GlobalStack("TestStack")
|
stack = cura.Settings.GlobalStack.GlobalStack("TestStack")
|
||||||
|
|
||||||
#Mock the loading of the instances.
|
#Mock the loading of the instance containers.
|
||||||
stack.findContainer = findSomeContainers
|
stack.findContainer = findSomeContainers
|
||||||
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all profiles you ask of.
|
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all profiles you ask of.
|
||||||
|
|
||||||
stack.deserialize(serialized)
|
stack.deserialize(serialized)
|
||||||
|
|
||||||
assert stack.userChanges.getId() == user_changes_id
|
assert stack.userChanges.getId() == user_changes_id
|
||||||
|
|
||||||
|
## Tests whether the quality changes are being read properly from a global
|
||||||
|
# stack.
|
||||||
|
@pytest.mark.parametrize("filename, quality_changes_id", [
|
||||||
|
("Global.global.cfg", "empty"),
|
||||||
|
("Global.stack.cfg", "empty"),
|
||||||
|
("MachineLegacy.stack.cfg", "empty"),
|
||||||
|
("OnlyQualityChanges.global.cfg", "some_instance"),
|
||||||
|
("Complete.global.cfg", "some_quality_changes")
|
||||||
|
])
|
||||||
|
def test_deserializeQualityChanges(filename, quality_changes_id, container_registry):
|
||||||
|
with open(os.path.join(os.path.dirname(os.path.abspath(__file__)), "stacks", filename)) as file_handle:
|
||||||
|
serialized = file_handle.read()
|
||||||
|
stack = cura.Settings.GlobalStack.GlobalStack("TestStack")
|
||||||
|
|
||||||
|
#Mock the loading of the instance containers.
|
||||||
|
stack.findContainer = findSomeContainers
|
||||||
|
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of.
|
||||||
|
|
||||||
|
stack.deserialize(serialized)
|
||||||
|
|
||||||
|
assert stack.qualityChanges.getId() == quality_changes_id
|
8
tests/Settings/stacks/OnlyQualityChanges.global.cfg
Normal file
8
tests/Settings/stacks/OnlyQualityChanges.global.cfg
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[general]
|
||||||
|
version = 3
|
||||||
|
name = Only Quality Changes
|
||||||
|
id = OnlyQualityChanges
|
||||||
|
|
||||||
|
[containers]
|
||||||
|
1 = some_instance
|
||||||
|
6 = some_definition
|
Loading…
Add table
Add a link
Reference in a new issue