test(native): gesture replay fixture loader + disabled recognizer scaffold (#78)#96
Merged
Conversation
…e 2)
Add a native gesture-replay harness that can consume TraceRecorder JSON
fixtures and run inside the existing host CMake / ctest workflow.
New files:
tests/replay/trace_fixture.h
Header-only C++17 fixture loader (parseFixture / loadFixture).
Parses the TraceRecorder schema (version 1) into plain structs with
xCoordinates() / yCoordinates() / times() / pointerIds() accessors
ready to forward to Suggest::getSuggestions once blockers are lifted.
tests/replay/gesture_replay_test.cpp
TraceFixtureParserTest (9 enabled tests) — cover JSON parsing,
accessor arrays, monotonic timestamps, coordinate bounds, escape
handling, and empty-pointer edge cases.
DISABLED_GestureReplayTest.ReplayHelloQwerty — compile-checked
scaffold documenting the exact API seam and two concrete blockers.
tests/replay/fixtures/hello_qwerty.json
Seed fixture: 14-sample "hello" trace on a 1080×310 QWERTY keyboard
(en-US). Consumed by TraceFixtureParserTest.LoadsHelloQwertyFromFile.
CMakeLists.txt:
Add target_compile_definitions(FIXTURE_DIR=...) so the file-path test
resolves the fixture directory at compile time without network access.
Blockers documented in gesture_replay_test.cpp (DISABLED_ comment block):
1. ProximityInfo requires a live JNIEnv* — calls env->GetArrayLength()
unconditionally in its constructor; no non-JNI overload exists.
Fix: add a raw-pointer constructor or a fake-JNIEnv shim.
2. Dictionary requires a compiled binary .dict asset not in the tree.
Fix: bundle a small en_US dict via CMake FetchContent, or generate
one programmatically using the existing v4 writer classes.
ctest result: 76/76 pass, 1 disabled (GestureReplayTest.ReplayHelloQwerty)
This was referenced Jun 12, 2026
AsafMah
added a commit
that referenced
this pull request
Jun 13, 2026
#78) (#104) Follow-up proof spike after #96. Add a non-JNI ProximityInfo constructor that accepts the same keyboard geometry as raw int/float arrays, so native host tests can build a keyboard geometry object without a live JVM/JNIEnv. Adds GestureReplayHostSeamTest.BuildsProximityInfoWithoutJNI: constructs a minimal QWERTY ProximityInfo and verifies key lookup for the 'hello' trace. Attempted to enable the full replay assertion with an in-memory dict; ASAN showed the next blocker is more fundamental than a dict asset: the open-source tree has no GestureSuggestPolicy implementation, only GestureSuggestPolicyFactory, whose factory method is null in host builds. Dictionary::getSuggestions(..., IS_GESTURE) therefore crashes at TRAVERSAL->getMaxSpatialDistance(). The disabled replay scaffold now documents that real blocker. Verification (WSL / ubuntu-like): native host ctest excluding the known FormatUtils quarantine -> 77/77 enabled tests pass, 1 disabled replay assertion.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #78 deliverable 2. This is the honest first increment: it adds the fixture/replay test harness path and documents the two native seams that block a real recognizer assertion in host CI.
What
tests/replay/trace_fixture.h— header-only parser + structs for TraceRecorder-style JSON fixtures.tests/replay/fixtures/hello_qwerty.json— seedhelloQWERTY trace (14 samples).tests/replay/gesture_replay_test.cpp— 9 enabled parser/fixture tests + 1DISABLED_GestureReplayTest.ReplayHelloQwertyscaffold.CMakeLists.txt— exposesFIXTURE_DIRto host tests.Why the recognizer assertion is disabled
The parser path is CI-ready, but a real host recognizer replay needs two explicit seams:
ProximityInforequires a liveJNIEnv*— its constructor callsenv->GetArrayLength(...)unconditionally. Fix: add a non-JNI constructor accepting raw arrays, or a tiny JNIEnv shim for host tests.Dictionaryrequires a compiled binary.dictasset — the source tree doesn't ship one. Fix: bundle/fetch a small compiled en-US dict, or generate a tiny v4 dict in the test using existing writer classes.No fake pass: the real assertion stays disabled until those seams are solved.
Verification
Subagent ran the native host suite on Ubuntu 24.04 / g++ 13 / cmake 3.28: 76/76 enabled tests pass, 1 disabled (
GestureReplayTest.ReplayHelloQwerty).