tests: add project auto-transition test

This commit is contained in:
Anton Belka 2013-04-24 15:25:20 +03:00 committed by Thibault Saunier
parent 4db816d3e6
commit 086bbd3b38
3 changed files with 113 additions and 0 deletions

View file

@ -52,6 +52,7 @@ LDADD = $(common_ldadd) libtestutils.la
EXTRA_DIST = \
ges/test-project.xges \
ges/test-auto-transition.xges \
ges/audio_only.ogg \
ges/image.png \
ges/audio_video.ogg

View file

@ -521,6 +521,89 @@ GST_START_TEST (test_project_load_xges)
GST_END_TEST;
GST_START_TEST (test_project_auto_transition)
{
GList *layers;
GMainLoop *mainloop;
GESProject *project;
GESTimeline *timeline;
GESLayer *layer = NULL;
GESAsset *formatter_asset;
gboolean saved;
gchar *tmpuri, *uri = ges_test_file_uri ("test-auto-transition.xges");
project = ges_project_new (uri);
mainloop = g_main_loop_new (NULL, FALSE);
fail_unless (GES_IS_PROJECT (project));
/* Connect the signals */
g_signal_connect (project, "loaded", (GCallback) project_loaded_cb, mainloop);
g_signal_connect (project, "missing-uri", (GCallback) _set_new_uri, NULL);
/* Now extract a timeline from it */
GST_LOG ("Loading project");
timeline = GES_TIMELINE (ges_asset_extract (GES_ASSET (project), NULL));
g_main_loop_run (mainloop);
/* Check timeline and layers auto-transition, must be FALSE */
fail_if (ges_timeline_get_auto_transition (timeline));
layers = ges_timeline_get_layers (timeline);
for (; layers; layers = layers->next) {
layer = layers->data;
fail_if (ges_layer_get_auto_transition (layer));
}
g_list_free_full (layers, gst_object_unref);
g_free (uri);
/* Set timeline and layers auto-transition to TRUE */
ges_timeline_set_auto_transition (timeline, TRUE);
tmpuri = ges_test_file_uri ("test-auto-transition-save.xges");
formatter_asset = ges_asset_request (GES_TYPE_FORMATTER, "ges", NULL);
saved =
ges_project_save (project, timeline, tmpuri, formatter_asset, TRUE, NULL);
fail_unless (saved);
gst_object_unref (timeline);
gst_object_unref (project);
project = ges_project_new (tmpuri);
ASSERT_OBJECT_REFCOUNT (project, "Our + cache", 2);
g_signal_connect (project, "loaded", (GCallback) project_loaded_cb, mainloop);
GST_LOG ("Loading saved project");
timeline = GES_TIMELINE (ges_asset_extract (GES_ASSET (project), NULL));
fail_unless (GES_IS_TIMELINE (timeline));
g_main_loop_run (mainloop);
/* Check timeline and layers auto-transition, must be TRUE */
fail_unless (ges_timeline_get_auto_transition (timeline));
layers = ges_timeline_get_layers (timeline);
for (; layers; layers = layers->next) {
layer = layers->data;
fail_unless (ges_layer_get_auto_transition (layer));
}
g_list_free_full (layers, gst_object_unref);
gst_object_unref (timeline);
gst_object_unref (project);
g_free (tmpuri);
g_main_loop_unref (mainloop);
g_signal_handlers_disconnect_by_func (project, (GCallback) project_loaded_cb,
mainloop);
g_signal_handlers_disconnect_by_func (project, (GCallback) asset_added_cb,
NULL);
}
GST_END_TEST;
/* FIXME This test does not pass for some bad reason */
#if 0
static void
@ -619,6 +702,7 @@ ges_suite (void)
tcase_add_test (tc_chain, test_project_add_assets);
tcase_add_test (tc_chain, test_project_load_xges);
tcase_add_test (tc_chain, test_project_add_keyframes);
tcase_add_test (tc_chain, test_project_auto_transition);
/*tcase_add_test (tc_chain, test_load_xges_and_play); */
tcase_add_test (tc_chain, test_project_unexistant_effect);

View file

@ -0,0 +1,28 @@
<ges version="0.1">
<project metadatas='metadatas, name=(string)&quot;Example\ project&quot;;'>
<encoding-profiles>
<encoding-profile name='first_profile' description='(null)' type='container' format='application/ogg'>
<stream-profile parent='first_profile' id='0' type='video' presence='0' format='video/x-h264' pass='0' variableframerate='0' />
<stream-profile parent='first_profile' id='1' type='audio' presence='0' format='audio/x-aac' />
</encoding-profile>
</encoding-profiles>
<resources>
<asset id="file:///test/not/exisiting"
extractable-type-name="GESUriClip"/>
</resources>
<timeline properties='properties, auto-transition=(boolean)false'>
<track track-type="2" caps="audio/x-raw" track-id="0"/>
<track track-type="4" caps="video/x-raw" track-id="1"/>
<layer priority="0" properties='properties, auto-transition=(boolean)false;' metadatas='metadatas, a=(guint)3'>
<clip id="0" layer-priority='0' asset-id="file:///test/not/exisiting" type-name="GESUriClip" track-types="6" start="0" duration="1000000000">
<effect asset-id='agingtv' clip-id='0' type-name='GESEffect' track-type='4' track-id='1' metadatas='metadatas;' children-properties='properties, scratch-lines=(uint)12;'/>
</clip>
</layer>
<layer priority="1" properties='properties, auto-transition=(boolean)false;'>
<clip id="1" asset-id="file:///test/not/exisiting" layer-priority="1"
type-name="GESUriClip" track-types="2" start="1000000000" duration="1000000000">
</clip>
</layer>
</timeline>
</project>
</ges>