diff --git a/crates/benilla-app/src/capture/fixtures.rs b/crates/benilla-app/src/capture/fixtures.rs index 380dc7aaf..2d3d993a3 100644 --- a/crates/benilla-app/src/capture/fixtures.rs +++ b/crates/benilla-app/src/capture/fixtures.rs @@ -108,13 +108,13 @@ pub(super) fn seed_ui_fixture( ResMut<'static, crate::loading_screen::LoadingScreen>, ResMut<'static, crate::ui_gossip::GossipState>, ResMut<'static, crate::ui_quest::QuestGiver>, + ResMut<'static, crate::ui_trainer::TrainerOpen>, ), )>, mut ctx: ResMut, mut commands: Commands, progress: Res, mut quest_log: ResMut, - mut trainer: ResMut, icons: Option>, ) { let icons = icons.as_deref(); @@ -123,7 +123,8 @@ pub(super) fn seed_ui_fixture( let mut lua: Option> = None; vm.turn(|script, parts| { let (mut merchant, mut loot, mut names, mut selection, mut player, store, rest) = parts; - let (mut actions, mut bank, mut exit, mut loading, mut gossip, mut quest) = rest; + let (mut actions, mut bank, mut exit, mut loading, mut gossip, mut quest, mut trainer) = + rest; let (mut items, mut index, mut home_bind) = store; // A glue-screen capture has no world scenario, and no glue screen opens a UI fixture. let Some(scenario) = ctx.scenario else { diff --git a/crates/benilla-app/src/capture/mod.rs b/crates/benilla-app/src/capture/mod.rs index 270c6ad7f..89dc8a777 100644 --- a/crates/benilla-app/src/capture/mod.rs +++ b/crates/benilla-app/src/capture/mod.rs @@ -1064,3 +1064,42 @@ fn drive_capture( } } } + +#[cfg(test)] +mod tests { + use crate::local_state::test_env::{EnvGuard, ENV_LOCK}; + use bevy::prelude::*; + + /// A capture run's systems initialize in the client's own world, so a parameter that overlaps + /// the VM turn's call host fails here and not at the first capture's schedule build. + #[test] + fn every_capture_system_initializes_in_the_client() { + let _l = ENV_LOCK + .lock() + .unwrap_or_else(std::sync::PoisonError::into_inner); + let _c = EnvGuard::set("WOW_CAPTURE", "ui-trainer"); + let mut app = crate::game_plugins::schedule_tests::headless_client_with(|app| { + app.add_plugins(super::CapturePlugin); + }); + let world = app.world_mut(); + let labels: Vec<_> = world + .resource::() + .iter() + .map(|(_, s)| s.label()) + .collect(); + let mut seen = false; + for label in labels { + world.schedule_scope(label, |world, schedule| { + schedule.graph_mut().systems.initialize(world); + seen |= + schedule.graph().systems.iter().any(|(_, system, _)| { + system.name().to_string().contains("seed_ui_fixture") + }); + }); + } + assert!( + seen, + "the census reads the capture seed among the client's systems" + ); + } +}