2008-05-03 Tim-Philipp Müller <tim.muller at collabora co uk>
+ * tests/check/elements/subparse.c: (do_test),
+ (test_tmplayer_style3b), (subparse_suite):
+ Add unit test for the tmplayer variant from bug #530962.
+
+2008-05-03 Tim-Philipp Müller <tim.muller at collabora co uk>
+
* gst/subparse/gstsubparse.c: (handle_buffer),
(gst_sub_parse_sink_event):
* gst/subparse/tmplayerparse.c: (tmplayer_process_buffer),
/* GStreamer unit tests for subparse
- *
- * Copyright (C) 2006 Tim-Philipp Müller <tim centricular net>
+ * Copyright (C) 2006-2008 Tim-Philipp Müller <tim centricular net>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
buf = g_list_nth_data (buffers, n);
fail_unless (buf != NULL);
+
+ /* check timestamp */
fail_unless (GST_BUFFER_TIMESTAMP_IS_VALID (buf), NULL);
- fail_unless (GST_BUFFER_DURATION_IS_VALID (buf), NULL);
fail_unless_equals_uint64 (GST_BUFFER_TIMESTAMP (buf), input[n].from_ts);
- fail_unless_equals_uint64 (GST_BUFFER_DURATION (buf),
- input[n].to_ts - input[n].from_ts);
+
+ /* might not be able to put a duration on the last buffer */
+ if (input[n].to_ts != GST_CLOCK_TIME_NONE) {
+ /* check duration */
+ fail_unless (GST_BUFFER_DURATION_IS_VALID (buf), NULL);
+ fail_unless_equals_uint64 (GST_BUFFER_DURATION (buf),
+ input[n].to_ts - input[n].from_ts);
+ }
+
out = (gchar *) GST_BUFFER_DATA (buf);
out_size = GST_BUFFER_SIZE (buf);
/* shouldn't have trailing newline characters */
GST_END_TEST;
+GST_START_TEST (test_tmplayer_style3b)
+{
+ static SubParseInputChunk tmplayer_style3b_input[] = {
+ {
+ "0:00:10:This is the Earth at a time|when the dinosaurs roamed...\n",
+ 10 * GST_SECOND, 14 * GST_SECOND,
+ "This is the Earth at a time\nwhen the dinosaurs roamed..."}, {
+ "0:00:14:a lush and fertile planet.\n",
+ 14 * GST_SECOND, 16 * GST_SECOND,
+ "a lush and fertile planet."}, {
+ "0:00:16:Yet another line.",
+ 16 * GST_SECOND, GST_CLOCK_TIME_NONE, "Yet another line."}
+ };
+
+ test_tmplayer_do_test (tmplayer_style3b_input,
+ G_N_ELEMENTS (tmplayer_style3b_input));
+}
+
+GST_END_TEST;
+
GST_START_TEST (test_tmplayer_style4)
{
static SubParseInputChunk tmplayer_style4_input[] = {
tcase_add_test (tc_chain, test_tmplayer_style1);
tcase_add_test (tc_chain, test_tmplayer_style2);
tcase_add_test (tc_chain, test_tmplayer_style3);
+ tcase_add_test (tc_chain, test_tmplayer_style3b);
tcase_add_test (tc_chain, test_tmplayer_style4);
tcase_add_test (tc_chain, test_tmplayer_style4_with_bogus_lines);
tcase_add_test (tc_chain, test_microdvd_with_fps);