diff --git a/tests/conform/test-score.c b/tests/conform/test-score.c index 2554cfdd7..a827f7efa 100644 --- a/tests/conform/test-score.c +++ b/tests/conform/test-score.c @@ -55,7 +55,7 @@ test_score (TestConformSimpleFixture *fixture, GSList *timelines; /* FIXME - this is necessary to make the master clock spin */ - (void) clutter_stage_get_default (); + ClutterActor *stage = clutter_stage_new (); timeline_1 = clutter_timeline_new (100); g_object_set_data_full (G_OBJECT (timeline_1), @@ -110,6 +110,8 @@ test_score (TestConformSimpleFixture *fixture, clutter_score_start (score); + clutter_actor_destroy (stage); + g_object_unref (timeline_1); g_object_unref (timeline_2); g_object_unref (timeline_3); diff --git a/tests/conform/test-timeline.c b/tests/conform/test-timeline.c index a04e948e2..7a1c17971 100644 --- a/tests/conform/test-timeline.c +++ b/tests/conform/test-timeline.c @@ -185,7 +185,6 @@ void test_timeline (TestConformSimpleFixture *fixture, gconstpointer data) { - ClutterActor *stage G_GNUC_UNUSED; ClutterTimeline *timeline_1; TimelineData data_1; ClutterTimeline *timeline_2; @@ -198,7 +197,7 @@ test_timeline (TestConformSimpleFixture *fixture, /* NB: We have to ensure a stage is instantiated else the master * clock wont run... */ - stage = clutter_stage_get_default (); + ClutterActor *stage = clutter_stage_new (); timeline_data_init (&data_1, 1); timeline_1 = clutter_timeline_new (FRAME_COUNT * 1000 / FPS); @@ -316,4 +315,6 @@ test_timeline (TestConformSimpleFixture *fixture, timeline_data_destroy (&data_3); g_source_remove (delay_tag); + + clutter_actor_destroy (stage); } diff --git a/tests/interactive/test-actor-clone.c b/tests/interactive/test-actor-clone.c index ec4f392d7..fa7fa3b58 100644 --- a/tests/interactive/test-actor-clone.c +++ b/tests/interactive/test-actor-clone.c @@ -10,10 +10,11 @@ typedef struct SuperOH { - ClutterActor **hand, *bgtex; - ClutterActor *real_hand; - ClutterActor *group; - ClutterActor *stage; + ClutterActor **hand; + ClutterActor *bgtex; + ClutterActor *real_hand; + ClutterActor *group; + ClutterActor *stage; gint stage_width; gint stage_height; @@ -22,6 +23,8 @@ typedef struct SuperOH ClutterBehaviour *scaler_1; ClutterBehaviour *scaler_2; ClutterTimeline *timeline; + + guint frame_id; } SuperOH; static gint n_hands = NHANDS; @@ -36,6 +39,15 @@ static GOptionEntry super_oh_entries[] = { { NULL } }; +static void +clean_and_quit (ClutterActor *actor, + SuperOH *oh) +{ + g_signal_handler_disconnect (oh->timeline, oh->frame_id); + + clutter_main_quit (); +} + static gboolean on_button_press_event (ClutterActor *actor, ClutterEvent *event, @@ -155,20 +167,23 @@ test_actor_clone_main (int argc, char *argv[]) return EXIT_FAILURE; } - stage = clutter_stage_get_default (); + oh = g_new (SuperOH, 1); + + oh->stage = stage = clutter_stage_new (); clutter_actor_set_size (stage, 800, 600); clutter_stage_set_title (CLUTTER_STAGE (stage), "Clone Test"); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); - oh = g_new (SuperOH, 1); + g_signal_connect (stage, "destroy", G_CALLBACK (clean_and_quit), oh); /* Create a timeline to manage animation */ oh->timeline = clutter_timeline_new (6000); clutter_timeline_set_loop (oh->timeline, TRUE); /* fire a callback for frame change */ - g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh); + oh->frame_id = + g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh); /* Set up some behaviours to handle scaling */ alpha = clutter_alpha_new_with_func (oh->timeline, my_sine_wave, NULL, NULL); @@ -207,7 +222,7 @@ test_actor_clone_main (int argc, char *argv[]) clutter_actor_hide (real_hand); /* create a new group to hold multiple actors in a group */ - oh->group = clutter_group_new(); + oh->group = clutter_group_new (); oh->hand = g_new (ClutterActor*, n_hands); @@ -274,11 +289,12 @@ test_actor_clone_main (int argc, char *argv[]) clutter_main (); - /* clean up */ g_object_unref (oh->scaler_1); g_object_unref (oh->scaler_2); g_object_unref (oh->timeline); + g_free (oh->hand); + g_free (oh); return EXIT_SUCCESS; diff --git a/tests/interactive/test-animation.c b/tests/interactive/test-animation.c index aba1a9d50..80b1212a1 100644 --- a/tests/interactive/test-animation.c +++ b/tests/interactive/test-animation.c @@ -84,15 +84,16 @@ G_MODULE_EXPORT int test_animation_main (int argc, char *argv[]) { ClutterActor *stage, *rect; - ClutterColor stage_color = { 0x66, 0x66, 0xdd, 0xff }; ClutterColor rect_color = { 0x44, 0xdd, 0x44, 0xff }; ClutterAction *action; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); + stage = clutter_stage_new (); + clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_LightSkyBlue); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Animation"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); rect = clutter_rectangle_new_with_color (&rect_color); clutter_container_add_actor (CLUTTER_CONTAINER (stage), rect); diff --git a/tests/interactive/test-animator.c b/tests/interactive/test-animator.c index d158655de..dcd64c038 100644 --- a/tests/interactive/test-animator.c +++ b/tests/interactive/test-animator.c @@ -55,18 +55,20 @@ test_animator_main (gint argc, if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Animator"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - for (i=0; iy += flowers[i]->v; flowers[i]->rot += flowers[i]->rv; - stage = clutter_stage_get_default (); if (flowers[i]->y > (gint) clutter_actor_get_height (stage)) flowers[i]->y = -clutter_actor_get_height (flowers[i]->ctex); @@ -167,23 +166,35 @@ tick (ClutterTimeline *timeline, } } -int +static void +stop_and_quit (ClutterActor *actor, + ClutterTimeline *timeline) +{ + clutter_timeline_stop (timeline); + clutter_main_quit (); +} + +G_MODULE_EXPORT int test_cairo_flowers_main (int argc, char **argv) { - int i; - ClutterActor *stage; - ClutterColor stage_color = { 0x0, 0x0, 0x0, 0xff }; + Flower *flowers[N_FLOWERS]; ClutterTimeline *timeline; - Flower *flowers[N_FLOWERS]; + int i; srand (time (NULL)); if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); + /* Create a timeline to manage animation */ + timeline = clutter_timeline_new (6000); + clutter_timeline_set_loop (timeline, TRUE); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); + stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cairo Flowers"); + g_signal_connect (stage, "destroy", G_CALLBACK (stop_and_quit), timeline); + + clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black); for (i=0; i< N_FLOWERS; i++) { @@ -201,10 +212,6 @@ test_cairo_flowers_main (int argc, char **argv) flowers[i]->x, flowers[i]->y); } - /* Create a timeline to manage animation */ - timeline = clutter_timeline_new (6000); - clutter_timeline_set_loop (timeline, TRUE); - /* fire a callback for frame change */ g_signal_connect (timeline, "new-frame", G_CALLBACK (tick), flowers); @@ -218,6 +225,13 @@ test_cairo_flowers_main (int argc, char **argv) clutter_main(); + g_object_unref (timeline); + return EXIT_SUCCESS; } +G_MODULE_EXPORT const char * +test_cairo_flowers_describe (void) +{ + return "Drawing pretty flowers with Cairo"; +} diff --git a/tests/interactive/test-clip.c b/tests/interactive/test-clip.c index b2f2a8af2..cdfbee1b7 100644 --- a/tests/interactive/test-clip.c +++ b/tests/interactive/test-clip.c @@ -325,7 +325,9 @@ test_clip_main (int argc, char **argv) data.current_clip.type = CLIP_NONE; data.clips = NULL; - data.stage = clutter_stage_get_default (); + data.stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (data.stage), "Clipping"); + g_signal_connect (data.stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); stub_actor = clutter_rectangle_new (); clutter_container_add (CLUTTER_CONTAINER (data.stage), stub_actor, NULL); @@ -366,3 +368,9 @@ test_clip_main (int argc, char **argv) return 0; } + +G_MODULE_EXPORT const char * +test_clip_describe (void) +{ + return "Actor clipping with various techniques"; +} diff --git a/tests/interactive/test-cogl-multitexture.c b/tests/interactive/test-cogl-multitexture.c index 1e23b0933..b815831b5 100644 --- a/tests/interactive/test-cogl-multitexture.c +++ b/tests/interactive/test-cogl-multitexture.c @@ -102,7 +102,7 @@ test_cogl_multitexture_main (int argc, char *argv[]) ClutterActor *stage; ClutterColor stage_color = { 0x61, 0x56, 0x56, 0xff }; TestMultiLayerMaterialState *state = g_new0 (TestMultiLayerMaterialState, 1); - ClutterGeometry geom; + gfloat stage_w, stage_h; gchar **files; gfloat tex_coords[] = { @@ -115,17 +115,20 @@ test_cogl_multitexture_main (int argc, char *argv[]) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); - clutter_actor_get_geometry (stage, &geom); + stage = clutter_stage_new (); + clutter_actor_get_size (stage, &stage_w, &stage_h); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl: Multi-texturing"); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); + /* We create a non-descript actor that we know doesn't have a * default paint handler, so that we can easily control * painting in a paint signal handler, without having to * sub-class anything etc. */ state->group = clutter_group_new (); - clutter_actor_set_position (state->group, geom.width/2, geom.height/2); + clutter_actor_set_position (state->group, stage_w / 2, stage_h / 2); g_signal_connect (state->group, "paint", G_CALLBACK(material_rectangle_paint), state); @@ -227,3 +230,9 @@ test_cogl_multitexture_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_cogl_multitexture_describe (void) +{ + return "Multi-texturing support in Cogl."; +} diff --git a/tests/interactive/test-cogl-offscreen.c b/tests/interactive/test-cogl-offscreen.c index e6a1bb7d6..4e1c210ca 100644 --- a/tests/interactive/test-cogl-offscreen.c +++ b/tests/interactive/test-cogl-offscreen.c @@ -225,37 +225,20 @@ setup_viewport (unsigned int width, } static void -test_coglbox_init (TestCoglbox *self) +test_coglbox_map (ClutterActor *actor) { + TestCoglboxPrivate *priv = TEST_COGLBOX_GET_PRIVATE (actor); ClutterActor *stage; - TestCoglboxPrivate *priv; - gchar *file; ClutterPerspective perspective; float stage_width; float stage_height; - self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self); - - printf ("Loading redhand.png\n"); - file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); - priv->texhand_id = cogl_texture_new_from_file (file, - COGL_TEXTURE_NONE, - COGL_PIXEL_FORMAT_ANY, - NULL); - g_free (file); - - printf ("Creating texture with size\n"); - priv->texture_id = cogl_texture_new_with_size (200, 200, - COGL_TEXTURE_NONE, - COGL_PIXEL_FORMAT_RGB_888); - - if (priv->texture_id == COGL_INVALID_HANDLE) - printf ("Failed creating texture with size!\n"); + CLUTTER_ACTOR_CLASS (test_coglbox_parent_class)->map (actor); printf ("Creating offscreen\n"); priv->offscreen_id = cogl_offscreen_new_to_texture (priv->texture_id); - stage = clutter_stage_get_default (); + stage = clutter_actor_get_stage (actor); clutter_stage_get_perspective (CLUTTER_STAGE (stage), &perspective); clutter_actor_get_size (stage, &stage_width, &stage_height); @@ -273,6 +256,31 @@ test_coglbox_init (TestCoglbox *self) printf ("Failed creating offscreen to texture!\n"); } +static void +test_coglbox_init (TestCoglbox *self) +{ + TestCoglboxPrivate *priv; + gchar *file; + + self->priv = priv = TEST_COGLBOX_GET_PRIVATE(self); + + printf ("Loading redhand.png\n"); + file = g_build_filename (TESTS_DATADIR, "redhand.png", NULL); + priv->texhand_id = cogl_texture_new_from_file (file, + COGL_TEXTURE_NONE, + COGL_PIXEL_FORMAT_ANY, + NULL); + g_free (file); + + printf ("Creating texture with size\n"); + priv->texture_id = cogl_texture_new_with_size (200, 200, + COGL_TEXTURE_NONE, + COGL_PIXEL_FORMAT_RGB_888); + + if (priv->texture_id == COGL_INVALID_HANDLE) + printf ("Failed creating texture with size!\n"); +} + static void test_coglbox_class_init (TestCoglboxClass *klass) { @@ -281,6 +289,8 @@ test_coglbox_class_init (TestCoglboxClass *klass) gobject_class->finalize = test_coglbox_finalize; gobject_class->dispose = test_coglbox_dispose; + + actor_class->map = test_coglbox_map; actor_class->paint = test_coglbox_paint; g_type_class_add_private (gobject_class, sizeof (TestCoglboxPrivate)); @@ -295,16 +305,17 @@ test_coglbox_new (void) G_MODULE_EXPORT int test_cogl_offscreen_main (int argc, char *argv[]) { - ClutterActor *stage; - ClutterActor *coglbox; + ClutterActor *stage; + ClutterActor *coglbox; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; /* Stage */ - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Offscreen Buffers"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); /* Cogl Box */ coglbox = test_coglbox_new (); @@ -316,3 +327,9 @@ test_cogl_offscreen_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_cogl_offscreen_describe (void) +{ + return "Offscreen buffer support in Cogl."; +} diff --git a/tests/interactive/test-cogl-point-sprites.c b/tests/interactive/test-cogl-point-sprites.c index c457aa34c..6a18ce3b8 100644 --- a/tests/interactive/test-cogl-point-sprites.c +++ b/tests/interactive/test-cogl-point-sprites.c @@ -219,7 +219,6 @@ idle_cb (gpointer data) G_MODULE_EXPORT int test_cogl_point_sprites_main (int argc, char *argv[]) { - static const ClutterColor black = { 0, 0, 0, 255 }; ClutterActor *stage; CoglHandle tex; Data data; @@ -260,9 +259,10 @@ test_cogl_point_sprites_main (int argc, char *argv[]) data.sparks[i].y = 2.0f; } - stage = clutter_stage_get_default (); - clutter_stage_set_color (CLUTTER_STAGE (stage), &black); - + stage = clutter_stage_new (); + clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Point Sprites"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect_after (stage, "paint", G_CALLBACK (paint_cb), &data); clutter_actor_show (stage); @@ -279,3 +279,9 @@ test_cogl_point_sprites_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_cogl_point_sprites_describe (void) +{ + return "Point sprites support in Cogl."; +} diff --git a/tests/interactive/test-cogl-primitives.c b/tests/interactive/test-cogl-primitives.c index 9069fc25c..7b237e2e9 100644 --- a/tests/interactive/test-cogl-primitives.c +++ b/tests/interactive/test-cogl-primitives.c @@ -114,9 +114,10 @@ test_cogl_primitives_main (int argc, char *argv[]) clutter_timeline_set_loop (tl, TRUE); clutter_timeline_start (tl); - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Path Primitives"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); coglbox = clutter_group_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox); @@ -136,3 +137,9 @@ test_cogl_primitives_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_cogl_primitives (void) +{ + return "2D Path primitives support in Cogl."; +} diff --git a/tests/interactive/test-cogl-tex-convert.c b/tests/interactive/test-cogl-tex-convert.c index f1e80167a..84aa9d6b7 100644 --- a/tests/interactive/test-cogl-tex-convert.c +++ b/tests/interactive/test-cogl-tex-convert.c @@ -202,10 +202,11 @@ test_cogl_tex_convert_main (int argc, char *argv[]) return 1; /* Stage */ - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); - + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Texture Conversion"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); + /* Cogl Box */ coglbox = test_coglbox_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox); @@ -216,3 +217,9 @@ test_cogl_tex_convert_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_cogl_tex_convert_describe (void) +{ + return "Pixel format conversion of Cogl textures."; +} diff --git a/tests/interactive/test-cogl-tex-foreign.c b/tests/interactive/test-cogl-tex-foreign.c index 40284fa0c..e32eece05 100644 --- a/tests/interactive/test-cogl-tex-foreign.c +++ b/tests/interactive/test-cogl-tex-foreign.c @@ -226,10 +226,11 @@ test_cogl_tex_foreign_main (int argc, char *argv[]) return 1; /* Stage */ - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); - + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Foreign Textures"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); + /* Cogl Box */ coglbox = test_coglbox_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox); @@ -240,3 +241,9 @@ test_cogl_tex_foreign_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_cogl_tex_foreign_describe (void) +{ + return "Foreign textures support in Cogl."; +} diff --git a/tests/interactive/test-cogl-tex-getset.c b/tests/interactive/test-cogl-tex-getset.c index a9d01ebf7..2697f1a69 100644 --- a/tests/interactive/test-cogl-tex-getset.c +++ b/tests/interactive/test-cogl-tex-getset.c @@ -249,10 +249,11 @@ test_cogl_tex_getset_main (int argc, char *argv[]) return 1; /* Stage */ - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); - + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Texture Readback"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); + /* Cogl Box */ coglbox = test_coglbox_new (); clutter_container_add_actor (CLUTTER_CONTAINER (stage), coglbox); @@ -263,3 +264,9 @@ test_cogl_tex_getset_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_cogl_tex_getset_describe (void) +{ + return "Texture region readback and update in Cogl."; +} diff --git a/tests/interactive/test-cogl-tex-polygon.c b/tests/interactive/test-cogl-tex-polygon.c index 00e881a66..1b4f6004c 100644 --- a/tests/interactive/test-cogl-tex-polygon.c +++ b/tests/interactive/test-cogl-tex-polygon.c @@ -365,10 +365,11 @@ test_cogl_tex_polygon_main (int argc, char *argv[]) return 1; /* Stage */ - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_stage_set_color (CLUTTER_STAGE (stage), &blue); clutter_actor_set_size (stage, 640, 480); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Texture Polygon"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); /* Cogl Box */ coglbox = test_coglbox_new (); @@ -412,3 +413,9 @@ test_cogl_tex_polygon_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_cogl_tex_polygon_describe (void) +{ + return "Texture polygon primitive."; +} diff --git a/tests/interactive/test-cogl-tex-tile.c b/tests/interactive/test-cogl-tex-tile.c index 7682831dd..025e804ea 100644 --- a/tests/interactive/test-cogl-tex-tile.c +++ b/tests/interactive/test-cogl-tex-tile.c @@ -190,9 +190,10 @@ test_cogl_tex_tile_main (int argc, char *argv[]) return 1; /* Stage */ - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_actor_set_size (stage, 400, 400); - clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Test"); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Texture Tiling"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); /* Cogl Box */ coglbox = test_coglbox_new (); @@ -210,3 +211,9 @@ test_cogl_tex_tile_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_cogl_tex_tile_describe (void) +{ + return "Texture tiling."; +} diff --git a/tests/interactive/test-cogl-vertex-buffer.c b/tests/interactive/test-cogl-vertex-buffer.c index 606c5bedf..6c26c9c57 100644 --- a/tests/interactive/test-cogl-vertex-buffer.c +++ b/tests/interactive/test-cogl-vertex-buffer.c @@ -50,6 +50,7 @@ typedef struct _TestState guint n_static_indices; CoglHandle indices; ClutterTimeline *timeline; + guint frame_id; } TestState; static void @@ -324,37 +325,47 @@ create_dummy_actor (guint width, guint height) return group; } +static void +stop_and_quit (ClutterActor *actor, + TestState *state) +{ + clutter_timeline_stop (state->timeline); + clutter_main_quit (); +} + G_MODULE_EXPORT int test_cogl_vertex_buffer_main (int argc, char *argv[]) { TestState state; ClutterActor *stage; - ClutterColor stage_clr = {0x0, 0x0, 0x0, 0xff}; - ClutterGeometry stage_geom; + gfloat stage_w, stage_h; gint dummy_width, dummy_height; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); - clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr); - clutter_actor_get_geometry (stage, &stage_geom); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Cogl Vertex Buffers"); + clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black); + g_signal_connect (stage, "destroy", G_CALLBACK (stop_and_quit), &state); + clutter_actor_get_size (stage, &stage_w, &stage_h); dummy_width = MESH_WIDTH * QUAD_WIDTH; dummy_height = MESH_HEIGHT * QUAD_HEIGHT; state.dummy = create_dummy_actor (dummy_width, dummy_height); clutter_container_add_actor (CLUTTER_CONTAINER (stage), state.dummy); clutter_actor_set_position (state.dummy, - (stage_geom.width / 2.0) - (dummy_width / 2.0), - (stage_geom.height / 2.0) - (dummy_height / 2.0)); + (stage_w / 2.0) - (dummy_width / 2.0), + (stage_h / 2.0) - (dummy_height / 2.0)); state.timeline = clutter_timeline_new (1000); clutter_timeline_set_loop (state.timeline, TRUE); - g_signal_connect (state.timeline, - "new-frame", - G_CALLBACK (frame_cb), - &state); + + state.frame_id = g_signal_connect (state.timeline, + "new-frame", + G_CALLBACK (frame_cb), + &state); g_signal_connect (state.dummy, "paint", G_CALLBACK (on_paint), &state); @@ -372,3 +383,8 @@ test_cogl_vertex_buffer_main (int argc, char *argv[]) return 0; } +G_MODULE_EXPORT const char * +test_cogl_vertex_buffer_describe (void) +{ + return "Vertex buffers support in Cogl."; +} diff --git a/tests/interactive/test-events.c b/tests/interactive/test-events.c index 18ba50229..de327c564 100644 --- a/tests/interactive/test-events.c +++ b/tests/interactive/test-events.c @@ -48,13 +48,13 @@ stage_state_cb (ClutterStage *stage, } static gboolean -blue_button_cb (ClutterActor *actor, - ClutterEvent *event, - gpointer data) +blue_button_cb (ClutterActor *actor, + ClutterEvent *event, + gpointer data) { ClutterActor *stage; - stage = clutter_stage_get_default (); + stage = clutter_actor_get_stage (actor); if (IsFullScreen) IsFullScreen = FALSE; @@ -104,12 +104,12 @@ capture_cb (ClutterActor *actor, } static void -key_focus_in_cb (ClutterActor *actor, - gpointer data) +key_focus_in_cb (ClutterActor *actor, + gpointer data) { - ClutterActor *focus_box = CLUTTER_ACTOR(data); + ClutterActor *focus_box = CLUTTER_ACTOR (data); - if (actor == clutter_stage_get_default ()) + if (CLUTTER_IS_STAGE (actor)) clutter_actor_hide (focus_box); else { @@ -171,7 +171,7 @@ input_cb (ClutterActor *actor, ClutterEvent *event, gpointer data) { - ClutterStage *stage = CLUTTER_STAGE (clutter_stage_get_default ()); + ClutterActor *stage = clutter_actor_get_stage (actor); ClutterActor *source_actor = clutter_event_get_source (event); gchar keybuf[128]; @@ -223,11 +223,11 @@ input_cb (ClutterActor *actor, clutter_event_get_button (event), clutter_event_get_click_count (event)); - if (source_actor == CLUTTER_ACTOR (stage)) - clutter_stage_set_key_focus (stage, NULL); + if (source_actor == stage) + clutter_stage_set_key_focus (CLUTTER_STAGE (stage), NULL); else if (source_actor == actor && - clutter_actor_get_parent (actor) == CLUTTER_ACTOR (stage)) - clutter_stage_set_key_focus (stage, actor); + clutter_actor_get_parent (actor) == stage) + clutter_stage_set_key_focus (CLUTTER_STAGE (stage), actor); break; case CLUTTER_SCROLL: g_print ("[%s] BUTTON SCROLL (direction:%s)", @@ -263,21 +263,15 @@ input_cb (ClutterActor *actor, G_MODULE_EXPORT int test_events_main (int argc, char *argv[]) { - ClutterActor *stage, *actor, *focus_box, *group; - ClutterColor rcol = { 0xff, 0, 0, 0xff }, - bcol = { 0, 0, 0xff, 0xff }, - gcol = { 0, 0xff, 0, 0xff }, - ycol = { 0xff, 0xff, 0, 0xff }, - ncol = { 0, 0, 0, 0xff }, - xcol = { 0xff, 0, 0xff, 0xff }; + ClutterActor *stage, *actor, *focus_box, *group; if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - - - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Events"); clutter_actor_set_name (stage, "Stage"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "event", G_CALLBACK (input_cb), "stage"); g_signal_connect (stage, "fullscreen", G_CALLBACK (stage_state_cb), "fullscreen"); @@ -287,13 +281,12 @@ test_events_main (int argc, char *argv[]) G_CALLBACK (stage_state_cb), "activate"); g_signal_connect (stage, "deactivate", G_CALLBACK (stage_state_cb), "deactivate"); -/*g_signal_connect (stage, "captured-event", G_CALLBACK (capture_cb), NULL);*/ - focus_box = clutter_rectangle_new_with_color (&ncol); + focus_box = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black); clutter_actor_set_name (focus_box, "Focus Box"); clutter_container_add (CLUTTER_CONTAINER(stage), focus_box, NULL); - actor = clutter_rectangle_new_with_color (&rcol); + actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Red); clutter_actor_set_name (actor, "Red Box"); clutter_actor_set_size (actor, 100, 100); clutter_actor_set_position (actor, 100, 100); @@ -308,7 +301,7 @@ test_events_main (int argc, char *argv[]) clutter_stage_set_key_focus (CLUTTER_STAGE (stage), actor); - actor = clutter_rectangle_new_with_color (&gcol); + actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Green); clutter_actor_set_name (actor, "Green Box"); clutter_actor_set_size (actor, 100, 100); clutter_actor_set_position (actor, 250, 100); @@ -319,7 +312,7 @@ test_events_main (int argc, char *argv[]) focus_box); g_signal_connect (actor, "captured-event", G_CALLBACK (capture_cb), NULL); - actor = clutter_rectangle_new_with_color (&bcol); + actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Blue); clutter_actor_set_name (actor, "Blue Box"); clutter_actor_set_size (actor, 100, 100); clutter_actor_set_position (actor, 400, 100); @@ -333,7 +326,7 @@ test_events_main (int argc, char *argv[]) G_CALLBACK (blue_button_cb), NULL); /* non reactive */ - actor = clutter_rectangle_new_with_color (&ncol); + actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Black); clutter_actor_set_name (actor, "Black Box"); clutter_actor_set_size (actor, 400, 50); clutter_actor_set_position (actor, 100, 250); @@ -345,7 +338,7 @@ test_events_main (int argc, char *argv[]) focus_box); /* non reactive group, with reactive child */ - actor = clutter_rectangle_new_with_color (&ycol); + actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Yellow); clutter_actor_set_name (actor, "Yellow Box"); clutter_actor_set_size (actor, 100, 100); clutter_actor_set_reactive (actor, TRUE); @@ -360,7 +353,7 @@ test_events_main (int argc, char *argv[]) clutter_actor_show_all (group); /* border actor */ - actor = clutter_rectangle_new_with_color (&xcol); + actor = clutter_rectangle_new_with_color (CLUTTER_COLOR_Magenta); clutter_actor_set_name (actor, "Border Box"); clutter_actor_set_size (actor, 100, 100); clutter_actor_set_position (actor, @@ -376,3 +369,9 @@ test_events_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_events_describe (void) +{ + return "Event handling and propagation."; +} diff --git a/tests/interactive/test-fbo.c b/tests/interactive/test-fbo.c index 5854ad181..039f73082 100644 --- a/tests/interactive/test-fbo.c +++ b/tests/interactive/test-fbo.c @@ -55,9 +55,11 @@ test_fbo_main (int argc, char *argv[]) if (clutter_feature_available (CLUTTER_FEATURE_OFFSCREEN) == FALSE) g_error("This test requires CLUTTER_FEATURE_OFFSCREEN"); - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT); clutter_stage_set_color (CLUTTER_STAGE (stage), &blue); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Texture from Actor"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); /* Create the first source */ onscreen_source = make_source(); @@ -97,3 +99,9 @@ test_fbo_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_fbo_describe (void) +{ + return "Create a texture from an actor."; +} diff --git a/tests/interactive/test-flow-layout.c b/tests/interactive/test-flow-layout.c index 82c2f3070..f0550543a 100644 --- a/tests/interactive/test-flow-layout.c +++ b/tests/interactive/test-flow-layout.c @@ -90,10 +90,11 @@ test_flow_layout_main (int argc, char *argv[]) return EXIT_FAILURE; } - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_stage_set_title (CLUTTER_STAGE (stage), "Flow Layout"); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); layout = clutter_flow_layout_new (vertical ? CLUTTER_FLOW_VERTICAL : CLUTTER_FLOW_HORIZONTAL); @@ -154,3 +155,9 @@ test_flow_layout_main (int argc, char *argv[]) return EXIT_SUCCESS; } + +G_MODULE_EXPORT const char * +test_flow_layout_describe (void) +{ + return "FlowLayout layout manager example"; +} diff --git a/tests/interactive/test-fullscreen.c b/tests/interactive/test-fullscreen.c index 6dbe2a2f3..007b7a743 100644 --- a/tests/interactive/test-fullscreen.c +++ b/tests/interactive/test-fullscreen.c @@ -31,9 +31,9 @@ on_unfullscreen (ClutterStage *stage) } static gboolean -toggle_fullscreen (gpointer dummy) +toggle_fullscreen (gpointer data) { - ClutterActor *stage = clutter_stage_get_default (); + ClutterActor *stage = data; gboolean is_fullscreen = FALSE; g_object_get (G_OBJECT (stage), "fullscreen-set", &is_fullscreen, NULL); @@ -60,7 +60,7 @@ toggle_fullscreen (gpointer dummy) case DONE: g_debug ("done: is_fullscreen := %s", is_fullscreen ? "true" : "false"); - clutter_main_quit (); + clutter_actor_destroy (stage); break; } @@ -75,13 +75,17 @@ test_fullscreen_main (int argc, char *argv[]) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Fullscreen"); g_signal_connect (stage, "fullscreen", G_CALLBACK (on_fullscreen), NULL); g_signal_connect (stage, "unfullscreen", G_CALLBACK (on_unfullscreen), NULL); + g_signal_connect (stage, + "destroy", G_CALLBACK (clutter_main_quit), + NULL); clutter_stage_set_fullscreen (CLUTTER_STAGE (stage), TRUE); clutter_actor_show (stage); @@ -91,9 +95,15 @@ test_fullscreen_main (int argc, char *argv[]) clutter_actor_get_height (stage), CLUTTER_ACTOR_IS_MAPPED (stage) ? "true" : "false"); - g_timeout_add (1000, toggle_fullscreen, NULL); + clutter_threads_add_timeout (1000, toggle_fullscreen, stage); clutter_main (); return EXIT_SUCCESS; } + +G_MODULE_EXPORT const char * +test_fullscreen_describe (void) +{ + return "Check behaviour of the Stage during fullscreen."; +} diff --git a/tests/interactive/test-grab.c b/tests/interactive/test-grab.c index 26ef6a669..931d0c464 100644 --- a/tests/interactive/test-grab.c +++ b/tests/interactive/test-grab.c @@ -170,9 +170,11 @@ test_grab_main (int argc, char *argv[]) g_print ("Green box: toggle per actor motion events.\n\n"); g_print ("Cyan box: toggle grab (from cyan box) for keyboard events.\n\n"); - stage = clutter_stage_get_default (); - g_signal_connect (stage, "event", G_CALLBACK (debug_event_cb), "stage"); - + stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Grabs"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); + g_signal_connect (stage, "event", + G_CALLBACK (debug_event_cb), "stage"); g_signal_connect (stage, "fullscreen", G_CALLBACK (stage_state_cb), "fullscreen"); g_signal_connect (stage, "unfullscreen", @@ -241,3 +243,9 @@ test_grab_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_grab_describe (void) +{ + return "Examples of using actor grabs"; +} diff --git a/tests/interactive/test-layout.c b/tests/interactive/test-layout.c index ee8649d0e..20536907a 100644 --- a/tests/interactive/test-layout.c +++ b/tests/interactive/test-layout.c @@ -751,8 +751,10 @@ test_layout_main (int argc, char *argv[]) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_actor_set_size (stage, 800, 600); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Layout"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); main_timeline = clutter_timeline_new (2000); clutter_timeline_set_loop (main_timeline, TRUE); @@ -823,3 +825,9 @@ test_layout_main (int argc, char *argv[]) return EXIT_SUCCESS; } + +G_MODULE_EXPORT const char * +test_layout_describe (void) +{ + return "Container implementing a layout policy."; +} diff --git a/tests/interactive/test-main.c b/tests/interactive/test-main.c index cec02cf51..586d6dc70 100644 --- a/tests/interactive/test-main.c +++ b/tests/interactive/test-main.c @@ -149,7 +149,15 @@ main (int argc, char **argv) goto out; } - n_unit_names = g_strv_length (unit_names); + if (unit_names != NULL) + n_unit_names = g_strv_length (unit_names); + else + { + g_print ("Usage: test-interactive \n"); + ret = EXIT_FAILURE; + goto out; + } + for (i = 0; i < n_unit_names; i++) { const char *unit_name = unit_names[i]; diff --git a/tests/interactive/test-multistage.c b/tests/interactive/test-multistage.c index 3a877fc81..5ae0d96c9 100644 --- a/tests/interactive/test-multistage.c +++ b/tests/interactive/test-multistage.c @@ -117,10 +117,12 @@ test_multistage_main (int argc, char *argv[]) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage_default = clutter_stage_get_default (); + stage_default = clutter_stage_new (); clutter_stage_set_title (CLUTTER_STAGE (stage_default), "Default Stage"); clutter_actor_set_name (stage_default, "Default Stage"); - + g_signal_connect (stage_default, "destroy", + G_CALLBACK (clutter_main_quit), + NULL); g_signal_connect (stage_default, "button-press-event", G_CALLBACK (on_button_press), NULL); diff --git a/tests/interactive/test-paint-wrapper.c b/tests/interactive/test-paint-wrapper.c index b51562a4c..e06c87ff0 100644 --- a/tests/interactive/test-paint-wrapper.c +++ b/tests/interactive/test-paint-wrapper.c @@ -32,6 +32,8 @@ typedef struct SuperOH ClutterBehaviour *scaler_2; ClutterTimeline *timeline; + guint frame_id; + gboolean *paint_guards; } SuperOH; @@ -187,6 +189,16 @@ hand_post_paint (ClutterActor *actor, oh->paint_guards[actor_num] = FALSE; } +static void +stop_and_quit (ClutterActor *actor, + SuperOH *oh) +{ + g_signal_handler_disconnect (oh->timeline, oh->frame_id); + clutter_timeline_stop (oh->timeline); + + clutter_main_quit (); +} + G_MODULE_EXPORT int test_paint_wrapper_main (int argc, char *argv[]) { @@ -217,7 +229,9 @@ test_paint_wrapper_main (int argc, char *argv[]) return EXIT_FAILURE; } - stage = clutter_stage_get_default (); + oh = g_new(SuperOH, 1); + + stage = clutter_stage_new (); clutter_actor_set_size (stage, 800, 600); if (use_alpha != 255) @@ -228,8 +242,8 @@ test_paint_wrapper_main (int argc, char *argv[]) clutter_stage_set_title (CLUTTER_STAGE (stage), "Paint Test"); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); + g_signal_connect (stage, "destroy", G_CALLBACK (stop_and_quit), oh); - oh = g_new(SuperOH, 1); oh->stage = stage; /* Create a timeline to manage animation */ @@ -237,7 +251,8 @@ test_paint_wrapper_main (int argc, char *argv[]) clutter_timeline_set_loop (oh->timeline, TRUE); /* fire a callback for frame change */ - g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh); + oh->frame_id = + g_signal_connect (oh->timeline, "new-frame", G_CALLBACK (frame_cb), oh); /* Set up some behaviours to handle scaling */ alpha = clutter_alpha_new_with_func (oh->timeline, my_sine_wave, NULL, NULL); @@ -347,3 +362,9 @@ test_paint_wrapper_main (int argc, char *argv[]) return 0; } + +G_MODULE_EXPORT const char * +test_paint_wrapper_describe (void) +{ + return "Wrap an actor's paint cycle for pre and post processing."; +} diff --git a/tests/interactive/test-pixmap.c b/tests/interactive/test-pixmap.c index b6ce2daa2..371276449 100644 --- a/tests/interactive/test-pixmap.c +++ b/tests/interactive/test-pixmap.c @@ -235,9 +235,11 @@ test_pixmap_main (int argc, char **argv) XMapWindow (xdpy, win_remote); - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); clutter_actor_set_position (stage, 0, 150); clutter_stage_set_color (CLUTTER_STAGE (stage), &gry); + clutter_stage_set_title (CLUTTER_STAGE (stage), "X11 Texture from Pixmap"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); timeline = clutter_timeline_new (5000); g_signal_connect (timeline, @@ -315,3 +317,9 @@ test_pixmap_main (int argc, char **argv) return EXIT_SUCCESS; } + +G_MODULE_EXPORT const char * +test_pixmap_describe (void) +{ + return "GLX Texture from pixmap extension support."; +} diff --git a/tests/interactive/test-scale.c b/tests/interactive/test-scale.c index 506948ba5..4564fea2b 100644 --- a/tests/interactive/test-scale.c +++ b/tests/interactive/test-scale.c @@ -59,10 +59,11 @@ test_scale_main (int argc, char *argv[]) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); - + stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Scaling"); clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_color); clutter_actor_set_size (stage, 300, 300); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); rect = clutter_rectangle_new_with_color (&rect_color); clutter_actor_set_size (rect, 100, 100); @@ -113,3 +114,9 @@ test_scale_main (int argc, char *argv[]) return EXIT_SUCCESS; } + +G_MODULE_EXPORT const char * +test_scale_describe (void) +{ + return "Scaling animation and scaling center changes"; +} diff --git a/tests/interactive/test-stage-read-pixels.c b/tests/interactive/test-stage-read-pixels.c index b49afc62e..535fc8d65 100644 --- a/tests/interactive/test-stage-read-pixels.c +++ b/tests/interactive/test-stage-read-pixels.c @@ -137,7 +137,9 @@ test_stage_read_pixels_main (int argc, char **argv) return 1; data.idle_source = 0; - data.stage = clutter_stage_get_default (); + data.stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (data.stage), "Read Pixels"); + g_signal_connect (data.stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); data.tex = make_tex (); data.box = make_box (); @@ -158,3 +160,9 @@ test_stage_read_pixels_main (int argc, char **argv) return 0; } + +G_MODULE_EXPORT const char * +test_stage_read_pixels_describe (void) +{ + return "Read back pixels from a Stage."; +} diff --git a/tests/interactive/test-stage-sizing.c b/tests/interactive/test-stage-sizing.c index f4bd6867f..0a939962f 100644 --- a/tests/interactive/test-stage-sizing.c +++ b/tests/interactive/test-stage-sizing.c @@ -44,7 +44,9 @@ test_stage_sizing_main (int argc, char *argv[]) if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (stage), "Stage Sizing"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); label = clutter_text_new_with_text ("Sans 16", "Toggle fullscreen"); rect = clutter_rectangle_new_with_color (CLUTTER_COLOR_LightScarletRed); @@ -107,3 +109,9 @@ test_stage_sizing_main (int argc, char *argv[]) return EXIT_SUCCESS; } + +G_MODULE_EXPORT const char * +test_stage_sizing_describe (void) +{ + return "Check stage sizing policies."; +} diff --git a/tests/interactive/test-state-animator.c b/tests/interactive/test-state-animator.c index 6a77d7b91..94d93c211 100644 --- a/tests/interactive/test-state-animator.c +++ b/tests/interactive/test-state-animator.c @@ -52,14 +52,17 @@ test_state_animator_main (gint argc, ClutterActor *stage; ClutterActor *rects[40]; gint i; + if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); + stage = clutter_stage_new (); + clutter_stage_set_title (CLUTTER_STAGE (stage), "State and Animator"); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); - for (i=0; i<2; i++) + for (i = 0; i < 2; i++) { - rects[i]=new_rect (255 *(i * 1.0/40), 50, 160, 255); + rects[i] = new_rect (255 * (i * 1.0 / 40), 50, 160, 255); clutter_container_add_actor (CLUTTER_CONTAINER (stage), rects[i]); clutter_actor_set_anchor_point (rects[i], 64, 64); clutter_actor_set_position (rects[i], 320.0, 240.0); @@ -133,3 +136,9 @@ test_state_animator_main (gint argc, return EXIT_SUCCESS; } + +G_MODULE_EXPORT const char * +test_state_animator_describe (void) +{ + return "Animate using the State and Animator classes."; +} diff --git a/tests/interactive/test-state.c b/tests/interactive/test-state.c index f02ecc69e..a8767e69e 100644 --- a/tests/interactive/test-state.c +++ b/tests/interactive/test-state.c @@ -92,24 +92,26 @@ G_MODULE_EXPORT gint test_state_main (gint argc, gchar **argv) { - ClutterColor black={0,0,0,0xff}; ClutterActor *stage; ClutterState *layout_state; gint i; + if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS) return 1; - stage = clutter_stage_get_default (); layout_state = clutter_state_new (); - clutter_stage_set_color (CLUTTER_STAGE (stage), &black); - clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT); + stage = clutter_stage_new (); + clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black); + clutter_stage_set_title (CLUTTER_STAGE (stage), "State Machine"); + clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT); + g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); g_signal_connect (stage, "button-press-event", G_CALLBACK (press_event), layout_state); g_signal_connect (stage, "button-release-event", G_CALLBACK (release_event), layout_state); - for (i=0; i