You can now assign and unassign library references

This commit is contained in:
Dion Moult
2021-11-17 11:43:53 +11:00
parent 62cdf76a5a
commit da6945b352
8 changed files with 165 additions and 10 deletions
@@ -103,3 +103,34 @@ Scenario: Edit library reference
And I press "bim.enable_editing_library_reference(reference={reference})"
When I press "bim.edit_library_reference()"
Then nothing happens
Scenario: Assign library reference
Given an empty IFC project
And I press "bim.add_library"
And the variable "library" is "{ifc}.by_type('IfcLibraryInformation')[-1].id()"
And I press "bim.enable_editing_library_references(library={library})"
And I press "bim.add_library_reference"
And the variable "reference" is "{ifc}.by_type('IfcLibraryReference')[-1].id()"
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
When I press "bim.assign_library_reference(reference={reference})"
Then nothing happens
Scenario: Unassign library reference
Given an empty IFC project
And I press "bim.add_library"
And the variable "library" is "{ifc}.by_type('IfcLibraryInformation')[-1].id()"
And I press "bim.enable_editing_library_references(library={library})"
And I press "bim.add_library_reference"
And the variable "reference" is "{ifc}.by_type('IfcLibraryReference')[-1].id()"
And I add a cube
And the object "Cube" is selected
And I set "scene.BIMRootProperties.ifc_class" to "IfcWall"
And I press "bim.assign_class"
And the object "IfcWall/Cube" is selected
And I press "bim.assign_library_reference(reference={reference})"
When I press "bim.unassign_library_reference(reference={reference})"
Then nothing happens
+14
View File
@@ -109,3 +109,17 @@ class TestEditLibraryReference:
library.get_active_library().should_be_called().will_return("library")
library.import_references("library").should_be_called()
subject.edit_library_reference(ifc, library)
class TestAssignLibraryReference:
def test_run(self, ifc):
ifc.get_entity("obj").should_be_called().will_return("product")
ifc.run("library.assign_reference", product="product", reference="reference").should_be_called()
subject.assign_library_reference(ifc, obj="obj", reference="reference")
class TestUnassignLibraryReference:
def test_run(self, ifc):
ifc.get_entity("obj").should_be_called().will_return("product")
ifc.run("library.unassign_reference", product="product", reference="reference").should_be_called()
subject.unassign_library_reference(ifc, obj="obj", reference="reference")