[mutter/gtk3-ci: 14/18] tests/test-runner: Add tile and untile commands
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gtk3-ci: 14/18] tests/test-runner: Add tile and untile commands
- Date: Wed, 15 Apr 2020 14:00:49 +0000 (UTC)
commit 4b4cf96de15443d22d6e480cde0d53e3d116fd11
Author: Jonas Ådahl <jadahl gmail com>
Date: Thu Apr 2 19:09:14 2020 +0200
tests/test-runner: Add tile and untile commands
This allows test cases to tile windows to the right or left, and untile,
just as the keyboard shortcuts does.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1171
src/tests/test-runner.c | 50 +++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
---
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index e1e2fc313..8f2cda16b 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -591,6 +591,56 @@ test_case_do (TestCase *test,
argv[2], argv[3], NULL))
return FALSE;
}
+ else if (strcmp (argv[0], "tile") == 0)
+ {
+ if (argc != 3)
+ BAD_COMMAND("usage: %s <client-id>/<window-id> [right|left]", argv[0]);
+
+ TestClient *client;
+ const char *window_id;
+ if (!test_case_parse_window_id (test, argv[1], &client, &window_id, error))
+ return FALSE;
+
+ MetaWindow *window = test_client_find_window (client, window_id, error);
+ if (!window)
+ return FALSE;
+
+ MetaTileMode tile_mode;
+ if (strcmp (argv[2], "right") == 0)
+ {
+ tile_mode = META_TILE_RIGHT;
+ }
+ else if (strcmp (argv[2], "left") == 0)
+ {
+ tile_mode = META_TILE_LEFT;
+ }
+ else
+ {
+ g_set_error (error,
+ TEST_RUNNER_ERROR,
+ TEST_RUNNER_ERROR_ASSERTION_FAILED,
+ "Invalid tile mode '%s'", argv[2]);
+ return FALSE;
+ }
+
+ meta_window_tile (window, tile_mode);
+ }
+ else if (strcmp (argv[0], "untile") == 0)
+ {
+ if (argc != 2)
+ BAD_COMMAND("usage: %s <client-id>/<window-id>", argv[0]);
+
+ TestClient *client;
+ const char *window_id;
+ if (!test_case_parse_window_id (test, argv[1], &client, &window_id, error))
+ return FALSE;
+
+ MetaWindow *window = test_client_find_window (client, window_id, error);
+ if (!window)
+ return FALSE;
+
+ meta_window_untile (window);
+ }
else if (strcmp (argv[0], "hide") == 0 ||
strcmp (argv[0], "activate") == 0 ||
strcmp (argv[0], "raise") == 0 ||
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]