summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Dröge <slomo@circular-chaos.org>2013-09-09 14:21:56 +0200
committerSebastian Dröge <slomo@circular-chaos.org>2013-09-09 14:21:56 +0200
commit26e27417d7b350db2230ade793c1eee52068f03f (patch)
tree8b5bc88819be1379c89b96740c05c8d3240810ed
parent7854e392dd82fe21837a2abac3c5949b519285e3 (diff)
tests/capsfilter: Fix memory leak and compare caps directly instead of strcmp()
-rw-r--r--tests/check/elements/capsfilter.c17
1 files changed, 7 insertions, 10 deletions
diff --git a/tests/check/elements/capsfilter.c b/tests/check/elements/capsfilter.c
index 6d4d48e1e..410a4863e 100644
--- a/tests/check/elements/capsfilter.c
+++ b/tests/check/elements/capsfilter.c
@@ -81,9 +81,8 @@ GST_END_TEST;
GST_START_TEST (test_caps_property)
{
GstElement *filter;
- GstCaps *filter_caps;
+ GstCaps *filter_caps, *caps;
const gchar *caps_str;
- gchar *str;
filter = gst_check_setup_element ("capsfilter");
@@ -93,11 +92,10 @@ GST_START_TEST (test_caps_property)
filter_caps = gst_caps_from_string (caps_str);
fail_unless (GST_IS_CAPS (filter_caps));
g_object_set (filter, "caps", filter_caps, NULL);
- gst_caps_unref (filter_caps);
- g_object_get (filter, "caps", &filter_caps, NULL);
- str = gst_caps_to_string (filter_caps);
- fail_unless (g_strcmp0 (str, caps_str) == 0);
+ g_object_get (filter, "caps", &caps, NULL);
+ fail_unless (gst_caps_is_equal (caps, filter_caps));
+ gst_caps_unref (caps);
gst_caps_unref (filter_caps);
/* 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);
fail_unless (GST_IS_CAPS (filter_caps));
g_object_set (filter, "caps", filter_caps, NULL);
- gst_caps_unref (filter_caps);
- g_object_get (filter, "caps", &filter_caps, NULL);
- str = gst_caps_to_string (filter_caps);
- fail_unless (g_strcmp0 (str, caps_str) == 0);
+ g_object_get (filter, "caps", &caps, NULL);
+ fail_unless (gst_caps_is_equal (caps, filter_caps));
+ gst_caps_unref (caps);
gst_caps_unref (filter_caps);
/* make sure that NULL caps is interpreted as ANY */