Commit 0b5e203b authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

tests: add unit test for basetransform/videoscale negotiation regression

Turn Rene's test pipeline into a unit test.

https://bugzilla.gnome.org/show_bug.cgi?id=648220
parent d9f1b373
......@@ -650,12 +650,8 @@ static void
gst_test_reverse_negotiation_sink_class_init (GstTestReverseNegotiationSinkClass
* klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstBaseSinkClass *gstbase_sink_class;
gobject_class = G_OBJECT_CLASS (klass);
gstelement_class = GST_ELEMENT_CLASS (klass);
gstbase_sink_class = GST_BASE_SINK_CLASS (klass);
gstbase_sink_class->buffer_alloc =
......@@ -764,6 +760,56 @@ GST_START_TEST (test_reverse_negotiation)
GST_END_TEST;
GST_START_TEST (test_basetransform_negotiation)
{
GstElement *pipeline, *src, *sink, *scale, *capsfilter1, *capsfilter2;
GstMessage *msg;
GstCaps *caps;
pipeline = gst_pipeline_new (NULL);
src = gst_element_factory_make ("videotestsrc", NULL);
capsfilter1 = gst_element_factory_make ("capsfilter", NULL);
scale = gst_element_factory_make ("videoscale", NULL);
capsfilter2 = gst_element_factory_make ("capsfilter", NULL);
sink = gst_element_factory_make ("fakesink", NULL);
fail_unless (pipeline && src && capsfilter1 && scale && capsfilter2 && sink);
g_object_set (src, "num-buffers", 3, NULL);
caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
"height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 1, 1, NULL);
g_object_set (capsfilter1, "caps", caps, NULL);
gst_caps_unref (caps);
/* same caps, just different pixel-aspect-ratio */
caps = gst_caps_new_simple ("video/x-raw-yuv", "format", GST_TYPE_FOURCC,
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), "width", G_TYPE_INT, 352,
"height", G_TYPE_INT, 288, "framerate", GST_TYPE_FRACTION, 30, 1,
"pixel-aspect-ratio", GST_TYPE_FRACTION, 12, 11, NULL);
g_object_set (capsfilter2, "caps", caps, NULL);
gst_caps_unref (caps);
gst_bin_add_many (GST_BIN (pipeline), src, capsfilter1, scale, capsfilter2,
sink, NULL);
fail_unless (gst_element_link_many (src, capsfilter1, scale, capsfilter2,
sink, NULL));
fail_unless_equals_int (gst_element_set_state (pipeline, GST_STATE_PLAYING),
GST_STATE_CHANGE_ASYNC);
msg = gst_bus_timed_pop_filtered (GST_ELEMENT_BUS (pipeline), -1,
GST_MESSAGE_EOS | GST_MESSAGE_ERROR);
fail_unless_equals_int (GST_MESSAGE_TYPE (msg), GST_MESSAGE_EOS);
gst_message_unref (msg);
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (pipeline);
}
GST_END_TEST;
static Suite *
videoscale_suite (void)
{
......@@ -811,6 +857,7 @@ videoscale_suite (void)
tcase_add_test (tc_chain, test_upscale_1x240_640x480_method_2);
tcase_add_test (tc_chain, test_negotiation);
tcase_add_test (tc_chain, test_reverse_negotiation);
tcase_add_test (tc_chain, test_basetransform_negotiation);
GST_ERROR ("FIXME: test 64-bpp formats as well");
return s;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment