Refactor and re-use common spatial_tool.select_products

This commit is contained in:
Sigma Dimensions
2023-06-12 15:21:33 +01:00
parent a7faa3ec3e
commit 0959a7f6a3
16 changed files with 43 additions and 72 deletions
+3 -3
View File
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.core.material as subject
from test.core.bootstrap import ifc, material, style
from test.core.bootstrap import ifc, material, style, spatial
class TestUnlinkMaterial:
@@ -158,7 +158,7 @@ class TestDisableEditingMaterials:
class TestSelectByMaterial:
def test_run(self, material):
def test_run(self, material, spatial):
material.get_elements_by_material("material").should_be_called().will_return("elements")
material.select_elements("elements").should_be_called()
spatial.select_products("elements").should_be_called()
subject.select_by_material(material, material="material")
+8 -1
View File
@@ -17,7 +17,7 @@
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
import blenderbim.core.style as subject
from test.core.bootstrap import ifc, material, style
from test.core.bootstrap import ifc, material, style, spatial
class TestAddStyle:
@@ -212,3 +212,10 @@ class TestDisableEditingStyles:
def test_run(self, style):
style.disable_editing_styles().should_be_called()
subject.disable_editing_styles(style)
class TestSelectByStyle:
def test_run(self, style, spatial):
style.get_elements_by_style("style").should_be_called().will_return("elements")
spatial.select_products("elements").should_be_called()
subject.select_by_style(style, style="style")
+7 -7
View File
@@ -18,7 +18,7 @@
import blenderbim.core.system as subject
from test.core.bootstrap import ifc, system
from test.core.bootstrap import ifc, system, spatial
class TestLoadSystems:
@@ -91,24 +91,24 @@ class TestSelectSystemProducts:
class TestShowPorts:
def test_run(self, ifc, system):
def test_run(self, ifc, system, spatial):
ifc.get_object("element").should_be_called().will_return("obj")
ifc.is_moved("obj").should_be_called().will_return(False)
system.get_ports("element").should_be_called().will_return(["port"])
system.load_ports("element", ["port"]).should_be_called()
system.select_elements(["port"]).should_be_called()
subject.show_ports(ifc, system, element="element")
spatial.select_products(["port"]).should_be_called()
subject.show_ports(ifc, system, spatial, element="element")
def test_syncing_locations_if_objects_moved_prior_to_showing_ports(self, ifc, system):
def test_syncing_locations_if_objects_moved_prior_to_showing_ports(self, ifc, system, spatial):
ifc.get_object("element").should_be_called().will_return("obj")
ifc.is_moved("obj").should_be_called().will_return(True)
system.run_geometry_edit_object_placement(obj="obj").should_be_called()
system.get_ports("element").should_be_called().will_return(["port"])
system.load_ports("element", ["port"]).should_be_called()
system.select_elements(["port"]).should_be_called()
subject.show_ports(ifc, system, element="element")
spatial.select_products(["port"]).should_be_called()
subject.show_ports(ifc, system, spatial, element="element")
class TestHidePorts: