[gegl/abyss] tests: added tests for gegl_buffer_get with different abyss policies



commit d3b969a701ba6ccb2da1f5150cd9ba833035e5f4
Author: Ville Sokk <ville sokk gmail com>
Date:   Fri Jun 29 11:44:43 2012 +0300

    tests: added tests for gegl_buffer_get with different abyss policies

 tests/buffer/reference/get_abyss_black.buf |   23 +++++++++++++++++++++++
 tests/buffer/reference/get_abyss_clamp.buf |   23 +++++++++++++++++++++++
 tests/buffer/reference/get_abyss_loop.buf  |   23 +++++++++++++++++++++++
 tests/buffer/reference/get_abyss_none.buf  |   23 +++++++++++++++++++++++
 tests/buffer/reference/get_abyss_white.buf |   23 +++++++++++++++++++++++
 tests/buffer/tests/get_abyss_black.c       |   22 ++++++++++++++++++++++
 tests/buffer/tests/get_abyss_clamp.c       |   22 ++++++++++++++++++++++
 tests/buffer/tests/get_abyss_loop.c        |   26 ++++++++++++++++++++++++++
 tests/buffer/tests/get_abyss_none.c        |   22 ++++++++++++++++++++++
 tests/buffer/tests/get_abyss_white.c       |   22 ++++++++++++++++++++++
 10 files changed, 229 insertions(+), 0 deletions(-)
