intake tests: an identical re-delivery is silent

This commit is contained in:
Meta Vens 2026-11-28 09:15:08 +01:00
commit 87da57fdfe
2 changed files with 9 additions and 4 deletions

View file

@ -6,7 +6,7 @@ use thing_core::bind::Binder;
use thing_core::diagnostic::Code;
use thing_core::input::{InputEvent, Key, Modifiers, PointerButton, WheelUnit};
use thing_core::layout::{LayoutFrame, Metrics, layout};
use thing_core::port::{Address, Ledger, StatePort};
use thing_core::port::{Address, Ledger};
use thing_core::render::{RenderCommand, RenderInput, ScrollOffsets, render};
use thing_core::resolve::{Limits, resolve};
use thing_core::theme::Theme;

View file

@ -148,8 +148,11 @@ fn a_surface_that_fails_to_resolve_leaves_the_last_good_tree_displayed() {
let bad = surface("main", 2, vec![command_button("go", "undeclared")]);
assert_eq!(codes(&rig.offer(&bad)), vec![Code::UndeclaredCommand]);
assert_eq!(rig.title(&key).as_deref(), Some("main v1"));
// The refused version was offered: it is stale now, not tried again.
assert_eq!(codes(&rig.offer(&bad)), vec![Code::StaleVersionIgnored]);
// The refused version was offered: it is stale now, not tried again. (The same document again is
// a replay and is silent.)
assert!(rig.offer(&bad).is_empty());
let other = surface("main", 2, vec![command_button("go", "also-undeclared")]);
assert_eq!(codes(&rig.offer(&other)), vec![Code::StaleVersionIgnored]);
assert_eq!(rig.title(&key).as_deref(), Some("main v1"));
assert!(rig.offer(&surface("main", 3, vec![])).is_empty());
@ -177,7 +180,9 @@ fn a_refused_surface_keeps_the_held_tree_and_is_not_a_delete() {
assert_eq!(diagnostics[0].surface, key);
assert_eq!(rig.title(&key).as_deref(), Some("main v1"));
// The version it was refused at was never taken: the same version is still the highest.
assert_eq!(codes(&rig.offer(&v1)), vec![Code::StaleVersionIgnored]);
assert!(rig.offer(&v1).is_empty(), "the same document again is a replay");
let other = surface("main", 1, vec![command_button("go", "go")]);
assert_eq!(codes(&rig.offer(&other)), vec![Code::StaleVersionIgnored]);
}