Skip to content

Commit c3a87c8

Browse files
committed
Add basic text editing feature tests
1 parent c30d24c commit c3a87c8

File tree

2 files changed

+76
-1
lines changed

2 files changed

+76
-1
lines changed

src/bonsai/test/bim/feature/drawing.feature

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,81 @@ Scenario: Create sheet - with a drawing added to it
310310
When I click "OUTPUT"
311311
Then the file "{ifc_dir}/sheets/A01 - UNTITLED.svg" should contain "IfcWall"
312312

313+
Scenario: Enable editing text
314+
Given an empty IFC project
315+
And I add a cube
316+
And the object "Cube" is selected
317+
And I save IFC project
318+
And I look at the "Drawings" panel
319+
And I click "IMPORT"
320+
And I click "ADD"
321+
And I press "bim.toggle_target_view(option="EXPAND", target_view='PLAN_VIEW')"
322+
And I select the "PLAN_VIEW" item in the "BIM_UL_drawinglist" list
323+
And I click "VIEW_CAMERA_UNSELECTED" in the row where I see "PLAN_VIEW" in the "1st" list
324+
And I press "bim.add_annotation"
325+
And the object "IfcAnnotation/TEXT" is selected
326+
And I look at the "BIM_PT_text" panel
327+
When I click "Enable Editing Text"
328+
Then I see "Literals:"
329+
And I don't see "FontSize"
330+
331+
Scenario: Disable editing text
332+
Given an empty IFC project
333+
And I add a cube
334+
And the object "Cube" is selected
335+
And I save IFC project
336+
And I look at the "Drawings" panel
337+
And I click "IMPORT"
338+
And I click "ADD"
339+
And I press "bim.toggle_target_view(option="EXPAND", target_view='PLAN_VIEW')"
340+
And I select the "PLAN_VIEW" item in the "BIM_UL_drawinglist" list
341+
And I click "VIEW_CAMERA_UNSELECTED" in the row where I see "PLAN_VIEW" in the "1st" list
342+
And I press "bim.add_annotation"
343+
And the object "IfcAnnotation/TEXT" is selected
344+
And I look at the "BIM_PT_text" panel
345+
And I click "Enable Editing Text"
346+
When I click "CANCEL"
347+
Then I see "FontSize"
348+
And I don't see "Literals:"
349+
350+
Scenario: Edit text - no changes
351+
Given an empty IFC project
352+
And I add a cube
353+
And the object "Cube" is selected
354+
And I save IFC project
355+
And I look at the "Drawings" panel
356+
And I click "IMPORT"
357+
And I click "ADD"
358+
And I press "bim.toggle_target_view(option="EXPAND", target_view='PLAN_VIEW')"
359+
And I select the "PLAN_VIEW" item in the "BIM_UL_drawinglist" list
360+
And I click "VIEW_CAMERA_UNSELECTED" in the row where I see "PLAN_VIEW" in the "1st" list
361+
And I press "bim.add_annotation"
362+
And the object "IfcAnnotation/TEXT" is selected
363+
And I look at the "BIM_PT_text" panel
364+
And I click "Enable Editing Text"
365+
When I click "Edit Text"
366+
Then I see "FontSize"
367+
And I don't see "Literals:"
368+
369+
Scenario: Edit text - change literal
370+
Given an empty IFC project
371+
And I add a cube
372+
And the object "Cube" is selected
373+
And I save IFC project
374+
And I look at the "Drawings" panel
375+
And I click "IMPORT"
376+
And I click "ADD"
377+
And I press "bim.toggle_target_view(option="EXPAND", target_view='PLAN_VIEW')"
378+
And I select the "PLAN_VIEW" item in the "BIM_UL_drawinglist" list
379+
And I click "VIEW_CAMERA_UNSELECTED" in the row where I see "PLAN_VIEW" in the "1st" list
380+
And I press "bim.add_annotation"
381+
And the object "IfcAnnotation/TEXT" is selected
382+
And I look at the "BIM_PT_text" panel
383+
And I click "Enable Editing Text"
384+
And I set the "Literal" property to "Hello World"
385+
When I click "Edit Text"
386+
Then I see "Hello World"
387+
313388
Scenario: Add reference image
314389
Given an empty IFC project
315390
And I save IFC project

src/bonsai/test/bim/test_feature.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,7 @@ def i_look_at_the_panel_panel(panel: str) -> None:
378378
# Option to provide explicit panel name if panel names overlap.
379379
panel_class = getattr(bpy.types, panel, None)
380380

381-
if panel_class is None:
381+
if panel_class is None or panel_class.bl_rna.base.name not in ("Panel", "Operator", "Menu", "UIList"):
382382
global ui_name_cache
383383
create_ui_name_cache()
384384
if panel not in ui_name_cache:

0 commit comments

Comments
 (0)