mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +00:00
tests/filesrc: Set location in wrong state
Also remove incorrect comment about code possibly not being reachable that is now exercised by the filesrc unit test. https://bugzilla.gnome.org/show_bug.cgi?id=709831
This commit is contained in:
parent
75b7387f8b
commit
1479aba1cf
2 changed files with 25 additions and 1 deletions
|
@ -241,7 +241,7 @@ gst_file_src_set_location (GstFileSrc * src, const gchar * location)
|
|||
g_free (src->filename);
|
||||
g_free (src->uri);
|
||||
|
||||
/* clear the filename if we get a NULL (is that possible?) */
|
||||
/* clear the filename if we get a NULL */
|
||||
if (location == NULL) {
|
||||
src->filename = NULL;
|
||||
src->uri = NULL;
|
||||
|
|
|
@ -342,12 +342,17 @@ GST_START_TEST (test_uri_interface)
|
|||
GstElement *src;
|
||||
gchar *location;
|
||||
GstBus *bus;
|
||||
GstPad *pad;
|
||||
|
||||
src = setup_filesrc ();
|
||||
bus = gst_bus_new ();
|
||||
|
||||
gst_element_set_bus (src, bus);
|
||||
|
||||
g_object_set (G_OBJECT (src), "location", NULL, NULL);
|
||||
g_object_get (G_OBJECT (src), "location", &location, NULL);
|
||||
fail_unless (location == NULL);
|
||||
|
||||
g_object_set (G_OBJECT (src), "location", "/i/do/not/exist", NULL);
|
||||
g_object_get (G_OBJECT (src), "location", &location, NULL);
|
||||
fail_unless_equals_string (location, "/i/do/not/exist");
|
||||
|
@ -390,6 +395,25 @@ GST_START_TEST (test_uri_interface)
|
|||
fail_if (gst_uri_handler_set_uri (GST_URI_HANDLER (src),
|
||||
"file://hostname/foo/foo", NULL));
|
||||
|
||||
g_object_set (G_OBJECT (src), "location", TESTFILE, NULL);
|
||||
|
||||
pad = gst_element_get_static_pad (src, "src");
|
||||
fail_unless (pad != NULL);
|
||||
fail_unless (gst_pad_activate_mode (pad, GST_PAD_MODE_PULL, TRUE));
|
||||
gst_object_unref (pad);
|
||||
|
||||
fail_unless (gst_element_set_state (src,
|
||||
GST_STATE_PLAYING) == GST_STATE_CHANGE_SUCCESS,
|
||||
"could not set to playing");
|
||||
|
||||
ASSERT_WARNING (g_object_set (G_OBJECT (src), "location", "/wrong", NULL));
|
||||
g_object_get (G_OBJECT (src), "location", &location, NULL);
|
||||
fail_unless_equals_string (location, TESTFILE);
|
||||
g_free (location);
|
||||
|
||||
fail_unless (gst_element_set_state (src,
|
||||
GST_STATE_NULL) == GST_STATE_CHANGE_SUCCESS, "could not set to null");
|
||||
|
||||
/* cleanup */
|
||||
gst_element_set_bus (src, NULL);
|
||||
gst_object_unref (GST_OBJECT (bus));
|
||||
|
|
Loading…
Reference in a new issue