ifc.unlink fixes after 3df75e9af

Also some changes related to #4843

add
This commit is contained in:
Andrej730
2024-06-14 12:25:40 +05:00
parent d0f612afc2
commit 75f8e75a8e
17 changed files with 64 additions and 84 deletions
+6 -29
View File
@@ -87,46 +87,23 @@ class TestAddMaterialSet:
class TestRemoveMaterial:
def test_removing_a_material(self, ifc, material, style):
def test_removing_a_material(self, ifc, material):
material.is_material_used_in_sets("material").should_be_called().will_return(False)
ifc.get_object("material").should_be_called().will_return(None)
ifc.unlink(element="material").should_be_called()
ifc.run("material.remove_material", material="material").should_be_called()
material.is_editing_materials().should_be_called().will_return(False)
subject.remove_material(ifc, material, style, material="material")
subject.remove_material(ifc, material, material="material")
def test_removing_a_material_and_reloading_imported_materials(self, ifc, material, style):
def test_removing_a_material_and_reloading_imported_materials(self, ifc, material):
material.is_material_used_in_sets("material").should_be_called().will_return(False)
ifc.get_object("material").should_be_called().will_return(None)
ifc.unlink(element="material").should_be_called()
ifc.run("material.remove_material", material="material").should_be_called()
material.is_editing_materials().should_be_called().will_return(True)
material.get_active_material_type().should_be_called().will_return("material_type")
material.import_material_definitions("material_type").should_be_called()
subject.remove_material(ifc, material, style, material="material")
subject.remove_material(ifc, material, material="material")
def test_removing_a_material_object_if_it_has_no_style(self, ifc, material, style):
material.is_material_used_in_sets("material").should_be_called().will_return(False)
ifc.get_object("material").should_be_called().will_return("obj")
ifc.unlink(element="material").should_be_called()
ifc.run("material.remove_material", material="material").should_be_called()
style.get_style("obj").should_be_called().will_return(None)
material.delete_object("obj").should_be_called()
material.is_editing_materials().should_be_called().will_return(False)
subject.remove_material(ifc, material, style, material="material")
def test_preserving_a_material_object_if_it_is_still_used_as_a_style(self, ifc, material, style):
material.is_material_used_in_sets("material").should_be_called().will_return(False)
ifc.get_object("material").should_be_called().will_return("obj")
ifc.unlink(element="material").should_be_called()
ifc.run("material.remove_material", material="material").should_be_called()
style.get_style("obj").should_be_called().will_return("style")
material.is_editing_materials().should_be_called().will_return(False)
subject.remove_material(ifc, material, style, material="material")
def test_not_removing_a_material_if_it_is_used_in_a_material_set(self, ifc, material, style):
def test_not_removing_a_material_if_it_is_used_in_a_material_set(self, ifc, material):
material.is_material_used_in_sets("material").should_be_called().will_return(True)
subject.remove_material(ifc, material, style, material="material")
subject.remove_material(ifc, material, material="material")
class TestRemoveMaterialSet: