Commit 8dc2001c authored by Luca Barbato's avatar Luca Barbato Committed by Luca Barbato

Add a copy_from_raw_u8 test

parent aaafd248
...@@ -669,6 +669,30 @@ impl<T: Pixel> EdgedPlaneSlice<'_, T> { ...@@ -669,6 +669,30 @@ impl<T: Pixel> EdgedPlaneSlice<'_, T> {
pub mod test { pub mod test {
use super::*; use super::*;
#[test]
fn copy_from_raw_u8() {
let mut plane = Plane::wrap(
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,
], 8);
let input = vec![42u8; 64];
plane.copy_from_raw_u8(&input, 8, 1);
println!("{:?}", &plane.data[..10]);
assert_eq!(&input[..64], &plane.data[..64]);
}
#[test] #[test]
fn test_plane_pad() { fn test_plane_pad() {
let mut plane = Plane::<u8> { let mut plane = Plane::<u8> {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment