mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 07:38:58 +08:00
Add tests for setDefinitionChangesById
One for when the ID exists, one for when it doesn't exist. Contributes to issue CURA-3497.
This commit is contained in:
parent
928181507d
commit
dbc4a90e10
@ -422,6 +422,23 @@ def test_setNextStack(global_stack):
|
||||
with pytest.raises(InvalidOperationError):
|
||||
global_stack.setNextStack(unittest.mock.MagicMock())
|
||||
|
||||
## Tests adding definition changes by specifying an ID of a container that
|
||||
# exists.
|
||||
def test_setDefinitionChangesByIdExists(global_stack, container_registry):
|
||||
original_container_registry = UM.Settings.ContainerStack._containerRegistry
|
||||
UM.Settings.ContainerStack._containerRegistry = container_registry #Always has all the profiles you ask of.
|
||||
|
||||
global_stack.setDefinitionChangesById("some_definition_changes") #The container registry always has a container with the ID.
|
||||
|
||||
#Restore.
|
||||
UM.Settings.ContainerStack._containerRegistry = original_container_registry
|
||||
|
||||
## Tests adding definition changes by specifying an ID of a container that
|
||||
# doesn't exist.
|
||||
def test_setDefinitionChangesByIdDoesntExist(global_stack):
|
||||
with pytest.raises(KeyError):
|
||||
global_stack.setDefinitionChangesById("some_definition_changes") #Container registry is empty now.
|
||||
|
||||
## Tests setting properties directly on the global stack.
|
||||
@pytest.mark.parametrize("key, property, value, output_value", [
|
||||
("layer_height", "value", "0.1337", 0.1337),
|
||||
|
Loading…
x
Reference in New Issue
Block a user