Fix test module Decoder calls and constructors
The other magic constructors were no longer valid because of the added struct members. The calls to `new()` have been reattached to `new_with_no_metadata()`. Tests pass, still!
This commit is contained in:
@@ -193,6 +193,10 @@ mod test {
|
|||||||
// op codes to demonstrate the indexing operations.
|
// op codes to demonstrate the indexing operations.
|
||||||
fn new_with_backbuffer(bytes: I, back_buffer: [PixelRGBA; 64]) -> Self {
|
fn new_with_backbuffer(bytes: I, back_buffer: [PixelRGBA; 64]) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
channels: 4,
|
||||||
|
colorspace: 0,
|
||||||
back_buffer,
|
back_buffer,
|
||||||
prev_pixel: PixelRGBA {
|
prev_pixel: PixelRGBA {
|
||||||
r: 0,
|
r: 0,
|
||||||
@@ -209,6 +213,10 @@ mod test {
|
|||||||
// function, but for testing a run of pixels.
|
// function, but for testing a run of pixels.
|
||||||
fn new_with_previous_pixel(bytes: I, prev_pixel: PixelRGBA) -> Self {
|
fn new_with_previous_pixel(bytes: I, prev_pixel: PixelRGBA) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
width: 0,
|
||||||
|
height: 0,
|
||||||
|
channels: 4,
|
||||||
|
colorspace: 0,
|
||||||
back_buffer: [PixelRGBA::zero(); 64],
|
back_buffer: [PixelRGBA::zero(); 64],
|
||||||
prev_pixel,
|
prev_pixel,
|
||||||
bytes,
|
bytes,
|
||||||
@@ -284,7 +292,7 @@ mod test {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let decoder = Decoder::new(compressed.into_iter());
|
let decoder = Decoder::new_with_no_metadata(compressed.into_iter());
|
||||||
let result = decoder.collect::<Vec<PixelRGBA>>();
|
let result = decoder.collect::<Vec<PixelRGBA>>();
|
||||||
assert_eq!(result, expected);
|
assert_eq!(result, expected);
|
||||||
}
|
}
|
||||||
@@ -330,7 +338,7 @@ mod test {
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
let decoder = Decoder::new(compressed.into_iter());
|
let decoder = Decoder::new_with_no_metadata(compressed.into_iter());
|
||||||
let result: Vec<PixelRGBA> = decoder.collect();
|
let result: Vec<PixelRGBA> = decoder.collect();
|
||||||
assert_eq!(result, expected);
|
assert_eq!(result, expected);
|
||||||
}
|
}
|
||||||
@@ -396,7 +404,7 @@ mod test {
|
|||||||
PixelRGBA::new(0, 0, 0, 255),
|
PixelRGBA::new(0, 0, 0, 255),
|
||||||
];
|
];
|
||||||
|
|
||||||
let decoder = Decoder::new(compressed.into_iter());
|
let decoder = Decoder::new_with_no_metadata(compressed.into_iter());
|
||||||
let result: Vec<PixelRGBA> = decoder.collect();
|
let result: Vec<PixelRGBA> = decoder.collect();
|
||||||
assert_eq!(result, expected);
|
assert_eq!(result, expected);
|
||||||
}
|
}
|
||||||
@@ -462,7 +470,7 @@ mod test {
|
|||||||
PixelRGBA::new(37, 19, 28, 255),
|
PixelRGBA::new(37, 19, 28, 255),
|
||||||
];
|
];
|
||||||
|
|
||||||
let decoder = Decoder::new(compressed.into_iter());
|
let decoder = Decoder::new_with_no_metadata(compressed.into_iter());
|
||||||
let result: Vec<PixelRGBA> = decoder.collect();
|
let result: Vec<PixelRGBA> = decoder.collect();
|
||||||
assert_eq!(result, expected);
|
assert_eq!(result, expected);
|
||||||
}
|
}
|
||||||
@@ -555,7 +563,7 @@ mod test {
|
|||||||
PixelRGBA::new(0xFF, 0xFF, 0xFF, 0xFF),
|
PixelRGBA::new(0xFF, 0xFF, 0xFF, 0xFF),
|
||||||
];
|
];
|
||||||
|
|
||||||
let mut decoder = Decoder::new(compressed.into_iter());
|
let mut decoder = Decoder::new_with_no_metadata(compressed.into_iter());
|
||||||
|
|
||||||
let mut result = Vec::<PixelRGBA>::new();
|
let mut result = Vec::<PixelRGBA>::new();
|
||||||
loop {
|
loop {
|
||||||
@@ -624,7 +632,7 @@ mod test {
|
|||||||
39, // run x3
|
39, // run x3
|
||||||
38, // final RGBA
|
38, // final RGBA
|
||||||
];
|
];
|
||||||
let mut decoder = Decoder::new(compressed.into_iter());
|
let mut decoder = Decoder::new_with_no_metadata(compressed.into_iter());
|
||||||
let mut iters = 0;
|
let mut iters = 0;
|
||||||
loop {
|
loop {
|
||||||
if let Some(pixel) = decoder.next() {
|
if let Some(pixel) = decoder.next() {
|
||||||
|
|||||||
Reference in New Issue
Block a user