2007-09-27 17:38:38 -04:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <clutter/clutter.h>
|
|
|
|
|
2010-07-30 14:39:35 -04:00
|
|
|
#include "test-conform-common.h"
|
|
|
|
|
|
|
|
static guint level = 0;
|
2007-12-04 11:26:19 -05:00
|
|
|
|
2008-11-14 09:52:35 -05:00
|
|
|
static void
|
|
|
|
on_score_started (ClutterScore *score)
|
|
|
|
{
|
2010-07-30 14:39:35 -04:00
|
|
|
if (g_test_verbose ())
|
|
|
|
g_print ("Score started\n");
|
2008-11-14 09:52:35 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_score_completed (ClutterScore *score)
|
|
|
|
{
|
2010-07-30 14:39:35 -04:00
|
|
|
if (g_test_verbose ())
|
|
|
|
g_print ("Score completed\n");
|
2008-11-14 09:52:35 -05:00
|
|
|
}
|
|
|
|
|
2007-12-04 11:26:19 -05:00
|
|
|
static void
|
|
|
|
on_timeline_started (ClutterScore *score,
|
|
|
|
ClutterTimeline *timeline)
|
|
|
|
{
|
2010-07-30 14:39:35 -04:00
|
|
|
if (g_test_verbose ())
|
|
|
|
g_print ("Started timeline: '%s'\n",
|
|
|
|
(gchar *) g_object_get_data (G_OBJECT (timeline), "timeline-name"));
|
2007-12-04 11:26:19 -05:00
|
|
|
|
|
|
|
level += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
on_timeline_completed (ClutterScore *score,
|
|
|
|
ClutterTimeline *timeline)
|
|
|
|
{
|
2010-07-30 14:39:35 -04:00
|
|
|
if (g_test_verbose ())
|
|
|
|
g_print ("Completed timeline: '%s'\n",
|
|
|
|
(gchar *) g_object_get_data (G_OBJECT (timeline), "timeline-name"));
|
2007-12-04 11:26:19 -05:00
|
|
|
|
|
|
|
level -= 1;
|
|
|
|
}
|
|
|
|
|
2010-07-30 14:39:35 -04:00
|
|
|
void
|
2012-02-27 07:54:23 -05:00
|
|
|
score_base (TestConformSimpleFixture *fixture,
|
2010-07-30 14:39:35 -04:00
|
|
|
gconstpointer data)
|
2007-09-27 17:38:38 -04:00
|
|
|
{
|
|
|
|
ClutterScore *score;
|
|
|
|
ClutterTimeline *timeline_1;
|
|
|
|
ClutterTimeline *timeline_2;
|
|
|
|
ClutterTimeline *timeline_3;
|
2007-10-17 19:03:38 -04:00
|
|
|
ClutterTimeline *timeline_4;
|
2008-03-18 13:54:40 -04:00
|
|
|
ClutterTimeline *timeline_5;
|
2008-02-07 06:53:52 -05:00
|
|
|
GSList *timelines;
|
2007-09-27 17:38:38 -04:00
|
|
|
|
2011-11-08 12:04:44 -05:00
|
|
|
/* FIXME - this is necessary to make the master clock spin */
|
2011-11-09 08:41:15 -05:00
|
|
|
ClutterActor *stage = clutter_stage_new ();
|
2007-09-27 17:38:38 -04:00
|
|
|
|
2010-07-30 14:39:35 -04:00
|
|
|
timeline_1 = clutter_timeline_new (100);
|
2007-12-04 11:26:19 -05:00
|
|
|
g_object_set_data_full (G_OBJECT (timeline_1),
|
|
|
|
"timeline-name", g_strdup ("Timeline 1"),
|
|
|
|
g_free);
|
|
|
|
|
2010-07-30 14:39:35 -04:00
|
|
|
timeline_2 = clutter_timeline_new (100);
|
|
|
|
clutter_timeline_add_marker_at_time (timeline_2, "foo", 50);
|
2007-12-04 11:26:19 -05:00
|
|
|
g_object_set_data_full (G_OBJECT (timeline_2),
|
|
|
|
"timeline-name", g_strdup ("Timeline 2"),
|
|
|
|
g_free);
|
|
|
|
|
2010-07-30 14:39:35 -04:00
|
|
|
timeline_3 = clutter_timeline_new (100);
|
2007-12-04 11:26:19 -05:00
|
|
|
g_object_set_data_full (G_OBJECT (timeline_3),
|
|
|
|
"timeline-name", g_strdup ("Timeline 3"),
|
|
|
|
g_free);
|
|
|
|
|
2010-07-30 14:39:35 -04:00
|
|
|
timeline_4 = clutter_timeline_new (100);
|
2007-12-04 11:26:19 -05:00
|
|
|
g_object_set_data_full (G_OBJECT (timeline_4),
|
|
|
|
"timeline-name", g_strdup ("Timeline 4"),
|
|
|
|
g_free);
|
|
|
|
|
2010-07-30 14:39:35 -04:00
|
|
|
timeline_5 = clutter_timeline_new (100);
|
2008-03-18 13:54:40 -04:00
|
|
|
g_object_set_data_full (G_OBJECT (timeline_5),
|
|
|
|
"timeline-name", g_strdup ("Timeline 5"),
|
|
|
|
g_free);
|
2007-09-27 17:38:38 -04:00
|
|
|
|
|
|
|
score = clutter_score_new();
|
2008-11-14 09:52:35 -05:00
|
|
|
g_signal_connect (score, "started",
|
|
|
|
G_CALLBACK (on_score_started),
|
|
|
|
NULL);
|
2007-12-04 11:26:19 -05:00
|
|
|
g_signal_connect (score, "timeline-started",
|
|
|
|
G_CALLBACK (on_timeline_started),
|
|
|
|
NULL);
|
|
|
|
g_signal_connect (score, "timeline-completed",
|
|
|
|
G_CALLBACK (on_timeline_completed),
|
|
|
|
NULL);
|
|
|
|
g_signal_connect (score, "completed",
|
2008-11-14 09:52:35 -05:00
|
|
|
G_CALLBACK (on_score_completed),
|
2007-12-04 11:26:19 -05:00
|
|
|
NULL);
|
|
|
|
|
2008-03-18 18:07:17 -04:00
|
|
|
clutter_score_append (score, NULL, timeline_1);
|
|
|
|
clutter_score_append (score, timeline_1, timeline_2);
|
|
|
|
clutter_score_append (score, timeline_1, timeline_3);
|
|
|
|
clutter_score_append (score, timeline_3, timeline_4);
|
2008-03-18 13:54:40 -04:00
|
|
|
|
2008-03-18 18:07:17 -04:00
|
|
|
clutter_score_append_at_marker (score, timeline_2, "foo", timeline_5);
|
2007-10-17 19:03:38 -04:00
|
|
|
|
2008-02-07 06:53:52 -05:00
|
|
|
timelines = clutter_score_list_timelines (score);
|
2008-03-18 13:54:40 -04:00
|
|
|
g_assert (5 == g_slist_length (timelines));
|
2008-02-07 06:53:52 -05:00
|
|
|
g_slist_free (timelines);
|
|
|
|
|
2007-09-27 17:38:38 -04:00
|
|
|
clutter_score_start (score);
|
|
|
|
|
2011-11-09 08:41:15 -05:00
|
|
|
clutter_actor_destroy (stage);
|
|
|
|
|
2007-09-27 17:38:38 -04:00
|
|
|
g_object_unref (timeline_1);
|
|
|
|
g_object_unref (timeline_2);
|
|
|
|
g_object_unref (timeline_3);
|
2007-12-04 11:26:19 -05:00
|
|
|
g_object_unref (timeline_4);
|
2008-03-18 13:54:40 -04:00
|
|
|
g_object_unref (timeline_5);
|
2007-12-06 04:07:12 -05:00
|
|
|
g_object_unref (score);
|
2007-09-27 17:38:38 -04:00
|
|
|
}
|