[mutter/gtk3-ci: 3/18] tests/test-client: Add line breaks to warning messages



commit 965d74355a20a88a958c814bd9990c693b58638f
Author: Jonas Ådahl <jadahl gmail com>
Date:   Thu Apr 2 15:59:20 2020 +0200

    tests/test-client: Add line breaks to warning messages
    
    When toying with the test client to try to reproduce issues (e.g.
    writing commands on stdin to create and manipulate windows), when you
    write a command incorrectly you'll get a warning printed to standard
    out. The problem, however, is that it doesn't include a line break in
    the end, meaning when you type the correct command, it won't be on a new
    line.
    
    Fix this minor annoyance by adding line breaks to all warning messages.
    
    https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1171

 src/tests/test-client.c | 84 ++++++++++++++++++++++++-------------------------
 1 file changed, 42 insertions(+), 42 deletions(-)
---
diff --git a/src/tests/test-client.c b/src/tests/test-client.c
index 3bb2a9a02..5687204bf 100644
--- a/src/tests/test-client.c
+++ b/src/tests/test-client.c
@@ -48,7 +48,7 @@ window_export_handle_cb (GdkWindow  *window,
 
   if (!gdk_wayland_window_set_transient_for_exported (gdk_window,
                                                       (gchar *) handle_str))
-    g_print ("Fail to set transient_for exported window handle %s", handle_str);
+    g_print ("Fail to set transient_for exported window handle %s\n", handle_str);
   gdk_window_set_modal_hint (gdk_window, TRUE);
 }
 
@@ -57,7 +57,7 @@ lookup_window (const char *window_id)
 {
   GtkWidget *window = g_hash_table_lookup (windows, window_id);
   if (!window)
-    g_print ("Window %s doesn't exist", window_id);
+    g_print ("Window %s doesn't exist\n", window_id);
 
   return window;
 }
@@ -251,14 +251,14 @@ process_line (const char *line)
 
   if (!g_shell_parse_argv (line, &argc, &argv, &error))
     {
-      g_print ("error parsing command: %s", error->message);
+      g_print ("error parsing command: %s\n", error->message);
       g_error_free (error);
       return;
     }
 
   if (argc < 1)
     {
-      g_print ("Empty command");
+      g_print ("Empty command\n");
       goto out;
     }
 
@@ -268,13 +268,13 @@ process_line (const char *line)
 
       if (argc  < 2)
         {
-          g_print ("usage: create <id> [override|csd]");
+          g_print ("usage: create <id> [override|csd]\n");
           goto out;
         }
 
       if (g_hash_table_lookup (windows, argv[1]))
         {
-          g_print ("window %s already exists", argv[1]);
+          g_print ("window %s already exists\n", argv[1]);
           goto out;
         }
 
@@ -290,7 +290,7 @@ process_line (const char *line)
 
       if (override && csd)
         {
-          g_print ("override and csd keywords are exclusie");
+          g_print ("override and csd keywords are exclusive\n");
           goto out;
         }
 
@@ -334,21 +334,21 @@ process_line (const char *line)
     {
       if (argc != 3)
         {
-          g_print ("usage: set_parent <window-id> <parent-id>");
+          g_print ("usage: set_parent <window-id> <parent-id>\n");
           goto out;
         }
 
       GtkWidget *window = lookup_window (argv[1]);
       if (!window)
         {
-          g_print ("unknown window %s", argv[1]);
+          g_print ("unknown window %s\n", argv[1]);
           goto out;
         }
 
       GtkWidget *parent_window = lookup_window (argv[2]);
       if (!parent_window)
         {
-          g_print ("unknown parent window %s", argv[2]);
+          g_print ("unknown parent window %s\n", argv[2]);
           goto out;
         }
 
@@ -359,21 +359,21 @@ process_line (const char *line)
     {
       if (argc != 3)
         {
-          g_print ("usage: set_parent_exported <window-id> <parent-id>");
+          g_print ("usage: set_parent_exported <window-id> <parent-id>\n");
           goto out;
         }
 
       GtkWidget *window = lookup_window (argv[1]);
       if (!window)
         {
-          g_print ("unknown window %s", argv[1]);
+          g_print ("unknown window %s\n", argv[1]);
           goto out;
         }
 
       GtkWidget *parent_window = lookup_window (argv[2]);
       if (!parent_window)
         {
-          g_print ("unknown parent window %s", argv[2]);
+          g_print ("unknown parent window %s\n", argv[2]);
           goto out;
         }
 
@@ -382,27 +382,27 @@ process_line (const char *line)
                                              window_export_handle_cb,
                                              window,
                                              NULL))
