Merge origin/main into the peer-payments branch
main moved under this PR when #120 (clean-look chrome redesign) landed, which touched the same three files (src/tui.rs, tests/tui_spec.rs, docs/TUI.md) and left PR #121 unmergeable. - docs/TUI.md: both sections kept — the peer-payment-history section from this branch, then #120's chrome-redesign section. - tests/tui_spec.rs: #120's `fit_cells` flake relaxation kept (it is a superset of the one on this branch: same cut point plus the ellipsis assertion). - src/tui.rs merged cleanly; `cargo test --locked` 383 passed / 0 failed and `cargo clippy --locked --all-targets -- -D warnings` clean afterwards. The peer-payments frames are byte-identical after the merge, so the dumps in this PR body still hold.
This commit is contained in:
commit
cbe889024b
5 changed files with 1343 additions and 475 deletions
|
|
@ -259,6 +259,13 @@ fn alert_line_truncates_to_frame_width() {
|
|||
!line.contains("roster on the next row"),
|
||||
"alert still has overflow tail: {line:?}"
|
||||
);
|
||||
// Cells, not chars: a double-width peer error must not overflow the row.
|
||||
let cjk = alert_line("接続がタイムアウトしました 接続がタイムアウトしました", 32);
|
||||
assert!(
|
||||
onionwire::tui::cell_width(&cjk) <= 32,
|
||||
"alert wider than 32 cells: {} {cjk:?}",
|
||||
onionwire::tui::cell_width(&cjk)
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
@ -1148,14 +1155,19 @@ fn wallets_settings_menu_truncates_wide_values_in_cells() {
|
|||
"no ellipsis: {cut:?}"
|
||||
);
|
||||
// ASCII chrome swaps the ellipsis and the section rule, never the width
|
||||
// contract.
|
||||
// contract. Either ellipsis form is accepted, like the two assertions above:
|
||||
// `ONIONWIRE_ASCII` is process-wide, so this test cannot assume which form
|
||||
// is active while other tests run in parallel.
|
||||
let ascii = fit_cells("abcdefghij", 8);
|
||||
assert!(cell_width(&ascii) <= 8, "{ascii:?}");
|
||||
// Either chrome: ASCII cuts at 5 cells and closes with `...`, unicode cuts at
|
||||
// 6 and closes with `…`, and both are 8 cells. Asserting `"abcdef"` here made
|
||||
// this test depend on another test's in-flight `ONIONWIRE_ASCII` mutation
|
||||
// (the suite mutates env vars without a global lock), so it flaked.
|
||||
assert!(ascii.starts_with("abcde"), "{ascii:?}");
|
||||
assert!(
|
||||
ascii.starts_with("abcde") && ascii != "abcdefghij",
|
||||
"truncation kept the whole string or dropped too much: {ascii:?}"
|
||||
);
|
||||
assert!(
|
||||
ascii.ends_with('…') || ascii.ends_with("..."),
|
||||
"no ellipsis: {ascii:?}"
|
||||
);
|
||||
assert_eq!(cell_width("名"), 2);
|
||||
assert_eq!(cell_width("abc"), 3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue