Oops, broke automatic string type parsing.
authorJan Schmidt <thaytan@mad.scientist.com>
Tue, 22 Nov 2005 13:14:51 +0000 (13:14 +0000)
committerJan Schmidt <thaytan@mad.scientist.com>
Tue, 22 Nov 2005 13:14:51 +0000 (13:14 +0000)
Original commit message from CVS:
* check/gst/gststructure.c: (GST_START_TEST):
* gst/gststructure.c: (gst_structure_parse_value):
Oops, broke automatic string type parsing.
Add a test to catch it in future.

ChangeLog
check/gst/gststructure.c
gst/gststructure.c
tests/check/gst/gststructure.c

index 5cfdfc1..00a115a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2005-11-22  Jan Schmidt  <thaytan@mad.scientist.com>
+
+       * check/gst/gststructure.c: (GST_START_TEST):
+       * gst/gststructure.c: (gst_structure_parse_value):
+        Oops, broke automatic string type parsing.
+       Add a test to catch it in future.
+
 2005-11-22  Andy Wingo  <wingo@pobox.com>
 
        * gst/gsttagsetter.c (gst_tag_setter_get_tag_merge_mode) 
index 60342be..e775de2 100644 (file)
@@ -99,6 +99,13 @@ GST_START_TEST (test_from_string)
   fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL);
   fail_unless (GST_VALUE_HOLDS_FRACTION (val));
   gst_structure_free (structure);
+
+  s = "test-string,value=bar";
+  structure = gst_structure_from_string (s, NULL);
+  fail_if (structure == NULL, "Could not get structure from string %s", s);
+  fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL);
+  fail_unless (G_VALUE_HOLDS_STRING (val));
+  gst_structure_free (structure);
 }
 
 GST_END_TEST;
index f09d817..84a8f97 100644 (file)
@@ -1637,7 +1637,7 @@ gst_structure_parse_value (gchar * str,
           { G_TYPE_INT, G_TYPE_DOUBLE, GST_TYPE_FRACTION, G_TYPE_STRING };
       int i;
 
-      for (i = 0; i < 3; i++) {
+      for (i = 0; i < 4; i++) {
         g_value_init (value, try_types[i]);
         ret = gst_value_deserialize (value, value_s);
         if (ret)
index 60342be..e775de2 100644 (file)
@@ -99,6 +99,13 @@ GST_START_TEST (test_from_string)
   fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL);
   fail_unless (GST_VALUE_HOLDS_FRACTION (val));
   gst_structure_free (structure);
+
+  s = "test-string,value=bar";
+  structure = gst_structure_from_string (s, NULL);
+  fail_if (structure == NULL, "Could not get structure from string %s", s);
+  fail_unless ((val = gst_structure_get_value (structure, "value")) != NULL);
+  fail_unless (G_VALUE_HOLDS_STRING (val));
+  gst_structure_free (structure);
 }
 
 GST_END_TEST;