diff options
| author | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:37:29 +0200 |
|---|---|---|
| committer | Jackson Moore <jacksonmoore@tuta.io> | 2026-09-04 12:37:29 +0200 |
| commit | adfb712e10e834e19c1541d0657fe4af4489be61 (patch) | |
| tree | c1f0d89e7349f421eff23daac32e74421845aa10 /tests | |
| parent | 4adf0440cdf0bdc9db3dadf89ebda0c9622d2a01 (diff) | |
Compare cursor with input landing
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/run.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/run.lua b/tests/run.lua index 062f9ec..902d846 100644 --- a/tests/run.lua +++ b/tests/run.lua @@ -6132,6 +6132,33 @@ test("Persistent feedback owns one finalizer set", function() truthy(registrations[third.finalizers.identity].active) end) +test("CursorMoved compares the actual cursor with the last-input landing", function() + local state, transitions = fresh_sequence_state() + local landing = domain.Position.new(2, 4) + transitions:BeginAcquisition("v", "f") + transitions:CommitAcquiredTarget("v", target("a")) + transitions:CommitVisualSuccess("v", landing) + transitions:CommitCommandSuccess("n", domain.Position.new(1, 2), true) + local host = MemoryHost.new({ cursor = landing }) + local feedback = feedback_service.new({ + host = host, + state = state, + transitions = transitions, + }) + + local equal = feedback:handle_finalizer_event("CursorMoved") + same(domain.ModeContext.from_full_mode("v"), equal.context) + same(landing, equal.expected) + same(landing, equal.actual) + truthy(equal.equal) + + host:set_cursor(domain.Position.new(2, 5)) + local different = feedback:handle_finalizer_event("CursorMoved") + same(landing, different.expected) + same(domain.Position.new(2, 5), different.actual) + falsy(different.equal) +end) + for _, item in ipairs(tests) do local ok, failure = xpcall(item.body, debug.traceback) if not ok then |
