Expand description
TUI Testing Framework (SPEC-024 Section 12 & 13)
This module enforces test-first development for TUI widgets. Tests DEFINE the interface - implementation follows.
§Example: Test-First Interface Definition
ⓘ
use presentar_test::tui::{TuiTestBackend, expect_frame, FrameAssertion};
#[test]
fn test_cpu_exploded_receives_async_updates() {
let mut backend = TuiTestBackend::new(120, 40);
let mut app = App::test_instance();
// Frame 1: Initial render
app.apply_snapshot(snapshot1);
backend.render(|buf| ui::draw(&app, buf));
let freq1 = backend.extract_text_at(50, 5); // CPU frequency
// Frame 2: After async update
app.apply_snapshot(snapshot2);
backend.render(|buf| ui::draw(&app, buf));
let freq2 = backend.extract_text_at(50, 5);
// ASSERTION: Data must update
expect_frame(&backend)
.field("cpu_freq")
.changed_between(freq1, freq2);
}Structs§
- Async
Update Assertion - Assertion helper for async data updates. This is the CRITICAL test that defines interface requirements.
- Benchmark
Harness - Benchmark harness for running widget benchmarks.
- Benchmark
Result - Benchmark result.
- Diff
Entry - Single difference entry.
- Frame
Assertion - Fluent frame assertion builder.
- Performance
Targets - Performance targets for validation.
- Render
Metrics - Performance metrics collected during rendering.
- Snapshot
Diff - Difference between two snapshots.
- TuiCell
- Cell in the TUI buffer.
- TuiSnapshot
- Snapshot of TUI state for comparison.
- TuiTest
Backend - In-memory TUI test backend. Renders widgets to a buffer for assertions.
Enums§
- Snapshot
Error - Snapshot error.
Functions§
- expect_
frame - Start building frame assertions.