[librsvg/wip/aruiz/rust-pixbuf-loader] itest: test last pixel
- From: Alberto Ruiz <aruiz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/wip/aruiz/rust-pixbuf-loader] itest: test last pixel
- Date: Fri, 5 Aug 2022 19:14:17 +0000 (UTC)
commit a0f6f906d648ff40ff7280d95d1b16c671c62f21
Author: Alberto Ruiz <aruiz redhat com>
Date: Fri Jul 29 18:35:34 2022 +0100
itest: test last pixel
gdk-pixbuf-loader/src/lib.rs | 26 ++++++++++++++++++++++----
1 file changed, 22 insertions(+), 4 deletions(-)
---
diff --git a/gdk-pixbuf-loader/src/lib.rs b/gdk-pixbuf-loader/src/lib.rs
index ac6770c90..6c5ffffc2 100644
--- a/gdk-pixbuf-loader/src/lib.rs
+++ b/gdk-pixbuf-loader/src/lib.rs
@@ -372,10 +372,28 @@ mod tests {
assert_eq!(*pixels.offset(3), 0xff);
// Bottom left pixel
- assert_eq!(*pixels.offset((stride * 99) as isize), 0xaa);
- assert_eq!(*pixels.offset((stride * 99) as isize + 1), 0x11);
- assert_eq!(*pixels.offset((stride * 99) as isize + 2), 0x44);
- assert_eq!(*pixels.offset((stride * 99) as isize + 3), 0xff);
+ assert_eq!(*pixels.offset((stride * (h - 1)) as isize), 0xaa);
+ assert_eq!(*pixels.offset((stride * (h - 1)) as isize + 1), 0x11);
+ assert_eq!(*pixels.offset((stride * (h - 1)) as isize + 2), 0x44);
+ assert_eq!(*pixels.offset((stride * (h - 1)) as isize + 3), 0xff);
+
+ // Bottom right pixel
+ assert_eq!(
+ *pixels.offset((stride * (h - 1)) as isize + (w as isize - 1) * 4),
+ 0xaa
+ );
+ assert_eq!(
+ *pixels.offset((stride * (h - 1)) as isize + (w as isize - 1) * 4 + 1),
+ 0x11
+ );
+ assert_eq!(
+ *pixels.offset((stride * (h - 1)) as isize + (w as isize - 1) * 4 + 2),
+ 0x44
+ );
+ assert_eq!(
+ *pixels.offset((stride * (h - 1)) as isize + (w as isize - 1) * 4 + 3),
+ 0xff
+ );
}
let ctx = unsafe { crate::begin_load(None, Some(prep_cb), None, null_mut(), null_mut()) };
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]