felipealmeida pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=88cce73f90a9920e0dafe34f7b99dbd215c1d4ab

commit 88cce73f90a9920e0dafe34f7b99dbd215c1d4ab
Author: Felipe Magno de Almeida <fel...@expertisesolutions.com.br>
Date:   Mon Jan 11 16:10:55 2016 -0200

    eina-cxx: Remove Eo classes defined manually
    
    Use Eolian to generate the Eo classes for the tests. This should fix T2940.
    
    @fix
---
 src/Makefile_Eina_Cxx.am                     | 25 +++++++--
 src/tests/eina_cxx/eina_cxx_test_accessor.cc | 22 ++++----
 src/tests/eina_cxx/eina_cxx_test_ptrarray.cc | 54 +++++++++----------
 src/tests/eina_cxx/eina_cxx_test_ptrlist.cc  | 77 +++++++++-------------------
 src/tests/eina_cxx/simple.c                  | 21 ++++++++
 src/tests/eina_cxx/simple.eo                 |  8 +++
 6 files changed, 113 insertions(+), 94 deletions(-)

diff --git a/src/Makefile_Eina_Cxx.am b/src/Makefile_Eina_Cxx.am
index e9f7c13..166429a 100644
--- a/src/Makefile_Eina_Cxx.am
+++ b/src/Makefile_Eina_Cxx.am
@@ -59,13 +59,33 @@ tests/eina_cxx/eina_cxx_test_error.cc \
 tests/eina_cxx/eina_cxx_test_accessor.cc \
 tests/eina_cxx/eina_cxx_test_thread.cc \
 tests/eina_cxx/eina_cxx_test_optional.cc \
-tests/eina_cxx/eina_cxx_test_value.cc
+tests/eina_cxx/eina_cxx_test_value.cc \
+tests/eina_cxx/simple.c
 
-tests_eina_cxx_eina_cxx_suite_CXXFLAGS = -I$(top_builddir)/src/lib/efl \
+tests/eina_cxx/tests_eina_cxx_eina_cxx_suite-eina_cxx_test_accessor.$(OBJEXT): 
tests/eina_cxx/simple.eo.hh tests/eina_cxx/simple.eo.h
+tests/eina_cxx/tests_eina_cxx_eina_cxx_suite-eina_cxx_test_ptrarray.$(OBJEXT): 
tests/eina_cxx/simple.eo.hh tests/eina_cxx/simple.eo.h
+tests/eina_cxx/tests_eina_cxx_eina_cxx_suite-eina_cxx_test_ptrlist.$(OBJEXT): 
tests/eina_cxx/simple.eo.hh tests/eina_cxx/simple.eo.h
+
+tests/eina_cxx/tests_eina_cxx_eina_cxx_suite-simple.$(OBJEXT): 
tests/eina_cxx/simple.eo.c tests/eina_cxx/simple.eo.h
+
+CLEANFILES += \
+tests/eina_cxx/simple.eo.c \
+tests/eina_cxx/simple.eo.h \
+tests/eina_cxx/simple.eo.hh \
+tests/eina_cxx/simple.eo.impl.hh
+
+EXTRA_DIST += \
+tests/eina_cxx/simple.eo
+
+tests_eina_cxx_eina_cxx_suite_CPPFLAGS = -I$(top_builddir)/src/lib/efl \
 -DTESTS_WD=\"`pwd`\" \
 -DTESTS_SRC_DIR=\"$(top_srcdir)/src/tests/eina_cxx\" \
 -DPACKAGE_BUILD_DIR=\"$(abs_top_builddir)/src/tests/eina_cxx\" \
 -DTESTS_BUILD_DIR=\"$(top_builddir)/src/tests/eina_cxx\" \
+-I$(top_builddir)/src/lib/efl \
+-I$(top_builddir)/src/lib/efl/interfaces \
+-I$(top_srcdir)/src/bin/eina_cxx \
+-I$(top_builddir)/src/tests/eina_cxx \
 @CHECK_CFLAGS@ \
 @EO_CFLAGS@ \
 @ECORE_CFLAGS@ \
@@ -76,4 +96,3 @@ tests_eina_cxx_eina_cxx_suite_DEPENDENCIES = 
@USE_EINA_INTERNAL_LIBS@ @USE_EO_IN
 
 endif
 endif
