2
#include <clutter/clutter.h>
5
#include "test-conform-common.h"
10
guint32 *data = g_malloc (100 * 100 * 4);
14
for (y = 0; y < 100; y ++)
15
for (x = 0; x < 100; x++)
18
data[y * 100 + x] = 0xff00ff00;
20
data[y * 100 + x] = 0xff00ffff;
22
return cogl_texture_new_from_data (100,
25
COGL_PIXEL_FORMAT_ARGB_8888,
26
COGL_PIXEL_FORMAT_ARGB_8888,
32
texture_pick_with_alpha (TestConformSimpleFixture *fixture,
35
ClutterTexture *tex = CLUTTER_TEXTURE (clutter_texture_new ());
36
ClutterStage *stage = CLUTTER_STAGE (clutter_stage_new ());
39
clutter_texture_set_cogl_texture (tex, make_texture ());
41
clutter_container_add_actor (CLUTTER_CONTAINER (stage), CLUTTER_ACTOR (tex));
43
clutter_actor_show (CLUTTER_ACTOR (stage));
45
if (g_test_verbose ())
47
g_print ("\nstage = %p\n", stage);
48
g_print ("texture = %p\n\n", tex);
51
clutter_texture_set_pick_with_alpha (tex, TRUE);
52
if (g_test_verbose ())
53
g_print ("Testing with pick-with-alpha enabled:\n");
55
/* This should fall through and hit the stage: */
56
actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 10, 10);
57
if (g_test_verbose ())
58
g_print ("actor @ (10, 10) = %p\n", actor);
59
g_assert (actor == CLUTTER_ACTOR (stage));
61
/* The rest should hit the texture */
62
actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 90, 10);
63
if (g_test_verbose ())
64
g_print ("actor @ (90, 10) = %p\n", actor);
65
g_assert (actor == CLUTTER_ACTOR (tex));
66
actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 90, 90);
67
if (g_test_verbose ())
68
g_print ("actor @ (90, 90) = %p\n", actor);
69
g_assert (actor == CLUTTER_ACTOR (tex));
70
actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 10, 90);
71
if (g_test_verbose ())
72
g_print ("actor @ (10, 90) = %p\n", actor);
73
g_assert (actor == CLUTTER_ACTOR (tex));
75
clutter_texture_set_pick_with_alpha (tex, FALSE);
76
if (g_test_verbose ())
77
g_print ("Testing with pick-with-alpha disabled:\n");
79
actor = clutter_stage_get_actor_at_pos (stage, CLUTTER_PICK_ALL, 10, 10);
80
if (g_test_verbose ())
81
g_print ("actor @ (10, 10) = %p\n", actor);
82
g_assert (actor == CLUTTER_ACTOR (tex));
84
clutter_actor_destroy (CLUTTER_ACTOR (stage));
86
if (g_test_verbose ())