Add check for instance private usage within in instance_init. (Currently
authorOwen Taylor <otaylor@redhat.com>
Wed, 6 Aug 2003 14:33:20 +0000 (14:33 +0000)
committerOwen Taylor <otaylor@src.gnome.org>
Wed, 6 Aug 2003 14:33:20 +0000 (14:33 +0000)
Wed Aug  6 09:57:14 2003  Owen Taylor  <otaylor@redhat.com>

        * testgobject.c (test_signal_accumulator): Add check
        for instance private usage within in instance_init.
        (Currently will fail.)

gobject/ChangeLog
gobject/testgobject.c

index f9ac1df..934d318 100644 (file)
@@ -1,3 +1,9 @@
+Wed Aug  6 09:57:14 2003  Owen Taylor  <otaylor@redhat.com>
+
+       * testgobject.c (test_signal_accumulator): Add check
+       for instance private usage within in instance_init.
+       (Currently will fail.)
+
 2003-07-20  Hans Breuer  <hans@breuer.org>
 
        * gobject.def : updated externals
index 87c3bda..7ea341e 100644 (file)
@@ -209,6 +209,20 @@ test_object_init (TestObject *tobject)
 
   g_assert (priv);
   g_assert ((gchar *)priv >= (gchar *)tobject + sizeof (TestObject));
+
+  priv->dummy1 = 54321;
+}
+/* Check to see if private data initialization in the
+ * instance init function works.
+ */
+static void
+test_object_check_private_init (TestObject *tobject)
+{
+  TestObjectPrivate *priv;
+
+  priv = TEST_OBJECT_GET_PRIVATE (tobject);
+
+  g_assert (priv->dummy1 == 54321);
 }
 static gboolean
 test_signal_accumulator (GSignalInvocationHint *ihint,
@@ -290,9 +304,15 @@ derived_object_test_iface_init (gpointer giface,
 #define DERIVED_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DERIVED_TYPE_OBJECT))
 #define DERIVED_OBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), DERIVED_TYPE_OBJECT, DerivedObjectClass))
 #define DERIVED_OBJECT_GET_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), DERIVED_TYPE_OBJECT, DerivedObjectPrivate))
-typedef struct _TestObject           DerivedObject;
+typedef struct _DerivedObject        DerivedObject;
 typedef struct _TestObjectClass      DerivedObjectClass;
 typedef struct _DerivedObjectPrivate DerivedObjectPrivate;
+struct _DerivedObject
+{
+  TestObject parent_instance;
+  int  dummy1;
+  int  dummy2;
+};
 struct _DerivedObjectPrivate
 {
   char dummy;
@@ -379,6 +399,8 @@ main (int   argc,
   g_type_class_ref (TEST_TYPE_OBJECT);
 
   dobject = g_object_new (DERIVED_TYPE_OBJECT, NULL);
+  test_object_check_private_init (TEST_OBJECT (dobject));
+
   sigarg = g_object_new (TEST_TYPE_OBJECT, NULL);
 
   g_print ("MAIN: emit test-signal:\n");