mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Fix failing core tests
This commit is contained in:
@@ -388,11 +388,11 @@ class Geometry:
|
||||
def clear_scale(cls, obj): pass
|
||||
def delete_data(cls, data): pass
|
||||
def delete_ifc_object(cls, obj): pass
|
||||
def delete_opening_object_placement(cls, opening): pass
|
||||
def does_representation_id_exist(cls, representation_id): pass
|
||||
def duplicate_object_data(cls, obj): pass
|
||||
def get_cartesian_point_offset(cls, obj): pass
|
||||
def delete_opening_object_placement(cls, opening): pass
|
||||
def get_blender_offset_type(cls, obj): pass
|
||||
def get_cartesian_point_offset(cls, obj): pass
|
||||
def get_element_type(cls, element): pass
|
||||
def get_elements_of_type(cls, type): pass
|
||||
def get_ifc_representation_class(cls, element, representation): pass
|
||||
@@ -418,6 +418,7 @@ class Geometry:
|
||||
def record_object_materials(cls, obj): pass
|
||||
def record_object_position(cls, obj): pass
|
||||
def recreate_object_with_data(cls, obj, data): pass
|
||||
def reimport_element_representations(cls, obj, representation, apply_openings=True): pass
|
||||
def reload_representation_item_ids(cls, representation, data) -> None: pass
|
||||
def remove_connection(cls, connection): pass
|
||||
def rename_object(cls, obj, name): pass
|
||||
@@ -639,6 +640,7 @@ class Project:
|
||||
def run_owner_add_person_and_organisation(cls, person=None, organisation=None): pass
|
||||
def run_owner_set_user(cls, user=None): pass
|
||||
def run_root_assign_class(cls, obj=None, ifc_class=None, predefined_type=None, should_add_representation=True, context=None, ifc_representation_class=None): pass
|
||||
def run_root_reload_grid_decorator(cls): pass
|
||||
def run_unit_assign_scene_units(cls): pass
|
||||
def set_context(cls, context): pass
|
||||
def set_default_context(cls): pass
|
||||
@@ -901,7 +903,7 @@ class Spatial:
|
||||
def run_spatial_import_spatial_decomposition(cls): pass
|
||||
def select_object(cls, obj): pass
|
||||
def select_products(cls, products, unhide=False): pass
|
||||
def set_active_object(cls, obj): pass
|
||||
def set_active_object(cls, obj, selection_mode=None): pass
|
||||
def set_relative_object_matrix(cls, target_obj, relative_to_obj, matrix): pass
|
||||
def set_target_container_as_default(cls): pass
|
||||
def show_scene_objects(cls): pass
|
||||
|
||||
@@ -43,7 +43,7 @@ class TestAddRepresentation:
|
||||
# Add representation
|
||||
geometry.get_object_data("obj").should_be_called().will_return("data")
|
||||
geometry.is_data_supported_for_adding_representation("data").should_be_called().will_return(True)
|
||||
geometry.get_cartesian_point_coordinate_offset("obj").should_be_called().will_return("coordinate_offset")
|
||||
geometry.get_cartesian_point_offset("obj").should_be_called().will_return("coordinate_offset")
|
||||
geometry.get_total_representation_items("obj").should_be_called().will_return(1)
|
||||
geometry.should_force_faceted_brep().should_be_called().will_return(False)
|
||||
geometry.should_force_triangulation().should_be_called().will_return(True)
|
||||
@@ -110,7 +110,7 @@ class TestAddRepresentation:
|
||||
# Add representation
|
||||
geometry.get_object_data("obj").should_be_called().will_return("data")
|
||||
geometry.is_data_supported_for_adding_representation("data").should_be_called().will_return(True)
|
||||
geometry.get_cartesian_point_coordinate_offset("obj").should_be_called().will_return("coordinate_offset")
|
||||
geometry.get_cartesian_point_offset("obj").should_be_called().will_return("coordinate_offset")
|
||||
geometry.get_total_representation_items("obj").should_be_called().will_return(1)
|
||||
geometry.should_force_faceted_brep().should_be_called().will_return(False)
|
||||
geometry.should_force_triangulation().should_be_called().will_return(True)
|
||||
@@ -194,23 +194,10 @@ class TestAddRepresentation:
|
||||
|
||||
|
||||
class TestSwitchRepresentation:
|
||||
def test_switching_to_a_freshly_loaded_representation(self, ifc, geometry):
|
||||
def test_switching_to_a_representation(self, ifc, geometry):
|
||||
geometry.is_edited("obj").should_be_called().will_return(False)
|
||||
geometry.get_object_data("obj").should_be_called().will_return("current_obj_data")
|
||||
geometry.should_use_immediate_representation("element", True).should_be_called().will_return(False)
|
||||
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
|
||||
geometry.get_representation_data("representation").should_be_called().will_return(None)
|
||||
geometry.import_representation("obj", "representation", apply_openings=True).should_be_called().will_return(
|
||||
"new_data"
|
||||
)
|
||||
geometry.get_representation_name("representation").should_be_called().will_return("name")
|
||||
geometry.rename_object("new_data", "name").should_be_called()
|
||||
geometry.link("representation", "new_data").should_be_called()
|
||||
geometry.change_object_data("obj", "new_data", is_global=True).should_be_called()
|
||||
geometry.record_object_materials("obj").should_be_called()
|
||||
geometry.clear_modifiers("obj").should_be_called()
|
||||
ifc.get_entity("obj").should_be_called().will_return("element")
|
||||
geometry.clear_cache("element").should_be_called()
|
||||
geometry.reimport_element_representations("obj", "mapped_rep", apply_openings=True).should_be_called()
|
||||
subject.switch_representation(
|
||||
ifc,
|
||||
geometry,
|
||||
@@ -222,78 +209,6 @@ class TestSwitchRepresentation:
|
||||
apply_openings=True,
|
||||
)
|
||||
|
||||
def test_switching_to_a_reloaded_representation_and_deleting_the_existing_data(self, ifc, geometry):
|
||||
geometry.is_edited("obj").should_be_called().will_return(False)
|
||||
geometry.get_object_data("obj").should_be_called().will_return("current_obj_data")
|
||||
geometry.should_use_immediate_representation("element", True).should_be_called().will_return(False)
|
||||
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
|
||||
geometry.get_representation_data("representation").should_be_called().will_return("existing_data")
|
||||
geometry.import_representation("obj", "representation", apply_openings=True).should_be_called().will_return(
|
||||
"new_data"
|
||||
)
|
||||
geometry.get_representation_name("representation").should_be_called().will_return("name")
|
||||
geometry.rename_object("new_data", "name").should_be_called()
|
||||
geometry.link("representation", "new_data").should_be_called()
|
||||
geometry.change_object_data("obj", "new_data", is_global=True).should_be_called()
|
||||
geometry.record_object_materials("obj").should_be_called()
|
||||
geometry.has_data_users("existing_data").should_be_called().will_return(False)
|
||||
geometry.delete_data("existing_data").should_be_called()
|
||||
geometry.clear_modifiers("obj").should_be_called()
|
||||
ifc.get_entity("obj").should_be_called().will_return("element")
|
||||
geometry.clear_cache("element").should_be_called()
|
||||
subject.switch_representation(
|
||||
ifc,
|
||||
geometry,
|
||||
obj="obj",
|
||||
representation="mapped_rep",
|
||||
should_reload=True,
|
||||
is_global=True,
|
||||
should_sync_changes_first=True,
|
||||
apply_openings=True,
|
||||
)
|
||||
|
||||
def test_switching_to_an_existing_representation(self, ifc, geometry):
|
||||
geometry.is_edited("obj").should_be_called().will_return(False)
|
||||
ifc.get_entity("obj").should_be_called().will_return("element")
|
||||
geometry.get_object_data("obj").should_be_called().will_return("current_obj_data")
|
||||
geometry.should_use_immediate_representation("element", True).should_be_called().will_return(False)
|
||||
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
|
||||
geometry.get_representation_data("representation").should_be_called().will_return("data")
|
||||
geometry.change_object_data("obj", "data", is_global=True).should_be_called()
|
||||
geometry.record_object_materials("obj").should_be_called()
|
||||
geometry.clear_modifiers("obj").should_be_called()
|
||||
geometry.clear_cache("element").should_be_called()
|
||||
subject.switch_representation(
|
||||
ifc,
|
||||
geometry,
|
||||
obj="obj",
|
||||
representation="mapped_rep",
|
||||
should_reload=False,
|
||||
is_global=True,
|
||||
should_sync_changes_first=True,
|
||||
)
|
||||
|
||||
def test_switching_to_an_existing_representation_reuse_representation(self, ifc, geometry):
|
||||
geometry.is_edited("obj").should_be_called().will_return(False)
|
||||
ifc.get_entity("obj").should_be_called().will_return("element")
|
||||
geometry.get_object_data("obj").should_be_called().will_return("current_obj_data")
|
||||
geometry.should_use_immediate_representation("element", True).should_be_called().will_return(True)
|
||||
geometry.unresolve_type_representation("mapped_rep", "element").should_be_called().will_return("representation")
|
||||
geometry.get_representation_data("representation").should_be_called().will_return("data")
|
||||
geometry.change_object_data("obj", "data", is_global=False).should_be_called()
|
||||
geometry.record_object_materials("obj").should_be_called()
|
||||
geometry.clear_modifiers("obj").should_be_called()
|
||||
geometry.clear_cache("element").should_be_called()
|
||||
subject.switch_representation(
|
||||
ifc,
|
||||
geometry,
|
||||
obj="obj",
|
||||
representation="mapped_rep",
|
||||
should_reload=False,
|
||||
is_global=True,
|
||||
should_sync_changes_first=True,
|
||||
)
|
||||
|
||||
def test_updating_a_representation_if_the_blender_object_has_been_edited_prior_to_switching(self, ifc, geometry):
|
||||
geometry.is_edited("obj").should_be_called().will_return(True)
|
||||
geometry.is_box_representation("mapped_rep").should_be_called().will_return(False)
|
||||
@@ -301,14 +216,7 @@ class TestSwitchRepresentation:
|
||||
geometry.run_geometry_update_representation(obj="obj").should_be_called()
|
||||
geometry.does_representation_id_exist("representation_id").should_be_called().will_return(True)
|
||||
geometry.get_object_data("obj").should_be_called().will_return("current_obj_data")
|
||||
geometry.should_use_immediate_representation("element", True).should_be_called().will_return(False)
|
||||
geometry.resolve_mapped_representation("mapped_rep").should_be_called().will_return("representation")
|
||||
geometry.get_representation_data("representation").should_be_called().will_return("data")
|
||||
geometry.change_object_data("obj", "data", is_global=False).should_be_called()
|
||||
geometry.record_object_materials("obj").should_be_called()
|
||||
geometry.clear_modifiers("obj").should_be_called()
|
||||
ifc.get_entity("obj").should_be_called().will_return("element")
|
||||
geometry.clear_cache("element").should_be_called()
|
||||
geometry.reimport_element_representations("obj", "mapped_rep", apply_openings=True).should_be_called()
|
||||
subject.switch_representation(
|
||||
ifc,
|
||||
geometry,
|
||||
|
||||
@@ -66,6 +66,9 @@ class TestCreateProject:
|
||||
project.run_context_add_context(
|
||||
context_type="Plan", context_identifier="Annotation", target_view="PLAN_VIEW", parent="plan"
|
||||
).should_be_called()
|
||||
project.run_context_add_context(
|
||||
context_type="Plan", context_identifier="Annotation", target_view="REFLECTED_PLAN_VIEW", parent="plan"
|
||||
).should_be_called()
|
||||
|
||||
def test_create_an_ifc4_project(self, ifc, georeference, project, spatial):
|
||||
ifc.get().should_be_called().will_return(None)
|
||||
@@ -98,6 +101,7 @@ class TestCreateProject:
|
||||
project.load_default_thumbnails().should_be_called()
|
||||
project.set_default_context().should_be_called()
|
||||
project.set_default_modeling_dimensions().should_be_called()
|
||||
project.run_root_reload_grid_decorator().should_be_called()
|
||||
georeference.set_model_origin().should_be_called()
|
||||
|
||||
subject.create_project(ifc, georeference, project, spatial, schema="IFC4", template=None)
|
||||
@@ -134,6 +138,7 @@ class TestCreateProject:
|
||||
project.load_default_thumbnails().should_be_called()
|
||||
project.set_default_context().should_be_called()
|
||||
project.set_default_modeling_dimensions().should_be_called()
|
||||
project.run_root_reload_grid_decorator().should_be_called()
|
||||
georeference.set_model_origin().should_be_called()
|
||||
|
||||
subject.create_project(ifc, georeference, project, spatial, schema="IFC4", template=None)
|
||||
@@ -171,6 +176,7 @@ class TestCreateProject:
|
||||
project.load_default_thumbnails().should_be_called()
|
||||
project.set_default_context().should_be_called()
|
||||
project.set_default_modeling_dimensions().should_be_called()
|
||||
project.run_root_reload_grid_decorator().should_be_called()
|
||||
georeference.set_model_origin().should_be_called()
|
||||
|
||||
subject.create_project(ifc, georeference, project, spatial, schema="IFC4", template="template")
|
||||
@@ -213,6 +219,7 @@ class TestCreateProject:
|
||||
project.load_default_thumbnails().should_be_called()
|
||||
project.set_default_context().should_be_called()
|
||||
project.set_default_modeling_dimensions().should_be_called()
|
||||
project.run_root_reload_grid_decorator().should_be_called()
|
||||
georeference.set_model_origin().should_be_called()
|
||||
|
||||
subject.create_project(ifc, georeference, project, spatial, schema="IFC2X3", template=None)
|
||||
|
||||
@@ -59,6 +59,7 @@ class TestCopyClass:
|
||||
geometry.get_representation_name("new_representation").should_be_called().will_return("name")
|
||||
geometry.rename_object("data", "name").should_be_called()
|
||||
geometry.link("new_representation", "data").should_be_called()
|
||||
geometry.reload_representation_item_ids("new_representation", "data").should_be_called()
|
||||
root.assign_body_styles("element", "obj").should_be_called()
|
||||
geometry.duplicate_object_data("obj").should_be_called().will_return("data")
|
||||
collector.assign("obj").should_be_called()
|
||||
|
||||
@@ -107,8 +107,8 @@ class TestCopyToContainer:
|
||||
class TestSelectContainer:
|
||||
def test_run(self, ifc, spatial):
|
||||
ifc.get_object("container").should_be_called().will_return("container_obj")
|
||||
spatial.set_active_object("container_obj").should_be_called()
|
||||
subject.select_container(ifc, spatial, container="container")
|
||||
spatial.set_active_object("container_obj", selection_mode="ADD").should_be_called()
|
||||
subject.select_container(ifc, spatial, container="container", selection_mode="ADD")
|
||||
|
||||
|
||||
class TestSelectSimilarContainer:
|
||||
|
||||
@@ -58,14 +58,13 @@ class TestRemoveStyle:
|
||||
|
||||
def test_removing_a_style(self, ifc, style):
|
||||
self.remove_a_style_common(ifc, style)
|
||||
style.is_editing_styles().should_be_called().will_return(False)
|
||||
subject.remove_style(ifc, style, style="style")
|
||||
|
||||
def test_removing_a_style_and_reloading_imported_styles(self, ifc, style):
|
||||
self.remove_a_style_common(ifc, style)
|
||||
style.is_editing_styles().should_be_called().will_return(True)
|
||||
style.import_presentation_styles("style_type").should_be_called()
|
||||
subject.remove_style(ifc, style, style="style")
|
||||
subject.remove_style(ifc, style, style="style", reload_styles_ui=True)
|
||||
|
||||
|
||||
class TestUpdateStyleColours:
|
||||
|
||||
Reference in New Issue
Block a user