mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-18 06:21:40 +00:00
Implement auto and manual refresh of the Brick model navigator
This commit is contained in:
@@ -109,3 +109,14 @@ Scenario: Convert IFC to brick
|
||||
And I press "bim.assign_class"
|
||||
When I press "bim.convert_ifc_to_brick"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: New brick file
|
||||
Given an empty Blender session
|
||||
When I press "bim.new_brick_file"
|
||||
Then nothing happens
|
||||
|
||||
Scenario: Refresh brick viewer
|
||||
Given an empty Blender session
|
||||
And I press "bim.new_brick_file"
|
||||
When I press "bim.refresh_brick_viewer"
|
||||
Then nothing happens
|
||||
|
||||
@@ -119,12 +119,14 @@ class TestAddBrick:
|
||||
def test_adding_a_brick(self, ifc, brick):
|
||||
ifc.get_entity("obj").should_be_called().will_return("product")
|
||||
brick.add_brick("product", "namespace", "brick_class").should_be_called().will_return("brick_uri")
|
||||
brick.run_refresh_brick_viewer().should_be_called()
|
||||
subject.add_brick(ifc, brick, obj="obj", namespace="namespace", brick_class="brick_class", library=None)
|
||||
|
||||
def test_adding_a_brick_an_auto_assigning_it_to_the_ifc_element(self, ifc, brick):
|
||||
ifc.get_entity("obj").should_be_called().will_return("product")
|
||||
brick.add_brick("product", "namespace", "brick_class").should_be_called().will_return("brick_uri")
|
||||
brick.run_assign_brick_reference(obj="obj", library="library", brick_uri="brick_uri").should_be_called()
|
||||
brick.run_refresh_brick_viewer().should_be_called()
|
||||
subject.add_brick(ifc, brick, obj="obj", namespace="namespace", brick_class="brick_class", library="library")
|
||||
|
||||
|
||||
@@ -135,6 +137,7 @@ class TestAddBrickFeed:
|
||||
brick.get_brick("source_element").should_be_called().will_return("source_brick")
|
||||
brick.get_brick("destination_element").should_be_called().will_return("destination_brick")
|
||||
brick.add_feed("source_brick", "destination_brick").should_be_called()
|
||||
brick.run_refresh_brick_viewer().should_be_called()
|
||||
subject.add_brick_feed(ifc, brick, source="source", destination="destination")
|
||||
|
||||
|
||||
@@ -142,18 +145,29 @@ class TestConvertIfcToBrick:
|
||||
def test_run(self, brick):
|
||||
brick.get_convertable_brick_objects_and_elements().should_be_called().will_return([("obj", "element")])
|
||||
brick.get_brick_class("element").should_be_called().will_return("brick_class")
|
||||
brick.run_add_brick(
|
||||
obj="obj", namespace="namespace", brick_class="brick_class", library="library"
|
||||
).should_be_called()
|
||||
brick.add_brick("element", "namespace", "brick_class").should_be_called().will_return("brick_uri")
|
||||
brick.run_assign_brick_reference(obj="obj", library="library", brick_uri="brick_uri").should_be_called()
|
||||
brick.run_refresh_brick_viewer().should_be_called()
|
||||
subject.convert_ifc_to_brick(brick, namespace="namespace", library="library")
|
||||
|
||||
def test_not_converting_an_element_where_we_cannot_find_the_corresponding_brick_class(self, brick):
|
||||
brick.get_convertable_brick_objects_and_elements().should_be_called().will_return([("obj", "element")])
|
||||
brick.get_brick_class("element").should_be_called().will_return(None)
|
||||
brick.run_refresh_brick_viewer().should_be_called()
|
||||
subject.convert_ifc_to_brick(brick, namespace="namespace", library="library")
|
||||
|
||||
|
||||
class TestNewBrickFile:
|
||||
def test_run(self, brick):
|
||||
brick.new_brick_file().should_be_called()
|
||||
brick.import_brick_classes("Class").should_be_called()
|
||||
brick.set_active_brick_class("Class").should_be_called()
|
||||
subject.new_brick_file(brick)
|
||||
|
||||
|
||||
class TestRefreshBrickViewer:
|
||||
def test_run(self, brick):
|
||||
brick.get_active_brick_class().should_be_called().will_return("class")
|
||||
brick.run_view_brick_class(brick_class="class").should_be_called()
|
||||
brick.pop_brick_breadcrumb().should_be_called()
|
||||
subject.refresh_brick_viewer(brick)
|
||||
|
||||
@@ -169,6 +169,12 @@ class TestExportBrickAttributes(NewFile):
|
||||
}
|
||||
|
||||
|
||||
class TestGetActiveBrickClass(NewFile):
|
||||
def test_run(self):
|
||||
subject.set_active_brick_class("brick_class")
|
||||
assert subject.get_active_brick_class() == "brick_class"
|
||||
|
||||
|
||||
class TestGetBrick(NewFile):
|
||||
def test_run(self):
|
||||
ifc = ifcopenshell.file()
|
||||
@@ -326,12 +332,17 @@ class TestPopBrickBreadcrumb(NewFile):
|
||||
assert bpy.context.scene.BIMBrickProperties.brick_breadcrumbs[0].name == "foo"
|
||||
|
||||
|
||||
class TestRunAddBrick(NewFile):
|
||||
class TestRunAssignBrickReference(NewFile):
|
||||
def test_nothing(self):
|
||||
pass
|
||||
|
||||
|
||||
class TestRunAssignBrickReference(NewFile):
|
||||
class TestRunRefreshBrickViewer(NewFile):
|
||||
def test_nothing(self):
|
||||
pass
|
||||
|
||||
|
||||
class TestViewBrickClass(NewFile):
|
||||
def test_nothing(self):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user