This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch fix-modern-macos
in repository efl.
View the commit online.
commit 14b010c8db97c955371f46f7d1a41ee95432c0cc
Author: Cedric BAIL <[email protected]>
AuthorDate: Wed Apr 29 17:35:39 2026 -0600
test(elementary): add unit tests for elm_app_new_window_* APIs
---
src/tests/elementary/elm_suite.c | 1 +
src/tests/elementary/elm_suite.h | 1 +
src/tests/elementary/elm_test_app.c | 92 +++++++++++++++++++++++++++++++++++++
src/tests/elementary/meson.build | 1 +
4 files changed, 95 insertions(+)
diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c
index dc6b731a17..a2d38c4c77 100644
--- a/src/tests/elementary/elm_suite.c
+++ b/src/tests/elementary/elm_suite.c
@@ -10,6 +10,7 @@
extern Eina_Bool abort_on_warnings;
static const Efl_Test_Case etc[] = {
+ { "elm_app", elm_test_app },
{ "elm_config", elm_test_config },
{ "elm_check", elm_test_check },
{ "elm_colorselector", elm_test_colorselector },
diff --git a/src/tests/elementary/elm_suite.h b/src/tests/elementary/elm_suite.h
index 60046c020e..5fbd8fa742 100644
--- a/src/tests/elementary/elm_suite.h
+++ b/src/tests/elementary/elm_suite.h
@@ -20,6 +20,7 @@
#include <Elementary.h>
#include "suite_helpers.h"
+void elm_test_app(TCase *tc);
void elm_test_config(TCase *tc);
void elm_test_check(TCase *tc);
void elm_test_colorselector(TCase *tc);
diff --git a/src/tests/elementary/elm_test_app.c b/src/tests/elementary/elm_test_app.c
new file mode 100644
index 0000000000..2375e9ed87
--- /dev/null
+++ b/src/tests/elementary/elm_test_app.c
@@ -0,0 +1,92 @@
+#ifdef HAVE_CONFIG_H
+# include "elementary_config.h"
+#endif
+
+#include <Elementary.h>
+#include "elm_suite.h"
+
+static int _cb_invocations = 0;
+static void *_cb_received_data = NULL;
+
+static Eina_Bool
+_test_cb(void *data)
+{
+ _cb_invocations++;
+ _cb_received_data = data;
+ return EINA_TRUE;
+}
+
+EFL_START_TEST(elm_app_new_window_cb_roundtrip)
+{
+ Elm_App_New_Window_Cb got_cb = NULL;
+ void *got_data = NULL;
+ int sentinel = 42;
+
+ /* Initially nothing registered */
+ elm_app_new_window_cb_get(&got_cb, &got_data);
+ ck_assert(got_cb == NULL);
+ ck_assert(got_data == NULL);
+
+ /* Set, then get */
+ elm_app_new_window_cb_set(_test_cb, &sentinel);
+ elm_app_new_window_cb_get(&got_cb, &got_data);
+ ck_assert(got_cb == _test_cb);
+ ck_assert(got_data == &sentinel);
+
+ /* Clear with NULL */
+ elm_app_new_window_cb_set(NULL, NULL);
+ elm_app_new_window_cb_get(&got_cb, &got_data);
+ ck_assert(got_cb == NULL);
+ ck_assert(got_data == NULL);
+}
+EFL_END_TEST
+
+EFL_START_TEST(elm_app_new_window_request_no_cb)
+{
+ Eina_Bool rc;
+
+ /* Make sure no cb is registered */
+ elm_app_new_window_cb_set(NULL, NULL);
+
+ rc = elm_app_new_window_request();
+ ck_assert(rc == EINA_FALSE);
+}
+EFL_END_TEST
+
+EFL_START_TEST(elm_app_new_window_request_invokes_cb)
+{
+ int sentinel = 99;
+ Eina_Bool rc;
+
+ _cb_invocations = 0;
+ _cb_received_data = NULL;
+
+ elm_app_new_window_cb_set(_test_cb, &sentinel);
+
+ rc = elm_app_new_window_request();
+ ck_assert(rc == EINA_TRUE);
+ ck_assert_int_eq(_cb_invocations, 1);
+ ck_assert(_cb_received_data == &sentinel);
+
+ /* Cleanup */
+ elm_app_new_window_cb_set(NULL, NULL);
+}
+EFL_END_TEST
+
+EFL_START_TEST(elm_app_default_menu_disable_is_sticky)
+{
+ /* No public getter — verify the call doesn't crash and is idempotent.
+ * The actual effect is verified by manual macOS testing in Task 8. */
+ elm_app_default_menu_disable();
+ elm_app_default_menu_disable(); /* second call must be safe */
+ /* No assertion — call must simply not crash */
+}
+EFL_END_TEST
+
+void elm_test_app(TCase *tc)
+{
+ tcase_add_test(tc, elm_app_new_window_cb_roundtrip);
+ tcase_add_test(tc, elm_app_new_window_request_no_cb);
+ tcase_add_test(tc, elm_app_new_window_request_invokes_cb);
+ tcase_add_test(tc, elm_app_default_menu_disable_is_sticky);
+}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index cefd55d9d3..3a6257895b 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -31,6 +31,7 @@ elementary_suite_src = [
'elm_test_entry.c',
'elm_test_init.c',
'elm_test_list.c',
+ 'elm_test_app.c',
'elm_test_button.c',
'elm_test_image.c',
'elm_test_photo.c',
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.