use crate::test_support::window::{pinned, seated, wall};
use crate::ui::{Channel, Chunk, Enrolling, Model, Unmaking};
mod bar;
mod covered;
use covered::{
assigning, ball_amending, ball_filing, board, clearing_trail, clients, commands, config,
doctor, dropped, find, fleet, login, prices, queue, records, trail, tuning,
};
pub(crate) struct World {
pub(crate) name: &'static str,
pub(crate) model: Model,
}
fn unprovisioned() -> World {
let scratch = crate::test_support::Scratch::new();
World {
name: "unprovisioned",
model: Model {
roster: crate::seat::channels(scratch.path()),
..Model::default()
},
}
}
fn working() -> World {
World {
name: "seated",
model: seated(),
}
}
fn beginning() -> World {
let mut model = seated();
model.conversation = None;
model.transcript = crate::reply::transcript::Transcript::default();
World {
name: "beginning",
model,
}
}
fn enrolling() -> World {
let mut model = seated();
let aim = model
.aim
.clone()
.unwrap_or_else(|| panic!("the seated fixture is aimed at a wall"));
model.enroll = Some(Enrolling::at(aim));
World {
name: "enrolling",
model,
}
}
fn accordion() -> World {
let mut model = seated();
model.roster.push(Chunk {
channel: Channel {
name: "lab".to_owned(),
named_there: None,
dials: Some("127.0.0.1:7737".to_owned()),
},
held: crate::ui::Held::Heard,
walls: vec![wall("bench"), wall("annex")],
..Chunk::default()
});
World {
name: "accordion",
model,
}
}
fn slashing() -> World {
let mut model = seated();
model.draft = crate::ui::slash::LEAD.to_string();
World {
name: "slashing",
model,
}
}
fn unpinning() -> World {
let mut model = pinned();
model.draft = crate::ui::slash::LEAD.to_string();
World {
name: "unpinning",
model,
}
}
fn switching() -> World {
let mut model = seated();
model.switching = true;
World {
name: "switching",
model,
}
}
fn asked_world() -> World {
World {
name: "asked",
model: crate::test_support::window::asked(),
}
}
fn docked() -> World {
let mut model = seated();
model.convs[0].state = crate::reply::convs::AgentState::InFlight;
World {
name: "docked",
model,
}
}
fn tabbed() -> World {
let mut model = seated();
let second = crate::test_support::window::conv("20260830T052000Z-b2c3", "tidy the rule");
model.convs.push(second);
for root in ["20260830T052000Z-b2c3", "20260830T051200Z-a1b2"] {
model.select(root);
}
model.transcript = seated().transcript;
World {
name: "tabbed",
model,
}
}
fn pinned_wall() -> World {
World {
name: "pinned",
model: pinned(),
}
}
fn unmaking() -> World {
let mut model = seated();
let aim = model
.aim
.clone()
.unwrap_or_else(|| panic!("the seated fixture is aimed at a wall"));
model.unmaking = Some(Unmaking::at(aim));
World {
name: "unmaking",
model,
}
}
fn filling() -> World {
let mut model = seated();
let conversation = model
.conversation
.clone()
.unwrap_or_else(|| panic!("the seated fixture has a conversation selected"));
model.fill_in(&conversation, crate::ui::Fill::Arming);
World {
name: "filling",
model,
}
}
fn noticed() -> World {
let mut model = seated();
model.notice = Some(crate::ui::Notice::InDoubt {
op: "message".to_owned(),
why: "the connection closed before the reply".to_owned(),
});
World {
name: "noticed",
model,
}
}
pub(crate) fn all() -> Vec<World> {
vec![
unprovisioned(),
working(),
beginning(),
enrolling(),
tuning(),
assigning(),
records(),
queue(),
trail(),
clearing_trail(),
board(),
ball_filing(),
ball_amending(),
fleet(),
commands(),
doctor(),
find(),
prices(),
login(),
clients(),
config(),
accordion(),
pinned_wall(),
slashing(),
unpinning(),
switching(),
dropped(),
asked_world(),
docked(),
tabbed(),
noticed(),
unmaking(),
filling(),
bar::opened(),
bar::footed(),
]
}