aboutsummaryrefslogtreecommitdiff
path: root/vendor/gif/tests/stall.rs
diff options
context:
space:
mode:
authorValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
committerValentin Popov <valentin@popov.link>2024-07-19 15:37:58 +0300
commita990de90fe41456a23e58bd087d2f107d321f3a1 (patch)
tree15afc392522a9e85dc3332235e311b7d39352ea9 /vendor/gif/tests/stall.rs
parent3d48cd3f81164bbfc1a755dc1d4a9a02f98c8ddd (diff)
downloadfparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.tar.xz
fparkan-a990de90fe41456a23e58bd087d2f107d321f3a1.zip
Deleted vendor folder
Diffstat (limited to 'vendor/gif/tests/stall.rs')
-rw-r--r--vendor/gif/tests/stall.rs42
1 files changed, 0 insertions, 42 deletions
diff --git a/vendor/gif/tests/stall.rs b/vendor/gif/tests/stall.rs
deleted file mode 100644
index 3d51a17..0000000
--- a/vendor/gif/tests/stall.rs
+++ /dev/null
@@ -1,42 +0,0 @@
-use std::{fs, sync::mpsc, thread, time::Duration};
-
-#[test]
-fn try_decode_crash_regression() {
- let files = fs::read_dir(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/stall")).unwrap();
-
- for entry in files {
- let entry = entry.unwrap();
- if let Some(ext) = entry.path().extension() {
- if ext.to_str() != Some("gif") {
- panic!("Unexpected file {} in crashtests, should end with .gif", entry.path().display());
- }
- } else {
- panic!("Unexpected file {} in crashtests, should end with .gif", entry.path().display());
- }
-
- let file_data = fs::read(entry.path()).unwrap();
- let _ = decode_on_timer(file_data);
- }
-}
-
-fn decode_on_timer(data: Vec<u8>) {
- let (send, recv) = mpsc::channel();
-
- thread::spawn(move || {
- let result = decode(&data);
- send.send(result).expect("still waiting");
- });
-
- let _ = recv.recv_timeout(Duration::from_secs(1))
- .expect("any result");
-}
-
-fn decode(data: &[u8]) -> Result<(), gif::DecodingError> {
- let mut options = gif::DecodeOptions::new();
- options.set_color_output(gif::ColorOutput::RGBA);
-
- let mut decoder = options.read_info(data)?;
- while let Some(_frame) = decoder.read_next_frame()? {}
-
- Ok(())
-}