summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauro Moura <lauromoura@expertisesolutions.com.br>2019-05-22 17:21:02 -0300
committerVitor Sousa <vitorsousa@expertisesolutions.com.br>2019-05-22 17:32:46 -0300
commit708f67c4889fe7c08cb0860e3f19ca2fa54f7fa0 (patch)
tree1fec13986b610ceeeb5b32f65c0c4f870c5ad74a
parent12cab54b9c92baf66c06ea69aa5fa0167d82c2c9 (diff)
csharp: Split test files
Summary: Make it easier to add new tests Reviewers: vitor.sousa Reviewed By: vitor.sousa Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D8937
-rw-r--r--src/tests/efl_mono/dummy_child.c86
-rw-r--r--src/tests/efl_mono/dummy_inherit_helper.c8
-rw-r--r--src/tests/efl_mono/dummy_interfaces.c5
-rw-r--r--src/tests/efl_mono/dummy_numberwrapper.c18
-rw-r--r--src/tests/efl_mono/dummy_part_holder.c35
-rw-r--r--src/tests/efl_mono/dummy_test_object.c (renamed from src/tests/efl_mono/libefl_mono_native_test.c)210
-rw-r--r--src/tests/efl_mono/libefl_mono_native_test.h63
-rw-r--r--src/tests/efl_mono/meson.build10
8 files changed, 225 insertions, 210 deletions
diff --git a/src/tests/efl_mono/dummy_child.c b/src/tests/efl_mono/dummy_child.c
new file mode 100644
index 0000000000..f9a2994c9b
--- /dev/null
+++ b/src/tests/efl_mono/dummy_child.c
@@ -0,0 +1,86 @@
1#include "libefl_mono_native_test.h"
2
3typedef struct Dummy_Child_Data
4{
5 int iface_prop;
6 const char* a;
7 double b;
8 Eina_Bool iface_was_set;
9 Eina_Bool obligatory_beta_ctor_was_called;
10 Eina_Bool optional_beta_ctor_was_called;
11} Dummy_Child_Data;
12
13/// Dummy.Child
14
15static Efl_Object *
16_dummy_child_efl_object_constructor(Eo *obj, Dummy_Child_Data *pd)
17{
18 efl_constructor(efl_super(obj, DUMMY_CHILD_CLASS));
19
20 pd->iface_prop = 1984;
21 pd->iface_was_set = EINA_FALSE;
22 pd->obligatory_beta_ctor_was_called = EINA_FALSE;
23 pd->optional_beta_ctor_was_called = EINA_FALSE;
24 return obj;
25}
26
27void _dummy_child_dummy_test_iface_iface_prop_set(EINA_UNUSED Eo *obj, Dummy_Child_Data *pd, int value)
28{
29 pd->iface_prop = value;
30 pd->iface_was_set = EINA_TRUE;
31}
32
33int _dummy_child_dummy_test_iface_iface_prop_get(EINA_UNUSED const Eo *obj, Dummy_Child_Data *pd)
34{
35 return pd->iface_prop;
36}
37
38void _dummy_child_double_params(EINA_UNUSED Eo* obj, Dummy_Child_Data *pd, const char* a, double b)
39{
40 if (pd->a)
41 free((void*)pd->a);
42 pd->a = malloc(sizeof(char)*(strlen(a) + 1));
43 strcpy((char*)pd->a, a);
44
45 pd->b = b;
46}
47
48Eina_Bool _dummy_child_iface_was_set_get(EINA_UNUSED const Eo* obj, Dummy_Child_Data *pd)
49{
50 return pd->iface_was_set;
51}
52
53void _dummy_child_obligatory_beta_ctor(EINA_UNUSED Eo* obj, Dummy_Child_Data *pd, EINA_UNUSED int a)
54{
55 pd->obligatory_beta_ctor_was_called = EINA_TRUE;
56}
57
58void _dummy_child_optional_beta_ctor(EINA_UNUSED Eo* obj, Dummy_Child_Data *pd, EINA_UNUSED int a)
59{
60 pd->optional_beta_ctor_was_called = EINA_TRUE;
61}
62
63Eina_Bool _dummy_child_obligatory_beta_ctor_was_called_get(EINA_UNUSED const Eo* obj, Dummy_Child_Data *pd)
64{
65 return pd->obligatory_beta_ctor_was_called;
66}
67
68Eina_Bool _dummy_child_optional_beta_ctor_was_called_get(EINA_UNUSED const Eo* obj, Dummy_Child_Data *pd)
69{
70 return pd->optional_beta_ctor_was_called;
71}
72
73EOLIAN static void
74_dummy_child_class_constructor(Efl_Class *klass)
75{
76 (void)klass;
77}
78
79EOLIAN static void
80_dummy_child_class_destructor(Efl_Class *klass)
81{
82 (void)klass;
83}
84
85#include "dummy_child.eo.c"
86
diff --git a/src/tests/efl_mono/dummy_inherit_helper.c b/src/tests/efl_mono/dummy_inherit_helper.c
new file mode 100644
index 0000000000..8aca188db0
--- /dev/null
+++ b/src/tests/efl_mono/dummy_inherit_helper.c
@@ -0,0 +1,8 @@
1#include "libefl_mono_native_test.h"
2
3typedef struct Dummy_Inherit_Helper_Data
4{
5} Dummy_Inherit_Helper_Data;
6
7
8#include "dummy_inherit_helper.eo.c"
diff --git a/src/tests/efl_mono/dummy_interfaces.c b/src/tests/efl_mono/dummy_interfaces.c
new file mode 100644
index 0000000000..f4b3ca5948
--- /dev/null
+++ b/src/tests/efl_mono/dummy_interfaces.c
@@ -0,0 +1,5 @@
1// Include file for interfaces .eo.c files
2#include "libefl_mono_native_test.h"
3
4#include "dummy_test_iface.eo.c"
5#include "dummy_inherit_iface.eo.c"
diff --git a/src/tests/efl_mono/dummy_numberwrapper.c b/src/tests/efl_mono/dummy_numberwrapper.c
new file mode 100644
index 0000000000..58945e9909
--- /dev/null
+++ b/src/tests/efl_mono/dummy_numberwrapper.c
@@ -0,0 +1,18 @@
1#include "libefl_mono_native_test.h"
2
3typedef struct Dummy_Numberwrapper_Data
4{
5 int number;
6} Dummy_Numberwrapper_Data;
7
8void _dummy_numberwrapper_number_set(EINA_UNUSED Eo *obj, Dummy_Numberwrapper_Data *pd, int n)
9{
10 pd->number = n;
11}
12
13int _dummy_numberwrapper_number_get(EINA_UNUSED const Eo *obj, Dummy_Numberwrapper_Data *pd)
14{
15 return pd->number;
16}
17
18#include "dummy_numberwrapper.eo.c"
diff --git a/src/tests/efl_mono/dummy_part_holder.c b/src/tests/efl_mono/dummy_part_holder.c
new file mode 100644
index 0000000000..b595ac1f8d
--- /dev/null
+++ b/src/tests/efl_mono/dummy_part_holder.c
@@ -0,0 +1,35 @@
1#include "libefl_mono_native_test.h"
2
3typedef struct Dummy_Part_Holder_Data
4{
5 Eo *one;
6 Eo *two;
7} Dummy_Part_Holder_Data;
8
9// Part holder
10static Efl_Object*
11_dummy_part_holder_efl_object_constructor(Eo *obj, Dummy_Part_Holder_Data *pd)
12{
13 efl_constructor(efl_super(obj, DUMMY_PART_HOLDER_CLASS));
14
15 // To avoid an infinite loop calling the same constructor
16 if (!efl_parent_get(obj))
17 {
18 pd->one = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_one"));
19 pd->two = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_two"));
20 }
21
22 return obj;
23}
24
25Efl_Object *_dummy_part_holder_efl_part_part_get(EINA_UNUSED const Eo *obj, Dummy_Part_Holder_Data *pd, const char *name)
26{
27 if (!strcmp(name, "one"))
28 return pd->one;
29 else if (!strcmp(name, "two"))
30 return pd->two;
31 else
32 return NULL;
33}
34
35#include "dummy_part_holder.eo.c"
diff --git a/src/tests/efl_mono/libefl_mono_native_test.c b/src/tests/efl_mono/dummy_test_object.c
index c5850d6ab2..fa5d01888a 100644
--- a/src/tests/efl_mono/libefl_mono_native_test.c
+++ b/src/tests/efl_mono/dummy_test_object.c
@@ -1,62 +1,5 @@
1 1
2#ifdef HAVE_CONFIG_H 2#include "libefl_mono_native_test.h"
3#include "config.h"
4#endif
5
6#define EFL_PART_PROTECTED
7
8#include <Ecore.h>
9#include <Eo.h>
10
11#ifdef EOAPI
12#undef EOAPI
13#endif
14
15#ifdef EWAPI
16#undef EWAPI
17#endif
18
19#ifdef EAPI
20#undef EAPI
21#endif
22
23#define EOAPI EAPI EAPI_WEAK
24#define EWAPI EAPI EAPI_WEAK
25
26#ifdef _WIN32
27# ifdef EFL_BUILD
28# ifdef DLL_EXPORT
29# define EAPI __declspec(dllexport)
30# else
31# define EAPI
32# endif
33# else
34# define EAPI __declspec(dllimport)
35# endif
36#else
37# ifdef __GNUC__
38# if __GNUC__ >= 4
39# define EAPI __attribute__ ((visibility("default")))
40# else
41# define EAPI
42# endif
43# else
44# define EAPI
45# endif
46#endif
47
48#include "dummy_test_iface.eo.h"
49#include "dummy_inherit_iface.eo.h"
50#include "dummy_numberwrapper.eo.h"
51#include "dummy_test_object.eo.h"
52#include "dummy_child.eo.h"
53#include "dummy_inherit_helper.eo.h"
54#include "dummy_part_holder.eo.h"
55
56#include <interfaces/efl_part.eo.h>
57
58#define EQUAL(a, b) ((a) == (b) ? 1 : (fprintf(stderr, "NOT EQUAL! %s:%i (%s)", __FILE__, __LINE__, __FUNCTION__), fflush(stderr), 0))
59#define STR_EQUAL(a, b) (strcmp((a), (b)) == 0 ? 1 : (fprintf(stderr, "NOT EQUAL! %s:%i (%s) '%s' != '%s'", __FILE__, __LINE__, __FUNCTION__, (a), (b)), fflush(stderr), 0))
60 3
61typedef struct Dummy_Test_Object_Data 4typedef struct Dummy_Test_Object_Data
62{ 5{
@@ -75,35 +18,6 @@ typedef struct Dummy_Test_Object_Data
75 Eo *iface_provider; 18 Eo *iface_provider;
76} Dummy_Test_Object_Data; 19} Dummy_Test_Object_Data;
77 20
78typedef struct Dummy_Numberwrapper_Data
79{
80 int number;
81} Dummy_Numberwrapper_Data;
82
83typedef struct Dummy_Child_Data
84{
85 int iface_prop;
86 const char* a;
87 double b;
88 Eina_Bool iface_was_set;
89 Eina_Bool obligatory_beta_ctor_was_called;
90 Eina_Bool optional_beta_ctor_was_called;
91} Dummy_Child_Data;
92
93typedef struct Dummy_Part_Holder_Data
94{
95 Eo *one;
96 Eo *two;
97} Dummy_Part_Holder_Data;
98
99typedef struct Dummy_Inherit_Helper_Data
100{
101} Dummy_Inherit_Helper_Data;
102
103typedef struct Dummy_Inherit_Iface_Data
104{
105} Dummy_Inherit_Iface_Data;
106
107static 21static
108void *_new_int(int v) 22void *_new_int(int v)
109{ 23{
@@ -3684,22 +3598,6 @@ _dummy_test_object_destroy_cmp_array_objects(void)
3684 efl_unref(modified_seq_obj[i]); 3598 efl_unref(modified_seq_obj[i]);
3685} 3599}
3686 3600
3687
3688// ################## //
3689// Test.Numberwrapper //
3690// ################## //
3691
3692
3693void _dummy_numberwrapper_number_set(EINA_UNUSED Eo *obj, Dummy_Numberwrapper_Data *pd, int n)
3694{
3695 pd->number = n;
3696}
3697
3698int _dummy_numberwrapper_number_get(EINA_UNUSED const Eo *obj, Dummy_Numberwrapper_Data *pd)
3699{
3700 return pd->number;
3701}
3702
3703void _dummy_test_object_set_value_ptr(EINA_UNUSED Eo *obj, Dummy_Test_Object_Data *pd, Eina_Value *value) 3601void _dummy_test_object_set_value_ptr(EINA_UNUSED Eo *obj, Dummy_Test_Object_Data *pd, Eina_Value *value)
3704{ 3602{
3705 if (pd->stored_value) { 3603 if (pd->stored_value) {
@@ -3973,78 +3871,6 @@ Efl_Object *_dummy_test_object_call_find_provider_for_iface(Eo *obj, EINA_UNUSED
3973 return efl_provider_find(obj, DUMMY_TEST_IFACE_INTERFACE); 3871 return efl_provider_find(obj, DUMMY_TEST_IFACE_INTERFACE);
3974} 3872}
3975 3873
3976/// Dummy.Child
3977
3978static Efl_Object *
3979_dummy_child_efl_object_constructor(Eo *obj, Dummy_Child_Data *pd)
3980{
3981 efl_constructor(efl_super(obj, DUMMY_CHILD_CLASS));
3982
3983 pd->iface_prop = 1984;
3984 pd->iface_was_set = EINA_FALSE;
3985 pd->obligatory_beta_ctor_was_called = EINA_FALSE;
3986 pd->optional_beta_ctor_was_called = EINA_FALSE;
3987 return obj;
3988}
3989
3990void _dummy_child_dummy_test_iface_iface_prop_set(EINA_UNUSED Eo *obj, Dummy_Child_Data *pd, int value)
3991{
3992 pd->iface_prop = value;
3993 pd->iface_was_set = EINA_TRUE;
3994}
3995
3996int _dummy_child_dummy_test_iface_iface_prop_get(EINA_UNUSED const Eo *obj, Dummy_Child_Data *pd)
3997{
3998 return pd->iface_prop;
3999}
4000
4001void _dummy_child_double_params(EINA_UNUSED Eo* obj, Dummy_Child_Data *pd, const char* a, double b)
4002{
4003 if (pd->a)
4004 free((void*)pd->a);
4005 pd->a = malloc(sizeof(char)*(strlen(a) + 1));
4006 strcpy((char*)pd->a, a);
4007
4008 pd->b = b;
4009}
4010
4011Eina_Bool _dummy_child_iface_was_set_get(EINA_UNUSED const Eo* obj, Dummy_Child_Data *pd)
4012{
4013 return pd->iface_was_set;
4014}
4015
4016void _dummy_child_obligatory_beta_ctor(EINA_UNUSED Eo* obj, Dummy_Child_Data *pd, EINA_UNUSED int a)
4017{
4018 pd->obligatory_beta_ctor_was_called = EINA_TRUE;
4019}
4020
4021void _dummy_child_optional_beta_ctor(EINA_UNUSED Eo* obj, Dummy_Child_Data *pd, EINA_UNUSED int a)
4022{
4023 pd->optional_beta_ctor_was_called = EINA_TRUE;
4024}
4025
4026Eina_Bool _dummy_child_obligatory_beta_ctor_was_called_get(EINA_UNUSED const Eo* obj, Dummy_Child_Data *pd)
4027{
4028 return pd->obligatory_beta_ctor_was_called;
4029}
4030
4031Eina_Bool _dummy_child_optional_beta_ctor_was_called_get(EINA_UNUSED const Eo* obj, Dummy_Child_Data *pd)
4032{
4033 return pd->optional_beta_ctor_was_called;
4034}
4035
4036EOLIAN static void
4037_dummy_child_class_constructor(Efl_Class *klass)
4038{
4039 (void)klass;
4040}
4041
4042EOLIAN static void
4043_dummy_child_class_destructor(Efl_Class *klass)
4044{
4045 (void)klass;
4046}
4047
4048// Inherit 3874// Inherit
4049int _dummy_inherit_helper_receive_dummy_and_call_int_out(Dummy_Test_Object *x) 3875int _dummy_inherit_helper_receive_dummy_and_call_int_out(Dummy_Test_Object *x)
4050{ 3876{
@@ -4058,39 +3884,5 @@ const char* _dummy_inherit_helper_receive_dummy_and_call_in_stringshare(Dummy_Te
4058 return dummy_inherit_iface_stringshare_test (x, eina_stringshare_add("hello world")); 3884 return dummy_inherit_iface_stringshare_test (x, eina_stringshare_add("hello world"));
4059} 3885}
4060 3886
4061// Part holder
4062static Efl_Object*
4063_dummy_part_holder_efl_object_constructor(Eo *obj, Dummy_Part_Holder_Data *pd)
4064{
4065 efl_constructor(efl_super(obj, DUMMY_PART_HOLDER_CLASS));
4066
4067 // To avoid an infinite loop calling the same constructor
4068 if (!efl_parent_get(obj))
4069 {
4070 pd->one = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_one"));
4071 pd->two = efl_add(DUMMY_TEST_OBJECT_CLASS, obj, efl_name_set(efl_added, "part_two"));
4072 }
4073
4074 return obj;
4075}
4076
4077Efl_Object *_dummy_part_holder_efl_part_part_get(EINA_UNUSED const Eo *obj, Dummy_Part_Holder_Data *pd, const char *name)
4078{
4079 if (!strcmp(name, "one"))
4080 return pd->one;
4081 else if (!strcmp(name, "two"))
4082 return pd->two;
4083 else
4084 return NULL;
4085}
4086
4087
4088
4089#include "dummy_test_object.eo.c" 3887#include "dummy_test_object.eo.c"
4090#include "dummy_numberwrapper.eo.c"
4091#include "dummy_child.eo.c"
4092#include "dummy_test_iface.eo.c"
4093#include "dummy_inherit_helper.eo.c"
4094#include "dummy_inherit_iface.eo.c"
4095#include "dummy_part_holder.eo.c"
4096 3888
diff --git a/src/tests/efl_mono/libefl_mono_native_test.h b/src/tests/efl_mono/libefl_mono_native_test.h
new file mode 100644
index 0000000000..672f249e27
--- /dev/null
+++ b/src/tests/efl_mono/libefl_mono_native_test.h
@@ -0,0 +1,63 @@
1#ifndef LIBEFL_MONO_NATIVE_TEST_H
2#define LIBEFL_MONO_NATIVE_TEST_H
3
4#ifdef HAVE_CONFIG_H
5#include "config.h"
6#endif
7
8#define EFL_PART_PROTECTED
9
10#include <Ecore.h>
11#include <Eo.h>
12
13#ifdef EOAPI
14#undef EOAPI
15#endif
16
17#ifdef EWAPI
18#undef EWAPI
19#endif
20
21#ifdef EAPI
22#undef EAPI
23#endif
24
25#define EOAPI EAPI EAPI_WEAK
26#define EWAPI EAPI EAPI_WEAK
27
28#ifdef _WIN32
29# ifdef EFL_BUILD
30# ifdef DLL_EXPORT
31# define EAPI __declspec(dllexport)
32# else
33# define EAPI
34# endif
35# else
36# define EAPI __declspec(dllimport)
37# endif
38#else
39# ifdef __GNUC__
40# if __GNUC__ >= 4
41# define EAPI __attribute__ ((visibility("default")))
42# else
43# define EAPI
44# endif
45# else
46# define EAPI
47# endif
48#endif
49
50#include "dummy_test_iface.eo.h"
51#include "dummy_inherit_iface.eo.h"
52#include "dummy_numberwrapper.eo.h"
53#include "dummy_test_object.eo.h"
54#include "dummy_child.eo.h"
55#include "dummy_inherit_helper.eo.h"
56#include "dummy_part_holder.eo.h"
57
58#include <interfaces/efl_part.eo.h>
59
60#define EQUAL(a, b) ((a) == (b) ? 1 : (fprintf(stderr, "NOT EQUAL! %s:%i (%s)", __FILE__, __LINE__, __FUNCTION__), fflush(stderr), 0))
61#define STR_EQUAL(a, b) (strcmp((a), (b)) == 0 ? 1 : (fprintf(stderr, "NOT EQUAL! %s:%i (%s) '%s' != '%s'", __FILE__, __LINE__, __FUNCTION__, (a), (b)), fflush(stderr), 0))
62
63#endif
diff --git a/src/tests/efl_mono/meson.build b/src/tests/efl_mono/meson.build
index abd497c376..ac658b46d3 100644
--- a/src/tests/efl_mono/meson.build
+++ b/src/tests/efl_mono/meson.build
@@ -15,7 +15,15 @@ endforeach
15 15
16 16
17efl_mono_native_test = library('efl_mono_native_test', 17efl_mono_native_test = library('efl_mono_native_test',
18 eo_file_targets + ['libefl_mono_native_test.c'], 18 eo_file_targets + [
19 'libefl_mono_native_test.h',
20 'dummy_child.c',
21 'dummy_inherit_helper.c',
22 'dummy_interfaces.c',
23 'dummy_numberwrapper.c',
24 'dummy_part_holder.c',
25 'dummy_test_object.c',
26 ],
19 dependencies : [ecore, eo, efl], 27 dependencies : [ecore, eo, efl],
20) 28)
21 29