summaryrefslogtreecommitdiff
path: root/tests/check/elements/subparse.c
diff options
context:
space:
mode:
authorYoung-Ho Cha <ganadist@gmail.com>2013-05-28 16:56:28 +0900
committerTim-Philipp Müller <tim@centricular.net>2013-07-16 18:10:37 +0100
commit6cea51c9623e6df6da3b3a9918ca250cd3d81ae1 (patch)
tree3fdc9eb42034da4b5195ce17743983795b611204 /tests/check/elements/subparse.c
parentf597efe24b010bf50ea7f7ebcae92fb293df3167 (diff)
tests: update sami parser testcases
Remove libxml dependency for sami parser and add more testcases. https://bugzilla.gnome.org/show_bug.cgi?id=693056
Diffstat (limited to 'tests/check/elements/subparse.c')
-rw-r--r--tests/check/elements/subparse.c75
1 files changed, 71 insertions, 4 deletions
diff --git a/tests/check/elements/subparse.c b/tests/check/elements/subparse.c
index 8e3a999d9..0651eabd5 100644
--- a/tests/check/elements/subparse.c
+++ b/tests/check/elements/subparse.c
@@ -667,7 +667,6 @@ GST_START_TEST (test_dks)
GST_END_TEST;
-#ifndef GST_DISABLE_XML
GST_START_TEST (test_sami)
{
SubParseInputChunk sami_input[] = {
@@ -703,7 +702,74 @@ GST_START_TEST (test_sami)
}
GST_END_TEST;
-#endif
+
+GST_START_TEST (test_sami_xml_entities)
+{
+ SubParseInputChunk sami_input[] = {
+ {"<SAMI>\n"
+ "<BODY>\n"
+ " <SYNC Start=1000>\n"
+ " <P Class=CC>\n" " &lt;Hello&gt; &amp;\n",
+ 1000 * GST_MSECOND, 2000 * GST_MSECOND,
+ "&lt;Hello&gt; &amp;"},
+ {" <SYNC Start=2000>\n"
+ " <P Class=CC>\n"
+ " &quot;World&apos;\n" "</BODY>\n" "</SAMI>\n",
+ 2000 * GST_MSECOND, GST_CLOCK_TIME_NONE,
+ "&quot;World&apos;"}
+
+ };
+
+ do_test (sami_input, G_N_ELEMENTS (sami_input), "pango-markup");
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_sami_html_entities)
+{
+ SubParseInputChunk sami_input[] = {
+ {"<SAMI>\n"
+ "<BODY>\n"
+ " <SYNC Start=1000>\n"
+ " <P Class=CC>\n" " &nbsp; &plusmn; &acute;\n",
+ 1000 * GST_MSECOND, 2000 * GST_MSECOND,
+ "\xc2\xa0 \xc2\xb1 \xc2\xb4"},
+ {" <SYNC Start=2000>\n"
+ " <P Class=CC>\n" " &Alpha; &omega;\n",
+ 2000 * GST_MSECOND, 3000 * GST_MSECOND,
+ "\xce\x91 \xcf\x89"},
+ {" <SYNC Start=3000>\n"
+ " <P Class=CC>\n"
+ " &#xa0; &#177; &#180;\n" "</BODY>\n" "</SAMI>\n",
+ 3000 * GST_MSECOND, GST_CLOCK_TIME_NONE,
+ "\xc2\xa0 \xc2\xb1 \xc2\xb4"}
+ };
+
+ do_test (sami_input, G_N_ELEMENTS (sami_input), "pango-markup");
+}
+
+GST_END_TEST;
+
+GST_START_TEST (test_sami_bad_entities)
+{
+ SubParseInputChunk sami_input[] = {
+ {"<SAMI>\n"
+ "<BODY>\n"
+ " <SYNC Start=1000>\n"
+ " <P Class=CC>\n" " &nbsp &\n",
+ 1000 * GST_MSECOND, 2000 * GST_MSECOND,
+ "\xc2\xa0 &amp;"},
+ {" <SYNC Start=2000>\n"
+ " <P Class=CC>\n"
+ " &#xa0 &#177 &#180;\n" "</BODY>\n" "</SAMI>\n",
+ 2000 * GST_MSECOND, GST_CLOCK_TIME_NONE,
+ "\xc2\xa0 \xc2\xb1 \xc2\xb4"}
+ };
+
+ do_test (sami_input, G_N_ELEMENTS (sami_input), "pango-markup");
+}
+
+GST_END_TEST;
/* TODO:
* - add/modify tests so that lines aren't dogfed to the parsers in complete
@@ -733,9 +799,10 @@ subparse_suite (void)
tcase_add_test (tc_chain, test_subviewer);
tcase_add_test (tc_chain, test_subviewer2);
tcase_add_test (tc_chain, test_dks);
-#ifndef GST_DISABLE_XML
tcase_add_test (tc_chain, test_sami);
-#endif
+ tcase_add_test (tc_chain, test_sami_xml_entities);
+ tcase_add_test (tc_chain, test_sami_html_entities);
+ tcase_add_test (tc_chain, test_sami_bad_entities);
return s;
}