mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
tests/capsfilter: Fix memory leak and compare caps directly instead of strcmp()
This commit is contained in:
parent
7854e392dd
commit
26e27417d7
1 changed files with 7 additions and 10 deletions
|
@ -81,9 +81,8 @@ GST_END_TEST;
|
||||||
GST_START_TEST (test_caps_property)
|
GST_START_TEST (test_caps_property)
|
||||||
{
|
{
|
||||||
GstElement *filter;
|
GstElement *filter;
|
||||||
GstCaps *filter_caps;
|
GstCaps *filter_caps, *caps;
|
||||||
const gchar *caps_str;
|
const gchar *caps_str;
|
||||||
gchar *str;
|
|
||||||
|
|
||||||
filter = gst_check_setup_element ("capsfilter");
|
filter = gst_check_setup_element ("capsfilter");
|
||||||
|
|
||||||
|
@ -93,11 +92,10 @@ GST_START_TEST (test_caps_property)
|
||||||
filter_caps = gst_caps_from_string (caps_str);
|
filter_caps = gst_caps_from_string (caps_str);
|
||||||
fail_unless (GST_IS_CAPS (filter_caps));
|
fail_unless (GST_IS_CAPS (filter_caps));
|
||||||
g_object_set (filter, "caps", filter_caps, NULL);
|
g_object_set (filter, "caps", filter_caps, NULL);
|
||||||
gst_caps_unref (filter_caps);
|
|
||||||
|
|
||||||
g_object_get (filter, "caps", &filter_caps, NULL);
|
g_object_get (filter, "caps", &caps, NULL);
|
||||||
str = gst_caps_to_string (filter_caps);
|
fail_unless (gst_caps_is_equal (caps, filter_caps));
|
||||||
fail_unless (g_strcmp0 (str, caps_str) == 0);
|
gst_caps_unref (caps);
|
||||||
gst_caps_unref (filter_caps);
|
gst_caps_unref (filter_caps);
|
||||||
|
|
||||||
/* verify that new caps set replace the old ones */
|
/* verify that new caps set replace the old ones */
|
||||||
|
@ -106,11 +104,10 @@ GST_START_TEST (test_caps_property)
|
||||||
filter_caps = gst_caps_from_string (caps_str);
|
filter_caps = gst_caps_from_string (caps_str);
|
||||||
fail_unless (GST_IS_CAPS (filter_caps));
|
fail_unless (GST_IS_CAPS (filter_caps));
|
||||||
g_object_set (filter, "caps", filter_caps, NULL);
|
g_object_set (filter, "caps", filter_caps, NULL);
|
||||||
gst_caps_unref (filter_caps);
|
|
||||||
|
|
||||||
g_object_get (filter, "caps", &filter_caps, NULL);
|
g_object_get (filter, "caps", &caps, NULL);
|
||||||
str = gst_caps_to_string (filter_caps);
|
fail_unless (gst_caps_is_equal (caps, filter_caps));
|
||||||
fail_unless (g_strcmp0 (str, caps_str) == 0);
|
gst_caps_unref (caps);
|
||||||
gst_caps_unref (filter_caps);
|
gst_caps_unref (filter_caps);
|
||||||
|
|
||||||
/* make sure that NULL caps is interpreted as ANY */
|
/* make sure that NULL caps is interpreted as ANY */
|
||||||
|
|
Loading…
Reference in a new issue