From 101c0613309af42bdc78c1ce25455cd40bd5d5cc Mon Sep 17 00:00:00 2001 From: Christopher Serr Date: Mon, 25 Mar 2024 23:02:49 +0100 Subject: [PATCH] Add Test for Background Image Rendering (#788) This adds a test that checks whether background images are rendered correctly. It uses a layout file that has a background image set and checks whether the image is rendered correctly. --- tests/layout_files/WithBackgroundImage.lsl | 158 +++++++++++++++++++++ tests/layout_files/mod.rs | 1 + tests/rendering.rs | 24 ++++ 3 files changed, 183 insertions(+) create mode 100644 tests/layout_files/WithBackgroundImage.lsl diff --git a/tests/layout_files/WithBackgroundImage.lsl b/tests/layout_files/WithBackgroundImage.lsl new file mode 100644 index 00000000..cceb559d --- /dev/null +++ b/tests/layout_files/WithBackgroundImage.lsl @@ -0,0 +1,158 @@ + + + Vertical + 552 + 274 + 217 + 316 + -1 + -1 + + FFFFFFFF + FF0F0F0F + 00000000 + 03FFFFFF + 24FFFFFF + FF16A6FF + FF00CC36 + FF52CC73 + FFCC5C52 + FFCC1200 + FFD8AF1F + False + FFACACAC + FF7A7A7A + 00000000 + 80000000 + + + + True + True + True + True + Image + + 0.9 + 0.4 + 1 + False + + + + LiveSplit.Title.dll + + 1.7.3 + True + True + True + False + False + False + + False + FFFFFFFF + 2D000000 + FF131313 + Plain + True + False + False + True + 0 + + + + LiveSplit.Splits.dll + + 1.6 + FF3373F4 + FF153574 + 4 + 1 + True + True + True + 20 + Seconds + False + FFFFFFFF + FFFFFFFF + FFFFFFFF + False + FFFFFFFF + FFFFFFFF + FFFFFFFF + False + True + True + 24 + True + 3.6 + Vertical + 00FFFFFF + 01FFFFFF + Alternating + True + Tenths + True + False + FFFFFFFF + False + False + FFFFFFFF + + + 1.5 + +/- + Delta + Current Comparison + Current Timing Method + + + 1.5 + Time + SplitTime + Current Comparison + Current Timing Method + + + + + + LiveSplit.Timer.dll + + 1.5 + 69 + 225 + 1.23 + False + True + FFAAAAAA + 00000000 + FF222222 + Plain + False + Current Timing Method + 35 + + + + LiveSplit.PreviousSegment.dll + + 1.6 + FFFFFFFF + False + 791C1C1C + FF0D0D0D + Plain + Tenths + True + Current Comparison + False + False + Tenths + + + + diff --git a/tests/layout_files/mod.rs b/tests/layout_files/mod.rs index b0f6bc16..bd27bb15 100644 --- a/tests/layout_files/mod.rs +++ b/tests/layout_files/mod.rs @@ -5,3 +5,4 @@ pub const DARK: &str = include_str!("dark.lsl"); pub const SUBSPLITS: &str = include_str!("subsplits.lsl"); pub const WSPLIT: &str = include_str!("WSplit.lsl"); pub const WITH_TIMER_DELTA_BACKGROUND: &str = include_str!("WithTimerDeltaBackground.lsl"); +pub const WITH_BACKGROUND_IMAGE: &str = include_str!("WithBackgroundImage.lsl"); diff --git a/tests/rendering.rs b/tests/rendering.rs index 68bba16a..f6b69ef9 100644 --- a/tests/rendering.rs +++ b/tests/rendering.rs @@ -295,6 +295,30 @@ fn subsplits_layout() { ); } +#[test] +fn background_image() { + let run = lss(run_files::CELESTE); + let mut timer = Timer::new(run).unwrap(); + let mut layout = lsl(layout_files::WITH_BACKGROUND_IMAGE); + + tests_helper::start_run(&mut timer); + tests_helper::make_progress_run_with_splits_opt( + &mut timer, + &[Some(10.0), None, Some(20.0), Some(55.0)], + ); + + let mut image_cache = ImageCache::new(); + + check_dims( + &layout.state(&mut image_cache, &timer.snapshot()), + &image_cache, + [300, 300], + "efc369e681d98dfe", + "f2bcd20608fb35df", + "background_image", + ); +} + #[test] fn display_two_rows() { let timer = tests_helper::create_timer(&["A"]);