[mutter] tests/test-client: Add 'fullscreen' and 'unfullscreen' commands
- From: Georges Basile Stavracas Neto <gbsneto src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] tests/test-client: Add 'fullscreen' and 'unfullscreen' commands
- Date: Thu, 7 May 2020 23:31:48 +0000 (UTC)
commit 9b8e5a05f59ae0a7ed6c260d308bbd534bf2414f
Author: Jonas Ã…dahl <jadahl gmail com>
Date: Thu Apr 2 18:28:24 2020 +0200
tests/test-client: Add 'fullscreen' and 'unfullscreen' commands
This needs some hand holding when calculating the "full" size of the
window, as the titlebar isn't actually shown.
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1171
src/tests/meson.build | 1 +
src/tests/test-client.c | 33 +++++++++++++++++++++++++++++++++
src/tests/test-runner.c | 2 ++
3 files changed, 36 insertions(+)
---
diff --git a/src/tests/meson.build b/src/tests/meson.build
index aa2edac84..6a0a8d61a 100644
--- a/src/tests/meson.build
+++ b/src/tests/meson.build
@@ -143,6 +143,7 @@ stacking_tests = [
'set-parent-exported',
'restore-size',
'unmaximize-new-size',
+ 'fullscreen-maximize',
]
foreach stacking_test: stacking_tests
diff --git a/src/tests/test-client.c b/src/tests/test-client.c
index 618161ac5..134d9b465 100644
--- a/src/tests/test-client.c
+++ b/src/tests/test-client.c
@@ -246,6 +246,11 @@ static int
calculate_titlebar_height (GtkWindow *window)
{
GtkWidget *titlebar;
+ GdkWindow *gdk_window;
+
+ gdk_window = gtk_widget_get_window (GTK_WIDGET (window));
+ if (gdk_window_get_state (gdk_window) & GDK_WINDOW_STATE_FULLSCREEN)
+ return 0;
titlebar = gtk_window_get_titlebar (window);
if (!titlebar)
@@ -733,6 +738,34 @@ process_line (const char *line)
gtk_window_unmaximize (GTK_WINDOW (window));
}
+ else if (strcmp (argv[0], "fullscreen") == 0)
+ {
+ if (argc != 2)
+ {
+ g_print ("usage: fullscreen <id>\n");
+ goto out;
+ }
+
+ GtkWidget *window = lookup_window (argv[1]);
+ if (!window)
+ goto out;
+
+ gtk_window_fullscreen (GTK_WINDOW (window));
+ }
+ else if (strcmp (argv[0], "unfullscreen") == 0)
+ {
+ if (argc != 2)
+ {
+ g_print ("usage: unfullscreen <id>\n");
+ goto out;
+ }
+
+ GtkWidget *window = lookup_window (argv[1]);
+ if (!window)
+ goto out;
+
+ gtk_window_unfullscreen (GTK_WINDOW (window));
+ }
else if (strcmp (argv[0], "assert_size") == 0)
{
int expected_width;
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index 6364d0ca9..6f3d24bbf 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -600,6 +600,8 @@ test_case_do (TestCase *test,
strcmp (argv[0], "unminimize") == 0 ||
strcmp (argv[0], "maximize") == 0 ||
strcmp (argv[0], "unmaximize") == 0 ||
+ strcmp (argv[0], "fullscreen") == 0 ||
+ strcmp (argv[0], "unfullscreen") == 0 ||
strcmp (argv[0], "destroy") == 0)
{
if (argc != 2)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]