From 91bb5c0774f0640141c9e37181051c77566dbdf4 Mon Sep 17 00:00:00 2001 From: Corwin Kuiper Date: Fri, 4 Jun 2021 10:42:45 +0100 Subject: [PATCH] add helper function for asserting output --- agb/src/display/example_logo.rs | 10 +--------- agb/src/lib.rs | 11 +++++++++++ 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/agb/src/display/example_logo.rs b/agb/src/display/example_logo.rs index 42e2c47b..de199d4b 100644 --- a/agb/src/display/example_logo.rs +++ b/agb/src/display/example_logo.rs @@ -19,13 +19,5 @@ fn logo_display(gba: &mut crate::Gba) { back.set_position(0, 0); back.show(); - let vblank = gba.display.vblank.get(); - vblank.wait_for_VBlank(); - let mut mgba = crate::mgba::Mgba::new().unwrap(); - mgba.print( - format_args!("image:gfx/test_logo.png"), - crate::mgba::DebugLevel::Info, - ) - .unwrap(); - vblank.wait_for_VBlank(); + crate::assert_image_output("gfx/test_logo.png"); } diff --git a/agb/src/lib.rs b/agb/src/lib.rs index 658b99b2..413aba5a 100644 --- a/agb/src/lib.rs +++ b/agb/src/lib.rs @@ -133,6 +133,17 @@ pub extern "C" fn main() -> ! { loop {} } +#[cfg(test)] +fn assert_image_output(image: &str) { + let mut mgba = crate::mgba::Mgba::new().unwrap(); + mgba.print( + format_args!("image:{}", image), + crate::mgba::DebugLevel::Info, + ) + .unwrap(); + display::busy_wait_for_VBlank(); +} + #[cfg(test)] mod test { use super::Gba;