From 8eb8c5565f19583cca7a7eb438ce674020182c75 Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Tue, 10 Mar 2026 15:38:42 +0100 Subject: [PATCH] [cpp] Fix test expected output to include refString fields Updates test.sh expected output to match current SkeletonSerializer format. Adds test infrastructure documentation to AGENTS.md. --- AGENTS.md | 16 ++++++++++++++++ spine-cpp/tests/test.sh | 6 +++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 38f7d0af3..7038bba08 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -41,3 +41,19 @@ Use lowercase prefixes exactly as listed below. - If multiple runtimes are changed, include multiple prefixes. - If all runtimes are changed, use `[runtimes]`. - If shared files at repo root are changed, include the runtime prefix(es) impacted by that change. + +## spine-cpp / spine-libgdx test infrastructure + +The spine-cpp headless test (`spine-cpp/tests/test.sh`) validates that spine-cpp produces the same parsed skeleton data as spine-libgdx. Both runtimes have a `SkeletonSerializer` that serializes loaded skeleton data to JSON for comparison. + +Files: +- `spine-cpp/tests/HeadlessTest.cpp` - C++ test that loads skeleton and serializes to JSON +- `spine-cpp/tests/SkeletonSerializer.h` - C++ JSON serializer for skeleton data +- `spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/HeadlessTest.java` - Java equivalent +- `spine-libgdx/spine-libgdx-tests/src/com/esotericsoftware/spine/utils/SkeletonSerializer.java` - Java equivalent + +When tests disagree: +1. Check if the skeleton was loaded from JSON or binary. Run both to isolate which parser differs. +2. Compare the SkeletonSerializer implementations. They must output identical JSON structure. +3. Check for unported changes in spine-libgdx (SkeletonBinary.java, SkeletonJson.java) and port them to spine-cpp. +4. Update `spine-cpp/tests/test.sh` expected output if the serializer format changed intentionally. diff --git a/spine-cpp/tests/test.sh b/spine-cpp/tests/test.sh index 3518c4f7e..02e13a4af 100755 --- a/spine-cpp/tests/test.sh +++ b/spine-cpp/tests/test.sh @@ -23,14 +23,14 @@ SPINEBOY_ANIM="idle" # Expected output pattern - first 10 lines of skeleton JSON data EXPECTED_OUTPUT="=== SKELETON DATA === { + \"refString\": \"\", \"type\": \"SkeletonData\", \"bones\": [{ + \"refString\": \"\", \"type\": \"BoneData\", \"index\": 0, \"parent\": null, - \"length\": 0, - \"color\": { - \"r\": 0.607843," + \"length\": 0," log_title "Spine-C++ Test" log_detail "Platform: $(uname)"