uri: Add test for correct absolute URI handling in gst_uri_from_string_with_base()
authorSebastian Dröge <sebastian@centricular.com>
Wed, 16 Sep 2015 21:40:44 +0000 (23:40 +0200)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 25 Sep 2015 21:54:27 +0000 (23:54 +0200)
If the second parameter is an absolute URI, the base should have no effect and
the second parameter should be returned again.

https://bugzilla.gnome.org/show_bug.cgi?id=755134

tests/check/gst/gsturi.c

index 3d80098..4da6aba 100644 (file)
@@ -782,6 +782,20 @@ GST_START_TEST (test_url_constructors)
   g_free (tmp_str);
   gst_uri_unref (url2);
 
+  url2 = gst_uri_from_string_with_base (url1, "http://foobar.com/bla");
+  fail_unless_equals_string (gst_uri_get_scheme (url2), "http");
+  fail_unless_equals_string (gst_uri_get_host (url2), "foobar.com");
+  fail_unless (gst_uri_get_port (url2) == 0);
+  tmp_str = gst_uri_get_path (url2);
+  fail_unless_equals_string (tmp_str, "/bla");
+  g_free (tmp_str);
+  fail_unless (gst_uri_get_query_table (url2) == NULL);
+  fail_unless (gst_uri_get_fragment (url2) == NULL);
+  tmp_str = gst_uri_to_string (url2);
+  fail_unless_equals_string (tmp_str, "http://foobar.com/bla");
+  g_free (tmp_str);
+  gst_uri_unref (url2);
+
   url2 = gst_uri_copy (url1);
   fail_unless (gst_uri_equal (url1, url2));
   gst_uri_set_query_value (url2, "key", "value");