3
#undef CLUTTER_DISABLE_DEPRECATED
4
#include <clutter/clutter.h>
6
#include "test-conform-common.h"
8
typedef struct _BehaviourFixture BehaviourFixture;
10
typedef void (* BehaviourTestFunc) (BehaviourFixture *fixture);
12
struct _BehaviourFixture
14
ClutterTimeline *timeline;
20
opacity_behaviour (BehaviourFixture *fixture)
22
ClutterBehaviour *behaviour;
26
behaviour = clutter_behaviour_opacity_new (fixture->alpha, 0, 255);
27
g_assert (CLUTTER_IS_BEHAVIOUR_OPACITY (behaviour));
29
clutter_behaviour_opacity_get_bounds (CLUTTER_BEHAVIOUR_OPACITY (behaviour),
33
if (g_test_verbose ())
34
g_print ("BehaviourOpacity:bounds = %d, %d (expected: 0, 255)\n",
38
g_assert_cmpint (start, ==, 0);
39
g_assert_cmpint (end, ==, 255);
41
clutter_behaviour_opacity_set_bounds (CLUTTER_BEHAVIOUR_OPACITY (behaviour),
44
/* XXX: The gobject property is actually a unsigned int not unsigned char
45
* property so we have to be careful not to corrupt the stack by passing
46
* a guint8 pointer here... */
48
g_object_get (G_OBJECT (behaviour), "opacity-start", &starti, NULL);
50
if (g_test_verbose ())
51
g_print ("BehaviourOpacity:start = %d (expected: 255)\n", start);
53
g_assert_cmpint (starti, ==, 255);
55
g_object_unref (behaviour);
61
BehaviourTestFunc func;
62
} behaviour_tests[] = {
63
{ "BehaviourOpacity", opacity_behaviour }
66
static const gint n_behaviour_tests = G_N_ELEMENTS (behaviour_tests);
69
test_behaviours (TestConformSimpleFixture *fixture,
72
BehaviourFixture b_fixture;
75
b_fixture.timeline = clutter_timeline_new (1000);
76
b_fixture.alpha = clutter_alpha_new_full (b_fixture.timeline, CLUTTER_LINEAR);
77
b_fixture.rect = clutter_rectangle_new ();
79
g_object_ref_sink (b_fixture.alpha);
80
g_object_unref (b_fixture.timeline);
82
for (i = 0; i < n_behaviour_tests; i++)
84
if (g_test_verbose ())
85
g_print ("Testing: %s\n", behaviour_tests[i].desc);
87
behaviour_tests[i].func (&b_fixture);
90
g_object_unref (b_fixture.alpha);
91
clutter_actor_destroy (b_fixture.rect);