[gegl] tests: Add test for gegl_object_set/get_has_forked



commit 8b352cf965775598049c0c9aafb0c0f9c42cdd58
Author: Daniel Sabo <DanielSabo gmail com>
Date:   Fri Dec 6 23:27:11 2013 -0800

    tests: Add test for gegl_object_set/get_has_forked

 tests/simple/.gitignore           |    1 +
 tests/simple/Makefile.am          |    1 +
 tests/simple/test-object-forked.c |   72 +++++++++++++++++++++++++++++++++++++
 3 files changed, 74 insertions(+), 0 deletions(-)
---
diff --git a/tests/simple/.gitignore b/tests/simple/.gitignore
index dada946..02bb590 100644
--- a/tests/simple/.gitignore
+++ b/tests/simple/.gitignore
@@ -14,6 +14,7 @@
 /test-image-compare
 /test-misc
 /test-node-properties
+/test-object-forked
 /test-opencl-colors
 /test-path
 /test-proxynop-processing
diff --git a/tests/simple/Makefile.am b/tests/simple/Makefile.am
index b8885ff..dae8755 100644
--- a/tests/simple/Makefile.am
+++ b/tests/simple/Makefile.am
@@ -13,6 +13,7 @@ noinst_PROGRAMS =                     \
        test-image-compare              \
        test-misc                       \
        test-node-properties            \
+       test-object-forked              \
        test-opencl-colors              \
        test-path                       \
        test-proxynop-processing        \
diff --git a/tests/simple/test-object-forked.c b/tests/simple/test-object-forked.c
new file mode 100644
index 0000000..e7bd5e3
--- /dev/null
+++ b/tests/simple/test-object-forked.c
@@ -0,0 +1,72 @@
+/*
+ * 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) 2013 Daniel Sabo
+ */
+
+#include <string.h>
+#include <stdio.h>
+
+#include "gegl.h"
+#include "operation/gegl-operation.h"
+
+#define SUCCESS  0
+#define FAILURE -1
+
+int main(int argc, char *argv[])
+{
+  GeglBuffer *buf_a;
+  GeglBuffer *buf_b;
+  gboolean    result = TRUE;
+
+  gegl_init (&argc, &argv);
+
+  buf_a = gegl_buffer_new (GEGL_RECTANGLE (0, 0, 10, 10), babl_format ("RGB float"));
+  buf_b = gegl_buffer_new (GEGL_RECTANGLE (0, 0, 10, 10), babl_format ("RGB float"));
+
+  if (gegl_object_get_has_forked (G_OBJECT (buf_a)))
+    result = FALSE;
+  if (gegl_object_get_has_forked (G_OBJECT (buf_b)))
+    result = FALSE;
+
+  gegl_object_set_has_forked (G_OBJECT (buf_a));
+
+  if (!gegl_object_get_has_forked (G_OBJECT (buf_a)))
+    result = FALSE;
+  if (gegl_object_get_has_forked (G_OBJECT (buf_b)))
+    result = FALSE;
+
+  gegl_object_set_has_forked (G_OBJECT (buf_a));
+
+  if (!gegl_object_get_has_forked (G_OBJECT (buf_a)))
+    result = FALSE;
+  if (gegl_object_get_has_forked (G_OBJECT (buf_b)))
+    result = FALSE;
+
+  gegl_object_set_has_forked (G_OBJECT (buf_b));
+
+  if (!gegl_object_get_has_forked (G_OBJECT (buf_a)))
+    result = FALSE;
+  if (!gegl_object_get_has_forked (G_OBJECT (buf_b)))
+    result = FALSE;
+
+  g_object_unref (buf_a);
+  g_object_unref (buf_b);
+
+  gegl_exit ();
+
+  if (result)
+    return SUCCESS;
+  return FAILURE;
+}
\ No newline at end of file


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