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




commit f0654918bfe4c0bdae7e0c64cde6a231d51de1f3
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 | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
---
diff --git a/src/tests/orientation-manager-unit-tests.c b/src/tests/orientation-manager-unit-tests.c
index 999b0a320a..6bf93b64b1 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,9 @@ 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));
 
   /* This timeout can be relatively generous because we don't expect to
    * reach it: if we do, that's a test failure. */
@@ -102,6 +108,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);
 
@@ -119,6 +128,8 @@ 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));
 
   /* This can't be as long as the timeout for wait_for_orientation(),
    * because in the usual case we expect to reach this timeout: we're
@@ -133,6 +144,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]