mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 18:20:06 +00:00
Adapt tests for create_port_at_cursor method
This commit is contained in:
@@ -1074,6 +1074,7 @@ class Surveyor:
|
|||||||
@interface
|
@interface
|
||||||
class System:
|
class System:
|
||||||
def create_empty_at_cursor_with_element_orientation(cls, element): pass
|
def create_empty_at_cursor_with_element_orientation(cls, element): pass
|
||||||
|
def create_port_at_cursor(cls, system): pass
|
||||||
def delete_element_objects(cls, elements): pass
|
def delete_element_objects(cls, elements): pass
|
||||||
def disable_editing_system(cls): pass
|
def disable_editing_system(cls): pass
|
||||||
def disable_system_editing_ui(cls): pass
|
def disable_system_editing_ui(cls): pass
|
||||||
|
|||||||
@@ -153,11 +153,10 @@ class TestAddPort:
|
|||||||
def test_run(self, ifc, system):
|
def test_run(self, ifc, system):
|
||||||
system.get_ports("element").should_be_called().will_return(["port"])
|
system.get_ports("element").should_be_called().will_return(["port"])
|
||||||
system.load_ports("element", ["port"]).should_be_called()
|
system.load_ports("element", ["port"]).should_be_called()
|
||||||
system.create_empty_at_cursor_with_element_orientation("element").should_be_called().will_return("obj")
|
#system.create_empty_at_cursor_with_element_orientation("element").should_be_called().will_return("obj")
|
||||||
system.run_root_assign_class(
|
#system.run_root_assign_class(obj="obj", ifc_class="IfcDistributionPort", should_add_representation=False).should_be_called().will_return("port")
|
||||||
obj="obj", ifc_class="IfcDistributionPort", should_add_representation=False
|
system.create_port_at_cursor("element").should_be_called().will_return("port")
|
||||||
).should_be_called().will_return("port")
|
system.load_ports("element", ["port"]).should_be_called()
|
||||||
ifc.run("system.assign_port", element="element", port="port").should_be_called()
|
|
||||||
subject.add_port(ifc, system, element="element")
|
subject.add_port(ifc, system, element="element")
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -103,6 +103,19 @@ class TestCreateEmptyAtCursorWithElementOrientation(NewFile):
|
|||||||
obj = subject.create_empty_at_cursor_with_element_orientation(element)
|
obj = subject.create_empty_at_cursor_with_element_orientation(element)
|
||||||
assert obj.matrix_world == bpy.context.scene.cursor.matrix
|
assert obj.matrix_world == bpy.context.scene.cursor.matrix
|
||||||
|
|
||||||
|
class TestCreatePortAtCursor(NewFile):
|
||||||
|
def test_run(self):
|
||||||
|
assert bpy.context.scene
|
||||||
|
ifc = ifcopenshell.file()
|
||||||
|
tool.Ifc().set(ifc)
|
||||||
|
system = ifcopenshell.api.system.add_system(ifc)
|
||||||
|
element = ifcopenshell.api.root.create_entity(ifc, ifc_class="IfcDuctSegment")
|
||||||
|
ifcopenshell.api.system.assign_system(ifc, products=[element], system=system)
|
||||||
|
obj = tool.Ifc.link(element, bpy.data.objects.new("Object", None))
|
||||||
|
port = subject.create_port_at_cursor(element)
|
||||||
|
assert port.is_a("IfcDistributionPort")
|
||||||
|
assert ifcopenshell.util.system.get_ports(element) == [port]
|
||||||
|
|
||||||
|
|
||||||
class TestDeleteElementObjects(NewFile):
|
class TestDeleteElementObjects(NewFile):
|
||||||
def test_run(self):
|
def test_run(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user