tests/clutter/utils: Add helper to flush input thread

This helps making sure input events we inject have managed to reach the
main thread.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2727>
This commit is contained in:
Jonas Ådahl 2022-12-01 21:51:02 +01:00 committed by Marge Bot
parent 489bc65381
commit c3f7bf331c
2 changed files with 10 additions and 0 deletions

View File

@ -8,6 +8,7 @@
#include "backends/meta-virtual-monitor.h" #include "backends/meta-virtual-monitor.h"
#include "compositor/meta-plugin-manager.h" #include "compositor/meta-plugin-manager.h"
#include "core/meta-context-private.h" #include "core/meta-context-private.h"
#include "tests/meta-test-utils.h"
typedef struct typedef struct
{ {
@ -75,6 +76,12 @@ clutter_test_get_stage (void)
return meta_backend_get_stage (backend); return meta_backend_get_stage (backend);
} }
void
clutter_test_flush_input (void)
{
meta_flush_input (test_environ->context);
}
typedef struct { typedef struct {
gpointer test_func; gpointer test_func;
gpointer test_data; gpointer test_data;

View File

@ -113,6 +113,9 @@ void clutter_test_add_data_full (const char *test_path,
gpointer test_data, gpointer test_data,
GDestroyNotify test_notify); GDestroyNotify test_notify);
CLUTTER_EXPORT
void clutter_test_flush_input (void);
CLUTTER_EXPORT CLUTTER_EXPORT
ClutterActor * clutter_test_get_stage (void); ClutterActor * clutter_test_get_stage (void);