diff --git a/src/encoder/mod.rs b/src/encoder/mod.rs index 952c3e0..7430799 100644 --- a/src/encoder/mod.rs +++ b/src/encoder/mod.rs @@ -760,7 +760,7 @@ impl<'a, W: 'a + Write + Seek, T: ColorType> ImageEncoder<'a, W, T> { /// Set image number of lines per strip /// - /// This function must be called before calling write_data() or write_strip(). + /// `write_strip` and will return an error otherwise. pub fn rows_per_strip(&mut self, value: u32) -> TiffResult<()> { if self.strip_idx != 0 { return Err(io::Error::new( diff --git a/tests/encode_images.rs b/tests/encode_images.rs index b2cce41..7ba8eb3 100644 --- a/tests/encode_images.rs +++ b/tests/encode_images.rs @@ -381,6 +381,7 @@ fn test_rows_per_strip() { image.write_strip(&img2[..]).unwrap(); } assert!(image.write_strip(&img2[..]).is_err()); + image.finish().unwrap(); } file.seek(SeekFrom::Start(0)).unwrap(); @@ -391,10 +392,9 @@ fn test_rows_per_strip() { for i in 0..50 { let img2 = [i; 2 * 100]; - if let DecodingResult::U8(data) = decoder.read_strip().unwrap() { - assert_eq!(&img2[..], &data[..]); - } else { - assert!(false); + match decoder.read_strip().unwrap() { + DecodingResult::U8(data) => assert_eq!(&img2[..], &data[..]), + other => panic!("Incorrect strip type {:?}", other), } } }