From 6aa6f94e058fcbcb0febd2607e2c4515b9529d89 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 16 Feb 2026 10:08:53 -0600 Subject: [PATCH] fix failing test in CI --- src/core/thumbnail.rs | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/src/core/thumbnail.rs b/src/core/thumbnail.rs index d52c2c5..739be6a 100644 --- a/src/core/thumbnail.rs +++ b/src/core/thumbnail.rs @@ -72,15 +72,18 @@ pub fn bg_from_video( pub fn bg_path_from_video(video: &Path) -> PathBuf { let video = PathBuf::from(video); debug!(?video); - let mut data_dir = dirs::data_local_dir().unwrap(); + let mut data_dir = + dirs::cache_dir().expect("Can't find cache dir"); data_dir.push("lumina"); data_dir.push("thumbnails"); + let _ = fs::create_dir_all(&data_dir); if !data_dir.exists() { fs::create_dir(&data_dir) .expect("Could not create thumbnails dir"); } let mut screenshot = data_dir.clone(); - screenshot.push(video.file_name().unwrap()); + screenshot + .push(video.file_name().expect("Should have file name")); screenshot.set_extension("png"); screenshot } @@ -93,17 +96,7 @@ mod test { fn test_bg_video_creation() { let video = Path::new("./res/bigbuckbunny.mp4"); let screenshot = bg_path_from_video(video); - let screenshot_string = - screenshot.to_str().expect("Should be thing"); - assert_eq!( - screenshot_string, - "/home/chris/.local/share/lumina/thumbnails/bigbuckbunny.png" - ); - - // let runtime = tokio::runtime::Runtime::new().unwrap(); - let result = bg_from_video(video, &screenshot); - // let result = runtime.block_on(future); - match result { + match bg_from_video(video, &screenshot) { Ok(_o) => assert!(screenshot.exists()), Err(e) => debug_assert!( false, @@ -112,16 +105,4 @@ mod test { ), } } - - #[test] - fn test_bg_not_same() { - let video = Path::new("./res/bigbuckbunny.mp4"); - let screenshot = bg_path_from_video(video); - let screenshot_string = - screenshot.to_str().expect("Should be thing"); - assert_ne!( - screenshot_string, - "./res/All WebDev Sucks and you know it.png" - ); - } }