tui: settings-menu frame dumps use the footer the app renders
All checks were successful
ci / test (pull_request) Successful in 5m17s
ci / sdk (pull_request) Successful in 1m8s
ci / fuzz (pull_request) Successful in 4m50s
android-ci / android (pull_request) Successful in 10m19s

The same defect as the peer-payments fixture, one screen over: after the
clean-look chrome redesign (now merged) `App::draw` renders the F9 menu's one
status line with `status_footer_phased` and the hint from `footer_hints`, while
`tests/tui_spec.rs::render_menu` still built a phase-free `status_footer` from a
hand-copied hint string — so every menu frame in the PR body showed a footer the
app does not draw (no Tor phase).

- `wallets_settings_footer_hint()` is now the single source for that hint, the
  way `peer_payments_footer_hint()` is for the history screen.
- `render_menu` makes the app's own two calls, `TorPhase::Ready` for the
  healthy-wallet state the fixture describes.
- `wallets_settings_menu_frame_shows_the_shipped_footer` pins the dumped frame's
  last line to the shipped one (RED first: the fixture's line read
  `TOR  me:… Esc back c copy ? help`, the app's `✓ TOR ready  me:…`).

`cargo test --locked` 384 passed / 0 failed, clippy clean.
This commit is contained in:
agent 2026-09-19 01:18:47 -04:00
commit c1d13178b6
No known key found for this signature in database
2 changed files with 49 additions and 5 deletions

View file

@ -3162,7 +3162,7 @@ match screen {
} }
Screen::WalletSetup(WalletSetup::CreateSeed { .. }) => "type SEEN Esc cancel ? help", Screen::WalletSetup(WalletSetup::CreateSeed { .. }) => "type SEEN Esc cancel ? help",
Screen::WalletSetup(WalletSetup::ImportSeed { .. }) => "paste seed Enter Esc ? help", Screen::WalletSetup(WalletSetup::ImportSeed { .. }) => "paste seed Enter Esc ? help",
Screen::WalletsSettings { .. } => "Esc back c copy ? help", Screen::WalletsSettings { .. } => wallets_settings_footer_hint(),
Screen::PeerPayments { .. } => peer_payments_footer_hint(), Screen::PeerPayments { .. } => peer_payments_footer_hint(),
Screen::Quit { .. } => "CLEAR or QUIT then Enter Esc cancel ? help", Screen::Quit { .. } => "CLEAR or QUIT then Enter Esc cancel ? help",
} }
@ -3177,6 +3177,16 @@ pub fn peer_payments_footer_hint() -> &'static str {
const PEER_PAYMENTS_FOOTER_HINT: &str = "Esc back up/down select F9 menu ? help"; const PEER_PAYMENTS_FOOTER_HINT: &str = "Esc back up/down select F9 menu ? help";
/// The hint line the WALLETS & SETTINGS menu prints, single-sourced for the
/// same reason as [`peer_payments_footer_hint`]: the menu's frame-dump fixture
/// must not hand-copy it (and must not pair it with the phase-free footer the
/// app stopped using when the chrome redesign landed).
pub fn wallets_settings_footer_hint() -> &'static str {
WALLETS_SETTINGS_FOOTER_HINT
}
const WALLETS_SETTINGS_FOOTER_HINT: &str = "Esc back c copy ? help";
fn apply_chrome_borders(block: Block<'_>) -> Block<'_> { fn apply_chrome_borders(block: Block<'_>) -> Block<'_> {
let block = block.borders(Borders::ALL); let block = block.borders(Borders::ALL);
if ascii_chrome() { if ascii_chrome() {

View file

@ -5,12 +5,13 @@ use onionwire::Message;
use onionwire::outbox::{OutboxEntry, OutboxStatus}; use onionwire::outbox::{OutboxEntry, OutboxStatus};
use onionwire::qr; use onionwire::qr;
use onionwire::tui::{ use onionwire::tui::{
OutboxSummary, SlashCmd, WalletMenuState, alert_line, ascii_chrome, cell_width, OutboxSummary, SlashCmd, TorPhase, WalletMenuState, alert_line, ascii_chrome, cell_width,
chat_with_delivery, delivery_tag, draw_chat, draw_share, draw_text_overlay, chat_with_delivery, delivery_tag, draw_chat, draw_share, draw_text_overlay,
draw_wallets_settings, empty_friend_chat_text, fit_cells, help_overlay_text, main_footer_hints, draw_wallets_settings, empty_friend_chat_text, fit_cells, help_overlay_text, main_footer_hints,
main_header_line, osc52_copy_sequence, parse_cmd, paste_screen_text, retry_in_text, main_header_line, osc52_copy_sequence, parse_cmd, paste_screen_text, retry_in_text,
roster_col_width, short_send_reason, status_footer, wallets_settings_menu_lines, roster_col_width, short_send_reason, status_footer, status_footer_phased,
wallets_settings_menu_text, wrap_invite, wallets_settings_footer_hint, wallets_settings_menu_lines, wallets_settings_menu_text,
wrap_invite,
}; };
use ratatui::Frame; use ratatui::Frame;
use ratatui::Terminal; use ratatui::Terminal;
@ -954,13 +955,46 @@ fn menu_state() -> WalletMenuState {
fn render_menu(w: u16, h: u16, st: &WalletMenuState) -> String { fn render_menu(w: u16, h: u16, st: &WalletMenuState) -> String {
let backend = TestBackend::new(w, h); let backend = TestBackend::new(w, h);
let mut terminal = Terminal::new(backend).expect("terminal"); let mut terminal = Terminal::new(backend).expect("terminal");
let footer = status_footer(w, FP, ONION, None, "Esc back c copy ? help"); // The app's own two calls for this screen (see `App::draw`): the phased
// footer with the hint `footer_hints` returns. A phase-free footer here
// would be a footer the app never renders.
let footer = status_footer_phased(
w,
FP,
ONION,
Some(TorPhase::Ready),
None,
wallets_settings_footer_hint(),
);
terminal terminal
.draw(|f| draw_wallets_settings(f, st, &footer)) .draw(|f| draw_wallets_settings(f, st, &footer))
.expect("draw"); .expect("draw");
screen_from(terminal.backend().buffer(), w, h) screen_from(terminal.backend().buffer(), w, h)
} }
#[test]
fn wallets_settings_menu_frame_shows_the_shipped_footer() {
// The app renders this screen's one status line with `status_footer_phased`
// (the chrome redesign put the Tor phase in it) and the hint from
// `footer_hints`; the fixture has to do the same or every menu frame in the
// PR is a frame the app never draws.
let shipped = status_footer_phased(
80,
FP,
ONION,
Some(TorPhase::Ready),
None,
wallets_settings_footer_hint(),
);
let frame = render_menu(80, 24, &menu_state());
let last = frame.lines().nth(23).unwrap_or_default();
assert_eq!(
last.trim_end(),
shipped.trim_end(),
"the dumped menu frame's footer is not the one the app renders"
);
}
#[test] #[test]
fn wallets_settings_menu_lists_both_groups_and_every_key() { fn wallets_settings_menu_lists_both_groups_and_every_key() {
let body = wallets_settings_menu_text(78, &menu_state()); let body = wallets_settings_menu_text(78, &menu_state());