Skip to content

Commit

Permalink
tests: If an image test isn't being checked and we expect it to fail,…
Browse files Browse the repository at this point in the history
… make it fail
  • Loading branch information
Dinnerbone committed Jul 26, 2023
1 parent 1943a6c commit 48e4066
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion tests/tests/util/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,18 @@ pub fn run_swf(

// Render the image to disk
// FIXME: Determine how we want to compare against on on-disk image
#[cfg(feature = "imgtests")]
#[allow(unused_variables)]
if let Some(image_comparison) = &test.options.image_comparison {
#[allow(unused_mut)]
let mut checked_image = false;

#[cfg(feature = "imgtests")]
if crate::util::environment::wgpu_descriptors().is_some() {
use anyhow::Context;
use ruffle_render_wgpu::backend::WgpuRenderBackend;
use ruffle_render_wgpu::target::TextureTarget;

checked_image = true;
let mut player_lock = player.lock().unwrap();
player_lock.render();
let renderer = player_lock
Expand Down Expand Up @@ -273,6 +278,14 @@ pub fn run_swf(
actual_image.save(expected_image_path)?;
}
}

if test.options.known_failure && !checked_image {
// It's possible that the trace output matched but the image might not.
// If we aren't checking the image, pretend the match failed (which makes it actually pass, since it's expecting failure).
return Err(anyhow!(
"Not checking images, pretending this failed since we don't know if it worked."
));
}
}

before_end(player)?;
Expand Down

0 comments on commit 48e4066

Please sign in to comment.