[gegl] tests: add a test that checks extracting a single component using bablformat
- From: Ãyvind KolÃs <ok src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] tests: add a test that checks extracting a single component using bablformat
- Date: Tue, 10 Apr 2012 22:14:49 +0000 (UTC)
commit 5abfa23d172de89698d7bf5ba1d6820e85f6abcc
Author: Ãyvind KolÃs <pippin gimp org>
Date: Wed Apr 11 00:14:12 2012 +0200
tests: add a test that checks extracting a single component using bablformat
tests/simple/Makefile.am | 1 +
tests/simple/test-buffer-extract.c | 65 ++++++++++++++++++++++++++++++++++++
2 files changed, 66 insertions(+), 0 deletions(-)
---
diff --git a/tests/simple/Makefile.am b/tests/simple/Makefile.am
index f35a51a..4046e66 100644
--- a/tests/simple/Makefile.am
+++ b/tests/simple/Makefile.am
@@ -12,6 +12,7 @@ noinst_PROGRAMS = \
test-gegl-rectangle \
test-misc \
test-path \
+ test-buffer-extract \
test-proxynop-processing
EXTRA_DIST = test-exp-combine.sh
diff --git a/tests/simple/test-buffer-extract.c b/tests/simple/test-buffer-extract.c
new file mode 100644
index 0000000..b8fd0c7
--- /dev/null
+++ b/tests/simple/test-buffer-extract.c
@@ -0,0 +1,65 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *
+ * Copyright (C) 2010 Martin Nordholts
+ */
+
+#include "config.h"
+
+#include "gegl.h"
+#include "gegl-plugin.h"
+
+#define SUCCESS 0
+#define FAILURE -1
+
+static int
+test_buffer_extract (void)
+{
+ gint result = SUCCESS;
+ GeglBuffer *buffer = gegl_buffer_new (GEGL_RECTANGLE (0,0,1,1),
+ babl_format ("R'G'B'A u8"));
+ guchar srcpix[4] = {1,2,3,4};
+ guchar dstpix[4] = {0};
+
+ gegl_buffer_set (buffer, NULL, 0, NULL, srcpix, GEGL_AUTO_ROWSTRIDE);
+ gegl_buffer_get (buffer, NULL, 1.0,
+ babl_format_new ("name", "B' u8",
+ babl_model ("R'G'B'A"),
+ babl_type ("u8"),
+ babl_component ("B'"),
+ NULL),
+ dstpix, GEGL_AUTO_ROWSTRIDE, GEGL_ABYSS_NONE);
+
+ g_object_unref (buffer);
+
+ if (dstpix[0] != 3)
+ result = FAILURE;
+
+ return result;
+}
+
+
+int main(int argc, char *argv[])
+{
+ gint result = SUCCESS;
+
+ gegl_init (&argc, &argv);
+
+ if (result == SUCCESS)
+ result = test_buffer_extract ();
+
+ gegl_exit ();
+
+ return result;
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]