tests/clutter: Use a dummy actor for some interactive tests
While completely untested, at least this makes it work "in theory" again. Before it'd listen to signals on the stage, but have an incorrect type signature to handle the test paint procedures, meaning it'd probably crash or cause memory corruptions. What was needed was a signal which in the callback the test could call some cogl functions to paint on the framebuffer. While there is no such signal on the stage, and the ClutterActor::paint signal (which they probably used in the past) is long gone, lets add a "test actor" that is just a wrapper that adds that paint signal with a paint context. The tests that need it are changed to add this actor to the stage, and to listen to the paint signal on the actor instead of incorrectly listening on stage signals. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2807>
This commit is contained in:
@ -15,6 +15,13 @@ typedef struct
|
||||
MetaContext *context;
|
||||
} ClutterTestEnvironment;
|
||||
|
||||
struct _ClutterTestActor
|
||||
{
|
||||
ClutterActor parent;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (ClutterTestActor, clutter_test_actor, CLUTTER_TYPE_ACTOR)
|
||||
|
||||
static ClutterTestEnvironment *test_environ = NULL;
|
||||
|
||||
static GMainLoop *clutter_test_main_loop = NULL;
|
||||
@ -485,3 +492,31 @@ clutter_test_check_color_at_point (ClutterActor *stage,
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
static void
|
||||
test_actor_paint (ClutterActor *actor,
|
||||
ClutterPaintContext *paint_context)
|
||||
{
|
||||
g_signal_emit_by_name (actor, "paint", paint_context);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_test_actor_class_init (ClutterTestActorClass *klass)
|
||||
{
|
||||
ClutterActorClass *actor_class = CLUTTER_ACTOR_CLASS (klass);
|
||||
|
||||
actor_class->paint = test_actor_paint;
|
||||
|
||||
g_signal_new ("paint",
|
||||
G_TYPE_FROM_CLASS (klass),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL, NULL,
|
||||
G_TYPE_NONE, 1,
|
||||
CLUTTER_TYPE_PAINT_CONTEXT);
|
||||
}
|
||||
|
||||
static void
|
||||
clutter_test_actor_init (ClutterTestActor *test_actor)
|
||||
{
|
||||
}
|
||||
|
Reference in New Issue
Block a user