[gnome-photos/wip/rishi/tests-gegl-assert-bbox] test-gegl: Assert the bounding box when zooming GeglBuffers
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-photos/wip/rishi/tests-gegl-assert-bbox] test-gegl: Assert the bounding box when zooming GeglBuffers
- Date: Tue, 19 Feb 2019 15:29:49 +0000 (UTC)
commit 103559423a7dbd2ddb7d0f6b79586afa454ccfd0
Author: Debarshi Ray <debarshir gnome org>
Date: Tue Feb 19 16:04:44 2019 +0100
test-gegl: Assert the bounding box when zooming GeglBuffers
While the SHA256 checksum is the ultimate source of truth when
comparing GeglBuffers, the checksum values provide very little insight
into why the buffers are different. Therefore, it's better to assert
the more human understandable properties of the GeglBuffer before
looking at the checksum.
tests/unit/photos-test-gegl.c | 43 +++++++++++++++++++++++++++++++++++++------
1 file changed, 37 insertions(+), 6 deletions(-)
---
diff --git a/tests/unit/photos-test-gegl.c b/tests/unit/photos-test-gegl.c
index 9cfb04da..2d0431cc 100644
--- a/tests/unit/photos-test-gegl.c
+++ b/tests/unit/photos-test-gegl.c
@@ -400,7 +400,13 @@ photos_test_gegl_buffer_check_pixbuf (PhotosTestGeglFixture *fixture, gboolean h
static void
-photos_test_gegl_buffer_check_zoom (PhotosTestGeglFixture *fixture, double zoom, const gchar *checksum)
+photos_test_gegl_buffer_check_zoom (PhotosTestGeglFixture *fixture,
+ double zoom,
+ const gchar *checksum,
+ gint height,
+ gint width,
+ gint x,
+ gint y)
{
const Babl *format_zoomed_converted;
g_autoptr (GeglBuffer) buffer_zoomed = NULL;
@@ -421,6 +427,11 @@ photos_test_gegl_buffer_check_zoom (PhotosTestGeglFixture *fixture, double zoom,
g_assert_true (GEGL_IS_BUFFER (buffer_zoomed));
bbox = *gegl_buffer_get_extent (buffer_zoomed);
+ g_assert_cmpint (bbox.height, ==, height);
+ g_assert_cmpint (bbox.width, ==, width);
+ g_assert_cmpint (bbox.x, ==, x);
+ g_assert_cmpint (bbox.y, ==, y);
+
format_zoomed_converted = babl_format ("R'G'B'A u8");
buffer_zoomed_converted = gegl_buffer_new (&bbox, format_zoomed_converted);
gegl_buffer_copy (buffer_zoomed, &bbox, GEGL_ABYSS_NONE, buffer_zoomed_converted, &bbox);
@@ -725,7 +736,11 @@ photos_test_gegl_buffer_zoom_in_0 (PhotosTestGeglFixture *fixture, gconstpointer
{
photos_test_gegl_buffer_check_zoom (fixture,
1.4,
- "12d60499ebbf9533040792debe28c8bcdebb5ac6b26e2864b26347f42fade116");
+ "12d60499ebbf9533040792debe28c8bcdebb5ac6b26e2864b26347f42fade116",
+ 280,
+ 280,
+ 0,
+ 0);
}
@@ -734,7 +749,11 @@ photos_test_gegl_buffer_zoom_in_1 (PhotosTestGeglFixture *fixture, gconstpointer
{
photos_test_gegl_buffer_check_zoom (fixture,
4.0,
- "f8a0d6eb8c2fdc3f5592f39beaea9477aaf33760e5985a092c99bbb02e735c21");
+ "f8a0d6eb8c2fdc3f5592f39beaea9477aaf33760e5985a092c99bbb02e735c21",
+ 800,
+ 800,
+ 0,
+ 0);
}
@@ -743,7 +762,11 @@ photos_test_gegl_buffer_zoom_nop (PhotosTestGeglFixture *fixture, gconstpointer
{
photos_test_gegl_buffer_check_zoom (fixture,
1.0,
- "2b759cc636f78ff70ef197b9b9495214f9e8de6b3743175f25186c24d9caed5f");
+ "2b759cc636f78ff70ef197b9b9495214f9e8de6b3743175f25186c24d9caed5f",
+ 200,
+ 200,
+ 0,
+ 0);
}
@@ -752,7 +775,11 @@ photos_test_gegl_buffer_zoom_out_0 (PhotosTestGeglFixture *fixture, gconstpointe
{
photos_test_gegl_buffer_check_zoom (fixture,
0.6,
- "d8c9c2c09079e0064f0633a2e05ed3ddce4f00cda3991b87d8cd79cccf319f6d");
+ "d8c9c2c09079e0064f0633a2e05ed3ddce4f00cda3991b87d8cd79cccf319f6d",
+ 120,
+ 120,
+ 0,
+ 0);
}
@@ -761,7 +788,11 @@ photos_test_gegl_buffer_zoom_out_1 (PhotosTestGeglFixture *fixture, gconstpointe
{
photos_test_gegl_buffer_check_zoom (fixture,
0.25,
- "82cfa8a533f8800bd213e47fd52593a8f3b78de2bcd4d9b28084cb7825e50e23");
+ "82cfa8a533f8800bd213e47fd52593a8f3b78de2bcd4d9b28084cb7825e50e23",
+ 50,
+ 50,
+ 0,
+ 0);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]