summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarco Trevisan (Treviño) <mail@3v1n0.net>2019-06-21 13:15:48 +0200
committerMarco Trevisan (Treviño) <mail@3v1n0.net>2019-06-24 15:01:25 +0200
commit866d6780c98276f187a5402adf2a25e7ea272a13 (patch)
tree87d7661d4fe2e970d4a99d0f10439d31fde19c1c
parent9009f8d48fd5b9a9c9a775407931580f57da1aa1 (diff)
downloadmutter-866d6780c98276f187a5402adf2a25e7ea272a13.tar.gz
test-runner: Add 'dispatch' command
This will only wait for events to be dispatched and processed by the server without waiting for client processing. Reuse the code for the wait command too. https://gitlab.gnome.org/GNOME/mutter/merge_requests/307 (cherry picked from commit 6022b23923fa6192c630920e9f895f185977beee)
-rw-r--r--src/tests/test-runner.c38
1 files changed, 28 insertions, 10 deletions
diff --git a/src/tests/test-runner.c b/src/tests/test-runner.c
index cc854af4d..fdf4395bf 100644
--- a/src/tests/test-runner.c
+++ b/src/tests/test-runner.c
@@ -87,6 +87,24 @@ test_case_loop_quit (gpointer data)
}
static gboolean
+test_case_dispatch (TestCase *test,
+ GError **error)
+{
+ /* Wait until we've done any outstanding queued up work.
+ * Though we add this as BEFORE_REDRAW, the iteration that runs the
+ * BEFORE_REDRAW idles will proceed on and do the redraw, so we're
+ * waiting until after *all* frame processing.
+ */
+ meta_later_add (META_LATER_BEFORE_REDRAW,
+ test_case_loop_quit,
+ test,
+ NULL);
+ g_main_loop_run (test->loop);
+
+ return TRUE;
+}
+
+static gboolean
test_case_wait (TestCase *test,
GError **error)
{
@@ -102,16 +120,8 @@ test_case_wait (TestCase *test,
if (!test_client_wait (value, error))
return FALSE;
- /* Then wait until we've done any outstanding queued up work.
- * Though we add this as BEFORE_REDRAW, the iteration that runs the
- * BEFORE_REDRAW idles will proceed on and do the redraw, so we're
- * waiting until after *all* frame processing.
- */
- meta_later_add (META_LATER_BEFORE_REDRAW,
- test_case_loop_quit,
- test,
- NULL);
- g_main_loop_run (test->loop);
+ /* Then wait until we've done any outstanding queued up work. */
+ test_case_dispatch (test, error);
/* Then set an XSync counter ourselves and and wait until
* we receive the resulting event - this makes sure that we've
@@ -560,6 +570,14 @@ test_case_do (TestCase *test,
if (!test_case_wait (test, error))
return FALSE;
}
+ else if (strcmp (argv[0], "dispatch") == 0)
+ {
+ if (argc != 1)
+ BAD_COMMAND("usage: %s", argv[0]);
+
+ if (!test_case_dispatch (test, error))
+ return FALSE;
+ }
else if (strcmp (argv[0], "sleep") == 0)
{
guint64 interval;