diff --git a/src/tests/clutter-test-utils.c b/src/tests/clutter-test-utils.c index f966edd60..2745b683e 100644 --- a/src/tests/clutter-test-utils.c +++ b/src/tests/clutter-test-utils.c @@ -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) +{ +} diff --git a/src/tests/clutter-test-utils.h b/src/tests/clutter-test-utils.h index c389c2f1e..75a91565a 100644 --- a/src/tests/clutter-test-utils.h +++ b/src/tests/clutter-test-utils.h @@ -87,6 +87,11 @@ main (int argc, char *argv[]) \ return clutter_test_run (); \ } +#define CLUTTER_TYPE_TEST_ACTOR (clutter_test_actor_get_type ()) +CLUTTER_EXPORT +G_DECLARE_FINAL_TYPE (ClutterTestActor, clutter_test_actor, + CLUTTER, TEST_ACTOR, ClutterActor) + CLUTTER_EXPORT void clutter_test_init (int *argc, char ***argv); diff --git a/src/tests/clutter/interactive/test-cogl-shader-glsl.c b/src/tests/clutter/interactive/test-cogl-shader-glsl.c index e4ca1e360..1b6963e6c 100644 --- a/src/tests/clutter/interactive/test-cogl-shader-glsl.c +++ b/src/tests/clutter/interactive/test-cogl-shader-glsl.c @@ -166,8 +166,8 @@ static unsigned int timeout_id = 0; static int shader_no = 0; static void -on_after_paint (ClutterActor *actor, - ClutterPaintContext *paint_context) +on_paint (ClutterActor *actor, + ClutterPaintContext *paint_context) { CoglFramebuffer *framebuffer = clutter_paint_context_get_framebuffer (paint_context); @@ -307,6 +307,7 @@ G_MODULE_EXPORT int test_cogl_shader_glsl_main (int argc, char *argv[]) { ClutterActor *stage; + ClutterActor *actor; char *file; GError *error; ClutterColor stage_color = { 0x61, 0x64, 0x8c, 0xff }; @@ -317,6 +318,8 @@ test_cogl_shader_glsl_main (int argc, char *argv[]) clutter_test_init (&argc, &argv); stage = clutter_test_get_stage (); + actor = g_object_new (CLUTTER_TYPE_TEST_ACTOR, NULL); + clutter_actor_add_child (stage, actor); clutter_stage_set_title (CLUTTER_STAGE (stage), "Assembly Shader Test"); clutter_actor_set_background_color (CLUTTER_ACTOR (stage), &stage_color); @@ -331,7 +334,7 @@ test_cogl_shader_glsl_main (int argc, char *argv[]) cogl_pipeline_set_layer_texture (pipeline, 0, redhand); set_shader_num (0); - g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), NULL); + g_signal_connect (actor, "paint", G_CALLBACK (on_paint), NULL); clutter_actor_set_reactive (stage, TRUE); g_signal_connect (stage, "button-release-event", diff --git a/src/tests/clutter/micro-bench/test-cogl-perf.c b/src/tests/clutter/micro-bench/test-cogl-perf.c index 3f3f29843..fac68e599 100644 --- a/src/tests/clutter/micro-bench/test-cogl-perf.c +++ b/src/tests/clutter/micro-bench/test-cogl-perf.c @@ -3,6 +3,7 @@ #include #include #include +#include #include #include @@ -100,9 +101,9 @@ TestCallback tests[] = }; static void -on_after_paint (ClutterActor *actor, - ClutterPaintContext *paint_context, - TestState *state) +on_paint (ClutterActor *actor, + ClutterPaintContext *paint_context, + TestState *state) { tests[state->current_test] (state, paint_context); } @@ -120,6 +121,7 @@ main (int argc, char *argv[]) { TestState state; ClutterActor *stage; + ClutterActor *actor; g_setenv ("CLUTTER_VBLANK", "none", FALSE); g_setenv ("CLUTTER_SHOW_FPS", "1", FALSE); @@ -129,6 +131,8 @@ main (int argc, char *argv[]) state.current_test = 0; state.stage = stage = clutter_test_get_stage (); + actor = g_object_new (CLUTTER_TYPE_TEST_ACTOR, NULL); + clutter_actor_add_child (stage, actor); clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT); clutter_actor_set_background_color (CLUTTER_ACTOR (stage), CLUTTER_COLOR_White); @@ -137,7 +141,7 @@ main (int argc, char *argv[]) /* We want continuous redrawing of the stage... */ clutter_threads_add_idle (queue_redraw, stage); - g_signal_connect (CLUTTER_STAGE (stage), "after-paint", G_CALLBACK (on_after_paint), &state); + g_signal_connect (actor, "paint", G_CALLBACK (on_paint), &state); clutter_actor_show (stage);