test out-of-bounds pixels

This commit is contained in:
Max Bradbury 2020-04-29 09:28:20 +01:00
parent 93209bd3fb
commit af3388f9f2
1 changed files with 24 additions and 0 deletions

View File

@ -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);
}
}