test(scenes): smoke del flux d'escenes i parser de debug.yaml

Cobreix les dues peces pures del flux:
- parseStartScene / resolveStartScene: tots els valors vàlids, fallback
  a GAME per valor invàlid, YAML corrupte o fitxer inexistent.
- createDefaultIfMissing: crea el fitxer amb start_scene=GAME si no
  existeix i és idempotent quan ja hi és.
- isReservedScancode: F1/F12/Escape reservats, SPACE/fletxes no, i
  UNKNOWN sempre fals.

La lògica de update/render dels placeholders no es testeja perquè
arrossegaria Screen/Notifier/RenderInfo (tot l'stack SDL). Aquesta
integració queda coberta pel smoke xvfb-run del binari.

Stand-alone target `test_scene_flow` que només enllaça els .cpp pures
necessaris, amb ctest afegit.
This commit is contained in:
JailDesigner committed 2026-04-22 10:35:07 +02:00
1 parent 87a9f098b5
commit 2cb21211ef
2 files changed
+178

No files matched your search

+20
View File
@@ -278,4 +278,24 @@ if(BUILD_TESTS)
add_test(NAME entities_smoke
COMMAND test_entities_smoke
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
# Smoke del flux d'escenes i del parser de debug.yaml. Stand-alone:
# només enllaça els helpers purs (debug_config, placeholder_input,
# key_config) perquè la integració completa dels placeholders arrossegaria
# tot l'stack SDL (Screen/Notifier/RenderInfo), coberta pel smoke xvfb.
add_executable(test_scene_flow
tests/test_scene_flow.cpp
source/game/debug_config.cpp
source/game/scenes/placeholder_input.cpp
source/core/input/key_config.cpp
)
target_include_directories(test_scene_flow PRIVATE
"${CMAKE_SOURCE_DIR}/source"
"${CMAKE_BINARY_DIR}"
)
target_link_libraries(test_scene_flow PRIVATE SDL3::SDL3)
target_compile_options(test_scene_flow PRIVATE -Wall -Wextra -Wpedantic)
add_test(NAME scene_flow
COMMAND test_scene_flow
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
endif()