libcaesium/tests/gif.rs

89 lines
2.7 KiB
Rust
Raw Normal View History

2021-10-23 17:18:52 +02:00
use std::sync::Once;
use std::fs;
static INIT: Once = Once::new();
pub fn initialize(file: &str) {
INIT.call_once(|| {
if fs::metadata(file).is_ok() {
fs::remove_file(file).unwrap();
}
});
}
pub fn cleanup(file: &str) {
if fs::metadata(file).is_ok() {
fs::remove_file(file).unwrap();
}
}
// #[test]
// fn compress_20() {
// let output = "tests/samples/output/compressed_20.gif";
// initialize(output);
2022-01-24 16:21:05 +01:00
// let mut params = libcaesium::initialize_parameters();
2021-10-23 17:18:52 +02:00
// params.gif.level = 20;
2022-01-24 16:21:05 +01:00
// libcaesium::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_50() {
// let output = "tests/samples/output/compressed_50.gif";
// initialize(output);
2022-01-24 16:21:05 +01:00
// let mut params = libcaesium::initialize_parameters();
2021-10-23 17:18:52 +02:00
// params.gif.level = 50;
2022-01-24 16:21:05 +01:00
// libcaesium::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);
2022-01-24 16:21:05 +01:00
// let mut params = libcaesium::initialize_parameters();
2021-10-23 17:18:52 +02:00
// params.gif.level = 80;
2022-01-24 16:21:05 +01:00
// libcaesium::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);
2022-01-24 16:21:05 +01:00
// let mut params = libcaesium::initialize_parameters();
2021-10-23 17:18:52 +02:00
// params.gif.level = 100;
2022-01-24 16:21:05 +01:00
// libcaesium::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);
2022-01-24 16:21:05 +01:00
// let mut params = libcaesium::initialize_parameters();
2021-10-23 17:18:52 +02:00
// params.optimize = true;
2022-01-24 16:21:05 +01:00
// libcaesium::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)
// }