Fix #6094. Fix failing core tests.

This commit is contained in:
Dion Moult
2025-02-04 13:36:28 +11:00
parent a35ef32ee6
commit 0c41f0c32c
7 changed files with 83 additions and 53 deletions
+33 -9
View File
@@ -34,9 +34,10 @@ class TestDisableEditingText:
class TestEditText:
def test_run(self, ifc, drawing):
def test_run(self, drawing):
drawing.synchronise_ifc_and_text_attributes("obj").should_be_called()
drawing.update_text_size_pset("obj").should_be_called()
drawing.update_newline_at("obj").should_be_called()
drawing.update_text_value("obj").should_be_called()
drawing.disable_editing_text("obj").should_be_called()
subject.edit_text(drawing, obj="obj")
@@ -161,11 +162,11 @@ class TestAddSheet:
subject.add_sheet(ifc, drawing, titleblock="titleblock")
class TestOpenSheet:
class TestOpenLayout:
def test_run(self, drawing):
drawing.get_document_uri("sheet", "LAYOUT").should_be_called().will_return("uri")
drawing.open_layout_svg("uri").should_be_called()
subject.open_sheet(drawing, sheet="sheet")
subject.open_layout(drawing, sheet="sheet")
class TestRemoveSheet:
@@ -532,19 +533,30 @@ class TestAddAnnotation:
drawing.create_annotation_object("drawing", "object_type").should_be_called().will_return("obj")
ifc.get_entity("obj").should_be_called().will_return(None)
drawing.get_ifc_representation_class("object_type").should_be_called().will_return("ifc_representation_class")
drawing.get_annotation_representation("element_type").should_be_called().will_return("type_rep")
drawing.run_root_assign_class(
obj="obj",
ifc_class="IfcAnnotation",
predefined_type="object_type",
should_add_representation=True,
should_add_representation=False,
context="context",
ifc_representation_class="ifc_representation_class",
).should_be_called().will_return("element")
drawing.get_drawing_group("drawing").should_be_called().will_return("group")
drawing.run_type_assign_type(element="element", relating_type="element_type").should_be_called()
ifc.run("group.assign_group", group="group", products=["element"]).should_be_called()
collector.assign("obj").should_be_called()
drawing.enable_editing("obj").should_be_called()
subject.add_annotation(ifc, collector, drawing, drawing="drawing", object_type="object_type")
drawing.get_representation("element", "context").should_be_called().will_return("rep")
drawing.reload_representation(obj="obj", representation="rep").should_be_called()
collector.assign("obj", should_clean_users_collection=True).should_be_called()
subject.add_annotation(
ifc,
collector,
drawing,
drawing="drawing",
object_type="object_type",
relating_type="element_type",
enable_editing=False,
)
def test_create_a_missing_annotation_context_on_the_fly(self, ifc, collector, drawing):
drawing.get_drawing_target_view("drawing").should_be_called().will_return("target_view")
@@ -554,6 +566,7 @@ class TestAddAnnotation:
drawing.create_annotation_object("drawing", "object_type").should_be_called().will_return("obj")
ifc.get_entity("obj").should_be_called().will_return(None)
drawing.get_ifc_representation_class("object_type").should_be_called().will_return("ifc_representation_class")
drawing.get_annotation_representation("element_type").should_be_called().will_return(None)
drawing.run_root_assign_class(
obj="obj",
ifc_class="IfcAnnotation",
@@ -562,8 +575,19 @@ class TestAddAnnotation:
context="context",
ifc_representation_class="ifc_representation_class",
).should_be_called().will_return("element")
drawing.run_type_assign_type(element="element", relating_type="element_type").should_be_called()
drawing.get_drawing_group("drawing").should_be_called().will_return("group")
ifc.run("group.assign_group", group="group", products=["element"]).should_be_called()
collector.assign("obj").should_be_called()
drawing.get_representation("element", "context").should_be_called().will_return("rep")
drawing.reload_representation(obj="obj", representation="rep").should_be_called()
collector.assign("obj", should_clean_users_collection=True).should_be_called()
drawing.enable_editing("obj").should_be_called()
subject.add_annotation(ifc, collector, drawing, drawing="drawing", object_type="object_type")
subject.add_annotation(
ifc,
collector,
drawing,
drawing="drawing",
object_type="object_type",
relating_type="element_type",
enable_editing=True,
)