---
diff --git a/tests/buffer/reference/get_abyss_black.buf b/tests/buffer/reference/get_abyss_black.buf
new file mode 100644
index 0000000..5f3ad1e
--- /dev/null
+++ b/tests/buffer/reference/get_abyss_black.buf
@@ -0,0 +1,23 @@
+Test: get_abyss_black
+ââââââââââââââââââââââ
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+ââââââââââââââââââââââ
diff --git a/tests/buffer/reference/get_abyss_clamp.buf b/tests/buffer/reference/get_abyss_clamp.buf
new file mode 100644
index 0000000..5d6a7dc
--- /dev/null
+++ b/tests/buffer/reference/get_abyss_clamp.buf
@@ -0,0 +1,23 @@
+Test: get_abyss_clamp
+ââââââââââââââââââââââ
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
diff --git a/tests/buffer/reference/get_abyss_loop.buf b/tests/buffer/reference/get_abyss_loop.buf
new file mode 100644
index 0000000..ddc8ff4
--- /dev/null
+++ b/tests/buffer/reference/get_abyss_loop.buf
@@ -0,0 +1,23 @@
+Test: get_abyss_loop
+ââââââââââââââââââââââ
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+â     âââ       âââ  â
+â     âââ       âââ  â
+â     âââ       âââ  â
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+â     âââ       âââ  â
+â     âââ       âââ  â
+â     âââ       âââ  â
+ââââââ   âââââââ   âââ
+ââââââ   âââââââ   âââ
+ââââââââââââââââââââââ
diff --git a/tests/buffer/reference/get_abyss_none.buf b/tests/buffer/reference/get_abyss_none.buf
new file mode 100644
index 0000000..c4b62f8
--- /dev/null
+++ b/tests/buffer/reference/get_abyss_none.buf
@@ -0,0 +1,23 @@
+Test: get_abyss_none
+ââââââââââââââââââââââ
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â     ââââââââââ     â
+â                    â
+â                    â
+â                    â
+â                    â
+â                    â
+ââââââââââââââââââââââ
diff --git a/tests/buffer/reference/get_abyss_white.buf b/tests/buffer/reference/get_abyss_white.buf
new file mode 100644
index 0000000..21ca3ea
--- /dev/null
+++ b/tests/buffer/reference/get_abyss_white.buf
@@ -0,0 +1,23 @@
+Test: get_abyss_white
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââ          ââââââ
+ââââââ          ââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
+ââââââââââââââââââââââ
diff --git a/tests/buffer/tests/get_abyss_black.c b/tests/buffer/tests/get_abyss_black.c
new file mode 100644
index 0000000..d633a03
--- /dev/null
+++ b/tests/buffer/tests/get_abyss_black.c
@@ -0,0 +1,22 @@
+TEST ()
+{
+  GeglBuffer    *buffer, *buffer2;
+  GeglRectangle  bound = {0, 0, 10, 10};
+  GeglRectangle  bound2 = {0, 0, 20, 20};
+  GeglRectangle  source = {-5, -5, 20, 20};
+  GeglRectangle  dest = {0, 0, 20, 20};
+  const Babl    *format = babl_format ("Y float");
+  gfloat         buf[20 * 20 * sizeof(gfloat)];
+
+  test_start ();
+  buffer = gegl_buffer_new (&bound, format);
+  buffer2 = gegl_buffer_new (&bound2, format);
+
+  vgrad (buffer);
+  gegl_buffer_get (buffer, &source, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_BLACK);
+  gegl_buffer_set (buffer2, &dest, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
+  print_buffer (buffer2);
+  g_object_unref (buffer);
+  g_object_unref (buffer2);
+  test_end ();
+}
diff --git a/tests/buffer/tests/get_abyss_clamp.c b/tests/buffer/tests/get_abyss_clamp.c
new file mode 100644
index 0000000..604bd8b
--- /dev/null
+++ b/tests/buffer/tests/get_abyss_clamp.c
@@ -0,0 +1,22 @@
+TEST ()
+{
+  GeglBuffer    *buffer, *buffer2;
+  GeglRectangle  bound = {0, 0, 10, 10};
+  GeglRectangle  bound2 = {0, 0, 20, 20};
+  GeglRectangle  source = {-5, -5, 20, 20};
+  GeglRectangle  dest = {0, 0, 20, 20};
+  const Babl    *format = babl_format ("Y float");
+  gfloat         buf[20 * 20 * sizeof(gfloat)];
+
+  test_start ();
+  buffer = gegl_buffer_new (&bound, format);
+  buffer2 = gegl_buffer_new (&bound2, format);
+
+  vgrad (buffer);
+  gegl_buffer_get (buffer, &source, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_CLAMP);
+  gegl_buffer_set (buffer2, &dest, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
+  print_buffer (buffer2);
+  g_object_unref (buffer);
+  g_object_unref (buffer2);
+  test_end ();
+}
diff --git a/tests/buffer/tests/get_abyss_loop.c b/tests/buffer/tests/get_abyss_loop.c
new file mode 100644
index 0000000..b691a5d
--- /dev/null
+++ b/tests/buffer/tests/get_abyss_loop.c
@@ -0,0 +1,26 @@
+TEST ()
+{
+  GeglBuffer    *buffer, *buffer2;
+  GeglRectangle  bound = {0, 0, 10, 10};
+  GeglRectangle  bound2 = {0, 0, 20, 20};
+  GeglRectangle  source = {-5, -5, 20, 20};
+  GeglRectangle  dest = {0, 0, 20, 20};
+  GeglRectangle  fill1 = {0, 0, 3, 3};
+  GeglRectangle  fill2 = {3, 3, 7, 7};
+  const Babl    *format = babl_format ("Y float");
+  gfloat         buf[20 * 20 * sizeof(gfloat)];
+
+  test_start ();
+  buffer = gegl_buffer_new (&bound, format);
+  buffer2 = gegl_buffer_new (&bound2, format);
+
+  fill_rect (buffer, &fill1, 0.2);
+  fill_rect (buffer, &fill2, 0.5);
+
+  gegl_buffer_get (buffer, &source, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_LOOP);
+  gegl_buffer_set (buffer2, &dest, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
+  print_buffer (buffer2);
+  g_object_unref (buffer);
+  g_object_unref (buffer2);
+  test_end ();
+}
diff --git a/tests/buffer/tests/get_abyss_none.c b/tests/buffer/tests/get_abyss_none.c
new file mode 100644
index 0000000..0d32b21
--- /dev/null
+++ b/tests/buffer/tests/get_abyss_none.c
@@ -0,0 +1,22 @@
+TEST ()
+{
+  GeglBuffer    *buffer, *buffer2;
+  GeglRectangle  bound = {0, 0, 10, 10};
+  GeglRectangle  bound2 = {0, 0, 20, 20};
+  GeglRectangle  source = {-5, -5, 20, 20};
+  GeglRectangle  dest = {0, 0, 20, 20};
+  const Babl    *format = babl_format ("Y float");
+  gfloat         buf[20 * 20 * sizeof(gfloat)];
+
+  test_start ();
+  buffer = gegl_buffer_new (&bound, format);
+  buffer2 = gegl_buffer_new (&bound2, format);
+
+  vgrad (buffer);
+  gegl_buffer_get (buffer, &source, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+  gegl_buffer_set (buffer2, &dest, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
+  print_buffer (buffer2);
+  g_object_unref (buffer);
+  g_object_unref (buffer2);
+  test_end ();
+}
diff --git a/tests/buffer/tests/get_abyss_white.c b/tests/buffer/tests/get_abyss_white.c
new file mode 100644
index 0000000..3ff2518
--- /dev/null
+++ b/tests/buffer/tests/get_abyss_white.c
@@ -0,0 +1,22 @@
+TEST ()
+{
+  GeglBuffer    *buffer, *buffer2;
+  GeglRectangle  bound = {0, 0, 10, 10};
+  GeglRectangle  bound2 = {0, 0, 20, 20};
+  GeglRectangle  source = {-5, -5, 20, 20};
+  GeglRectangle  dest = {0, 0, 20, 20};
+  const Babl    *format = babl_format ("Y float");
+  gfloat         buf[20 * 20 * sizeof(gfloat)];
+
+  test_start ();
+  buffer = gegl_buffer_new (&bound, format);
+  buffer2 = gegl_buffer_new (&bound2, format);
+
+  vgrad (buffer);
+  gegl_buffer_get (buffer, &source, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_WHITE);
+  gegl_buffer_set (buffer2, &dest, 1.0, format, buf, GEGL_AUTO_ROWSTRIDE);
+  print_buffer (buffer2);
+  g_object_unref (buffer);
+  g_object_unref (buffer2);
+  test_end ();
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]