aKode fase 5: rinomina interna (crate akode-*, akode-rs/, akode-cli/, binario akode, AKODE_*, ~/.akode, snapshot)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
39
akode-rs/tui/tests/suite/screen_reader.rs
Normal file
39
akode-rs/tui/tests/suite/screen_reader.rs
Normal file
@@ -0,0 +1,39 @@
|
||||
//! Checks that interactive startup persists detection without replacing a user preference.
|
||||
|
||||
use super::focus_palette::PtyCodex;
|
||||
use super::focus_palette::write_test_config;
|
||||
use anyhow::Result;
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::time::Duration;
|
||||
use std::time::Instant;
|
||||
|
||||
#[test]
|
||||
fn startup_records_screen_reader_detection() -> Result<()> {
|
||||
let repo_root = akode_utils_cargo_bin::repo_root()?;
|
||||
let home = tempfile::tempdir()?;
|
||||
write_test_config(home.path(), &repo_root)?;
|
||||
let path = home.path().join("config.toml");
|
||||
let contents = std::fs::read_to_string(&path)?;
|
||||
std::fs::write(&path, format!("{contents}\n[tui]\nanimations = true\n"))?;
|
||||
let mut terminal = PtyCodex::start(&repo_root, home, &[])?;
|
||||
terminal.wait_for_startup()?;
|
||||
let deadline = Instant::now() + Duration::from_secs(/*secs*/ 30);
|
||||
loop {
|
||||
let config: toml::Value = toml::from_str(&std::fs::read_to_string(&path)?)?;
|
||||
if config["tui"].get("screen_reader_detection_done").is_some() {
|
||||
assert_eq!(
|
||||
config["tui"],
|
||||
toml::Value::Table(toml::toml! {
|
||||
animations = true
|
||||
screen_reader_detection_done = true
|
||||
})
|
||||
);
|
||||
return Ok(());
|
||||
}
|
||||
anyhow::ensure!(
|
||||
Instant::now() < deadline,
|
||||
"startup did not record detection"
|
||||
);
|
||||
terminal.read_output(Duration::from_millis(/*millis*/ 50))?;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user