interactive: Remove test-unproject

The coordinate transformation code is exercised throughout the
conformance and interactive tests, so there's no need to have a specific
interactive test that doesn't do anything more complicated than calling
clutter_actor_transform_stage_point().
This commit is contained in:
Emmanuele Bassi 2011-11-16 13:59:11 +00:00
parent bf9339b8f4
commit 15000307fd
2 changed files with 0 additions and 158 deletions

View File

@ -22,7 +22,6 @@ UNIT_TESTS = \
test-animator.c \ test-animator.c \
test-state.c \ test-state.c \
test-state-animator.c \ test-state-animator.c \
test-unproject.c \
test-fbo.c \ test-fbo.c \
test-multistage.c \ test-multistage.c \
test-cogl-primitives.c \ test-cogl-primitives.c \

View File

@ -1,157 +0,0 @@
#include <clutter/clutter.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gmodule.h>
#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,
gpointer user_data)
{
switch (event->type)
{
case CLUTTER_BUTTON_PRESS:
{
ClutterActor *actor;
gfloat xu2, yu2;
gfloat x, y;
clutter_event_get_coords (event, &x, &y);
actor = clutter_stage_get_actor_at_pos (stage,
CLUTTER_PICK_ALL,
x, y);
if (clutter_actor_transform_stage_point (actor, x, y, &xu2, &yu2))
{
gchar *txt;
if (actor == test_rectangle)
txt = g_strdup_printf ("Click on rectangle\n"
"Screen coords: [%d, %d]\n"
"Local coords : [%d, %d]",
(int) x, (int) y,
(int) xu2, (int) yu2);
else
txt = g_strdup_printf ("Click on stage\n"
"Screen coords: [%d, %d]\n"
"Local coords : [%d, %d]",
(int) x, (int) y,
(int) xu2, (int) yu2);
clutter_text_set_text (CLUTTER_TEXT (label), txt);
g_free (txt);
}
else
clutter_text_set_text (CLUTTER_TEXT (label), "Unprojection failed.");
}
break;
default:
break;
}
return FALSE;
}
G_MODULE_EXPORT int
test_unproject_main (int argc, char *argv[])
{
gchar *txt;
ClutterActor *rect, *stage, *label0;
int i, rotate_x = 0, rotate_y = 60, rotate_z = 0;
ClutterColor stage_clr = { 0x0, 0x0, 0x0, 0xff },
white = { 0xff, 0xff, 0xff, 0xff },
blue = { 0x0, 0xff, 0xff, 0xff };
for (i = 0; i < argc; ++i)
{
if (!strncmp (argv[i], "--rotate-x", 10))
{
rotate_x = atoi (argv[i] + 11);
}
else if (!strncmp (argv[i], "--rotate-y", 10))
{
rotate_y = atoi (argv[i] + 11);
}
else if (!strncmp (argv[i], "--rotate-z", 10))
{
rotate_z = atoi (argv[i] + 11);
}
else if (!strncmp (argv[i], "--help", 6))
{
g_print ("%s [--rotage-x=degrees] "
"[--rotage-y=degrees] "
"[--rotage-z=degrees]\n",
argv[0]);
return EXIT_FAILURE;
}
}
if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
return 1;
stage = clutter_stage_new ();
clutter_stage_set_title (CLUTTER_STAGE (stage), "Unprojecting events");
clutter_stage_set_color (CLUTTER_STAGE (stage), &stage_clr);
clutter_actor_set_size (stage, 640, 480);
g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);
rect = clutter_rectangle_new_with_color (&white);
clutter_actor_set_size (rect, RECT_W, RECT_H);
clutter_actor_set_position (rect, RECT_L, RECT_T);
clutter_actor_set_rotation (rect, CLUTTER_X_AXIS, rotate_x, 0, 0, 0);
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_container_add_actor (CLUTTER_CONTAINER (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",
RECT_L, RECT_L + RECT_W,
RECT_T, RECT_T + RECT_H,
rotate_x, rotate_y, rotate_z);
label0 = clutter_text_new_with_text ("Mono 8pt", txt);
clutter_text_set_color (CLUTTER_TEXT (label0), &white);
clutter_actor_set_position (label0, 10, 10);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label0);
g_free (txt);
label =
clutter_text_new_with_text ("Mono 8pt", "Click around!");
clutter_text_set_color (CLUTTER_TEXT (label), &blue);
clutter_actor_set_position (label, 10, 50);
clutter_container_add_actor (CLUTTER_CONTAINER (stage), label);
clutter_actor_show_all (stage);
g_signal_connect (stage, "event", G_CALLBACK (on_event), NULL);
clutter_main();
return EXIT_SUCCESS;
}
G_MODULE_EXPORT const char *
test_unproject_describe (void)
{
return "Transform stage coordinates into actor coordinates.";
}