subparse: Add unit test for LRC subtitles
authorSebastian Dröge <sebastian@centricular.com>
Wed, 18 Dec 2013 14:52:09 +0000 (15:52 +0100)
committerSebastian Dröge <sebastian@centricular.com>
Wed, 18 Dec 2013 14:52:53 +0000 (15:52 +0100)
tests/check/elements/subparse.c

index 3bc56d5..23e99b6 100644 (file)
@@ -797,6 +797,25 @@ GST_START_TEST (test_sami_comment)
 
 GST_END_TEST;
 
+GST_START_TEST (test_lrc)
+{
+  SubParseInputChunk lrc_input[] = {
+    {"[ar:123]\n" "[ti:Title]\n" "[al:Album]\n" "[00:02.23]Line 1\n",
+          2230 * GST_MSECOND, GST_CLOCK_TIME_NONE,
+        "Line 1"},
+    {"[00:05.10]Line 2\n",
+          5100 * GST_MSECOND, GST_CLOCK_TIME_NONE,
+        "Line 2"},
+    {"[00:06.123]Line 3\n",
+          6123 * GST_MSECOND, GST_CLOCK_TIME_NONE,
+        "Line 3"}
+  };
+
+  do_test (lrc_input, G_N_ELEMENTS (lrc_input), "utf8");
+}
+
+GST_END_TEST;
+
 /* TODO:
  *  - add/modify tests so that lines aren't dogfed to the parsers in complete
  *    lines or sets of complete lines, but rather in random chunks
@@ -830,6 +849,7 @@ subparse_suite (void)
   tcase_add_test (tc_chain, test_sami_html_entities);
   tcase_add_test (tc_chain, test_sami_bad_entities);
   tcase_add_test (tc_chain, test_sami_comment);
+  tcase_add_test (tc_chain, test_lrc);
   return s;
 }