Vendor things
This commit is contained in:
parent
5deceec006
commit
977e3c17e5
19434 changed files with 10682014 additions and 0 deletions
30
third-party/vendor/image/tests/save_jpeg.rs
vendored
Normal file
30
third-party/vendor/image/tests/save_jpeg.rs
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
//! Test saving "default" and specific quality jpeg.
|
||||
#![cfg(all(feature = "jpeg", feature = "tiff"))]
|
||||
extern crate image;
|
||||
|
||||
use image::{ImageFormat, ImageOutputFormat};
|
||||
use std::io::Cursor;
|
||||
|
||||
#[test]
|
||||
fn jqeg_qualitys() {
|
||||
let img = image::open("tests/images/tiff/testsuite/mandrill.tiff").unwrap();
|
||||
|
||||
let mut default = vec![];
|
||||
img.write_to(&mut Cursor::new(&mut default), ImageFormat::Jpeg)
|
||||
.unwrap();
|
||||
assert_eq!(&[255, 216], &default[..2]);
|
||||
|
||||
let mut small = vec![];
|
||||
img.write_to(&mut Cursor::new(&mut small), ImageOutputFormat::Jpeg(10))
|
||||
.unwrap();
|
||||
assert_eq!(&[255, 216], &small[..2]);
|
||||
|
||||
assert!(small.len() < default.len());
|
||||
|
||||
let mut large = vec![];
|
||||
img.write_to(&mut Cursor::new(&mut large), ImageOutputFormat::Jpeg(99))
|
||||
.unwrap();
|
||||
assert_eq!(&[255, 216], &large[..2]);
|
||||
|
||||
assert!(large.len() > default.len());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue