diff --git a/src/main.rs b/src/main.rs index e2e13e5..73644e7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -473,7 +473,7 @@ mod test { QOI_OP_RGBA, 0x20, 0x20, 0x20, 0x20, (QOI_OP_INDEX | 1), (QOI_OP_DIFF | 0b0011_1111), - (QOI_OP_LUMA | 0b0011_111), 0b0011_1111, + (QOI_OP_LUMA | 0b0011_1111), 0b1111_1111, (QOI_OP_RUN | 2), QOI_OP_RGBA, 0xFF, 0xFF, 0xFF, 0xFF, ]; @@ -481,23 +481,22 @@ mod test { let expected = [ PixelRGBA::new(0, 0, 0, 0xFF), // init PixelRGBA::new(0x10, 0x10, 0x10, 0xFF), // RGB - PixelRGBA::new(0x20, 0x20, 0x20, 0xFF), // RGBA + PixelRGBA::new(0x20, 0x20, 0x20, 0x20), // RGBA PixelRGBA::new(0, 0, 0, 0), // INDEX -- this doubles as a small test for the backbuffer operation PixelRGBA::new(0x1, 0x1, 0x1, 0x0), // DIFF PixelRGBA::new(0x27, 0x20, 0x27, 0x0), // LUMA PixelRGBA::new(0x27, 0x20, 0x27, 0x0), // RUN 1 PixelRGBA::new(0x27, 0x20, 0x27, 0x0), // RUN 2 PixelRGBA::new(0x27, 0x20, 0x27, 0x0), // RUN 3 - // final OP_RGBA is just to flush out the OP_RUN prev_pixel value + PixelRGBA::new(0xFF, 0xFF, 0xFF, 0xFF) ]; let mut decoder = Decoder::new(compressed.into_iter()); let mut result = Vec::::new(); loop { - if let Some(_) = decoder.next() { - result.push(*decoder.peek_prev_pixel()); - } else { + result.push(*decoder.peek_prev_pixel()); + if let None = decoder.next() { break; } }