Skip to content

Commit

Permalink
make testing good
Browse files Browse the repository at this point in the history
  • Loading branch information
torokati44 committed Feb 5, 2024
1 parent e3b795d commit bab9a41
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 7 deletions.
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ workspace = true
# Enable running image comparison tests. This is off by default,
# since the images we compare against are generated on CI, and may
# not match your local machine's Vulkan version / image output.
imgtests = ["ruffle_test_framework/ruffle_video_software", "ruffle_render_wgpu"]
imgtests = [
"ruffle_render_wgpu",
"ruffle_test_framework/ruffle_video_software",
"ruffle_test_framework/ruffle_video_external",
]
jpegxr = ["ruffle_test_framework/jpegxr"]
lzma = ["ruffle_test_framework/lzma"]

Expand Down
4 changes: 3 additions & 1 deletion tests/framework/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ ruffle_core = { path = "../../core", features = ["deterministic", "timeline_debu
ruffle_render = { path = "../../render" }
ruffle_input_format = { path = "../input-format" }
ruffle_socket_format = { path = "../socket-format" }
ruffle_video = { path = "../../video" }
ruffle_video_software = { path = "../../video/software", optional = true }
ruffle_video_external = { path = "../../video/external", optional = true }
image = { version = "0.24.8", default-features = false, features = ["png"] }
regex = "1.10.3"
url = "2.5.0"
Expand All @@ -32,4 +34,4 @@ percent-encoding = "2.3.1"

[features]
jpegxr = ["ruffle_core/jpegxr"]
lzma = ["ruffle_core/lzma"]
lzma = ["ruffle_core/lzma"]
34 changes: 31 additions & 3 deletions tests/framework/src/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,38 @@ impl PlayerOptions {

player_builder = player_builder.with_player_runtime(self.runtime);

#[cfg(feature = "ruffle_video_software")]
if self.with_video {
use ruffle_video_software::backend::SoftwareVideoBackend;
player_builder = player_builder.with_video(SoftwareVideoBackend::new())

// TODO: Do the same dance everywhere we set up a video backend, or
// make ExternalVideoBackend tolerate failure and fall back completely
// to SoftwareVideoBackend internally?
let video: Option<Box<dyn ruffle_video::backend::VideoBackend>> =

if cfg!(feature = "ruffle_video_external") {
match ruffle_video_external::backend::ExternalVideoBackend::new() {
Ok(video) => Some(Box::new(video)),
Err(e) => {
if cfg!(feature = "ruffle_software_video") {
Some(Box::new(
ruffle_video_software::backend::SoftwareVideoBackend::new(),
))
} else {
None
}
}
}
} else if cfg!(feature = "ruffle_video_software") {
Some(Box::new(
ruffle_video_software::backend::SoftwareVideoBackend::new(),
))
} else {
None
};

if let Some(video) = video {
player_builder = player_builder.with_boxed_video(video);
}

}

Ok(player_builder)
Expand Down
Binary file modified tests/tests/swfs/visual/video/h264/output.expected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified tests/tests/swfs/visual/video/h264/test.swf
Binary file not shown.
3 changes: 2 additions & 1 deletion tests/tests/swfs/visual/video/h264/test.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
num_frames = 1
num_frames = 5
num_ticks = 10

[image_comparisons.output]
tolerance = 0
Expand Down
2 changes: 1 addition & 1 deletion video/external/src/decoder/openh264.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl H264Decoder {

assert_eq!(
(version.uMajor, version.uMinor, version.uRevision),
(2, 4, 1),
(2, 4, 0),
"Unexpected OpenH264 version"
);

Expand Down

0 comments on commit bab9a41

Please sign in to comment.