mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-17 05:52:33 +00:00
#2094. Removing styles now also purges Blender material object if possible.
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import blenderbim.core.style as subject
|
||||
from test.core.bootstrap import ifc, style
|
||||
from test.core.bootstrap import ifc, material, style
|
||||
|
||||
|
||||
class TestAddStyle:
|
||||
@@ -53,11 +53,32 @@ class TestAddStyle:
|
||||
|
||||
|
||||
class TestRemoveStyle:
|
||||
def test_run(self, ifc, style):
|
||||
style.get_style("obj").should_be_called().will_return("style")
|
||||
def test_removing_a_style(self, ifc, material, style):
|
||||
ifc.get_object("style").should_be_called().will_return("obj")
|
||||
ifc.unlink(obj="obj", element="style").should_be_called()
|
||||
ifc.run("style.remove_style", style="style").should_be_called()
|
||||
subject.remove_style(ifc, style, obj="obj")
|
||||
ifc.get_entity("obj").should_be_called().will_return("material")
|
||||
style.is_editing_styles().should_be_called().will_return(False)
|
||||
subject.remove_style(ifc, material, style, style="style")
|
||||
|
||||
def test_removing_a_style_and_reloading_imported_styles(self, ifc, material, style):
|
||||
ifc.get_object("style").should_be_called().will_return("obj")
|
||||
ifc.unlink(obj="obj", element="style").should_be_called()
|
||||
ifc.run("style.remove_style", style="style").should_be_called()
|
||||
ifc.get_entity("obj").should_be_called().will_return("material")
|
||||
style.is_editing_styles().should_be_called().will_return(True)
|
||||
style.get_active_style_type().should_be_called().will_return("style_type")
|
||||
style.import_presentation_styles("style_type").should_be_called()
|
||||
subject.remove_style(ifc, material, style, style="style")
|
||||
|
||||
def test_removing_an_object_if_it_is_not_still_used_for_a_material(self, ifc, material, style):
|
||||
ifc.get_object("style").should_be_called().will_return("obj")
|
||||
ifc.unlink(obj="obj", element="style").should_be_called()
|
||||
ifc.run("style.remove_style", style="style").should_be_called()
|
||||
ifc.get_entity("obj").should_be_called().will_return(None)
|
||||
material.delete_object("obj").should_be_called()
|
||||
style.is_editing_styles().should_be_called().will_return(False)
|
||||
subject.remove_style(ifc, material, style, style="style")
|
||||
|
||||
|
||||
class TestUpdateStyleColours:
|
||||
|
||||
Reference in New Issue
Block a user