mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-09-02 02:03:54 +00:00
gst/parse/grammar.y: Remove unneeded value unset.
Original commit message from CVS: * gst/parse/grammar.y: Remove unneeded value unset. * tests/check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite): Add unit test for de/serialization of caps.
This commit is contained in:
parent
65715dbc66
commit
363148faf4
3 changed files with 51 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
||||||
|
2008-05-14 Wim Taymans <wim.taymans@collabora.co.uk>
|
||||||
|
|
||||||
|
* gst/parse/grammar.y:
|
||||||
|
Remove unneeded value unset.
|
||||||
|
|
||||||
|
* tests/check/gst/gstvalue.c: (GST_START_TEST), (gst_value_suite):
|
||||||
|
Add unit test for de/serialization of caps.
|
||||||
|
|
||||||
2008-05-13 Sebastian Dröge <slomo@circular-chaos.org>
|
2008-05-13 Sebastian Dröge <slomo@circular-chaos.org>
|
||||||
|
|
||||||
* plugins/elements/gstfakesink.c:
|
* plugins/elements/gstfakesink.c:
|
||||||
|
|
|
@ -339,7 +339,6 @@ gst_parse_element_set (gchar *value, GstElement *element, graph_t *graph)
|
||||||
if (!gst_value_deserialize (&v, pos))
|
if (!gst_value_deserialize (&v, pos))
|
||||||
goto error;
|
goto error;
|
||||||
g_object_set_property (G_OBJECT (target), pspec->name, &v);
|
g_object_set_property (G_OBJECT (target), pspec->name, &v);
|
||||||
g_value_unset (&v);
|
|
||||||
} else {
|
} else {
|
||||||
/* do a delayed set */
|
/* do a delayed set */
|
||||||
if (GST_IS_CHILD_PROXY (element)) {
|
if (GST_IS_CHILD_PROXY (element)) {
|
||||||
|
|
|
@ -1657,6 +1657,48 @@ GST_START_TEST (test_serialize_deserialize_format_enum)
|
||||||
|
|
||||||
GST_END_TEST;
|
GST_END_TEST;
|
||||||
|
|
||||||
|
GST_START_TEST (test_serialize_deserialize_caps)
|
||||||
|
{
|
||||||
|
GValue value = { 0 }, value2 = {
|
||||||
|
0};
|
||||||
|
GstCaps *caps, *caps2;
|
||||||
|
gchar *serialized;
|
||||||
|
|
||||||
|
caps = gst_caps_new_simple ("test/caps",
|
||||||
|
"foo", G_TYPE_INT, 10, "bar", G_TYPE_STRING, "test", NULL);
|
||||||
|
fail_if (GST_CAPS_REFCOUNT_VALUE (caps) != 1);
|
||||||
|
|
||||||
|
/* and assign caps to gvalue */
|
||||||
|
g_value_init (&value, GST_TYPE_CAPS);
|
||||||
|
g_value_take_boxed (&value, caps);
|
||||||
|
fail_if (GST_CAPS_REFCOUNT_VALUE (caps) != 1);
|
||||||
|
|
||||||
|
/* now serialize it */
|
||||||
|
serialized = gst_value_serialize (&value);
|
||||||
|
GST_DEBUG ("serialized caps to %s", serialized);
|
||||||
|
fail_unless (serialized != NULL);
|
||||||
|
|
||||||
|
/* refcount should not change */
|
||||||
|
fail_if (GST_CAPS_REFCOUNT_VALUE (caps) != 1);
|
||||||
|
|
||||||
|
/* now deserialize again */
|
||||||
|
g_value_init (&value2, GST_TYPE_CAPS);
|
||||||
|
gst_value_deserialize (&value2, serialized);
|
||||||
|
|
||||||
|
caps2 = g_value_get_boxed (&value2);
|
||||||
|
fail_if (GST_CAPS_REFCOUNT_VALUE (caps2) != 1);
|
||||||
|
|
||||||
|
/* they should be equal */
|
||||||
|
fail_unless (gst_caps_is_equal (caps, caps2));
|
||||||
|
|
||||||
|
/* cleanup */
|
||||||
|
g_value_unset (&value);
|
||||||
|
g_value_unset (&value2);
|
||||||
|
g_free (serialized);
|
||||||
|
}
|
||||||
|
|
||||||
|
GST_END_TEST;
|
||||||
|
|
||||||
static Suite *
|
static Suite *
|
||||||
gst_value_suite (void)
|
gst_value_suite (void)
|
||||||
{
|
{
|
||||||
|
@ -1686,6 +1728,7 @@ gst_value_suite (void)
|
||||||
tcase_add_test (tc_chain, test_value_subtract_fraction_range);
|
tcase_add_test (tc_chain, test_value_subtract_fraction_range);
|
||||||
tcase_add_test (tc_chain, test_date);
|
tcase_add_test (tc_chain, test_date);
|
||||||
tcase_add_test (tc_chain, test_fraction_range);
|
tcase_add_test (tc_chain, test_fraction_range);
|
||||||
|
tcase_add_test (tc_chain, test_serialize_deserialize_caps);
|
||||||
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue