mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 12:47:49 -06:00
Add test for seeing whether variants are properly found
Whether the deserialize function finds the variants properly. Contributes to issue CURA-3497.
This commit is contained in:
parent
95a377d54e
commit
79f6e49280
2 changed files with 30 additions and 1 deletions
|
@ -123,3 +123,24 @@ def test_deserializeMaterial(filename, material_id, container_registry):
|
||||||
stack.deserialize(serialized)
|
stack.deserialize(serialized)
|
||||||
|
|
||||||
assert stack.material.getId() == material_id
|
assert stack.material.getId() == material_id
|
||||||
|
|
||||||
|
## Tests whether the variant profile is being read properly from a global
|
||||||
|
# stack.
|
||||||
|
@pytest.mark.parametrize("filename, variant_id", [
|
||||||
|
("Global.global.cfg", "empty"),
|
||||||
|
("Global.stack.cfg", "empty"),
|
||||||
|
("MachineLegacy.stack.cfg", "empty"),
|
||||||
|
("OnlyVariant.global.cfg", "some_instance"),
|
||||||
|
("Complete.global.cfg", "some_variant")
|
||||||
|
])
|
||||||
|
def test_deserializeVariant(filename, variant_id, container_registry):
|
||||||
|
serialized = readStack(filename)
|
||||||
|
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.variant.getId() == variant_id
|
8
tests/Settings/stacks/OnlyVariant.global.cfg
Normal file
8
tests/Settings/stacks/OnlyVariant.global.cfg
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[general]
|
||||||
|
version = 3
|
||||||
|
name = Only Material
|
||||||
|
id = OnlyMaterial
|
||||||
|
|
||||||
|
[containers]
|
||||||
|
4 = some_instance
|
||||||
|
6 = some_definition
|
Loading…
Add table
Add a link
Reference in a new issue