mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-18 14:26:43 +00:00
tests: playbin: add test for new "element-setup" signal
https://bugzilla.gnome.org/show_bug.cgi?id=578933
This commit is contained in:
parent
7c2cabd407
commit
ece702920f
1 changed files with 55 additions and 1 deletions
|
@ -523,7 +523,7 @@ GST_START_TEST (test_source_setup)
|
|||
GstElement *src = NULL;
|
||||
|
||||
if (!gst_registry_check_feature_version (gst_registry_get (), "redvideosrc",
|
||||
0, 10, 0)) {
|
||||
GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)) {
|
||||
fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
|
||||
gst_red_video_src_get_type ()));
|
||||
}
|
||||
|
@ -553,6 +553,59 @@ GST_START_TEST (test_source_setup)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
static void
|
||||
element_setup (GstElement * playbin, GstElement * element, GQueue * elts)
|
||||
{
|
||||
GstElementFactory *f = gst_element_get_factory (element);
|
||||
|
||||
g_queue_push_tail (elts, f ? GST_OBJECT_NAME (f) : GST_OBJECT_NAME (element));
|
||||
}
|
||||
|
||||
GST_START_TEST (test_element_setup)
|
||||
{
|
||||
GstElement *playbin, *videosink;
|
||||
GQueue elts = G_QUEUE_INIT;
|
||||
|
||||
if (!gst_registry_check_feature_version (gst_registry_get (), "redvideosrc",
|
||||
GST_VERSION_MAJOR, GST_VERSION_MINOR, 0)) {
|
||||
fail_unless (gst_element_register (NULL, "redvideosrc", GST_RANK_PRIMARY,
|
||||
gst_red_video_src_get_type ()));
|
||||
}
|
||||
|
||||
playbin = gst_element_factory_make ("playbin", NULL);
|
||||
g_object_set (playbin, "uri", "redvideo://", NULL);
|
||||
|
||||
videosink = gst_element_factory_make ("fakesink", "myvideosink");
|
||||
g_object_set (playbin, "video-sink", videosink, NULL);
|
||||
|
||||
g_signal_connect (playbin, "element-setup", G_CALLBACK (element_setup),
|
||||
&elts);
|
||||
|
||||
fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_PAUSED),
|
||||
GST_STATE_CHANGE_ASYNC);
|
||||
fail_unless_equals_int (gst_element_get_state (playbin, NULL, NULL,
|
||||
GST_CLOCK_TIME_NONE), GST_STATE_CHANGE_SUCCESS);
|
||||
|
||||
#define seen_element(e) g_queue_find_custom(&elts, e, (GCompareFunc) strcmp)
|
||||
|
||||
fail_unless (seen_element ("redvideosrc"));
|
||||
fail_unless (seen_element ("uridecodebin"));
|
||||
fail_unless (seen_element ("videoconvert"));
|
||||
fail_unless (seen_element ("videoscale"));
|
||||
fail_unless (seen_element ("fakesink"));
|
||||
|
||||
#undef seen_element
|
||||
|
||||
g_queue_clear (&elts);
|
||||
|
||||
fail_unless_equals_int (gst_element_set_state (playbin, GST_STATE_NULL),
|
||||
GST_STATE_CHANGE_SUCCESS);
|
||||
|
||||
gst_object_unref (playbin);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
/*** redvideo:// source ***/
|
||||
|
||||
static GstURIType
|
||||
|
@ -849,6 +902,7 @@ playbin_suite (void)
|
|||
tcase_add_test (tc_chain, test_missing_primary_decoder);
|
||||
tcase_add_test (tc_chain, test_refcount);
|
||||
tcase_add_test (tc_chain, test_source_setup);
|
||||
tcase_add_test (tc_chain, test_element_setup);
|
||||
|
||||
#if 0
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue