forked from enlightenment/efl
Eo tests: Also test function calls in reinit test.
Since we cache ops we also need to check function calls work
when we reinit eo, not just class_get functions.
This commit essentially verifies that
5284b62e93
was done correctly.
This commit is contained in:
parent
b67413bc33
commit
c6159e042b
|
@ -89,7 +89,6 @@ EO_VOID_FUNC_BODY(simple_pure_virtual);
|
||||||
EO_VOID_FUNC_BODY(simple_no_implementation);
|
EO_VOID_FUNC_BODY(simple_no_implementation);
|
||||||
|
|
||||||
static Eo_Op_Description op_descs[] = {
|
static Eo_Op_Description op_descs[] = {
|
||||||
EO_OP_FUNC_OVERRIDE(eo_dbg_info_get, _dbg_info_get),
|
|
||||||
EO_OP_FUNC(simple_a_set, _a_set),
|
EO_OP_FUNC(simple_a_set, _a_set),
|
||||||
EO_OP_FUNC(simple_a_get, _a_get),
|
EO_OP_FUNC(simple_a_get, _a_get),
|
||||||
EO_OP_FUNC(simple_a_print, _a_print),
|
EO_OP_FUNC(simple_a_print, _a_print),
|
||||||
|
@ -97,6 +96,7 @@ static Eo_Op_Description op_descs[] = {
|
||||||
EO_OP_FUNC(simple_recursive, _recursive),
|
EO_OP_FUNC(simple_recursive, _recursive),
|
||||||
EO_OP_FUNC(simple_part_get, _part_get),
|
EO_OP_FUNC(simple_part_get, _part_get),
|
||||||
EO_OP_FUNC(simple_pure_virtual, NULL),
|
EO_OP_FUNC(simple_pure_virtual, NULL),
|
||||||
|
EO_OP_FUNC_OVERRIDE(eo_dbg_info_get, _dbg_info_get),
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Eo_Class_Description class_desc = {
|
static const Eo_Class_Description class_desc = {
|
||||||
|
@ -112,3 +112,28 @@ static const Eo_Class_Description class_desc = {
|
||||||
|
|
||||||
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL)
|
EO_DEFINE_CLASS(simple_class_get, &class_desc, EO_CLASS, NULL)
|
||||||
|
|
||||||
|
|
||||||
|
static int
|
||||||
|
_beef_get(Eo *obj EINA_UNUSED, void *class_data EINA_UNUSED)
|
||||||
|
{
|
||||||
|
return 0xBEEF;
|
||||||
|
}
|
||||||
|
|
||||||
|
EO_FUNC_BODY_CONST(simple2_class_beef_get, int, 0);
|
||||||
|
|
||||||
|
static Eo_Op_Description op_descs2[] = {
|
||||||
|
EO_OP_CLASS_FUNC(simple2_class_beef_get, _beef_get),
|
||||||
|
};
|
||||||
|
|
||||||
|
static const Eo_Class_Description class_desc2 = {
|
||||||
|
EO_VERSION,
|
||||||
|
"Simple2",
|
||||||
|
EO_CLASS_TYPE_REGULAR,
|
||||||
|
EO_CLASS_DESCRIPTION_OPS(op_descs2),
|
||||||
|
NULL,
|
||||||
|
0,
|
||||||
|
NULL,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
|
||||||
|
EO_DEFINE_CLASS(simple2_class_get, &class_desc2, EO_CLASS, NULL)
|
||||||
|
|
|
@ -24,4 +24,9 @@ extern const Eo_Event_Description _EV_A_CHANGED2;
|
||||||
#define SIMPLE_CLASS simple_class_get()
|
#define SIMPLE_CLASS simple_class_get()
|
||||||
const Eo_Class *simple_class_get(void);
|
const Eo_Class *simple_class_get(void);
|
||||||
|
|
||||||
|
EAPI int simple2_class_beef_get(const Eo_Class *obj);
|
||||||
|
|
||||||
|
#define SIMPLE2_CLASS simple2_class_get()
|
||||||
|
const Eo_Class *simple2_class_get(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include <Eo.h>
|
#include <Eo.h>
|
||||||
|
|
||||||
#include "eo_suite.h"
|
#include "eo_suite.h"
|
||||||
|
#include "eo_test_class_simple.h"
|
||||||
|
|
||||||
START_TEST(eo_test_simple)
|
START_TEST(eo_test_simple)
|
||||||
{
|
{
|
||||||
|
@ -17,12 +18,26 @@ END_TEST
|
||||||
|
|
||||||
START_TEST(eo_test_init_shutdown)
|
START_TEST(eo_test_init_shutdown)
|
||||||
{
|
{
|
||||||
|
Eo *obj;
|
||||||
|
|
||||||
fail_if(!eo_init());
|
fail_if(!eo_init());
|
||||||
ck_assert_str_eq("Eo_Base", eo_class_name_get(EO_BASE_CLASS));
|
ck_assert_str_eq("Eo_Base", eo_class_name_get(EO_BASE_CLASS));
|
||||||
|
|
||||||
|
/* XXX-1: Essential for the next test to assign the wrong op. */
|
||||||
|
obj = eo_add(SIMPLE_CLASS, NULL);
|
||||||
|
simple_a_set(obj, 1);
|
||||||
|
ck_assert_int_eq(1, simple_a_get(obj));
|
||||||
|
|
||||||
|
/* XXX-1: Essential for the next test to cache the op. */
|
||||||
|
ck_assert_int_eq(0xBEEF, simple2_class_beef_get(SIMPLE2_CLASS));
|
||||||
|
eo_unref(obj);
|
||||||
fail_if(eo_shutdown());
|
fail_if(eo_shutdown());
|
||||||
|
|
||||||
fail_if(!eo_init());
|
fail_if(!eo_init());
|
||||||
ck_assert_str_eq("Eo_Base", eo_class_name_get(EO_BASE_CLASS));
|
ck_assert_str_eq("Eo_Base", eo_class_name_get(EO_BASE_CLASS));
|
||||||
|
|
||||||
|
/* XXX-1: Verify that the op was not cached. */
|
||||||
|
ck_assert_int_eq(0xBEEF, simple2_class_beef_get(SIMPLE2_CLASS));
|
||||||
fail_if(eo_shutdown());
|
fail_if(eo_shutdown());
|
||||||
}
|
}
|
||||||
END_TEST
|
END_TEST
|
||||||
|
|
Loading…
Reference in New Issue