[mutter/wip/smcv/disoriented: 2/3] tests: Add additional debug in wait_for_orientation()




commit f829ccba10b374b9de62beddc8b79f8674928492
Author: Simon McVittie <smcv debian org>
Date:   Sun Oct 10 13:43:52 2021 +0100

    tests: Add additional debug in wait_for_orientation()
    
    Signed-off-by: Simon McVittie <smcv debian org>

 src/tests/orientation-manager-unit-tests.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
---
diff --git a/src/tests/orientation-manager-unit-tests.c b/src/tests/orientation-manager-unit-tests.c
index 4d568a6aae..daa5f9a645 100644
--- a/src/tests/orientation-manager-unit-tests.c
+++ b/src/tests/orientation-manager-unit-tests.c
@@ -61,6 +61,9 @@ on_orientation_changed (gpointer data,
 
   wfo->orientation = meta_orientation_manager_get_orientation (orientation_manager);
   wfo->times_signalled++;
+
+  g_test_message ("wait_for_orientation_changes: Orientation changed to %d: %s",
+                  wfo->orientation, orientation_to_string (wfo->orientation));
 }
 
 static gboolean
@@ -83,6 +86,10 @@ wait_for_orientation (MetaOrientationManager *orientation_manager,
   WaitForOrientation wfo = { orientation, META_ORIENTATION_UNDEFINED, 0, 0, 0 };
 
   wfo.orientation = meta_orientation_manager_get_orientation (orientation_manager);
+  g_test_message ("%s: Waiting for orientation to change from %d: %s to %d: %s...",
+                  G_STRFUNC, wfo.orientation, orientation_to_string (wfo.orientation),
+                  orientation, orientation_to_string (orientation));
+
   wfo.timeout_id = g_timeout_add_seconds (10, on_max_wait_timeout, &wfo);
   wfo.connection_id = g_signal_connect_swapped (orientation_manager,
                                                  "orientation-changed",
@@ -99,6 +106,9 @@ wait_for_orientation (MetaOrientationManager *orientation_manager,
              orientation_to_string (orientation),
              wfo.times_signalled);
 
+  g_test_message ("%s: Orientation is now %d: %s",
+                  G_STRFUNC, orientation, orientation_to_string (orientation));
+
   g_clear_handle_id (&wfo.timeout_id, g_source_remove);
   g_signal_handler_disconnect (orientation_manager, wfo.connection_id);
 
@@ -116,6 +126,9 @@ wait_for_possible_orientation_change (MetaOrientationManager *orientation_manage
   WaitForOrientation wfo = { META_ORIENTATION_UNDEFINED, META_ORIENTATION_UNDEFINED, 0, 0, 0 };
 
   wfo.orientation = meta_orientation_manager_get_orientation (orientation_manager);
+  g_test_message ("%s: Waiting for orientation to maybe change from %d: %s...",
+                  G_STRFUNC, wfo.orientation, orientation_to_string (wfo.orientation));
+
   wfo.timeout_id = g_timeout_add (300, on_max_wait_timeout, &wfo);
   wfo.connection_id = g_signal_connect_swapped (orientation_manager,
                                                  "orientation-changed",
@@ -125,6 +138,12 @@ wait_for_possible_orientation_change (MetaOrientationManager *orientation_manage
   while (wfo.times_signalled == 0 && wfo.timeout_id != 0)
     g_main_context_iteration (NULL, TRUE);
 
+  if (wfo.timeout_id == 0)
+    g_test_message ("%s: Orientation didn't change", G_STRFUNC);
+  else
+    g_test_message ("%s: Orientation is now %d: %s",
+                    G_STRFUNC, wfo.orientation, orientation_to_string (wfo.orientation));
+
   g_clear_handle_id (&wfo.timeout_id, g_source_remove);
   g_signal_handler_disconnect (orientation_manager, wfo.connection_id);
 


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