1
0
Fork 0

tests: Add additional debug in wait_for_orientation()

Signed-off-by: Simon McVittie <smcv@debian.org>
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2049>
This commit is contained in:
Simon McVittie 2021-10-10 13:43:52 +01:00 committed by Marge Bot
parent 838d5656c3
commit 7c6fe21daf

View file

@ -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);