Skip to content

Commit

Permalink
Skip test when using miniz
Browse files Browse the repository at this point in the history
  • Loading branch information
kornelski committed Jan 22, 2019
1 parent 7ad93ed commit 851b454
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ optional = true
version = "2.0.0"

[target.'cfg(any(target_arch = "x86_64", target_arch = "aarch64"))'.dependencies]
cloudflare-zlib = "^0.2.0"
cloudflare-zlib = "^0.2.2"

[dependencies.image]
default-features = false
Expand Down
9 changes: 8 additions & 1 deletion src/deflate/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,14 @@ use PngResult;
pub mod miniz_stream;

#[cfg(any(target_arch = "x86_64", target_arch = "aarch64"))]
mod cfzlib;
pub mod cfzlib;

#[cfg(not(any(target_arch = "x86_64", target_arch = "aarch64")))]
mod cfzlib {
pub fn is_supported() -> bool {
return false;
}
}

/// Decompress a data stream using the DEFLATE algorithm
pub fn inflate(data: &[u8]) -> PngResult<Vec<u8>> {
Expand Down
4 changes: 4 additions & 0 deletions tests/interlaced.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,10 @@ fn interlaced_palette_8_should_be_palette_8() {

#[test]
fn interlaced_palette_8_should_be_palette_4() {
// miniz doesn't estimate compression that well
if !oxipng::internal_tests::cfzlib::is_supported() {
return;
}
test_it_converts(
"tests/files/interlaced_palette_8_should_be_palette_4.png",
ColorType::Indexed,
Expand Down

0 comments on commit 851b454

Please sign in to comment.