Tests: Compositor: add UI test case for undo

Support the compositor in UI tests and add an undo test case involving
a compositing node tree.

Pull Request: https://projects.blender.org/blender/blender/pulls/140595
This commit is contained in:
Habib Gahbiche
2025-07-24 11:41:46 +02:00
parent c1df8404e7
commit 25d4ac38b1
2 changed files with 34 additions and 0 deletions

View File

@ -1356,6 +1356,7 @@ if(WITH_UI_TESTS)
test_workspace.sanity_check_sculpting
test_workspace.sanity_check_vfx
test_workspace.sanity_check_video_editing
test_undo.compositor_make_group
test_undo.text_editor_edit_mode_mix
test_undo.text_editor_simple
test_undo.view3d_edit_mode_multi_window

View File

@ -288,6 +288,39 @@ def text_editor_edit_mode_mix():
t.assertEqual(len(_bmesh_from_object(window.view_layer.objects.active).verts), 8 * 4)
t.assertEqual(text.as_string(), "AABBCC")
# -----------------------------------------------------------------------------
# Node Editor
def _compositor_startup_area(e):
"""
Set up the compositor node editor
"""
yield e.shift.f3(2) # Compositor
# yield e.ctrl.alt.space() # Full-screen.
def compositor_make_group():
import bpy
e, t = _test_vars(window := _test_window())
yield from _compositor_startup_area(e)
# Create a node tree with multiple nodes and select all nodes.
# TODO: Node tree should be created through the UI
node_group = bpy.data.node_groups.new(name="comp ntree", type="CompositorNodeTree")
window.scene.compositing_node_group = node_group
yield from _call_menu(e, "Add -> Color -> Alpha Convert")
yield e.ret() # Confirm adding node.
yield from _call_menu(e, "Add -> Filter -> Filter")
yield e.ret()
yield e.a() # Select all.
t.assertEqual(len(window.scene.compositing_node_group.nodes), 2)
yield e.ctrl.g() # Make group.
t.assertEqual(len(window.scene.compositing_node_group.nodes), 1)
yield e.ctrl.z()
t.assertEqual(len(window.scene.compositing_node_group.nodes), 2)
yield e.ctrl.z(5) # Revert to original state
# -----------------------------------------------------------------------------
# 3D View