structure: fix some more 0.11 fixmes

don't allow spaces in structure names and fix unit tests.
This commit is contained in:
Wim Taymans 2011-06-03 13:25:54 +02:00
parent f7acae0af5
commit 7b43f02ed3
2 changed files with 5 additions and 20 deletions

View file

@ -171,10 +171,9 @@ gst_structure_validate_name (const gchar * name)
return FALSE;
}
/* FIXME 0.11: don't allow spaces */
/* FIXME: test name string more */
s = &name[1];
while (*s && (g_ascii_isalnum (*s) || strchr ("/-_.:+ ", *s) != NULL))
while (*s && (g_ascii_isalnum (*s) || strchr ("/-_.:+", *s) != NULL))
s++;
if (G_UNLIKELY (*s != '\0')) {
GST_WARNING ("Invalid character '%c' at offset %lu in structure name: %s",

View file

@ -159,11 +159,9 @@ GST_START_TEST (test_from_string)
fail_unless_equals_int (g_value_get_boolean (val), TRUE);
gst_structure_free (structure);
/* This should still work for now (FIXME: 0.11) */
s = "0.10:decoder-video/mpeg, abc=(boolean)false";
structure = gst_structure_from_string (s, NULL);
fail_if (structure == NULL, "Could not get structure from string %s", s);
gst_structure_free (structure);
ASSERT_CRITICAL (structure = gst_structure_from_string (s, NULL));
fail_unless (structure == NULL, "Could not get structure from string %s", s);
/* make sure we bail out correctly in case of an error or if parsing fails */
s = "***foo***, abc=(boolean)false";
@ -188,22 +186,10 @@ GST_START_TEST (test_to_string)
ASSERT_CRITICAL (st1 = gst_structure_new ("Foo\nwith-newline", NULL));
fail_unless (st1 == NULL);
/* FIXME 0.11: re-enable this */
#if 0
ASSERT_CRITICAL (st1 = gst_structure_new ("Foo with whitespace", NULL));
fail_unless (st1 == NULL);
ASSERT_CRITICAL (st1 = gst_structure_new ("1st", NULL));
fail_unless (st1 == NULL);
#else
st1 = gst_structure_new ("Foo with whitespace is still allowed", NULL);
fail_unless (st1 != NULL);
gst_structure_free (st1);
/* structure names starting with a number are also still allowed */
st1 = gst_structure_new ("1st", NULL);
fail_unless (st1 != NULL);
gst_structure_free (st1);
#endif
}
GST_END_TEST;
@ -339,8 +325,8 @@ GST_START_TEST (test_structure_new)
g_error_free (e);
gst_structure_free (s);
/* This should still work for now (FIXME 0.11) */
gst_structure_free (gst_structure_new ("0.10:decoder-video/mpeg", NULL));
ASSERT_CRITICAL (gst_structure_free (gst_structure_new
("0.10:decoder-video/mpeg", NULL)));
/* make sure we bail out correctly in case of an error or if parsing fails */
ASSERT_CRITICAL (s = gst_structure_new ("^joo\nba\ndoo^",