summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMathieu Duponchelle <seeed@laposte.net>2011-08-28 03:56:26 +0200
committerThibault Saunier <thibault.saunier@collabora.com>2012-01-11 11:56:14 -0300
commitc210650256f4d4893c6430699b918de8c02fb818 (patch)
tree93f5bcb262d881dea54a88bad6bd418950a0c51a
parentc7a984824fb6023cbbaee5830e7ea4e5ebc4284e (diff)
test: Add a pitivi formatter test
For now we requiere a project files and media files to be on the host system, this is not optimal and we should rework that in the future.
-rw-r--r--tests/check/ges/save_and_load.c56
1 files changed, 54 insertions, 2 deletions
diff --git a/tests/check/ges/save_and_load.c b/tests/check/ges/save_and_load.c
index 4cd5f99f..bd7cbd7a 100644
--- a/tests/check/ges/save_and_load.c
+++ b/tests/check/ges/save_and_load.c
@@ -20,6 +20,8 @@
#include <ges/ges.h>
#include <gst/check/gstcheck.h>
#include <string.h>
+#include <unistd.h>
+#define GetCurrentDir getcwd
#define KEY_FILE_START {\
if (cmp) g_key_file_free (cmp);\
@@ -631,6 +633,53 @@ GST_START_TEST (test_keyfile_load)
GST_END_TEST;
+GST_START_TEST (test_pitivi_file_load)
+{
+ GESFormatter *formatter;
+ GESTimeline *timeline, *expected;
+ GMainLoop *mainloop;
+ char cCurrentPath[FILENAME_MAX];
+ char *a;
+ gchar *uri, *save_uri;
+
+ /*create the expected timeline */
+ timeline = ges_timeline_new ();
+ mainloop = g_main_loop_new (NULL, FALSE);
+ expected = ges_timeline_new ();
+
+ /* create the timeline from formatter */
+ formatter = GES_FORMATTER (ges_pitivi_formatter_new ());
+ a = GetCurrentDir (cCurrentPath, sizeof (cCurrentPath));
+ uri = g_strconcat (a, "/test.xptv", NULL);
+ save_uri = g_strconcat (a, "/testsave.xptv", NULL);
+ if (g_file_test (uri, G_FILE_TEST_EXISTS) == FALSE) {
+ GST_ERROR ("Could not test GESPitiviFormatter as no project file found");
+ return;
+ }
+
+ ges_formatter_load_from_uri (formatter, timeline, uri);
+ g_timeout_add (1000, (GSourceFunc) g_main_loop_quit, mainloop);
+ g_main_loop_run (mainloop);
+ printf ("saloperie\n");
+ formatter = GES_FORMATTER (ges_pitivi_formatter_new ());
+ ges_formatter_save_to_uri (formatter, timeline, save_uri);
+ formatter = GES_FORMATTER (ges_pitivi_formatter_new ());
+ ges_formatter_load_from_uri (formatter, expected, uri);
+ g_timeout_add (1000, (GSourceFunc) g_main_loop_quit, mainloop);
+ g_main_loop_run (mainloop);
+
+ /* compare the two timelines and fail test if they are different */
+ TIMELINE_COMPARE (expected, timeline);
+ g_free (uri);
+ g_free (save_uri);
+ g_main_loop_unref (mainloop);
+ g_object_unref (formatter);
+ g_object_unref (timeline);
+ g_object_unref (expected);
+}
+
+GST_END_TEST;
+
GST_START_TEST (test_keyfile_identity)
{
@@ -683,9 +732,11 @@ GST_START_TEST (test_keyfile_identity)
"freq", (gdouble) 600,
"volume", 1.0, "vpattern", GES_VIDEO_TEST_PATTERN_RED);
- } LAYER_END;
+ }
+ LAYER_END;
- } TIMELINE_END;
+ }
+ TIMELINE_END;
serialized = ges_timeline_new ();
@@ -712,6 +763,7 @@ ges_suite (void)
tcase_add_test (tc_chain, test_keyfile_save);
tcase_add_test (tc_chain, test_keyfile_load);
tcase_add_test (tc_chain, test_keyfile_identity);
+ tcase_add_test (tc_chain, test_pitivi_file_load);
return s;
}