-
diff --git a/src/tests/eina_cxx/eina_cxx_test_accessor.cc 
b/src/tests/eina_cxx/eina_cxx_test_accessor.cc
index 39b85f0..af49fb9 100644
--- a/src/tests/eina_cxx/eina_cxx_test_accessor.cc
+++ b/src/tests/eina_cxx/eina_cxx_test_accessor.cc
@@ -10,9 +10,9 @@
 
 #include <check.h>
 
-
-const Eo_Class *simple_class_get(void);
-#define MY_CLASS simple_class_get()
+extern "C" {
+#include "simple.eo.h"
+}
 
 struct wrapper : efl::eo::concrete
 {
@@ -46,10 +46,10 @@ START_TEST(eina_cxx_eo_accessor_indexing)
 
   efl::eina::list<wrapper> list;
 
-  wrapper const w1(eo_add(MY_CLASS, NULL));
-  wrapper const w2(eo_add(MY_CLASS, NULL));
-  wrapper const w3(eo_add(MY_CLASS, NULL));
-  wrapper const w4(eo_add(MY_CLASS, NULL));
+  wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
 
   list.push_back(w1);
   list.push_back(w2);
@@ -100,10 +100,10 @@ START_TEST(eina_cxx_eo_accessor_iterator)
 
   efl::eina::list<wrapper> list;
 
-  wrapper const w1(eo_add(MY_CLASS, NULL));
-  wrapper const w2(eo_add(MY_CLASS, NULL));
-  wrapper const w3(eo_add(MY_CLASS, NULL));
-  wrapper const w4(eo_add(MY_CLASS, NULL));
+  wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
 
   list.push_back(w1);
   list.push_back(w2);
diff --git a/src/tests/eina_cxx/eina_cxx_test_ptrarray.cc 
b/src/tests/eina_cxx/eina_cxx_test_ptrarray.cc
index 67d4722..2bf8bb5 100644
--- a/src/tests/eina_cxx/eina_cxx_test_ptrarray.cc
+++ b/src/tests/eina_cxx/eina_cxx_test_ptrarray.cc
@@ -11,9 +11,9 @@
 #include <algorithm>
 
 #include <check.h>
-
-const Eo_Class *simple_class_get(void);
-#define MY_CLASS simple_class_get()
+extern "C" {
+#include "simple.eo.h"
+}
 
 struct wrapper : efl::eo::concrete
 {
@@ -29,9 +29,9 @@ START_TEST(eina_cxx_ptrarray_push_back)
   int result[] = {5, 10, 15};
   int rresult[] = {15, 10, 5};
 
-  wrapper const w1(eo_add(MY_CLASS, NULL));
-  wrapper const w2(eo_add(MY_CLASS, NULL));
-  wrapper const w3(eo_add(MY_CLASS, NULL));
+  wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
   
   {
     efl::eina::ptr_array<int> array;
@@ -105,9 +105,9 @@ START_TEST(eina_cxx_ptrarray_pop_back)
     ck_assert(std::equal(array.rbegin(), array.rend(), rresult));
   }
   {
-    wrapper const w1(eo_add(MY_CLASS, NULL));
-    wrapper const w2(eo_add(MY_CLASS, NULL));
-    wrapper const w3(eo_add(MY_CLASS, NULL));
+    wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
 
     efl::eina::array<wrapper> array;
 
@@ -200,11 +200,11 @@ START_TEST(eina_cxx_ptrarray_insert)
     ck_assert(std::equal(array.begin(), array.end(), array4.begin()));
   }
   {
-    wrapper const w0(eo_add(MY_CLASS, NULL));
-    wrapper const w1(eo_add(MY_CLASS, NULL));
-    wrapper const w2(eo_add(MY_CLASS, NULL));
-    wrapper const w3(eo_add(MY_CLASS, NULL));
-    wrapper const w4(eo_add(MY_CLASS, NULL));
+    wrapper const w0(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
 
     efl::eina::array<wrapper> array;
     ck_assert(std::distance(array.begin(), array.end()) == 0u);
@@ -280,7 +280,7 @@ START_TEST(eina_cxx_ptrarray_constructors)
   efl::eina::eina_init eina_init;
   efl::eo::eo_init eo_init;
 
-  wrapper const w1(eo_add(MY_CLASS, NULL));
+  wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
 
   {
     efl::eina::ptr_array<int> array1;
@@ -359,12 +359,12 @@ START_TEST(eina_cxx_ptrarray_erase)
     ck_assert(array1.back() == 25);
   }
   {
-    wrapper const w1(eo_add(MY_CLASS, NULL));
-    wrapper const w2(eo_add(MY_CLASS, NULL));
-    wrapper const w3(eo_add(MY_CLASS, NULL));
-    wrapper const w4(eo_add(MY_CLASS, NULL));
-    wrapper const w5(eo_add(MY_CLASS, NULL));
-    wrapper const w6(eo_add(MY_CLASS, NULL));
+    wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w5(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w6(eo_add(SIMPLE_CLASS, NULL));
     
     efl::eina::array<wrapper> array1;
     
@@ -440,12 +440,12 @@ START_TEST(eina_cxx_ptrarray_range)
   }
 
   {
-    wrapper const w1(eo_add(MY_CLASS, NULL));
-    wrapper const w2(eo_add(MY_CLASS, NULL));
-    wrapper const w3(eo_add(MY_CLASS, NULL));
-    wrapper const w4(eo_add(MY_CLASS, NULL));
-    wrapper const w5(eo_add(MY_CLASS, NULL));
-    wrapper const w6(eo_add(MY_CLASS, NULL));
+    wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w5(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w6(eo_add(SIMPLE_CLASS, NULL));
 
     efl::eina::array<wrapper> array;
     array.push_back(w1);
diff --git a/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc 
b/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc
index 35f2cef..281740d 100644
--- a/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc
+++ b/src/tests/eina_cxx/eina_cxx_test_ptrlist.cc
@@ -13,39 +13,10 @@
 
 #include <check.h>
 
-const Eo_Class *simple_class_get(void);
-#define MY_CLASS simple_class_get()
-
-static Eo *
-_constructor(Eo *obj, void *class_data EINA_UNUSED)
-{
-   return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
-}
-
-static void
-_destructor(Eo *obj, void *class_data EINA_UNUSED)
-{
-   eo_do_super(obj, MY_CLASS, eo_destructor());
+extern "C" {
+#include "simple.eo.h"
 }
 
-static Eo_Op_Description op_descs[] = {
-    EO_OP_FUNC_OVERRIDE(reinterpret_cast<void*>(&eo_constructor), 
reinterpret_cast<void*>(&_constructor))
-  , EO_OP_FUNC_OVERRIDE(reinterpret_cast<void*>(&eo_destructor), 
reinterpret_cast<void*>(&_destructor))
-};
-
-static const Eo_Class_Description class_desc = {
-     EO_VERSION,
-     "Simple",
-     EO_CLASS_TYPE_REGULAR,
-     EO_CLASS_DESCRIPTION_OPS(op_descs),
-     NULL,
-     0,
-     0,
-     0
-};
-
-EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL);
-
 struct wrapper : efl::eo::concrete
 {
   explicit wrapper(Eo* o)
@@ -60,9 +31,9 @@ START_TEST(eina_cxx_ptrlist_push_back)
   int result[] = {5, 10, 15};
   int rresult[] = {15, 10, 5};
 
-  wrapper const w1(eo_add(MY_CLASS, NULL));
-  wrapper const w2(eo_add(MY_CLASS, NULL));
-  wrapper const w3(eo_add(MY_CLASS, NULL));
+  wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
   
   {
     efl::eina::ptr_list<int> list;
@@ -109,9 +80,9 @@ START_TEST(eina_cxx_ptrlist_pop_back)
   int result[] = {5, 10};
   int rresult[] = {10, 5};
 
-  wrapper const w1(eo_add(MY_CLASS, NULL));
-  wrapper const w2(eo_add(MY_CLASS, NULL));
-  wrapper const w3(eo_add(MY_CLASS, NULL));
+  wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
 
   {
     efl::eina::ptr_list<int> list;
@@ -175,9 +146,9 @@ START_TEST(eina_cxx_ptrlist_push_front)
     ck_assert(std::equal(list.rbegin(), list.rend(), rresult));
   }
   {
-    wrapper const w1(eo_add(MY_CLASS, NULL));
-    wrapper const w2(eo_add(MY_CLASS, NULL));
-    wrapper const w3(eo_add(MY_CLASS, NULL));
+    wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
 
     efl::eina::list<wrapper> list;
 
@@ -203,9 +174,9 @@ START_TEST(eina_cxx_ptrlist_pop_front)
   int result[] = {10, 5};
   int rresult[] = {5, 10};
 
-  wrapper const w1(eo_add(MY_CLASS, NULL));
-  wrapper const w2(eo_add(MY_CLASS, NULL));
-  wrapper const w3(eo_add(MY_CLASS, NULL));
+  wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+  wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
 
   {
     efl::eina::ptr_list<int> list;
@@ -305,11 +276,11 @@ START_TEST(eina_cxx_ptrlist_insert)
     ck_assert(std::equal(list.begin(), list.end(), list4.begin()));
   }
   {
-    wrapper const w0(eo_add(MY_CLASS, NULL));
-    wrapper const w1(eo_add(MY_CLASS, NULL));
-    wrapper const w2(eo_add(MY_CLASS, NULL));
-    wrapper const w3(eo_add(MY_CLASS, NULL));
-    wrapper const w4(eo_add(MY_CLASS, NULL));
+    wrapper const w0(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
 
     efl::eina::list<wrapper> list;
 
@@ -398,11 +369,11 @@ START_TEST(eina_cxx_ptrlist_constructors)
     ck_assert(list2 == list4);
   }
   {
-    wrapper const w0(eo_add(MY_CLASS, NULL));
-    wrapper const w1(eo_add(MY_CLASS, NULL));
-    wrapper const w2(eo_add(MY_CLASS, NULL));
-    wrapper const w3(eo_add(MY_CLASS, NULL));
-    wrapper const w4(eo_add(MY_CLASS, NULL));
+    wrapper const w0(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w1(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w2(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w3(eo_add(SIMPLE_CLASS, NULL));
+    wrapper const w4(eo_add(SIMPLE_CLASS, NULL));
 
     efl::eina::list<wrapper> list1;
     ck_assert(list1.empty());
diff --git a/src/tests/eina_cxx/simple.c b/src/tests/eina_cxx/simple.c
new file mode 100644
index 0000000..8a742e1
--- /dev/null
+++ b/src/tests/eina_cxx/simple.c
@@ -0,0 +1,21 @@
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <Eo.h>
+#include <Ecore.h>
+
+#include <stdlib.h>
+
+#include "simple.eo.h"
+
+#define MY_CLASS SIMPLE_CLASS
+
+static Eo *_simple_eo_base_constructor(Eo *obj, void *pd EINA_UNUSED)
+{
+   return eo_do_super_ret(obj, MY_CLASS, obj, eo_constructor());
+}
+
+#include "simple.eo.c"
+
diff --git a/src/tests/eina_cxx/simple.eo b/src/tests/eina_cxx/simple.eo
new file mode 100644
index 0000000..15aebec
--- /dev/null
+++ b/src/tests/eina_cxx/simple.eo
@@ -0,0 +1,8 @@
+class Simple (Eo.Base)
+{
+   legacy_prefix: null;
+   data: null;
+   implements {
+      Eo.Base.constructor;
+   }
+}

-- 


Reply via email to