Test add_filling operator

This commit is contained in:
Gorgious
2021-09-24 10:01:52 +02:00
parent 4868edaa83
commit d3cdbbbeb8
2 changed files with 31 additions and 0 deletions
+9
View File
@@ -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,
}
@@ -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"
"""