libcaesium/tests/gif.rs

82 lines
2.6 KiB
Rust
Raw Normal View History

2023-02-25 20:39:52 +01:00
use crate::cleanup::remove_compressed_test_file;
2024-01-23 18:51:39 +01:00
use std::sync::Once;
2023-02-25 20:39:52 +01:00
mod cleanup;
2021-10-23 17:18:52 +02:00
static INIT: Once = Once::new();
pub fn initialize(file: &str) {
2024-01-23 18:51:39 +01:00
INIT.call_once(|| remove_compressed_test_file(file));
2021-10-23 17:18:52 +02:00
}
// #[test]
// fn compress_20() {
// let output = "tests/samples/output/compressed_20.gif";
// initialize(output);
2024-10-10 20:02:38 +02:00
// let mut params = CSParameters::new();
2022-02-12 14:10:12 +01:00
// params.gif.quality = 20;
2022-02-23 17:50:48 +01:00
// caesium::compress(String::from("tests/samples/uncompressed_은하.gif"),
2021-10-23 17:18:52 +02:00
// String::from(output),
// params)
// .unwrap();
// assert!(std::path::Path::new(output).exists());
2022-02-12 14:10:12 +01:00
// assert_eq!(infer::get_from_path(output).unwrap().unwrap().mime_type(), "image/webp");
2021-10-23 17:18:52 +02:00
// cleanup(output)
// }
//
// #[test]
// fn compress_50() {
// let output = "tests/samples/output/compressed_50.gif";
// initialize(output);
2024-10-10 20:02:38 +02:00
// let mut params = CSParameters::new();
2021-10-23 17:18:52 +02:00
// params.gif.level = 50;
2022-02-23 17:50:48 +01:00
// caesium::compress(String::from("tests/samples/uncompressed_은하.gif"),
2021-10-23 17:18:52 +02:00
// String::from(output),
// params)
// .unwrap();
// assert!(std::path::Path::new(output).exists());
// cleanup(output)
// }
//
// #[test]
// fn compress_80() {
// let output = "tests/samples/output/compressed_80.gif";
// initialize(output);
2024-10-10 20:02:38 +02:00
// let mut params = CSParameters::new();
2021-10-23 17:18:52 +02:00
// params.gif.level = 80;
2022-02-23 17:50:48 +01:00
// caesium::compress(String::from("tests/samples/uncompressed_은하.gif"),
2021-10-23 17:18:52 +02:00
// String::from(output),
// params)
// .unwrap();
// assert!(std::path::Path::new(output).exists());
// cleanup(output)
// }
//
// #[test]
// fn compress_100() {
// let output = "tests/samples/output/compressed_100.gif";
// initialize(output);
2024-10-10 20:02:38 +02:00
// let mut params = CSParameters::new();
2021-10-23 17:18:52 +02:00
// params.gif.level = 100;
2022-02-23 17:50:48 +01:00
// caesium::compress(String::from("tests/samples/uncompressed_은하.gif"),
2021-10-23 17:18:52 +02:00
// String::from(output),
// params)
// .unwrap();
// assert!(std::path::Path::new(output).exists());
// cleanup(output)
// }
//
// #[test]
// fn optimize_gif() {
// let output = "tests/samples/output/optimized.gif";
// initialize(output);
2024-10-10 20:02:38 +02:00
// let mut params = CSParameters::new();
2021-10-23 17:18:52 +02:00
// params.optimize = true;
2022-02-23 17:50:48 +01:00
// caesium::compress(String::from("tests/samples/uncompressed_은하.gif"),
2021-10-23 17:18:52 +02:00
// String::from(output),
// params)
// .unwrap();
// assert!(std::path::Path::new(output).exists());
// cleanup(output)
// }