diff --git a/src/image.rs b/src/image.rs index dce465f..7f5b02e 100644 --- a/src/image.rs +++ b/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); + } }