summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOlivier CrĂȘte <olivier.crete@collabora.com>2017-04-07 17:49:29 (GMT)
committerOlivier CrĂȘte <olivier.crete@collabora.com>2017-04-07 17:49:55 (GMT)
commit7699b8a1bc49f30cd9a0c300831a085516f5442e (patch)
tree3e9b927374c9c7f172086a6e292e08c2f60c5bab
parent47047992fca1e8fb972d455ba48ab207ddffd2c4 (diff)
downloadgstreamer-7699b8a1bc49f30cd9a0c300831a085516f5442e.tar.gz
gstreamer-7699b8a1bc49f30cd9a0c300831a085516f5442e.tar.xz
test: Add test for serializing/deserializing NULL strings
-rw-r--r--tests/check/gst/gststructure.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/check/gst/gststructure.c b/tests/check/gst/gststructure.c
index a531717..7d3f2b4 100644
--- a/tests/check/gst/gststructure.c
+++ b/tests/check/gst/gststructure.c
@@ -254,6 +254,24 @@ GST_START_TEST (test_to_from_string)
gst_structure_free (st1);
gst_structure_free (st2);
+
+ /* Test NULL strings */
+ st1 = gst_structure_new ("test", "mynullstr", G_TYPE_STRING, NULL, NULL);
+ fail_unless (st1 != NULL);
+ str = gst_structure_to_string (st1);
+ fail_unless (strcmp (str, "test, mynullstr=(string)NULL;") == 0,
+ "Failed to serialize to right string: %s", str);
+
+ st2 = gst_structure_from_string (str, NULL);
+ fail_unless (st2 != NULL);
+ g_free (str);
+
+ fail_unless (gst_structure_is_equal (st1, st2),
+ "Structures did not match:\n\tStructure 1: %" GST_PTR_FORMAT
+ "\n\tStructure 2: %" GST_PTR_FORMAT "\n", st1, st2);
+
+ gst_structure_free (st1);
+ gst_structure_free (st2);
}
GST_END_TEST;