diff --git a/tests/Machines/TestContainerTree.py b/tests/Machines/TestContainerTree.py index c6fbccc266..173d607f2c 100644 --- a/tests/Machines/TestContainerTree.py +++ b/tests/Machines/TestContainerTree.py @@ -101,4 +101,19 @@ def test_getCurrentQualityChangesGroupsNoGlobalStack(container_registry): container_tree = ContainerTree() result = container_tree.getCurrentQualityChangesGroups() - assert len(result) == 0 \ No newline at end of file + assert len(result) == 0 + +def test_getCurrentQualityChangesGroups(container_registry, application): + with patch("UM.Settings.ContainerRegistry.ContainerRegistry.getInstance", MagicMock(return_value = container_registry)): + container_tree = ContainerTree() + container_tree.machines["current_global_stack"] = MagicMock() # Mock so that we can track whether the getQualityGroups function gets called with correct parameters. + + with patch("cura.CuraApplication.CuraApplication.getInstance", MagicMock(return_value = application)): + result = container_tree.getCurrentQualityChangesGroups() + + # As defined in the fixture for application. + expected_variant_names = ["current_global_stack_left_variant_name", "current_global_stack_right_variant_name"] + expected_material_base_files = ["current_global_stack_left_material_base_file", "current_global_stack_right_material_base_file"] + expected_is_enabled = [True, True] + + container_tree.machines["current_global_stack"].getQualityChangesGroups.assert_called_with(expected_variant_names, expected_material_base_files, expected_is_enabled) \ No newline at end of file