DRYyer tests (#117)
This commit is contained in:
parent
d2b1d56e8b
commit
ebf541219c
5 changed files with 419 additions and 1503 deletions
673
tests/filters.rs
673
tests/filters.rs
File diff suppressed because it is too large
Load diff
|
|
@ -22,20 +22,20 @@ fn get_opts(input: &Path) -> (OutFile, oxipng::Options) {
|
|||
}
|
||||
|
||||
fn test_it_converts(
|
||||
input: &Path,
|
||||
output: &OutFile,
|
||||
opts: &oxipng::Options,
|
||||
input: PathBuf,
|
||||
output: OutFile,
|
||||
opts: oxipng::Options,
|
||||
color_type_in: ColorType,
|
||||
bit_depth_in: BitDepth,
|
||||
color_type_out: ColorType,
|
||||
bit_depth_out: BitDepth,
|
||||
) {
|
||||
let png = png::PngData::new(input, opts.fix_errors).unwrap();
|
||||
let png = png::PngData::new(&input, opts.fix_errors).unwrap();
|
||||
|
||||
assert_eq!(png.ihdr_data.color_type, color_type_in);
|
||||
assert_eq!(png.ihdr_data.bit_depth, bit_depth_in);
|
||||
|
||||
match oxipng::optimize(input, output, opts) {
|
||||
match oxipng::optimize(&input, &output, &opts) {
|
||||
Ok(_) => (),
|
||||
Err(x) => panic!("{}", x),
|
||||
};
|
||||
|
|
@ -63,9 +63,9 @@ fn verbose_mode() {
|
|||
opts.verbosity = Some(1);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
input,
|
||||
output,
|
||||
opts,
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::RGB,
|
||||
|
|
@ -377,9 +377,9 @@ fn preserve_attrs() {
|
|||
opts.preserve_attrs = true;
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
input,
|
||||
output,
|
||||
opts,
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::RGB,
|
||||
|
|
@ -429,9 +429,8 @@ fn zopfli_mode() {
|
|||
opts.deflate = Deflaters::Zopfli;
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
input,
|
||||
output, opts,
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::RGB,
|
||||
|
|
|
|||
|
|
@ -20,21 +20,21 @@ fn get_opts(input: &Path) -> (OutFile, oxipng::Options) {
|
|||
}
|
||||
|
||||
fn test_it_converts(
|
||||
input: &Path,
|
||||
output: &OutFile,
|
||||
opts: &oxipng::Options,
|
||||
input: &str,
|
||||
color_type_in: ColorType,
|
||||
bit_depth_in: BitDepth,
|
||||
color_type_out: ColorType,
|
||||
bit_depth_out: BitDepth,
|
||||
) {
|
||||
let png = png::PngData::new(input, opts.fix_errors).unwrap();
|
||||
let input = PathBuf::from(input);
|
||||
let (output, opts) = get_opts(&input);
|
||||
let png = png::PngData::new(&input, opts.fix_errors).unwrap();
|
||||
|
||||
assert_eq!(png.ihdr_data.color_type, color_type_in);
|
||||
assert_eq!(png.ihdr_data.bit_depth, bit_depth_in);
|
||||
assert_eq!(png.ihdr_data.interlaced, 1);
|
||||
|
||||
match oxipng::optimize(input, output, opts) {
|
||||
match oxipng::optimize(&input, &output, &opts) {
|
||||
Ok(_) => (),
|
||||
Err(x) => panic!("{}", x),
|
||||
};
|
||||
|
|
@ -57,13 +57,8 @@ fn test_it_converts(
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_rgba_16() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_rgba_16.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_rgba_16.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::RGBA,
|
||||
|
|
@ -73,13 +68,8 @@ fn interlaced_rgba_16_should_be_rgba_16() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_rgba_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_rgba_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_rgba_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::RGBA,
|
||||
|
|
@ -89,13 +79,8 @@ fn interlaced_rgba_16_should_be_rgba_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_8_should_be_rgba_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_8_should_be_rgba_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_8_should_be_rgba_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::RGBA,
|
||||
|
|
@ -105,13 +90,8 @@ fn interlaced_rgba_8_should_be_rgba_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_rgb_16() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_rgb_16.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_rgb_16.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::RGB,
|
||||
|
|
@ -121,13 +101,8 @@ fn interlaced_rgba_16_should_be_rgb_16() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_rgb_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_rgb_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_rgb_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::RGB,
|
||||
|
|
@ -137,13 +112,8 @@ fn interlaced_rgba_16_should_be_rgb_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_8_should_be_rgb_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_8_should_be_rgb_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_8_should_be_rgb_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::RGB,
|
||||
|
|
@ -153,13 +123,8 @@ fn interlaced_rgba_8_should_be_rgb_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_palette_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_palette_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_palette_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -169,13 +134,8 @@ fn interlaced_rgba_16_should_be_palette_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_8_should_be_palette_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_8_should_be_palette_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_8_should_be_palette_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -185,13 +145,8 @@ fn interlaced_rgba_8_should_be_palette_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_palette_4() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_palette_4.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_palette_4.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -201,13 +156,8 @@ fn interlaced_rgba_16_should_be_palette_4() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_8_should_be_palette_4() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_8_should_be_palette_4.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_8_should_be_palette_4.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -217,13 +167,8 @@ fn interlaced_rgba_8_should_be_palette_4() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_palette_2() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_palette_2.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_palette_2.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -233,13 +178,8 @@ fn interlaced_rgba_16_should_be_palette_2() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_8_should_be_palette_2() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_8_should_be_palette_2.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_8_should_be_palette_2.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -249,13 +189,8 @@ fn interlaced_rgba_8_should_be_palette_2() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_palette_1() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_palette_1.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_palette_1.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -265,13 +200,8 @@ fn interlaced_rgba_16_should_be_palette_1() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_8_should_be_palette_1() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_8_should_be_palette_1.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_8_should_be_palette_1.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -281,13 +211,8 @@ fn interlaced_rgba_8_should_be_palette_1() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_grayscale_alpha_16() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_grayscale_alpha_16.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_grayscale_alpha_16.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::GrayscaleAlpha,
|
||||
|
|
@ -297,13 +222,8 @@ fn interlaced_rgba_16_should_be_grayscale_alpha_16() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_grayscale_alpha_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_grayscale_alpha_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_grayscale_alpha_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::GrayscaleAlpha,
|
||||
|
|
@ -313,13 +233,8 @@ fn interlaced_rgba_16_should_be_grayscale_alpha_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_8_should_be_grayscale_alpha_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_8_should_be_grayscale_alpha_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_8_should_be_grayscale_alpha_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::GrayscaleAlpha,
|
||||
|
|
@ -329,13 +244,8 @@ fn interlaced_rgba_8_should_be_grayscale_alpha_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_grayscale_16() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_grayscale_16.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_grayscale_16.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -345,13 +255,8 @@ fn interlaced_rgba_16_should_be_grayscale_16() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_16_should_be_grayscale_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_16_should_be_grayscale_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_16_should_be_grayscale_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -361,13 +266,8 @@ fn interlaced_rgba_16_should_be_grayscale_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgba_8_should_be_grayscale_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgba_8_should_be_grayscale_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgba_8_should_be_grayscale_8.png",
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -377,13 +277,8 @@ fn interlaced_rgba_8_should_be_grayscale_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_16_should_be_rgb_16() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_16_should_be_rgb_16.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_16_should_be_rgb_16.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::RGB,
|
||||
|
|
@ -393,13 +288,8 @@ fn interlaced_rgb_16_should_be_rgb_16() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_16_should_be_rgb_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_16_should_be_rgb_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_16_should_be_rgb_8.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::RGB,
|
||||
|
|
@ -409,13 +299,8 @@ fn interlaced_rgb_16_should_be_rgb_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_8_should_be_rgb_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_8_should_be_rgb_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_8_should_be_rgb_8.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::RGB,
|
||||
|
|
@ -425,13 +310,8 @@ fn interlaced_rgb_8_should_be_rgb_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_16_should_be_palette_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_16_should_be_palette_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_16_should_be_palette_8.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -441,13 +321,8 @@ fn interlaced_rgb_16_should_be_palette_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_8_should_be_palette_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_8_should_be_palette_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_8_should_be_palette_8.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -457,13 +332,8 @@ fn interlaced_rgb_8_should_be_palette_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_16_should_be_palette_4() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_16_should_be_palette_4.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_16_should_be_palette_4.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -473,13 +343,8 @@ fn interlaced_rgb_16_should_be_palette_4() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_8_should_be_palette_4() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_8_should_be_palette_4.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_8_should_be_palette_4.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -489,13 +354,8 @@ fn interlaced_rgb_8_should_be_palette_4() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_16_should_be_palette_2() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_16_should_be_palette_2.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_16_should_be_palette_2.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -505,13 +365,8 @@ fn interlaced_rgb_16_should_be_palette_2() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_8_should_be_palette_2() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_8_should_be_palette_2.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_8_should_be_palette_2.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -521,13 +376,8 @@ fn interlaced_rgb_8_should_be_palette_2() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_16_should_be_palette_1() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_16_should_be_palette_1.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_16_should_be_palette_1.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -537,13 +387,8 @@ fn interlaced_rgb_16_should_be_palette_1() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_8_should_be_palette_1() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_8_should_be_palette_1.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_8_should_be_palette_1.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -553,13 +398,8 @@ fn interlaced_rgb_8_should_be_palette_1() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_16_should_be_grayscale_16() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_16_should_be_grayscale_16.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_16_should_be_grayscale_16.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -569,13 +409,8 @@ fn interlaced_rgb_16_should_be_grayscale_16() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_16_should_be_grayscale_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_16_should_be_grayscale_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_16_should_be_grayscale_8.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -585,13 +420,8 @@ fn interlaced_rgb_16_should_be_grayscale_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_rgb_8_should_be_grayscale_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_rgb_8_should_be_grayscale_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_rgb_8_should_be_grayscale_8.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -601,13 +431,8 @@ fn interlaced_rgb_8_should_be_grayscale_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_8_should_be_palette_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_8_should_be_palette_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_8_should_be_palette_8.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -617,13 +442,8 @@ fn interlaced_palette_8_should_be_palette_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_8_should_be_palette_4() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_8_should_be_palette_4.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_8_should_be_palette_4.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -633,13 +453,8 @@ fn interlaced_palette_8_should_be_palette_4() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_4_should_be_palette_4() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_4_should_be_palette_4.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_4_should_be_palette_4.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Four,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -649,13 +464,8 @@ fn interlaced_palette_4_should_be_palette_4() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_8_should_be_palette_2() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_8_should_be_palette_2.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_8_should_be_palette_2.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -665,13 +475,8 @@ fn interlaced_palette_8_should_be_palette_2() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_4_should_be_palette_2() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_4_should_be_palette_2.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_4_should_be_palette_2.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Four,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -681,13 +486,8 @@ fn interlaced_palette_4_should_be_palette_2() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_2_should_be_palette_2() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_2_should_be_palette_2.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_2_should_be_palette_2.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Two,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -697,13 +497,8 @@ fn interlaced_palette_2_should_be_palette_2() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_8_should_be_palette_1() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_8_should_be_palette_1.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_8_should_be_palette_1.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -713,13 +508,8 @@ fn interlaced_palette_8_should_be_palette_1() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_4_should_be_palette_1() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_4_should_be_palette_1.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_4_should_be_palette_1.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Four,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -729,13 +519,8 @@ fn interlaced_palette_4_should_be_palette_1() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_2_should_be_palette_1() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_2_should_be_palette_1.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_2_should_be_palette_1.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Two,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -745,13 +530,8 @@ fn interlaced_palette_2_should_be_palette_1() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_palette_1_should_be_palette_1() {
|
||||
let input = PathBuf::from("tests/files/interlaced_palette_1_should_be_palette_1.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_palette_1_should_be_palette_1.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::One,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -761,14 +541,8 @@ fn interlaced_palette_1_should_be_palette_1() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_grayscale_alpha_16_should_be_grayscale_alpha_16() {
|
||||
let input =
|
||||
PathBuf::from("tests/files/interlaced_grayscale_alpha_16_should_be_grayscale_alpha_16.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_grayscale_alpha_16_should_be_grayscale_alpha_16.png",
|
||||
ColorType::GrayscaleAlpha,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::GrayscaleAlpha,
|
||||
|
|
@ -778,14 +552,8 @@ fn interlaced_grayscale_alpha_16_should_be_grayscale_alpha_16() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_grayscale_alpha_16_should_be_grayscale_alpha_8() {
|
||||
let input =
|
||||
PathBuf::from("tests/files/interlaced_grayscale_alpha_16_should_be_grayscale_alpha_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_grayscale_alpha_16_should_be_grayscale_alpha_8.png",
|
||||
ColorType::GrayscaleAlpha,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::GrayscaleAlpha,
|
||||
|
|
@ -795,14 +563,8 @@ fn interlaced_grayscale_alpha_16_should_be_grayscale_alpha_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_grayscale_alpha_8_should_be_grayscale_alpha_8() {
|
||||
let input =
|
||||
PathBuf::from("tests/files/interlaced_grayscale_alpha_8_should_be_grayscale_alpha_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_grayscale_alpha_8_should_be_grayscale_alpha_8.png",
|
||||
ColorType::GrayscaleAlpha,
|
||||
BitDepth::Eight,
|
||||
ColorType::GrayscaleAlpha,
|
||||
|
|
@ -812,14 +574,8 @@ fn interlaced_grayscale_alpha_8_should_be_grayscale_alpha_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_grayscale_alpha_16_should_be_grayscale_16() {
|
||||
let input =
|
||||
PathBuf::from("tests/files/interlaced_grayscale_alpha_16_should_be_grayscale_16.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_grayscale_alpha_16_should_be_grayscale_16.png",
|
||||
ColorType::GrayscaleAlpha,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -829,14 +585,8 @@ fn interlaced_grayscale_alpha_16_should_be_grayscale_16() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_grayscale_alpha_16_should_be_grayscale_8() {
|
||||
let input =
|
||||
PathBuf::from("tests/files/interlaced_grayscale_alpha_16_should_be_grayscale_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_grayscale_alpha_16_should_be_grayscale_8.png",
|
||||
ColorType::GrayscaleAlpha,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -846,13 +596,8 @@ fn interlaced_grayscale_alpha_16_should_be_grayscale_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_grayscale_alpha_8_should_be_grayscale_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_grayscale_alpha_8_should_be_grayscale_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_grayscale_alpha_8_should_be_grayscale_8.png",
|
||||
ColorType::GrayscaleAlpha,
|
||||
BitDepth::Eight,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -862,13 +607,8 @@ fn interlaced_grayscale_alpha_8_should_be_grayscale_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_grayscale_16_should_be_grayscale_16() {
|
||||
let input = PathBuf::from("tests/files/interlaced_grayscale_16_should_be_grayscale_16.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_grayscale_16_should_be_grayscale_16.png",
|
||||
ColorType::Grayscale,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -878,13 +618,8 @@ fn interlaced_grayscale_16_should_be_grayscale_16() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_grayscale_16_should_be_grayscale_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_grayscale_16_should_be_grayscale_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_grayscale_16_should_be_grayscale_8.png",
|
||||
ColorType::Grayscale,
|
||||
BitDepth::Sixteen,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -894,13 +629,8 @@ fn interlaced_grayscale_16_should_be_grayscale_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_grayscale_8_should_be_grayscale_8() {
|
||||
let input = PathBuf::from("tests/files/interlaced_grayscale_8_should_be_grayscale_8.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_grayscale_8_should_be_grayscale_8.png",
|
||||
ColorType::Grayscale,
|
||||
BitDepth::Eight,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -910,13 +640,8 @@ fn interlaced_grayscale_8_should_be_grayscale_8() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_small_files() {
|
||||
let input = PathBuf::from("tests/files/interlaced_small_files.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_small_files.png",
|
||||
ColorType::Indexed,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -926,13 +651,8 @@ fn interlaced_small_files() {
|
|||
|
||||
#[test]
|
||||
fn interlaced_odd_width() {
|
||||
let input = PathBuf::from("tests/files/interlaced_odd_width.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/interlaced_odd_width.png",
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::RGB,
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -20,20 +20,21 @@ fn get_opts(input: &Path) -> (OutFile, oxipng::Options) {
|
|||
}
|
||||
|
||||
fn test_it_converts(
|
||||
input: &Path,
|
||||
output: &OutFile,
|
||||
opts: &oxipng::Options,
|
||||
input: &str,
|
||||
custom: Option<(OutFile, oxipng::Options)>,
|
||||
color_type_in: ColorType,
|
||||
bit_depth_in: BitDepth,
|
||||
color_type_out: ColorType,
|
||||
bit_depth_out: BitDepth,
|
||||
) {
|
||||
let png = png::PngData::new(input, opts.fix_errors).unwrap();
|
||||
let input = PathBuf::from(input);
|
||||
let (output, opts) = custom.unwrap_or_else(|| get_opts(&input));
|
||||
let png = png::PngData::new(&input, opts.fix_errors).unwrap();
|
||||
|
||||
assert_eq!(png.ihdr_data.color_type, color_type_in);
|
||||
assert_eq!(png.ihdr_data.bit_depth, bit_depth_in);
|
||||
|
||||
match oxipng::optimize(input, output, opts) {
|
||||
match oxipng::optimize(&input, &output, &opts) {
|
||||
Ok(_) => (),
|
||||
Err(x) => panic!("{}", x),
|
||||
};
|
||||
|
|
@ -56,13 +57,9 @@ fn test_it_converts(
|
|||
|
||||
#[test]
|
||||
fn issue_29() {
|
||||
let input = PathBuf::from("tests/files/issue-29.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-29.png",
|
||||
None,
|
||||
ColorType::RGB,
|
||||
BitDepth::Eight,
|
||||
ColorType::RGB,
|
||||
|
|
@ -106,13 +103,9 @@ fn issue_42() {
|
|||
|
||||
#[test]
|
||||
fn issue_52_01() {
|
||||
let input = PathBuf::from("tests/files/issue-52-01.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-52-01.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -122,13 +115,9 @@ fn issue_52_01() {
|
|||
|
||||
#[test]
|
||||
fn issue_52_02() {
|
||||
let input = PathBuf::from("tests/files/issue-52-02.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-52-02.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -138,13 +127,9 @@ fn issue_52_02() {
|
|||
|
||||
#[test]
|
||||
fn issue_52_03() {
|
||||
let input = PathBuf::from("tests/files/issue-52-03.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-52-03.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -154,13 +139,9 @@ fn issue_52_03() {
|
|||
|
||||
#[test]
|
||||
fn issue_52_04() {
|
||||
let input = PathBuf::from("tests/files/issue-52-04.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-52-04.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -170,13 +151,9 @@ fn issue_52_04() {
|
|||
|
||||
#[test]
|
||||
fn issue_52_05() {
|
||||
let input = PathBuf::from("tests/files/issue-52-05.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-52-05.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -186,13 +163,9 @@ fn issue_52_05() {
|
|||
|
||||
#[test]
|
||||
fn issue_52_06() {
|
||||
let input = PathBuf::from("tests/files/issue-52-06.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-52-06.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -202,13 +175,9 @@ fn issue_52_06() {
|
|||
|
||||
#[test]
|
||||
fn issue_56() {
|
||||
let input = PathBuf::from("tests/files/issue-56.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-56.png",
|
||||
None,
|
||||
ColorType::Indexed,
|
||||
BitDepth::Four,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -218,13 +187,9 @@ fn issue_56() {
|
|||
|
||||
#[test]
|
||||
fn issue_58() {
|
||||
let input = PathBuf::from("tests/files/issue-58.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-58.png",
|
||||
None,
|
||||
ColorType::Indexed,
|
||||
BitDepth::Four,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -234,13 +199,9 @@ fn issue_58() {
|
|||
|
||||
#[test]
|
||||
fn issue_59() {
|
||||
let input = PathBuf::from("tests/files/issue-59.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-59.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::RGBA,
|
||||
|
|
@ -250,13 +211,9 @@ fn issue_59() {
|
|||
|
||||
#[test]
|
||||
fn issue_60() {
|
||||
let input = PathBuf::from("tests/files/issue-60.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-60.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::GrayscaleAlpha,
|
||||
|
|
@ -266,13 +223,9 @@ fn issue_60() {
|
|||
|
||||
#[test]
|
||||
fn issue_80() {
|
||||
let input = PathBuf::from("tests/files/issue-80.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-80.png",
|
||||
None,
|
||||
ColorType::Indexed,
|
||||
BitDepth::Two,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -282,13 +235,9 @@ fn issue_80() {
|
|||
|
||||
#[test]
|
||||
fn issue_82() {
|
||||
let input = PathBuf::from("tests/files/issue-82.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-82.png",
|
||||
None,
|
||||
ColorType::Indexed,
|
||||
BitDepth::Four,
|
||||
ColorType::Indexed,
|
||||
|
|
@ -298,13 +247,9 @@ fn issue_82() {
|
|||
|
||||
#[test]
|
||||
fn issue_89() {
|
||||
let input = PathBuf::from("tests/files/issue-89.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-89.png",
|
||||
None,
|
||||
ColorType::RGBA,
|
||||
BitDepth::Eight,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -314,13 +259,9 @@ fn issue_89() {
|
|||
|
||||
#[test]
|
||||
fn issue_92_filter_0() {
|
||||
let input = PathBuf::from("tests/files/issue-92.png");
|
||||
let (output, opts) = get_opts(&input);
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
"tests/files/issue-92.png",
|
||||
None,
|
||||
ColorType::Grayscale,
|
||||
BitDepth::Eight,
|
||||
ColorType::Grayscale,
|
||||
|
|
@ -330,17 +271,14 @@ fn issue_92_filter_0() {
|
|||
|
||||
#[test]
|
||||
fn issue_92_filter_5() {
|
||||
let input = PathBuf::from("tests/files/issue-92.png");
|
||||
let (_, mut opts) = get_opts(&input);
|
||||
let mut filter = HashSet::new();
|
||||
filter.insert(5);
|
||||
opts.filter = filter;
|
||||
let output = OutFile::Path(Some(input.with_extension("-f5-out.png").to_owned()));
|
||||
let input = "tests/files/issue-92.png";
|
||||
let (_, mut opts) = get_opts(Path::new(input));
|
||||
opts.filter = [5].iter().cloned().collect();
|
||||
let output = OutFile::Path(Some(Path::new(input).with_extension("-f5-out.png").to_owned()));
|
||||
|
||||
test_it_converts(
|
||||
&input,
|
||||
&output,
|
||||
&opts,
|
||||
Some((output, opts)),
|
||||
ColorType::Grayscale,
|
||||
BitDepth::Eight,
|
||||
ColorType::Grayscale,
|
||||
|
|
|
|||
Loading…
Reference in a new issue