object: Add _set_name() test on parented object
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 26 May 2016 18:43:10 +0000 (14:43 -0400)
committerNicolas Dufresne <nicolas.dufresne@collabora.com>
Thu, 26 May 2016 19:36:52 +0000 (15:36 -0400)
This is not allowed, and set_name() should fail.

https://bugzilla.gnome.org/show_bug.cgi?id=766923

tests/check/gst/gstobject.c

index 4f166af..d7f00cc 100644 (file)
@@ -95,7 +95,7 @@ notify_name (GObject * object, GParamSpec * pspec, gint * out_count)
 /* GstFakeObject name tests */
 GST_START_TEST (test_fake_object_name)
 {
-  GstObject *object;
+  GstObject *object, *parent;
   gint count = 0;
   gchar *name;
   gchar *name2;
@@ -135,7 +135,13 @@ GST_START_TEST (test_fake_object_name)
   g_free (name);
   g_free (name2);
 
-  gst_object_unref (object);
+  /* add a parent and ensure name cannot be changed */
+  parent = g_object_new (gst_fake_object_get_type (), NULL);
+  gst_object_set_parent (object, parent);
+  fail_if (gst_object_set_name (object, "broken"),
+      "Could set name on parented object");
+
+  gst_object_unref (parent);
 }
 
 GST_END_TEST;