mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-20 13:17:51 -06:00
Add tests for _correctPrintSequence
CURA-7827
This commit is contained in:
parent
c1becbe43c
commit
bd5ed7a3ac
1 changed files with 37 additions and 0 deletions
|
@ -255,3 +255,40 @@ def test_isActiveQualityNotSupported(machine_manager):
|
|||
def test_isActiveQualityNotSupported_noQualityGroup(machine_manager):
|
||||
machine_manager.activeQualityGroup = MagicMock(return_value=None)
|
||||
assert not machine_manager.isActiveQualitySupported
|
||||
|
||||
|
||||
def test_correctPrintSequence_with2ExtrudersEnabled(machine_manager, application):
|
||||
mocked_stack = application.getGlobalContainerStack()
|
||||
|
||||
# The definition changes container reports 2 enabled extruders so the correctPrintSequence should attempt to
|
||||
# change the print_sequence setting to all-at-once
|
||||
mocked_definition_changes_container = MagicMock(name="DefinitionChangesContainer")
|
||||
mocked_definition_changes_container.getProperty = lambda key, prop: 2 if (key == "extruders_enabled_count" and prop == "value") else -1
|
||||
|
||||
mocked_user_changes_container = MagicMock(name="UserChangesContainer")
|
||||
|
||||
mocked_stack.userChanges = mocked_user_changes_container
|
||||
mocked_stack.definitionChanges = mocked_definition_changes_container
|
||||
|
||||
machine_manager._correctPrintSequence()
|
||||
|
||||
# After the function is called, the user changes container should attempt to correct its print sequence to all-at-once
|
||||
mocked_user_changes_container.setProperty.assert_called_once_with("print_sequence", "value", "all_at_once")
|
||||
|
||||
|
||||
def test_correctPrintSequence_with1ExtruderEnabled(machine_manager, application):
|
||||
mocked_stack = application.getGlobalContainerStack()
|
||||
|
||||
# The definition changes container reports 1 enabled extruder so the correctPrintSequence should not change anything
|
||||
mocked_definition_changes_container = MagicMock(name="DefinitionChangesContainer")
|
||||
mocked_definition_changes_container.getProperty = lambda key, prop: 1 if (key == "extruders_enabled_count" and prop == "value") else -1
|
||||
|
||||
mocked_user_changes_container = MagicMock(name="UserChangesContainer")
|
||||
|
||||
mocked_stack.userChanges = mocked_user_changes_container
|
||||
mocked_stack.definitionChanges = mocked_definition_changes_container
|
||||
|
||||
machine_manager._correctPrintSequence()
|
||||
|
||||
# After the function is called, the user changes container should not have tried to change any properties
|
||||
assert not mocked_user_changes_container.setProperty.called, "Method should not have been called"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue