Open source Loom alternative. Beautiful, shareable screen recordings.
Rust appcapcossloommacnextjsnextjs15open-sourceossreactrecordrustscreen-capturescreen-recorderscreenshotsolidjstauritauri-apptypescriptvite
test(cursor): retry a cursor image whose PNG write failed
Aatman Jain (AJ)c243b59abf7c
diff --git a/crates/recording/src/cursor.rs b/crates/recording/src/cursor.rsindex 4328f03d8..57644c55d 100644--- a/crates/recording/src/cursor.rs+++ b/crates/recording/src/cursor.rs@@ -1215,7 +1215,7 @@ mod cursor_image_tests {}#[test]- fn a_cursor_image_that_fails_to_save_is_retried() {+ fn a_cursor_image_that_fails_to_decode_is_not_cached() {let dir = tempfile::tempdir().unwrap();let mut response = empty_response();let mut last = None;@@ -1230,4 +1230,32 @@ mod cursor_image_tests {assert!(response.cursors.is_empty());assert!(last.is_none());}++ #[test]+ fn a_cursor_image_that_fails_to_save_is_retried() {+ let dir = tempfile::tempdir().unwrap();+ let mut response = empty_response();+ let mut last = None;+ let red = png([255, 0, 0, 255]);++ // A directory at the cursor's path makes the PNG write fail.+ let cursor_path = dir.path().join("cursor_0.png");+ std::fs::create_dir(&cursor_path).unwrap();+ cursor_id_for_image(+ cursor_data(red.clone()),+ &mut response,+ dir.path(),+ &mut last,+ );+ assert!(response.cursors.is_empty());+ assert!(last.is_none());++ std::fs::remove_dir(&cursor_path).unwrap();+ assert_eq!(+ cursor_id_for_image(cursor_data(red), &mut response, dir.path(), &mut last),+ "0"+ );+ assert_eq!(response.cursors.len(), 1);+ assert!(cursor_path.is_file());+ }}