Fix bug where editing then switching to the current representation crashes.

This commit is contained in:
Dion Moult
2022-01-30 14:46:05 +11:00
parent c7428dd160
commit e9670a6906
6 changed files with 74 additions and 25 deletions
+18
View File
@@ -272,7 +272,9 @@ class TestSwitchRepresentation:
def test_updating_a_representation_if_the_blender_object_has_been_edited_prior_to_switching(self, geometry):
geometry.is_edited("obj").should_be_called().will_return(True)
geometry.is_box_representation("mapped_rep").should_be_called().will_return(False)
geometry.get_representation_id("mapped_rep").should_be_called().will_return("representation_id")
geometry.run_geometry_update_representation(obj="obj").should_be_called()
geometry.does_representation_id_exist("representation_id").should_be_called().will_return(True)
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()
@@ -287,6 +289,22 @@ class TestSwitchRepresentation:
should_sync_changes_first=True,
)
def test_not_switching_if_an_updated_representation_is_the_same_one_we_were_going_to_switch_to(self, geometry):
geometry.is_edited("obj").should_be_called().will_return(True)
geometry.is_box_representation("mapped_rep").should_be_called().will_return(False)
geometry.get_representation_id("mapped_rep").should_be_called().will_return("representation_id")
geometry.run_geometry_update_representation(obj="obj").should_be_called()
geometry.does_representation_id_exist("representation_id").should_be_called().will_return(False)
subject.switch_representation(
geometry,
obj="obj",
representation="mapped_rep",
should_reload=False,
enable_dynamic_voids=False,
is_global=False,
should_sync_changes_first=True,
)
class TestGetRepresentationIfcParameters:
def test_run(self, geometry):