summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2014-08-25 11:34:48 +0200
committerWim Taymans <wtaymans@redhat.com>2014-09-02 12:04:15 +0200
commit7e33f52961d0215d8be10657417e6889bf9cc518 (patch)
treed87f2e9e50b5c3c52ff4c65fbc460b3fc7c6cae8
parent060b16ac75ac227d4cfe1db89ccdc4f4b31545ff (diff)
tests: add flush-stop on inactive pad testwork
Check that pushing flush-stop on an inactive pad does not clear the flushing flag.
-rw-r--r--tests/check/gst/gstpad.c77
1 files changed, 77 insertions, 0 deletions
diff --git a/tests/check/gst/gstpad.c b/tests/check/gst/gstpad.c
index cf4586d4f..625fec07b 100644
--- a/tests/check/gst/gstpad.c
+++ b/tests/check/gst/gstpad.c
@@ -1976,6 +1976,82 @@ GST_START_TEST (test_last_flow_return_pull)
GST_END_TEST;
+GST_START_TEST (test_flush_stop_inactive)
+{
+ GstPad *sinkpad, *srcpad;
+
+ sinkpad = gst_pad_new ("sink", GST_PAD_SINK);
+ fail_unless (sinkpad != NULL);
+
+ /* new pads are inactive and flushing */
+ fail_if (GST_PAD_IS_ACTIVE (sinkpad));
+ fail_unless (GST_PAD_IS_FLUSHING (sinkpad));
+
+ /* this should fail, pad is inactive */
+ fail_if (gst_pad_send_event (sinkpad, gst_event_new_flush_stop (FALSE)));
+
+ /* nothing should have changed */
+ fail_if (GST_PAD_IS_ACTIVE (sinkpad));
+ fail_unless (GST_PAD_IS_FLUSHING (sinkpad));
+
+ gst_pad_set_active (sinkpad, TRUE);
+
+ /* pad is now active an not flushing anymore */
+ fail_unless (GST_PAD_IS_ACTIVE (sinkpad));
+ fail_if (GST_PAD_IS_FLUSHING (sinkpad));
+
+ /* do flush, does not deactivate the pad */
+ fail_unless (gst_pad_send_event (sinkpad, gst_event_new_flush_start ()));
+ fail_unless (GST_PAD_IS_ACTIVE (sinkpad));
+ fail_unless (GST_PAD_IS_FLUSHING (sinkpad));
+
+ fail_unless (gst_pad_send_event (sinkpad, gst_event_new_flush_stop (FALSE)));
+ fail_unless (GST_PAD_IS_ACTIVE (sinkpad));
+ fail_if (GST_PAD_IS_FLUSHING (sinkpad));
+
+ gst_pad_set_active (sinkpad, FALSE);
+ fail_if (GST_PAD_IS_ACTIVE (sinkpad));
+ fail_unless (GST_PAD_IS_FLUSHING (sinkpad));
+
+ gst_object_unref (sinkpad);
+
+ /* we should not be able to push on an inactive srcpad */
+ srcpad = gst_pad_new ("src", GST_PAD_SRC);
+ fail_unless (srcpad != NULL);
+
+ fail_if (GST_PAD_IS_ACTIVE (srcpad));
+ fail_unless (GST_PAD_IS_FLUSHING (srcpad));
+
+ fail_if (gst_pad_push_event (srcpad, gst_event_new_flush_stop (FALSE)));
+
+ /* should still be inactive and flushing */
+ fail_if (GST_PAD_IS_ACTIVE (srcpad));
+ fail_unless (GST_PAD_IS_FLUSHING (srcpad));
+
+ gst_pad_set_active (srcpad, TRUE);
+
+ /* pad is now active an not flushing anymore */
+ fail_unless (GST_PAD_IS_ACTIVE (srcpad));
+ fail_if (GST_PAD_IS_FLUSHING (srcpad));
+
+ /* do flush, does not deactivate the pad */
+ fail_if (gst_pad_push_event (srcpad, gst_event_new_flush_start ()));
+ fail_unless (GST_PAD_IS_ACTIVE (srcpad));
+ fail_unless (GST_PAD_IS_FLUSHING (srcpad));
+
+ fail_if (gst_pad_push_event (srcpad, gst_event_new_flush_stop (FALSE)));
+ fail_unless (GST_PAD_IS_ACTIVE (srcpad));
+ fail_if (GST_PAD_IS_FLUSHING (srcpad));
+
+ gst_pad_set_active (srcpad, FALSE);
+ fail_if (GST_PAD_IS_ACTIVE (srcpad));
+ fail_unless (GST_PAD_IS_FLUSHING (srcpad));
+
+ gst_object_unref (srcpad);
+}
+
+GST_END_TEST;
+
static Suite *
gst_pad_suite (void)
{
@@ -2021,6 +2097,7 @@ gst_pad_suite (void)
tcase_add_test (tc_chain, test_sticky_events);
tcase_add_test (tc_chain, test_last_flow_return_push);
tcase_add_test (tc_chain, test_last_flow_return_pull);
+ tcase_add_test (tc_chain, test_flush_stop_inactive);
return s;
}