#include #include #include #include #include "test-common.h" #include "test-utils.h" static gint times = 16; #define STAGE_WIDTH 800 #define STAGE_HEIGHT 600 #define ACTOR_WIDTH 64 #define ACTOR_HEIGHT 64 #define COLS (STAGE_WIDTH/ACTOR_WIDTH) #define ROWS (STAGE_HEIGHT/ACTOR_HEIGHT) #define TOTAL (ROWS*COLS) static void completed (ClutterState *state, gpointer data) { if (g_str_equal (clutter_state_get_state (state), "right")) { /* skip straight to left state when reaching right */ clutter_state_warp_to_state (state, "left"); } else if (g_str_equal (clutter_state_get_state (state), "active")) clutter_state_set_state (state, "right"); else { clutter_state_set_state (state, "active"); } times --; if (times <=0) clutter_main_quit (); } static ClutterActor *new_rect (gint r, gint g, gint b, gint a) { GError *error = NULL; ClutterColor *color = clutter_color_new (r, g, b, a); ClutterActor *group = clutter_group_new (); ClutterActor *rectangle = clutter_rectangle_new_with_color (color); ClutterActor *hand = NULL; gchar *file = g_build_filename (TESTS_DATA_DIR, "redhand.png", NULL); hand = clutter_test_utils_create_texture_from_file (file, &error); if (rectangle == NULL) g_error ("image load failed: %s", error->message); g_free (file); clutter_actor_set_size (hand, ACTOR_WIDTH,ACTOR_HEIGHT); clutter_actor_set_size (rectangle, ACTOR_WIDTH,ACTOR_HEIGHT); clutter_color_free (color); clutter_container_add (CLUTTER_CONTAINER (group), rectangle, hand, NULL); return group; } gint main (gint argc, gchar **argv) { ClutterActor *stage; ClutterState *layout_state; gint i; clutter_perf_fps_init (); if (CLUTTER_INIT_SUCCESS != clutter_init (&argc, &argv)) g_error ("Failed to initialize Clutter"); stage = clutter_stage_new (); layout_state = clutter_state_new (); clutter_stage_set_color (CLUTTER_STAGE (stage), CLUTTER_COLOR_Black); clutter_stage_set_title (CLUTTER_STAGE (stage), "State Performance [pick]"); clutter_actor_set_size (stage, STAGE_WIDTH, STAGE_HEIGHT); g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL); for (i=0; i