test out-of-bounds pixels
This commit is contained in:
parent
93209bd3fb
commit
af3388f9f2
24
src/image.rs
24
src/image.rs
|
@ -93,4 +93,28 @@ mod test {
|
|||
|
||||
assert_eq!(output, expected);
|
||||
}
|
||||
|
||||
/// lots of Bitsy games have editor errors where pixels can be placed out of bounds
|
||||
/// check that these extraneous pixels are stripped out
|
||||
#[test]
|
||||
fn test_image_out_of_bounds() {
|
||||
let output = Image::from(
|
||||
include_str!("test-resources/image-oob").to_string()
|
||||
);
|
||||
|
||||
let expected = Image {
|
||||
pixels: vec![
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,0,0,1,1,1,1,
|
||||
1,0,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
1,1,1,1,1,1,1,1,
|
||||
0,0,0,0,0,0,0,0,
|
||||
]
|
||||
};
|
||||
|
||||
assert_eq!(output, expected);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue