//! A Bevy app that can be used as an integration test target. //! It displays a button that must be clicked. The button is placed at a random position and //! moves every 5 seconds. //! //! Run with the `bevy_remote` feature enabled: //! ```bash //! cargo run --example app_under_test --features="bevy_remote" //! ``` //! This example can be paired with the `integration_test` example, which will run an integration //! test on this app. use bevy::{ prelude::*, remote::{http::RemoteHttpPlugin, RemotePlugin}, time::common_conditions::on_timer, ui::UiGlobalTransform, }; use chacha20::ChaCha8Rng; use rand::{RngExt, SeedableRng}; fn main() { App::new() .add_plugins(DefaultPlugins) // To make the app available for integration testing, we add these // remote plugins to expose API’s for a testing framework to call. .add_plugins(RemotePlugin::default()) .add_plugins(RemoteHttpPlugin::default()) .insert_resource(SeededRng(ChaCha8Rng::seed_from_u64(19878367467712))) .add_systems(Startup, setup) .add_systems( Update, ( move_button.run_if(on_timer(std::time::Duration::from_secs(5))), log_button_position, ), ) .run(); } #[derive(Resource)] struct SeededRng(ChaCha8Rng); fn on_button_click(_click: On>, mut exit: MessageWriter) { info!("Button pressed!"); exit.write(AppExit::Success); } fn log_button_position( transform: Single<&UiGlobalTransform, (With