From 4a5aa8dba03549cfc806ff2a1080b671fd86d4ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Thu, 11 Jan 2018 14:56:42 +0000 Subject: [PATCH] tests: filesrc: fix for windows Location paths have backslashes on windows when converted from URI. --- tests/check/elements/filesrc.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/tests/check/elements/filesrc.c b/tests/check/elements/filesrc.c index fd42284049..ead87aab1e 100644 --- a/tests/check/elements/filesrc.c +++ b/tests/check/elements/filesrc.c @@ -367,26 +367,45 @@ GST_START_TEST (test_uri_interface) fail_unless_equals_string (location, "file:///i/do/not/exist"); g_free (location); +#define DSEP G_DIR_SEPARATOR_S + /* should accept file:///foo/bar URIs */ fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (src), "file:///foo/bar", NULL)); location = gst_uri_handler_get_uri (GST_URI_HANDLER (src)); fail_unless_equals_string (location, "file:///foo/bar"); g_free (location); + location = NULL; g_object_get (G_OBJECT (src), "location", &location, NULL); - fail_unless_equals_string (location, "/foo/bar"); + fail_unless_equals_string (location, DSEP "foo" DSEP "bar"); g_free (location); +#ifdef G_OS_WIN32 + /* should accept file:///c:/foo/bar.txt URIs */ + fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (src), + "file://c:/foo/bar", NULL)); + location = gst_uri_handler_get_uri (GST_URI_HANDLER (src)); + fail_unless_equals_string (location, "file://c:/foo/bar"); + g_free (location); + location = NULL; + g_object_get (G_OBJECT (src), "location", &location, NULL); + fail_unless_equals_string (location, "c:" DSEP "foo" DSEP "bar"); + g_free (location); +#endif + /* should accept file://localhost/foo/bar URIs */ fail_unless (gst_uri_handler_set_uri (GST_URI_HANDLER (src), "file://localhost/foo/baz", NULL)); location = gst_uri_handler_get_uri (GST_URI_HANDLER (src)); fail_unless_equals_string (location, "file:///foo/baz"); g_free (location); + location = NULL; g_object_get (G_OBJECT (src), "location", &location, NULL); - fail_unless_equals_string (location, "/foo/baz"); + fail_unless_equals_string (location, DSEP "foo" DSEP "baz"); g_free (location); +#undef DSEP + /* should escape non-uri characters for the URI but not for the location */ g_object_set (G_OBJECT (src), "location", "/foo/b?r", NULL); g_object_get (G_OBJECT (src), "location", &location, NULL);