use bevy::{ app::{AppExit}, prelude::*, }; use bevy_http::HttpAssetReaderPlugin; mod bytes_asset; use bytes_asset::*; #[derive(Resource, Default)] struct State { handle: Handle, } #[test] fn main() { App::new() .add_plugins(( HttpAssetReaderPlugin{ id: "remote".into(), base_url: "https://bevyengine.org/".into(), }, DefaultPlugins, // ScheduleRunnerPlugin::run_loop(Duration::from_secs(1)), BytesAssetPlugin, )) .init_resource::() .add_systems(Startup, setup) .add_systems(Update, print_on_load) .run(); } fn setup(mut state: ResMut, asset_server: Res) { state.handle = asset_server.load("remote://assets/icon.png"); } fn print_on_load( state: Res, custom_assets: ResMut>, mut exit: EventWriter, ) { let custom_asset = custom_assets.get(&state.handle); if let Some(custom_asset) = custom_asset { let _length = custom_asset.bytes.len(); exit.send(AppExit); } }