[clutter] conform: Add markers parsing to the timeline unit
- From: Emmanuele Bassi <ebassi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [clutter] conform: Add markers parsing to the timeline unit
- Date: Sun, 27 Nov 2011 12:20:11 +0000 (UTC)
commit 3f4bd0d9d4b619d8545a57ee6735eb136dacb1c4
Author: Emmanuele Bassi <ebassi gnome org>
Date: Sun Nov 27 12:18:49 2011 +0000
conform: Add markers parsing to the timeline unit
We should check that the newly added custom parser for timeline
markers is working as intended.
tests/conform/test-conform-main.c | 1 +
tests/conform/test-timeline.c | 40 ++++++++++++++++++++++++++
tests/data/Makefile.am | 1 +
tests/data/test-script-timeline-markers.json | 11 +++++++
4 files changed, 53 insertions(+), 0 deletions(-)
---
diff --git a/tests/conform/test-conform-main.c b/tests/conform/test-conform-main.c
index 7a187b9..afbde48 100644
--- a/tests/conform/test-conform-main.c
+++ b/tests/conform/test-conform-main.c
@@ -208,6 +208,7 @@ main (int argc, char **argv)
TEST_CONFORM_SIMPLE ("/script", test_script_layout_property);
TEST_CONFORM_SIMPLE ("/timeline", test_timeline);
+ TEST_CONFORM_SIMPLE ("/timeline", markers_from_script);
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", timeline_interpolation);
TEST_CONFORM_SKIP (!g_test_slow (), "/timeline", timeline_rewind);
diff --git a/tests/conform/test-timeline.c b/tests/conform/test-timeline.c
index 7a1c179..b929190 100644
--- a/tests/conform/test-timeline.c
+++ b/tests/conform/test-timeline.c
@@ -318,3 +318,43 @@ test_timeline (TestConformSimpleFixture *fixture,
clutter_actor_destroy (stage);
}
+
+void
+markers_from_script (TestConformSimpleFixture *fixture,
+ gconstpointer data)
+{
+ ClutterScript *script = clutter_script_new ();
+ ClutterTimeline *timeline;
+ GError *error = NULL;
+ gchar *test_file;
+ gchar **markers;
+ gsize n_markers;
+
+ test_file = clutter_test_get_data_file ("test-script-timeline-markers.json");
+ clutter_script_load_from_file (script, test_file, &error);
+ if (g_test_verbose () && error != NULL)
+ g_print ("Error: %s", error->message);
+
+ g_assert_no_error (error);
+
+ timeline = CLUTTER_TIMELINE (clutter_script_get_object (script, "timeline0"));
+
+ g_assert (clutter_timeline_has_marker (timeline, "marker0"));
+ g_assert (clutter_timeline_has_marker (timeline, "marker1"));
+ g_assert (!clutter_timeline_has_marker (timeline, "foo"));
+ g_assert (clutter_timeline_has_marker (timeline, "marker2"));
+
+ markers = clutter_timeline_list_markers (timeline, -1, &n_markers);
+ g_assert_cmpint (n_markers, ==, 3);
+ g_strfreev (markers);
+
+ markers = clutter_timeline_list_markers (timeline, 500, &n_markers);
+ g_assert_cmpint (n_markers, ==, 1);
+ g_assert (markers != NULL);
+ g_assert_cmpstr (markers[0], ==, "marker1");
+ g_strfreev (markers);
+
+ g_object_unref (script);
+
+ g_free (test_file);
+}
diff --git a/tests/data/Makefile.am b/tests/data/Makefile.am
index b30d3d1..e461a48 100644
--- a/tests/data/Makefile.am
+++ b/tests/data/Makefile.am
@@ -15,6 +15,7 @@ json_files = \
test-animator-2.json \
test-animator-3.json \
test-state-1.json \
+ test-script-timeline-markers.json \
$(NULL)
png_files = \
diff --git a/tests/data/test-script-timeline-markers.json b/tests/data/test-script-timeline-markers.json
new file mode 100644
index 0000000..9dacecb
--- /dev/null
+++ b/tests/data/test-script-timeline-markers.json
@@ -0,0 +1,11 @@
+{
+ "id" : "timeline0",
+ "type" : "ClutterTimeline",
+ "duration" : 1000,
+
+ "markers" : [
+ { "name" : "marker0", "time" : 250 },
+ { "name" : "marker1", "time" : 500 },
+ { "name" : "marker2", "time" : 750 }
+ ]
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]