-        g_print ("Fail to export handle for window id %s", argv[2]);
+        g_print ("Fail to export handle for window id %s\n", argv[2]);
     }
   else if (strcmp (argv[0], "accept_focus") == 0)
     {
       if (argc != 3)
         {
-          g_print ("usage: %s <window-id> [true|false]", argv[0]);
+          g_print ("usage: %s <window-id> [true|false]\n", argv[0]);
           goto out;
         }
 
       GtkWidget *window = lookup_window (argv[1]);
       if (!window)
         {
-          g_print ("unknown window %s", argv[1]);
+          g_print ("unknown window %s\n", argv[1]);
           goto out;
         }
 
       if (!wayland &&
           window_has_x11_event_handler (window, handle_take_focus))
         {
-          g_print ("Impossible to use %s for windows accepting take focus",
+          g_print ("Impossible to use %s for windows accepting take focus\n",
                    argv[1]);
           goto out;
         }
@@ -414,26 +414,26 @@ process_line (const char *line)
     {
       if (argc != 3)
         {
-          g_print ("usage: %s <window-id> [true|false]", argv[0]);
+          g_print ("usage: %s <window-id> [true|false]\n", argv[0]);
           goto out;
         }
 
       GtkWidget *window = lookup_window (argv[1]);
       if (!window)
         {
-          g_print ("unknown window %s", argv[1]);
+          g_print ("unknown window %s\n", argv[1]);
           goto out;
         }
 
       if (wayland)
         {
-          g_print ("%s not supported under wayland", argv[0]);
+          g_print ("%s not supported under wayland\n", argv[0]);
           goto out;
         }
 
       if (window_has_x11_event_handler (window, handle_take_focus))
         {
-          g_print ("Impossible to change %s for windows accepting take focus",
+          g_print ("Impossible to change %s for windows accepting take focus\n",
                    argv[1]);
           goto out;
         }
@@ -473,32 +473,32 @@ process_line (const char *line)
     {
       if (argc != 3)
         {
-          g_print ("usage: %s <window-id> [true|false]", argv[0]);
+          g_print ("usage: %s <window-id> [true|false]\n", argv[0]);
           goto out;
         }
 
       GtkWidget *window = lookup_window (argv[1]);
       if (!window)
         {
-          g_print ("unknown window %s", argv[1]);
+          g_print ("unknown window %s\n", argv[1]);
           goto out;
         }
 
       if (wayland)
         {
-          g_print ("%s not supported under wayland", argv[0]);
+          g_print ("%s not supported under wayland\n", argv[0]);
           goto out;
         }
 
       if (gtk_window_get_accept_focus (GTK_WINDOW (window)))
         {
-          g_print ("%s not supported for input windows", argv[0]);
+          g_print ("%s not supported for input windows\n", argv[0]);
           goto out;
         }
 
       if (!g_object_get_qdata (G_OBJECT (window), can_take_focus_quark))
         {
-          g_print ("%s not supported for windows with no WM_TAKE_FOCUS set",
+          g_print ("%s not supported for windows with no WM_TAKE_FOCUS set\n",
                    argv[0]);
           goto out;
         }
@@ -512,7 +512,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: show <id>");
+          g_print ("usage: show <id>\n");
           goto out;
         }
 
@@ -527,7 +527,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: hide <id>");
+          g_print ("usage: hide <id>\n");
           goto out;
         }
 
@@ -541,7 +541,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: activate <id>");
+          g_print ("usage: activate <id>\n");
           goto out;
         }
 
@@ -555,7 +555,7 @@ process_line (const char *line)
     {
       if (argc != 4)
         {
-          g_print ("usage: resize <id> <width> <height>");
+          g_print ("usage: resize <id> <width> <height>\n");
           goto out;
         }
 
@@ -571,7 +571,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: raise <id>");
+          g_print ("usage: raise <id>\n");
           goto out;
         }
 
@@ -585,7 +585,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: lower <id>");
+          g_print ("usage: lower <id>\n");
           goto out;
         }
 
@@ -599,7 +599,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: destroy <id>");
+          g_print ("usage: destroy <id>\n");
           goto out;
         }
 
@@ -614,7 +614,7 @@ process_line (const char *line)
     {
       if (argc != 1)
         {
-          g_print ("usage: destroy_all");
+          g_print ("usage: destroy_all\n");
           goto out;
         }
 
@@ -631,7 +631,7 @@ process_line (const char *line)
     {
       if (argc != 1)
         {
-          g_print ("usage: sync");
+          g_print ("usage: sync\n");
           goto out;
         }
 
@@ -644,13 +644,13 @@ process_line (const char *line)
 
       if (argc != 3)
         {
-          g_print ("usage: set_counter <counter> <value>");
+          g_print ("usage: set_counter <counter> <value>\n");
           goto out;
         }
 
       if (wayland)
         {
-          g_print ("usage: set_counter can only be used for X11");
+          g_print ("usage: set_counter can only be used for X11\n");
           goto out;
         }
 
@@ -666,7 +666,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: minimize <id>");
+          g_print ("usage: minimize <id>\n");
           goto out;
         }
 
@@ -680,7 +680,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: unminimize <id>");
+          g_print ("usage: unminimize <id>\n");
           goto out;
         }
 
@@ -694,7 +694,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: maximize <id>");
+          g_print ("usage: maximize <id>\n");
           goto out;
         }
 
@@ -708,7 +708,7 @@ process_line (const char *line)
     {
       if (argc != 2)
         {
-          g_print ("usage: unmaximize <id>");
+          g_print ("usage: unmaximize <id>\n");
           goto out;
         }
 
@@ -720,7 +720,7 @@ process_line (const char *line)
     }
   else
     {
-      g_print ("Unknown command %s", argv[0]);
+      g_print ("Unknown command %s\n", argv[0]);
       goto out;
     }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]