tests: Fix test-events output

• The enter/leave event line should take into account the case where
  the related field is set to NULL (meaning entering from off-stage
  and leaving the stage).

• The ButtonRelease line shows the click count but uses the button; the
  button *and* the click count should be displayed for both ButtonPress
  and ButtonRelease, to verify they match.
This commit is contained in:
Emmanuele Bassi 2009-12-07 23:02:48 +00:00
parent b3a42c3b09
commit 68b47e3ed4

View File

@ -193,22 +193,28 @@ input_cb (ClutterActor *actor,
case CLUTTER_ENTER: case CLUTTER_ENTER:
g_print ("[%s] ENTER (from:%s)", g_print ("[%s] ENTER (from:%s)",
clutter_actor_get_name (source_actor), clutter_actor_get_name (source_actor),
clutter_actor_get_name (clutter_event_get_related (event))); clutter_event_get_related (event) != NULL
? clutter_actor_get_name (clutter_event_get_related (event))
: "<out of stage>");
break; break;
case CLUTTER_LEAVE: case CLUTTER_LEAVE:
g_print ("[%s] LEAVE (to:%s)", g_print ("[%s] LEAVE (to:%s)",
clutter_actor_get_name (source_actor), clutter_actor_get_name (source_actor),
clutter_actor_get_name (clutter_event_get_related (event))); clutter_event_get_related (event) != NULL
? clutter_actor_get_name (clutter_event_get_related (event))
: "<out of stage>");
break; break;
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
g_print ("[%s] BUTTON PRESS (click count:%i)", g_print ("[%s] BUTTON PRESS (button:%i, click count:%i)",
clutter_actor_get_name (source_actor), clutter_actor_get_name (source_actor),
clutter_event_get_button (event),
clutter_event_get_click_count (event)); clutter_event_get_click_count (event));
break; break;
case CLUTTER_BUTTON_RELEASE: case CLUTTER_BUTTON_RELEASE:
g_print ("[%s] BUTTON RELEASE (click count:%i)", g_print ("[%s] BUTTON RELEASE (button:%i, click count:%i)",
clutter_actor_get_name (source_actor), clutter_actor_get_name (source_actor),
clutter_event_get_button (event)); clutter_event_get_button (event),
clutter_event_get_click_count (event));
if (source_actor == CLUTTER_ACTOR (stage)) if (source_actor == CLUTTER_ACTOR (stage))
clutter_stage_set_key_focus (stage, NULL); clutter_stage_set_key_focus (stage, NULL);