mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-13 04:59:05 +08:00
Add test for deserialising materials in stacks
Similar to the other tests, but this one is a bit special since the original test stacks had a material defined. Therefore it also defines a separate stack that only has a definition so that we can see if it's fine with the material being empty. Contributes to issue CURA-3497.
This commit is contained in:
parent
80329ad6e8
commit
95a377d54e
@ -100,4 +100,26 @@ def test_deserializeQuality(filename, quality_id, container_registry):
|
||||
|
||||
stack.deserialize(serialized)
|
||||
|
||||
assert stack.quality.getId() == quality_id
|
||||
assert stack.quality.getId() == quality_id
|
||||
|
||||
## Tests whether the material profile is being read properly from a global
|
||||
# stack.
|
||||
@pytest.mark.parametrize("filename, material_id", [
|
||||
("Global.global.cfg", "some_instance"),
|
||||
("Global.stack.cfg", "some_instance"),
|
||||
("MachineLegacy.stack.cfg", "some_instance"),
|
||||
("OnlyDefinition.global.cfg", "empty"),
|
||||
("OnlyMaterial.global.cfg", "some_instance"),
|
||||
("Complete.global.cfg", "some_material")
|
||||
])
|
||||
def test_deserializeMaterial(filename, material_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.material.getId() == material_id
|
7
tests/Settings/stacks/OnlyDefinition.global.cfg
Normal file
7
tests/Settings/stacks/OnlyDefinition.global.cfg
Normal file
@ -0,0 +1,7 @@
|
||||
[general]
|
||||
version = 3
|
||||
name = Only Definition
|
||||
id = OnlyDefinition
|
||||
|
||||
[containers]
|
||||
6 = some_definition
|
8
tests/Settings/stacks/OnlyMaterial.global.cfg
Normal file
8
tests/Settings/stacks/OnlyMaterial.global.cfg
Normal file
@ -0,0 +1,8 @@
|
||||
[general]
|
||||
version = 3
|
||||
name = Only Material
|
||||
id = OnlyMaterial
|
||||
|
||||
[containers]
|
||||
3 = some_instance
|
||||
6 = some_definition
|
Loading…
x
Reference in New Issue
Block a user