add helper function for asserting output

This commit is contained in:
Corwin Kuiper 2021-06-04 10:42:45 +01:00
parent 12406fc952
commit 91bb5c0774
2 changed files with 12 additions and 9 deletions

View file

@ -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");
}

View file

@ -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;