utils/kuhy_credit/godot/tests/click_test.gd
Krzysztof kuhy Rudnicki d696189a2e
Some checks are pending
file length / file-length (push) Waiting to run
kuhy_credit drift / drift (push) Waiting to run
kuhy_credit tests / python (push) Waiting to run
kuhy_credit tests / web (push) Waiting to run
kuhy_credit tests / flutter (push) Waiting to run
kuhy_credit tests / godot (push) Waiting to run
md-naming / markdown naming convention (push) Waiting to run
palette drift / palette (push) Waiting to run
repo-contract / repo contract (push) Waiting to run
shared gate tests / gate unit tests (push) Waiting to run
kuhy_credit: Flutter example, CI fixes
- Flutter example gets its android and web platform dirs (label
  "Credit" for the launcher contract); logo painter moves to a part
  file to stay under 250 lines.
- Godot click tests size the headless window to 640x360 (the official
  build opens 64x64 and drops clicks outside it) and hide GUT's GUI.
- godot/test.sh writes godot output to files, not $(...), and fails
  when fewer tests ran than tests/ declares.
- README Python snippet passes ruff format.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-20 16:49:46 +01:00

26 lines
798 B
GDScript

extends GutTest
## Base for tests that click. GUT's own full-window GUI sits on a CanvasLayer
## above the scene and swallows pushed mouse events, so it is hidden while
## these tests run. The headless window of the official Godot build is 64x64,
## and a click outside the window is dropped, so the window takes the
## project's 640x360 size for these tests.
const TEST_WINDOW := Vector2i(640, 360)
var _gut_layers: Array[Node] = []
var _old_size: Vector2i
func before_all() -> void:
_old_size = get_window().size
get_window().size = TEST_WINDOW
_gut_layers = get_tree().root.find_children("GutLayer", "CanvasLayer", true, false)
for layer in _gut_layers:
layer.visible = false
func after_all() -> void:
for layer in _gut_layers:
layer.visible = true
get_window().size = _old_size