This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository enlightenment.

View the commit online.

commit 1174ec24ceac24b4abd47e0807e17cf14b7faf75
Author: Cedric BAIL <[email protected]>
AuthorDate: Tue Nov 24 19:42:20 2026 -0600

    tests - press a key binding on X11
    
    Key bindings run through e_comp_canvas.c on both backends, and no test
    covered them. The test profile now binds Super+i to
    window_maximized_toggle, and an X11 test presses it through E's key
    grab and expects the focused window to maximize, then to be restored.
    
    Co-Authored-By: Claude Opus 5.5 <[email protected]>
---
 data/config/wltest/e_bindings.src |  9 ++++++
 src/tests/x11/meson.build         |  2 ++
 src/tests/x11/test_key_binding.c  | 58 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 69 insertions(+)

diff --git a/data/config/wltest/e_bindings.src b/data/config/wltest/e_bindings.src
index 0f11f7e11..5f5e12a4a 100644
--- a/data/config/wltest/e_bindings.src
+++ b/data/config/wltest/e_bindings.src
@@ -10,6 +10,15 @@ group "E_Config_Bindings" struct {
       value "any_mod" uchar: 0;
     }
   }
+  group "key_bindings" list {
+    group "E_Config_Binding_Key" struct {
+      value "context" int: 9;
+      value "modifiers" int: 8;
+      value "key" string: "i";
+      value "action" string: "window_maximized_toggle";
+      value "any_mod" uchar: 0;
+    }
+  }
   group "signal_bindings" list {
     group "E_Config_Binding_Signal" struct {
       value "context" int: 2;
diff --git a/src/tests/x11/meson.build b/src/tests/x11/meson.build
index 66ab716ff..cf9d61cbf 100644
--- a/src/tests/x11/meson.build
+++ b/src/tests/x11/meson.build
@@ -20,6 +20,8 @@ if not config_h.has('HAVE_WAYLAND_ONLY')
     ['x11-iconify', executable('test_x11_iconify', 'test_iconify.c',
                                dependencies: x11_test_deps),
      {'ELM_TRANSITION_DURATION_FACTOR': '4'}],
+    ['x11-key-binding', executable('test_x11_key_binding', 'test_key_binding.c',
+                                   dependencies: x11_test_deps)],
   ]
 
   # Two heads as well: a window on the right-hand screen is far from 0,0,
diff --git a/src/tests/x11/test_key_binding.c b/src/tests/x11/test_key_binding.c
new file mode 100644
index 000000000..72ba7fe6b
--- /dev/null
+++ b/src/tests/x11/test_key_binding.c
@@ -0,0 +1,58 @@
+/* A key binding acts on the focused window: the test profile binds
+ * Super+i to window_maximized_toggle. The keys come from the X server,
+ * through E's key grab, as a user's would. */
+#include "x11_testkit.h"
+
+#define WAIT_SECONDS 10.0
+
+static void
+_super_i(void)
+{
+   if ((!ecore_x_test_fake_key_down("Super_L")) ||
+       (!ecore_x_test_fake_key_press("i")) ||
+       (!ecore_x_test_fake_key_up("Super_L")))
+     xtk_fail("cannot send keys");
+}
+
+static void
+_wait_maximized(Evas_Object *win, Eina_Bool maximized, const char *what)
+{
+   double end = ecore_time_get() + WAIT_SECONDS;
+
+   ecore_x_sync();
+   while (elm_win_maximized_get(win) != maximized)
+     {
+        if (ecore_time_get() > end) xtk_fail("%s", what);
+        ecore_main_loop_iterate();
+        usleep(10 * 1000);
+     }
+}
+
+int
+main(int argc, char **argv)
+{
+   Evas_Object *win;
+   double end;
+
+   xtk_init(argc, argv, "test-x11-key-binding");
+   win = elm_win_util_standard_add("key-binding", "key binding");
+   elm_win_autodel_set(win, EINA_FALSE);
+   evas_object_resize(win, 300, 200);
+   evas_object_show(win);
+   end = ecore_time_get() + WAIT_SECONDS;
+   while (!elm_win_focus_get(win))
+     {
+        if (ecore_time_get() > end) xtk_fail("the window never got the focus");
+        ecore_main_loop_iterate();
+        usleep(10 * 1000);
+     }
+
+   _super_i();
+   _wait_maximized(win, EINA_TRUE, "Super+i did not maximize the window");
+   _super_i();
+   _wait_maximized(win, EINA_FALSE, "Super+i again did not restore the window");
+
+   printf("test-x11-key-binding: ok\n");
+   xtk_shutdown(win);
+   return 0;
+}

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to