603f936745
framework * configure.ac: * tests/*: The tests have been reorganised into different categories: conformance, interactive and micro benchmarks. - conformance tests can be run as part of automated tests - interactive tests are basically all the existing tests - micro benchmarks focus on a single performance metric I converted the timeline tests to conformance tests and also added some tests from Neil Roberts and Ebassi. Note: currently only the conformance tests use the glib test APIs, though the micro benchmarks should too. The other change is to make the unit tests link into monolithic binaries which makes the build time for unit tests considerably faster. To deal with the extra complexity this adds to debugging individual tests I have added some sugar to the makefiles so all the tests can be run directly via a symlink and when an individual test is run this way, then a note is printed to the terminal explaining exactly how that test may be debugged using GDB. There is a convenience make rule: 'make test-report', that will run all the conformance tests and hopefully even open the results in your web browser. It skips some of the slower timeline tests, but you can run those using 'make full-report'
112 lines
3.2 KiB
C
112 lines
3.2 KiB
C
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <gmodule.h>
|
|
#include <clutter/clutter.h>
|
|
|
|
static gint level = 1;
|
|
|
|
static void
|
|
on_timeline_started (ClutterScore *score,
|
|
ClutterTimeline *timeline)
|
|
{
|
|
gint i;
|
|
|
|
for (i = 0; i < level; i++)
|
|
g_print (" ");
|
|
|
|
g_print ("Started timeline: `%s'\n",
|
|
(gchar *) g_object_get_data (G_OBJECT (timeline), "timeline-name"));
|
|
|
|
level += 1;
|
|
}
|
|
|
|
static void
|
|
on_timeline_completed (ClutterScore *score,
|
|
ClutterTimeline *timeline)
|
|
{
|
|
gint i;
|
|
|
|
level -= 1;
|
|
|
|
for (i = 0; i < level; i++)
|
|
g_print (" ");
|
|
|
|
g_print ("Completed timeline: `%s'\n",
|
|
(gchar *) g_object_get_data (G_OBJECT (timeline), "timeline-name"));
|
|
}
|
|
|
|
G_MODULE_EXPORT int
|
|
test_score_main (int argc, char **argv)
|
|
{
|
|
ClutterScore *score;
|
|
ClutterTimeline *timeline_1;
|
|
ClutterTimeline *timeline_2;
|
|
ClutterTimeline *timeline_3;
|
|
ClutterTimeline *timeline_4;
|
|
ClutterTimeline *timeline_5;
|
|
GSList *timelines;
|
|
|
|
clutter_init (&argc, &argv);
|
|
|
|
timeline_1 = clutter_timeline_new_for_duration (1000);
|
|
g_object_set_data_full (G_OBJECT (timeline_1),
|
|
"timeline-name", g_strdup ("Timeline 1"),
|
|
g_free);
|
|
|
|
timeline_2 = clutter_timeline_new_for_duration (1000);
|
|
clutter_timeline_add_marker_at_time (timeline_2, "foo", 500);
|
|
g_object_set_data_full (G_OBJECT (timeline_2),
|
|
"timeline-name", g_strdup ("Timeline 2"),
|
|
g_free);
|
|
|
|
timeline_3 = clutter_timeline_new_for_duration (1000);
|
|
g_object_set_data_full (G_OBJECT (timeline_3),
|
|
"timeline-name", g_strdup ("Timeline 3"),
|
|
g_free);
|
|
|
|
timeline_4 = clutter_timeline_new_for_duration (1000);
|
|
g_object_set_data_full (G_OBJECT (timeline_4),
|
|
"timeline-name", g_strdup ("Timeline 4"),
|
|
g_free);
|
|
|
|
timeline_5 = clutter_timeline_new_for_duration (1000);
|
|
g_object_set_data_full (G_OBJECT (timeline_5),
|
|
"timeline-name", g_strdup ("Timeline 5"),
|
|
g_free);
|
|
|
|
score = clutter_score_new();
|
|
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",
|
|
G_CALLBACK (clutter_main_quit),
|
|
NULL);
|
|
|
|
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);
|
|
|
|
clutter_score_append_at_marker (score, timeline_2, "foo", timeline_5);
|
|
|
|
timelines = clutter_score_list_timelines (score);
|
|
g_assert (5 == g_slist_length (timelines));
|
|
g_slist_free (timelines);
|
|
|
|
clutter_score_start (score);
|
|
|
|
clutter_main ();
|
|
|
|
g_object_unref (timeline_1);
|
|
g_object_unref (timeline_2);
|
|
g_object_unref (timeline_3);
|
|
g_object_unref (timeline_4);
|
|
g_object_unref (timeline_5);
|
|
g_object_unref (score);
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|