mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 06:46:38 +00:00
check/gst/capslist.h: Comment test cases
Original commit message from CVS: * check/gst/capslist.h: Comment test cases * check/gst/gststructure.c: (GST_START_TEST), (gst_structure_suite): Test automatic value type detection in gst_structure_from_string. * gst/gststructure.c: (gst_structure_parse_value): Add fraction as a type we try and guess automatically in caps/structure strings.
This commit is contained in:
parent
861fb1c115
commit
32538f9ed2
6 changed files with 83 additions and 1 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2005-11-22 Jan Schmidt <thaytan@mad.scientist.com>
|
||||
|
||||
* check/gst/capslist.h:
|
||||
Comment test cases
|
||||
* check/gst/gststructure.c: (GST_START_TEST),
|
||||
(gst_structure_suite):
|
||||
Test automatic value type detection in gst_structure_from_string.
|
||||
* gst/gststructure.c: (gst_structure_parse_value):
|
||||
Add fraction as a type we try and guess automatically in
|
||||
caps/structure strings.
|
||||
|
||||
2005-11-22 Andy Wingo <wingo@pobox.com>
|
||||
|
||||
patch by: Torsten Schoenfeld <kaffeetisch gmx de>
|
||||
|
|
|
@ -15,11 +15,14 @@ static const gchar *caps_list[] = {
|
|||
"video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0x000000FF, framerate = (double) [ 0, max ]",
|
||||
"video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0xFF000000, framerate = (double) [ 0, max ]",
|
||||
"video/x-raw-rgb,\\ bpp=(int)32",
|
||||
/* Test fraction type */
|
||||
"test/gst-fraction, fraction = (fraction) 1/8",
|
||||
"test/gst-fraction, fraction = (fraction) MIN",
|
||||
"test/gst-fraction, fraction = (fraction) MAX",
|
||||
/* Test fraction range */
|
||||
"test/gst-fraction-range, fraction = (fraction) [ 1/3, 1/4 ]",
|
||||
"test/gst-fraction-range, fraction = (fraction) [ MIN, MAX ]",
|
||||
/* Test lists of fractions and fraction ranges */
|
||||
"test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], 1/8 }",
|
||||
"test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], [ 1/8, 2/8 ] }",
|
||||
"ANY",
|
||||
|
|
|
@ -72,6 +72,37 @@ GST_START_TEST (test_from_string_int)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
/* Test type conversions from string */
|
||||
GST_START_TEST (test_from_string)
|
||||
{
|
||||
GstStructure *structure;
|
||||
const gchar *s;
|
||||
const GValue *val;
|
||||
|
||||
s = "test-string,value=1";
|
||||
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_INT (val));
|
||||
gst_structure_free (structure);
|
||||
|
||||
s = "test-string,value=1.0";
|
||||
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_DOUBLE (val));
|
||||
gst_structure_free (structure);
|
||||
|
||||
s = "test-string,value=1/1";
|
||||
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 (GST_VALUE_HOLDS_FRACTION (val));
|
||||
gst_structure_free (structure);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
Suite *
|
||||
gst_value_suite (void)
|
||||
{
|
||||
|
@ -110,6 +141,7 @@ gst_structure_suite (void)
|
|||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_test (tc_chain, test_from_string_int);
|
||||
tcase_add_test (tc_chain, test_from_string);
|
||||
tcase_add_test (tc_chain, test_structure_new);
|
||||
return s;
|
||||
}
|
||||
|
|
|
@ -1633,7 +1633,8 @@ gst_structure_parse_value (gchar * str,
|
|||
c = *value_end;
|
||||
*value_end = 0;
|
||||
if (type == G_TYPE_INVALID) {
|
||||
GType try_types[] = { G_TYPE_INT, G_TYPE_DOUBLE, G_TYPE_STRING };
|
||||
GType try_types[] =
|
||||
{ G_TYPE_INT, G_TYPE_DOUBLE, GST_TYPE_FRACTION, G_TYPE_STRING };
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
|
|
|
@ -15,11 +15,14 @@ static const gchar *caps_list[] = {
|
|||
"video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0x000000FF, framerate = (double) [ 0, max ]",
|
||||
"video/x-raw-rgb, bpp = (int) 32, depth = (int) 24, endianness = (int) BIG_ENDIAN, red_mask = (int) 0xFF000000, framerate = (double) [ 0, max ]",
|
||||
"video/x-raw-rgb,\\ bpp=(int)32",
|
||||
/* Test fraction type */
|
||||
"test/gst-fraction, fraction = (fraction) 1/8",
|
||||
"test/gst-fraction, fraction = (fraction) MIN",
|
||||
"test/gst-fraction, fraction = (fraction) MAX",
|
||||
/* Test fraction range */
|
||||
"test/gst-fraction-range, fraction = (fraction) [ 1/3, 1/4 ]",
|
||||
"test/gst-fraction-range, fraction = (fraction) [ MIN, MAX ]",
|
||||
/* Test lists of fractions and fraction ranges */
|
||||
"test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], 1/8 }",
|
||||
"test/gst-fraction-range, fraction = (fraction) { [ 1/3, 1/4 ], [ 1/8, 2/8 ] }",
|
||||
"ANY",
|
||||
|
|
|
@ -72,6 +72,37 @@ GST_START_TEST (test_from_string_int)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
/* Test type conversions from string */
|
||||
GST_START_TEST (test_from_string)
|
||||
{
|
||||
GstStructure *structure;
|
||||
const gchar *s;
|
||||
const GValue *val;
|
||||
|
||||
s = "test-string,value=1";
|
||||
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_INT (val));
|
||||
gst_structure_free (structure);
|
||||
|
||||
s = "test-string,value=1.0";
|
||||
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_DOUBLE (val));
|
||||
gst_structure_free (structure);
|
||||
|
||||
s = "test-string,value=1/1";
|
||||
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 (GST_VALUE_HOLDS_FRACTION (val));
|
||||
gst_structure_free (structure);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
Suite *
|
||||
gst_value_suite (void)
|
||||
{
|
||||
|
@ -110,6 +141,7 @@ gst_structure_suite (void)
|
|||
|
||||
suite_add_tcase (s, tc_chain);
|
||||
tcase_add_test (tc_chain, test_from_string_int);
|
||||
tcase_add_test (tc_chain, test_from_string);
|
||||
tcase_add_test (tc_chain, test_structure_new);
|
||||
return s;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue