tests: Readd suffix to actual/difference files

This commit is contained in:
Nathan Adams 2023-01-28 13:54:32 +01:00 committed by kmeisthax
parent 67ec70d960
commit 9c4190b20b
3 changed files with 13 additions and 5 deletions

View File

@ -94,8 +94,8 @@ jobs:
with:
name: swf_images
path: |
tests*/**/actual.png
tests*/**/difference.png
tests*/**/actual*.png
tests*/**/difference*.png
check-required:
needs: changes

View File

@ -160,6 +160,7 @@ impl ImageComparison {
actual_image: image::RgbaImage,
expected_image: image::RgbaImage,
test_path: &Path,
adapter_info: ruffle_render_wgpu::wgpu::AdapterInfo,
) -> Result<()> {
use anyhow::Context;
@ -196,16 +197,18 @@ impl ImageComparison {
.unwrap();
if outliers > self.max_outliers {
let suffix = format!("{}-{:?}", std::env::consts::OS, adapter_info.backend);
image::RgbaImage::from_raw(
expected_image.width(),
expected_image.height(),
difference_data,
)
.context("Couldn't create difference image")?
.save(test_path.join("difference.png"))
.save(test_path.join(format!("difference-{suffix}.png")))
.context("Couldn't save difference image")?;
actual_image
.save(test_path.join("actual.png"))
.save(test_path.join(format!("actual-{suffix}.png")))
.context("Couldn't save actual image")?;
return Err(anyhow!(

View File

@ -147,7 +147,12 @@ pub fn run_swf(
.context("Failed to open expected image")?
.into_rgba8();
image_comparison.test(actual_image, expected_image, base_path)?;
image_comparison.test(
actual_image,
expected_image,
base_path,
renderer.descriptors().adapter.get_info(),
)?;
} else {
actual_image.save(expected_image_path)?;
}