aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/Makefile_Eo.am10
-rw-r--r--src/lib/eo/eo_base_class.c2
-rw-r--r--src/lib/eo/eo_private.h2
-rw-r--r--src/tests/eo/children/children_main.c72
-rw-r--r--src/tests/eo/children/children_simple.c22
-rw-r--r--src/tests/eo/children/children_simple.h7
6 files changed, 112 insertions, 3 deletions
diff --git a/src/Makefile_Eo.am b/src/Makefile_Eo.am
index 7c2b093b38..cd5e6b6a69 100644
--- a/src/Makefile_Eo.am
+++ b/src/Makefile_Eo.am
@@ -38,8 +38,18 @@ tests/eo/test_function_overrides \
tests/eo/test_interface \
tests/eo/test_mixin \
tests/eo/test_signals \
+tests/eo/test_children \
tests/eo/eo_suite
+tests_eo_test_children_SOURCES = \
+tests/eo/children/children_main.c \
+tests/eo/children/children_simple.c \
+tests/eo/children/children_simple.h
+tests_eo_test_children_CPPFLAGS = -I$(top_builddir)/src/lib/efl @EO_CFLAGS@
+tests_eo_test_children_LDADD = @USE_EO_LIBS@
+tests_eo_test_children_DEPENDENCIES = @USE_EO_INTERNAL_LIBS@
+TESTS += tests/eo/test_children
+
tests_eo_test_access_SOURCES = \
tests/eo/access/access_inherit.c \
tests/eo/access/access_inherit.h \
diff --git a/src/lib/eo/eo_base_class.c b/src/lib/eo/eo_base_class.c
index b1bd8b2673..483e3907f2 100644
--- a/src/lib/eo/eo_base_class.c
+++ b/src/lib/eo/eo_base_class.c
@@ -251,7 +251,7 @@ _children_iterator_new(Eo *obj_id, void *class_data)
if (!it) return NULL;
EINA_MAGIC_SET(&it->iterator, EINA_MAGIC_ITERATOR);
- it->current = obj->children;
+ it->current = pd->children;
it->obj = _eo_ref(obj);
it->obj_id = obj_id;
diff --git a/src/lib/eo/eo_private.h b/src/lib/eo/eo_private.h
index 8648d023b8..6cb12c4e10 100644
--- a/src/lib/eo/eo_private.h
+++ b/src/lib/eo/eo_private.h
@@ -86,8 +86,6 @@ struct _Eo_Base
struct _Eo_Object
{
Eo_Base header;
- Eo *parent;
- Eina_List *children;
const _Eo_Class *klass;
#ifdef EO_DEBUG
Eina_Inlist *xrefs;
diff --git a/src/tests/eo/children/children_main.c b/src/tests/eo/children/children_main.c
new file mode 100644
index 0000000000..0e0832f8ce
--- /dev/null
+++ b/src/tests/eo/children/children_main.c
@@ -0,0 +1,72 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "Eo.h"
+
+#include "../eunit_tests.h"
+#include "children_simple.h"
+
+
+#define CHECK_ITER_DATA(iter, data, expected_data) \
+ fail_if(!eina_iterator_next(iter, &(data))); \
+ fail_if(expected_data != data);
+
+int
+main(int argc, char *argv[])
+{
+ (void) argc;
+ (void) argv;
+ Eina_Iterator *iter = NULL;
+ void *chld;
+
+ eo_init();
+
+ Eo *parent = eo_add(SIMPLE_CLASS, NULL);
+
+ Eo *child1 = eo_add(SIMPLE_CLASS, parent);
+ Eo *child2 = eo_add(SIMPLE_CLASS, parent);
+ Eo *child3 = eo_add(SIMPLE_CLASS, parent);
+
+ eo_do(parent, iter = eo_children_iterator_new());
+ fail_if(!iter);
+
+ CHECK_ITER_DATA(iter, chld, child1);
+ CHECK_ITER_DATA(iter, chld, child2);
+ CHECK_ITER_DATA(iter, chld, child3);
+ fail_if(eina_iterator_next(iter, &chld));
+
+ eina_iterator_free(iter);
+
+ eo_del(child2);
+
+ eo_do(parent, iter = eo_children_iterator_new());
+ fail_if(!iter);
+
+ CHECK_ITER_DATA(iter, chld, child1);
+ CHECK_ITER_DATA(iter, chld, child3);
+ fail_if(eina_iterator_next(iter, &chld));
+
+ eina_iterator_free(iter);
+
+
+ eo_del(child1);
+
+ eo_do(parent, iter = eo_children_iterator_new());
+ fail_if(!iter);
+
+ CHECK_ITER_DATA(iter, chld, child3);
+ fail_if(eina_iterator_next(iter, &chld));
+ eina_iterator_free(iter);
+
+
+ eo_del(child3);
+
+ eo_do(parent, iter = eo_children_iterator_new());
+ fail_if(iter);
+
+ eo_unref(parent);
+
+ eo_shutdown();
+ return 0;
+}
diff --git a/src/tests/eo/children/children_simple.c b/src/tests/eo/children/children_simple.c
new file mode 100644
index 0000000000..cd351d3001
--- /dev/null
+++ b/src/tests/eo/children/children_simple.c
@@ -0,0 +1,22 @@
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include "Eo.h"
+#include "children_simple.h"
+
+#define MY_CLASS SIMPLE_CLASS
+
+static const Eo_Class_Description class_desc = {
+ EO_VERSION,
+ "Simple",
+ EO_CLASS_TYPE_REGULAR,
+ EO_CLASS_DESCRIPTION_NOOPS(),
+ NULL,
+ 0,
+ NULL,
+ NULL
+};
+
+EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL)
+
diff --git a/src/tests/eo/children/children_simple.h b/src/tests/eo/children/children_simple.h
new file mode 100644
index 0000000000..1502e591f1
--- /dev/null
+++ b/src/tests/eo/children/children_simple.h
@@ -0,0 +1,7 @@
+#ifndef SIMPLE_H
+#define SIMPLE_H
+
+#define SIMPLE_CLASS simple_class_get()
+const Eo_Class *simple_class_get(void);
+
+#endif