summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWander Lairson Costa <wander.lairson@gmail.com>2020-11-04 18:25:37 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2020-11-04 18:56:37 +0000
commitfc949660f70f99fe97e63de65b1b67377d16c6da (patch)
treeb4a77e9a085662c26fff476ab5fa1abeb1bb3b47
parent888e1e74012a4d17bb56ef3d2be2dd6d635c449b (diff)
downloadefl-fc949660f70f99fe97e63de65b1b67377d16c6da.tar.gz
eo_test_general.c: Make eo_signals tests pass on Windows
Summary: EFL_CALLBACKS_ARRAY_DEFINE reorders the callbacks according to efl_callbacks_cmp. efl_callbacks_cmp compares the address of the desc field, which depends on the memory layout generated by the linker. To make the test run deterministically, we define the array of callbacks manually. Reviewers: vtorri, felipealmeida, raster Reviewed By: raster Subscribers: cedric, #reviewers, #committers, jptiz, felipealmeida Tags: #efl Differential Revision: https://phab.enlightenment.org/D12043
-rw-r--r--src/tests/eo/suite/eo_test_general.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/tests/eo/suite/eo_test_general.c b/src/tests/eo/suite/eo_test_general.c
index ae026a27f4..7bdb0e170b 100644
--- a/src/tests/eo/suite/eo_test_general.c
+++ b/src/tests/eo/suite/eo_test_general.c
@@ -199,11 +199,26 @@ _eo_signals_cb_added_deled(void *data EINA_UNUSED, const Efl_Event *event)
fail_if(callback_array->func != _eo_signals_cb_added_deled);
}
-EFL_CALLBACKS_ARRAY_DEFINE(_eo_signals_callbacks,
-{ EV_A_CHANGED, _eo_signals_a_changed_cb },
-{ EV_A_CHANGED, _eo_signals_a_changed_cb2 },
-{ EV_A_CHANGED, _eo_signals_a_changed_never },
-{ EFL_EVENT_DEL, _eo_signals_efl_del_cb });
+// We don't use the EFL_CALLBACKS_ARRAY_DEFINE macro because
+// we need the callbacks be called in a specific order
+static Efl_Callback_Array_Item *
+_eo_signals_callbacks(void)
+{
+ static Efl_Callback_Array_Item items[] =
+ {
+ { EV_A_CHANGED, _eo_signals_a_changed_cb },
+ { EV_A_CHANGED, _eo_signals_a_changed_cb2 },
+ { EV_A_CHANGED, _eo_signals_a_changed_never },
+ { 0, _eo_signals_efl_del_cb },
+ { 0, 0 },
+ };
+
+ // On Windows, because _EFL_EVENT_DEL is a symbol exported
+ // from the DLL, we can't assign from a context expression
+ items[3].desc = EFL_EVENT_DEL;
+
+ return items;
+}
EFL_START_TEST(eo_signals)
{