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
This commit is contained in:
Jonas Ådahl 2020-04-02 18:28:24 +02:00 committed by Georges Basile Stavracas Neto
parent d14c8cf9a4
commit 9b8e5a05f5
3 changed files with 36 additions and 0 deletions

View File

@ -143,6 +143,7 @@ stacking_tests = [
'set-parent-exported',
'restore-size',
'unmaximize-new-size',
'fullscreen-maximize',
]
foreach stacking_test: stacking_tests

View File

@ -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;

View File

@ -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)