tests: Test caps using query

Sending an event can accepted event if the caps were rejected
because the event could be queued and processed later.

Also send a drain query in the caps test to make sure that the
event has been processed.

https://bugzilla.gnome.org/show_bug.cgi?id=781673
This commit is contained in:
Olivier Crête 2016-07-06 17:28:11 -04:00
parent c483cbf904
commit cbafb022aa

View file

@ -385,6 +385,7 @@ GST_START_TEST (test_caps_query_interlaced)
GstCaps *caps;
GstCaps *caps_mixed, *caps_progressive, *caps_interleaved;
GstEvent *caps_event;
GstQuery *drain;
caps_interleaved =
gst_caps_from_string ("video/x-raw, interlace-mode=interleaved");
@ -420,6 +421,11 @@ GST_START_TEST (test_caps_query_interlaced)
gst_caps_unref (caps);
fail_unless (gst_pad_send_event (sinkpad, caps_event));
/* Send drain query to make sure this is processed */
drain = gst_query_new_drain ();
gst_pad_query (sinkpad, drain);
gst_query_unref (drain);
/* now recheck the interlace-mode */
gst_object_unref (sinkpad);
sinkpad = gst_element_get_request_pad (compositor, "sink_%u");
@ -565,7 +571,6 @@ run_late_caps_set_test (GstCaps * first_caps, GstCaps * expected_query_caps,
GstStateChangeReturn state_res;
GstPad *sinkpad_2;
GstCaps *caps;
GstEvent *caps_event;
GstBus *bus;
GstMessage *msg;
@ -596,8 +601,9 @@ run_late_caps_set_test (GstCaps * first_caps, GstCaps * expected_query_caps,
sinkpad_2 = gst_element_get_request_pad (compositor, "sink_%u");
caps = gst_pad_query_caps (sinkpad_2, NULL);
fail_unless (gst_caps_is_subset (expected_query_caps, caps));
caps_event = gst_event_new_caps (second_caps);
fail_unless (gst_pad_send_event (sinkpad_2, caps_event) == accept_caps);
gst_caps_unref (caps);
caps = gst_pad_query_caps (sinkpad_2, second_caps);
fail_unless (gst_caps_is_empty (caps) != accept_caps);
gst_caps_unref (caps);
gst_object_unref (sinkpad_2);