tui(history): payment history and tx detail screen #83
2 changed files with 59 additions and 0 deletions
tui(history): add F6 h needle + PR frame dump for hostile memo
- Add 'F6 h' to tests/tui_chrome.rs needle list (help_overlay_text already documents the history binding; test must assert it) - Add dump_history_pr_frames to tests/tui_frames.rs: empty, mixed verified/unverified list, detail view, and hostile memo (C0 + bidi) at 80x24 and 120x40 Signed-off-by: tui-design <tui-design@hermes>
commit
7f880ede2c
|
|
@ -46,6 +46,7 @@ fn help_overlay_lists_core_bindings() {
|
||||||
"F4",
|
"F4",
|
||||||
"F5",
|
"F5",
|
||||||
"F6",
|
"F6",
|
||||||
|
"F6 h",
|
||||||
"F6 s",
|
"F6 s",
|
||||||
"F6 n",
|
"F6 n",
|
||||||
"F6 r",
|
"F6 r",
|
||||||
|
|
|
||||||
|
|
@ -1250,3 +1250,61 @@ fn dump_history_ascii_frames() {
|
||||||
|
|
||||||
/// Lock for env-var-touching tests (mirrors tui_spec.rs pattern).
|
/// Lock for env-var-touching tests (mirrors tui_spec.rs pattern).
|
||||||
static ASCII_ENV: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
static ASCII_ENV: std::sync::Mutex<()> = std::sync::Mutex::new(());
|
||||||
|
|
||||||
|
/// Dump history frames at 80x24 and 120x40 for PR-body evidence:
|
||||||
|
/// empty, mixed verified/unverified list, detail view, and a hostile memo
|
||||||
|
/// (C0 control chars + bidi override) rendered as inert text.
|
||||||
|
#[test]
|
||||||
|
fn dump_history_pr_frames() {
|
||||||
|
unsafe { std::env::remove_var("ONIONWIRE_ASCII"); }
|
||||||
|
unsafe { std::env::remove_var("NO_COLOR"); };
|
||||||
|
let now = 1700000300i64;
|
||||||
|
let hostile = "pay\x01now\u{202E}reverse";
|
||||||
|
let payments = vec![
|
||||||
|
Payment {
|
||||||
|
id: 1,
|
||||||
|
dir: "out".into(),
|
||||||
|
kind: "tip".into(),
|
||||||
|
amount_atomic: "1000000000".into(),
|
||||||
|
address: "4AdYaG7wVQ3nHvWoXbN9dQkXj1uYcR2mS8pT5LzE6fK7gB3aD".into(),
|
||||||
|
memo: "coffee".into(),
|
||||||
|
txid: Some("abcdef0123456789abcdef0123456789abcdef0123456789abcdef0123456789".into()),
|
||||||
|
verified: true,
|
||||||
|
created_at: 1699999000,
|
||||||
|
},
|
||||||
|
Payment {
|
||||||
|
id: 2,
|
||||||
|
dir: "in".into(),
|
||||||
|
kind: "payment".into(),
|
||||||
|
amount_atomic: "50000000000".into(),
|
||||||
|
address: String::new(),
|
||||||
|
memo: String::new(),
|
||||||
|
txid: Some("deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef".into()),
|
||||||
|
verified: true,
|
||||||
|
created_at: 1700000100,
|
||||||
|
},
|
||||||
|
Payment {
|
||||||
|
id: 3,
|
||||||
|
dir: "out".into(),
|
||||||
|
kind: "invoice".into(),
|
||||||
|
amount_atomic: "500000000".into(),
|
||||||
|
address: String::new(),
|
||||||
|
memo: hostile.to_string(),
|
||||||
|
txid: None,
|
||||||
|
verified: false,
|
||||||
|
created_at: 1700000200,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
draw_to(80, 24, "history list (mixed verified/unverified)", |f| {
|
||||||
|
draw_history(f, &payments, 0, false, "alice", now);
|
||||||
|
});
|
||||||
|
draw_to(80, 24, "history detail (hostile memo)", |f| {
|
||||||
|
draw_history(f, &payments, 2, true, "alice", now);
|
||||||
|
});
|
||||||
|
draw_to(80, 24, "history empty", |f| {
|
||||||
|
draw_history(f, &[], 0, false, "bob", now);
|
||||||
|
});
|
||||||
|
draw_to(120, 40, "history list (mixed)", |f| {
|
||||||
|
draw_history(f, &payments, 0, false, "alice", now);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue