pub mod tiff; pub mod binfile; pub const TEST_IMAGE_PATH: &str = "../test.tif"; pub const TEST_OUTPUT_PATH: &str = "../test.bin"; #[cfg(test)] mod tests { use super::*; #[test] fn it_works() { assert_eq!(0, 0); } #[test] fn ignore_warning_test() { tiff::ignore_warnings(); assert_eq!(0, 0); } #[test] fn tiff_open_test() { tiff::ignore_warnings(); if let Some(result) = tiff::open(TEST_IMAGE_PATH) { tiff::close(result); } else { assert!(false); } } #[test] fn tiff_width_test() { tiff::ignore_warnings(); if let Some(t_handle) = tiff::open(TEST_IMAGE_PATH) { let width = tiff::get_image_width(t_handle).expect("Image should have width!"); assert!(width > 0); tiff::close(t_handle); } else { assert!(false); } } #[test] fn tiff_height_test() { tiff::ignore_warnings(); if let Some(t_handle) = tiff::open(TEST_IMAGE_PATH) { let height = tiff::get_image_height(t_handle).expect("Image should have height!"); assert!(height > 0); tiff::close(t_handle); } else { assert!(false); } } #[test] fn tiff_channel_test() { tiff::ignore_warnings(); if let Some(t_handle) = tiff::open(TEST_IMAGE_PATH) { let channels = tiff::get_image_channels(t_handle); assert!(channels > 0); tiff::close(t_handle); } else { assert!(false); } } #[test] fn tiff_read_test() { tiff::ignore_warnings(); if let Some(t_handle) = tiff::open(TEST_IMAGE_PATH) { let _data = tiff::read(t_handle); tiff::close(t_handle); } else { assert!(false); } } #[test] fn tiff_data_dump_test() { tiff::ignore_warnings(); if let Some(standard_format) = tiff::as_standard_format(TEST_IMAGE_PATH) { binfile::dump_u32_vec(TEST_OUTPUT_PATH, standard_format).expect("File output error"); } else { assert!(false); } } }