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




commit 2fd93652c50c7a5a888dff52f44955173f962e7a
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 | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
---
diff --git a/src/tests/orientation-manager-unit-tests.c b/src/tests/orientation-manager-unit-tests.c
index eca7ca68b1..5aa9d10bd4 100644
--- a/src/tests/orientation-manager-unit-tests.c
+++ b/src/tests/orientation-manager-unit-tests.c
@@ -59,6 +59,9 @@ on_orientation_changed (WaitForOrientation     *wfo,
 {
   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,11 @@ wait_for_orientation (MetaOrientationManager *orientation_manager,
   };
 
   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. */
@@ -104,6 +112,9 @@ wait_for_orientation (MetaOrientationManager *orientation_manager,
                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);
 
@@ -123,6 +134,9 @@ wait_for_possible_orientation_change (MetaOrientationManager *orientation_manage
   };
 
   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
@@ -137,6 +151,17 @@ 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]