test-runner: Add 'csd' keyword for window creation

Allow specifying 'csd' when creating a window to make the client
create a client-side-decorated window.
This commit is contained in:
Owen W. Taylor 2014-09-15 13:24:05 -04:00
parent e926ebafdb
commit 5716fc4b90
3 changed files with 27 additions and 7 deletions

View File

@ -48,9 +48,10 @@ quit_client <client-id>
Destroys all windows for the client, waits for that to be processed, Destroys all windows for the client, waits for that to be processed,
then instructs the client to exit. then instructs the client to exit.
create <client-id>/<window-id> [override] create <client-id>/<window-id> [override|csd]
Creates a new window. For the X11 backend, the keyword 'override' Creates a new window. For the X11 backend, the keyword 'override'
can be given to create an override-redirect can be given to create an override-redirect and the keyword 'csd'
can be given to create a client-side decorated window.
show <client-id>/<window-id> show <client-id>/<window-id>
hide <client-id>/<window-id> hide <client-id>/<window-id>

View File

@ -67,7 +67,7 @@ process_line (const char *line)
if (argc < 2) if (argc < 2)
{ {
g_print ("usage: create <id> [override]"); g_print ("usage: create <id> [override|csd]");
goto out; goto out;
} }
@ -78,13 +78,31 @@ process_line (const char *line)
} }
gboolean override = FALSE; gboolean override = FALSE;
gboolean csd = FALSE;
for (i = 2; i < argc; i++) for (i = 2; i < argc; i++)
if (strcmp (argv[i], "override") == 0) {
override = TRUE; if (strcmp (argv[i], "override") == 0)
override = TRUE;
if (strcmp (argv[i], "csd") == 0)
csd = TRUE;
}
if (override && csd)
{
g_print ("override and csd keywords are exclusie");
goto out;
}
GtkWidget *window = gtk_window_new (override ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL); GtkWidget *window = gtk_window_new (override ? GTK_WINDOW_POPUP : GTK_WINDOW_TOPLEVEL);
g_hash_table_insert (windows, g_strdup (argv[1]), window); g_hash_table_insert (windows, g_strdup (argv[1]), window);
if (csd)
{
GtkWidget *headerbar = gtk_header_bar_new ();
gtk_window_set_titlebar (GTK_WINDOW (window), headerbar);
gtk_widget_show (headerbar);
}
gtk_window_set_default_size (GTK_WINDOW (window), 100, 100); gtk_window_set_default_size (GTK_WINDOW (window), 100, 100);
gchar *title = g_strdup_printf ("test/%s/%s", client_id, argv[1]); gchar *title = g_strdup_printf ("test/%s/%s", client_id, argv[1]);

View File

@ -665,8 +665,9 @@ test_case_do (TestCase *test,
else if (strcmp (argv[0], "create") == 0) else if (strcmp (argv[0], "create") == 0)
{ {
if (!(argc == 2 || if (!(argc == 2 ||
(argc == 3 && strcmp (argv[2], "override") == 0))) (argc == 3 && strcmp (argv[2], "override") == 0) ||
BAD_COMMAND("usage: %s <client-id>/<window-id > [override]", argv[0]); (argc == 3 && strcmp (argv[2], "csd") == 0)))
BAD_COMMAND("usage: %s <client-id>/<window-id > [override|csd]", argv[0]);
TestClient *client; TestClient *client;
const char *window_id; const char *window_id;