feat(stress): add a deterministic particle demo with sequenced music
Move Storm Eagle playback and source assets to Stress Console and keep Dummy Boy silent. Exercise VM math, seeded Random and persistent typed particles with a projected tunnel, bounded 512-sprite heavy workload, reproducible replays and measured costs.
This commit is contained in:
@@ -687,6 +687,50 @@ impl ApplicationHandler for HostRunner {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn studio_stress_demoscene_publishes_graphics_and_native_music() {
|
||||
let cart = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("../../../test-cartridges/stress-console");
|
||||
let mut host = HostRunner::new(None, None);
|
||||
host.set_boot_target(BootTarget::Cartridge {
|
||||
path: cart.to_string_lossy().into_owned(),
|
||||
debug: false,
|
||||
debug_port: 0,
|
||||
});
|
||||
let deadline = Instant::now() + Duration::from_secs(5);
|
||||
while !host.studio_boot_step(true).unwrap() {
|
||||
assert!(Instant::now() < deadline);
|
||||
std::thread::sleep(Duration::from_millis(1));
|
||||
}
|
||||
let (mut callback, mut reclaimer) = crate::audio::AudioCallback::new();
|
||||
let transport = host.hardware.audio.transport();
|
||||
let mut pcm = [0.0; 1600];
|
||||
let mut audible = false;
|
||||
while host.studio_frame(None).is_none() || !audible {
|
||||
assert!(Instant::now() < deadline, "demo did not publish graphics/music");
|
||||
host.studio_step(Default::default()).unwrap();
|
||||
callback.render(&transport, &mut pcm);
|
||||
audible |= pcm.iter().any(|x| x.abs() > 0.001);
|
||||
reclaimer.service(&transport);
|
||||
std::thread::sleep(Duration::from_millis(2));
|
||||
}
|
||||
assert!(callback.diagnostics().maximum_voices > 0);
|
||||
assert_eq!(host.studio_frame(None).unwrap().ownership.app_id, 1);
|
||||
let before_pause = callback.diagnostics().frames;
|
||||
host.studio_pause(true);
|
||||
callback.render(&transport, &mut pcm);
|
||||
assert!(pcm.iter().all(|x| *x == 0.0));
|
||||
assert_eq!(callback.diagnostics().frames, before_pause);
|
||||
reclaimer.service(&transport);
|
||||
host.studio_pause(false);
|
||||
callback.render(&transport, &mut pcm);
|
||||
assert!(callback.diagnostics().frames > before_pause);
|
||||
reclaimer.service(&transport);
|
||||
host.studio_stop(true).unwrap();
|
||||
callback.render(&transport, &mut pcm);
|
||||
assert!(pcm.iter().all(|x| *x == 0.0));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn studio_can_boot_and_publish_without_a_window() {
|
||||
let cart = std::path::Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
|
||||
Reference in New Issue
Block a user