[tests] Fix the actor detection

The test-unproject interactive test assumed that only the rectangle was
on the stage. As it turns out, labels can be picked as well.
This commit is contained in:
Emmanuele Bassi 2008-12-19 13:03:53 +00:00
parent cdb78ec4d2
commit f6e9a701e4

View File

@ -5,13 +5,15 @@
#include <string.h>
#include <gmodule.h>
ClutterActor *label;
#define RECT_L 200
#define RECT_T 150
#define RECT_W 320
#define RECT_H 240
static ClutterActor *test_rectangle = NULL;
static ClutterActor *label = NULL;
static gboolean
on_event (ClutterStage *stage,
ClutterEvent *event,
@ -29,7 +31,6 @@ on_event (ClutterStage *stage,
actor = clutter_stage_get_actor_at_pos (stage, x, y);
if (clutter_actor_transform_stage_point (actor,
CLUTTER_UNITS_FROM_DEVICE (x),
CLUTTER_UNITS_FROM_DEVICE (y),
@ -37,7 +38,7 @@ on_event (ClutterStage *stage,
{
gchar *txt;
if (actor != CLUTTER_ACTOR (stage))
if (actor == test_rectangle)
txt = g_strdup_printf ("Click on rectangle\n"
"Screen coords: [%d, %d]\n"
"Local coords : [%d, %d]",
@ -117,6 +118,7 @@ test_unproject_main (int argc, char *argv[])
clutter_actor_set_rotation (rect, CLUTTER_Y_AXIS, rotate_y, 0, 0, 0);
clutter_actor_set_rotation (rect, CLUTTER_Z_AXIS, rotate_z, 0, 0, 0);
clutter_group_add (CLUTTER_GROUP (stage), rect);
test_rectangle = rect;
txt = g_strdup_printf ("Rectangle: L %d, R %d, T %d, B %d\n"
"Rotation : x %d, y %d, z %d",
@ -146,5 +148,8 @@ test_unproject_main (int argc, char *argv[])
clutter_main();
test_rectangle = NULL;
label = NULL;
return EXIT_SUCCESS;
}