diff --git a/src/blenderbim/test/bim/bootstrap.py b/src/blenderbim/test/bim/bootstrap.py index f57d35bcde..74f464bc44 100644 --- a/src/blenderbim/test/bim/bootstrap.py +++ b/src/blenderbim/test/bim/bootstrap.py @@ -264,6 +264,14 @@ def the_object_name_is_not_voided_by_void(name, void): assert False, "A void was found" +def the_void_name_is_filled_by_filling(name, filling): + ifc = IfcStore.get_file() + element = ifc.by_id(the_object_name_exists(name).BIMObjectProperties.ifc_definition_id) + if any(rel.RelatedBuildingElement.Name == filling for rel in element.HasFillings): + return True + assert False, f"Filling was not found" + + def the_object_name_should_display_as_mode(name, mode): assert the_object_name_exists(name).display_type == mode @@ -317,6 +325,7 @@ definitions = { 'the object "(.*)" should display as "(.*)"': the_object_name_should_display_as_mode, 'the object "(.*)" has "([0-9]+)" vertices': the_object_name_has_number_vertices, 'the object "(.*)" is at "(.*)"': the_object_name_is_at_location, + 'the object "(.*)" is filled by "(.*)"': the_void_name_is_filled_by_filling, } diff --git a/src/blenderbim/test/bim/module/void/test_operator.py b/src/blenderbim/test/bim/module/void/test_operator.py index 96cba2d83e..6ab8c4d356 100644 --- a/src/blenderbim/test/bim/module/void/test_operator.py +++ b/src/blenderbim/test/bim/module/void/test_operator.py @@ -113,3 +113,25 @@ class TestRemoveOpening(test.bim.bootstrap.NewFile): And I delete the selected objects Then the object "Cube" is not an IFC element """ + + +class TestAddFilling(test.bim.bootstrap.NewFile): + @test.bim.bootstrap.scenario + def test_adding_a_filling(self): + return """ + Given an empty IFC project + Given I add a cube + When the object "Cube" is selected + And I set "scene.BIMRootProperties.ifc_class" to "IfcOpeningElement" + And I press "bim.assign_class" + And I add a cube + And the object "Cube" is selected + And I set "scene.BIMRootProperties.ifc_class" to "IfcDoor" + And I press "bim.assign_class" + And the object "IfcOpeningElement/Cube" is selected + And I press "bim.add_filling(opening='IfcOpeningElement/Cube', obj='IfcDoor/Cube')" + Then the object "IfcOpeningElement/Cube" is an "IfcOpeningElement" + And the object "IfcOpeningElement/Cube" should display as "WIRE" + And the object "IfcDoor/Cube" is an "IfcDoor" + And the void "IfcOpeningElement/Cube" is filled by "Cube" + """