Created
August 12, 2019 19:22
-
-
Save lu-zero/ec713b9579bdf6a80a648efcf0fdab08 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/frame/plane.rs b/src/frame/plane.rs | |
index 71555c42..30f0c020 100644 | |
--- a/src/frame/plane.rs | |
+++ b/src/frame/plane.rs | |
@@ -665,6 +665,39 @@ pub mod test { | |
assert_eq!(&input[..64], &plane.data[..64]); | |
} | |
+ #[test] | |
+ fn mutable_access() { | |
+ let mut plane = Plane::<u8> { | |
+ data: PlaneData::from_slice(&vec![ | |
+ 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 1, 2, 3, 4, 0, 0, | |
+ 0, 0, 8, 7, 6, 5, 0, 0, | |
+ 0, 0, 9, 8, 7, 6, 0, 0, | |
+ 0, 0, 2, 3, 4, 5, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, | |
+ 0, 0, 0, 0, 0, 0, 0, 0, | |
+ ]), | |
+ cfg: PlaneConfig { | |
+ stride: 8, | |
+ alloc_height: 9, | |
+ width: 4, | |
+ height: 4, | |
+ xdec: 0, | |
+ ydec: 0, | |
+ xpad: 0, | |
+ ypad: 0, | |
+ xorigin: 2, | |
+ yorigin: 3, | |
+ }, | |
+ }; | |
+ let mut s = plane.as_mut_slice(); | |
+ | |
+ s[1][2] = 42; | |
+ | |
+ } | |
+ | |
#[test] | |
fn test_plane_pad() { | |
let mut plane = Plane::<u8> { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment