Files
MovementTests/addons/gdUnit4/src/ui/menu/GdUnitEditorFileSystemContextMenuHandler.gd
Minimata caeae26a09
Some checks failed
Create tag and build when new code gets to main / BumpTag (push) Successful in 22s
Create tag and build when new code gets to main / Test (push) Failing after 2m10s
Create tag and build when new code gets to main / Export (push) Has been skipped
fixed camera and sword animation issue and upgraded to Godot 4.6
2026-01-27 17:47:19 +01:00

38 lines
1.1 KiB
GDScript

@tool
extends EditorContextMenuPlugin
var _context_menus: Array[GdUnitContextMenuItem] = []
func _init() -> void:
var is_test_suite := func is_visible(script: Script, is_ts: bool) -> bool:
if script == null:
return false
return GdUnitTestSuiteScanner.is_test_suite(script) == is_ts
_context_menus.append(GdUnitContextMenuItem.new(
GdUnitCommandFileSystemRunTests.ID,
"Run Testsuites",
is_test_suite.bind(true)
))
_context_menus.append(GdUnitContextMenuItem.new(
GdUnitCommandFileSystemDebugTests.ID,
"Debug Testsuites",
is_test_suite.bind(true)
))
# setup shortcuts
for menu_item in _context_menus:
if menu_item.shortcut():
var cb := func call(...files: Array) -> void:
var paths: Array = files[0]
menu_item.execute.callv(paths)
add_menu_shortcut(menu_item.shortcut(), cb)
func _popup_menu(paths: PackedStringArray) -> void:
for menu_item in _context_menus:
if menu_item.shortcut():
add_context_menu_item_from_shortcut(menu_item.name, menu_item.shortcut(), menu_item.icon)
else:
add_context_menu_item(menu_item.name, menu_item.execute.bindv(paths).unbind(1), menu_item.icon)