Fix bug where syncing an object removed from the collection tree breaks.

This commit is contained in:
Dion Moult
2022-01-30 14:42:26 +11:00
parent bf9d46b506
commit c7428dd160
8 changed files with 71 additions and 43 deletions
+40 -37
View File
@@ -5,41 +5,44 @@
# ############################################################################ #
# This allows us to write full integration tests that test how all systems work
# as a whole. Whilst other tests focus on portions of the software, these tests
# simulate what happens when a user opens Blender, presses buttons, and does
# things.
# Note: these tests are commented out as they are for learning purposes only. If
# you want to run these tests, uncomment it :)
# These tests read like english. You can see all the possible sentences defined
# in test_feature.py. Most of the time, there is already a sentence defined for
# what you want to test.
@demo
Feature: Demo
# Every operator has at least one scenario associated with it to test it.
Scenario: Demonstrate hello world
Given an empty IFC project
When I press "bim.demonstrate_hello_world"
# Blender doesn't have a way of testing that things are visible in the
# interface and layout. We can check properties, and whats in the 3D
# scenegraph, but not layout. There is no "DOM" like in web applications.
# Too bad, we can't check the results, but we still write the test, that way
# we can still check for errors like crashes or Python errors, like a "smoke
# test".
Then nothing happens
# This operator has two scenarios because there are two possibilities of a user
# interacting with it.
Scenario: Demonstrate rename project - with a name provided
Given an empty IFC project
When I set "scene.BIMDemoProperties.name" to "Foobar"
And I press "bim.demonstrate_rename_project"
Then the object "IfcProject/Foobar" is an "IfcProject"
# This is the other possible scenario for the rename project operator.
Scenario: Demonstrate rename project - with no name
Given an empty IFC project
When I set "scene.BIMDemoProperties.name" to ""
And I press "bim.demonstrate_rename_project"
Then the object "IfcProject/My Project" is an "IfcProject"
#|# This allows us to write full integration tests that test how all systems work
#|# as a whole. Whilst other tests focus on portions of the software, these tests
#|# simulate what happens when a user opens Blender, presses buttons, and does
#|# things.
#|
#|# These tests read like english. You can see all the possible sentences defined
#|# in test_feature.py. Most of the time, there is already a sentence defined for
#|# what you want to test.
#|
#|@demo
#|Feature: Demo
#|
#|# Every operator has at least one scenario associated with it to test it.
#|Scenario: Demonstrate hello world
#| Given an empty IFC project
#| When I press "bim.demonstrate_hello_world"
#| # Blender doesn't have a way of testing that things are visible in the
#| # interface and layout. We can check properties, and whats in the 3D
#| # scenegraph, but not layout. There is no "DOM" like in web applications.
#| # Too bad, we can't check the results, but we still write the test, that way
#| # we can still check for errors like crashes or Python errors, like a "smoke
#| # test".
#| Then nothing happens
#|
#|# This operator has two scenarios because there are two possibilities of a user
#|# interacting with it.
#|Scenario: Demonstrate rename project - with a name provided
#| Given an empty IFC project
#| When I set "scene.BIMDemoProperties.name" to "Foobar"
#| And I press "bim.demonstrate_rename_project"
#| Then the object "IfcProject/Foobar" is an "IfcProject"
#|
#|# This is the other possible scenario for the rename project operator.
#|Scenario: Demonstrate rename project - with no name
#| Given an empty IFC project
#| When I set "scene.BIMDemoProperties.name" to ""
#| And I press "bim.demonstrate_rename_project"
#| Then the object "IfcProject/My Project" is an "IfcProject"
+1 -1
View File
@@ -184,7 +184,7 @@ def the_object_name_is_placed_in_the_collection_collection(name, collection):
def additionally_the_object_name_is_selected(name):
obj = bpy.context.scene.objects.get(name)
if not obj:
assert False, 'The object "{name}" could not be selected'
assert False, f'The object "{name}" could not be selected'
bpy.context.view_layer.objects.active = obj
obj.select_set(True)