os/ossrv/glib/gobject/testgobject.c
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/* GObject - GLib Type, Object, Parameter and Signal Library
sl@0
     2
 * Copyright (C) 2001 Red Hat, Inc.
sl@0
     3
 * Portions copyright (c) 2009 Nokia Corporation.  All rights reserved.
sl@0
     4
 * This library is free software; you can redistribute it and/or
sl@0
     5
 * modify it under the terms of the GNU Lesser General Public
sl@0
     6
 * License as published by the Free Software Foundation; either
sl@0
     7
 * version 2 of the License, or (at your option) any later version.
sl@0
     8
 *
sl@0
     9
 * This library is distributed in the hope that it will be useful,
sl@0
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
sl@0
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
sl@0
    12
 * Lesser General Public License for more details.
sl@0
    13
 *
sl@0
    14
 * You should have received a copy of the GNU Lesser General
sl@0
    15
 * Public License along with this library; if not, write to the
sl@0
    16
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
sl@0
    17
 * Boston, MA 02111-1307, USA.
sl@0
    18
 */
sl@0
    19
sl@0
    20
#include <string.h>
sl@0
    21
sl@0
    22
#undef	G_LOG_DOMAIN
sl@0
    23
#define	G_LOG_DOMAIN "TestObject"
sl@0
    24
#include	<glib-object.h>
sl@0
    25
#ifdef __SYMBIAN32__
sl@0
    26
#include "mrt2_glib2_test.h"
sl@0
    27
#endif /*__SYMBIAN32__*/
sl@0
    28
sl@0
    29
/* --- TestIface --- */
sl@0
    30
#define TEST_TYPE_IFACE           (test_iface_get_type ())
sl@0
    31
#define TEST_IFACE(obj)		  (G_TYPE_CHECK_INSTANCE_CAST ((obj), TEST_TYPE_IFACE, TestIface))
sl@0
    32
#define TEST_IS_IFACE(obj)	  (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TEST_TYPE_IFACE))
sl@0
    33
#define TEST_IFACE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_IFACE, TestIfaceClass))
sl@0
    34
typedef struct _TestIface      TestIface;
sl@0
    35
typedef struct _TestIfaceClass TestIfaceClass;
sl@0
    36
struct _TestIfaceClass
sl@0
    37
{
sl@0
    38
  GTypeInterface base_iface;
sl@0
    39
  void	(*print_string)	(TestIface	*tiobj,
sl@0
    40
			 const gchar	*string);
sl@0
    41
};
sl@0
    42
static void	iface_base_init		(TestIfaceClass	*iface);
sl@0
    43
static void	iface_base_finalize	(TestIfaceClass	*iface);
sl@0
    44
static void	print_foo		(TestIface	*tiobj,
sl@0
    45
					 const gchar	*string);
sl@0
    46
static GType
sl@0
    47
test_iface_get_type (void)
sl@0
    48
{
sl@0
    49
  static GType test_iface_type = 0;
sl@0
    50
sl@0
    51
  if (!test_iface_type)
sl@0
    52
    {
sl@0
    53
      static const GTypeInfo test_iface_info =
sl@0
    54
      {
sl@0
    55
	sizeof (TestIfaceClass),
sl@0
    56
	(GBaseInitFunc)	iface_base_init,		/* base_init */
sl@0
    57
	(GBaseFinalizeFunc) iface_base_finalize,	/* base_finalize */
sl@0
    58
      };
sl@0
    59
sl@0
    60
      test_iface_type = g_type_register_static (G_TYPE_INTERFACE, "TestIface", &test_iface_info, 0);
sl@0
    61
      g_type_interface_add_prerequisite (test_iface_type, G_TYPE_OBJECT);
sl@0
    62
    }
sl@0
    63
sl@0
    64
  return test_iface_type;
sl@0
    65
}
sl@0
    66
static guint iface_base_init_count = 0;
sl@0
    67
static void
sl@0
    68
iface_base_init (TestIfaceClass *iface)
sl@0
    69
{
sl@0
    70
  iface_base_init_count++;
sl@0
    71
  if (iface_base_init_count == 1)
sl@0
    72
    {
sl@0
    73
      /* add signals here */
sl@0
    74
    }
sl@0
    75
}
sl@0
    76
static void
sl@0
    77
iface_base_finalize (TestIfaceClass *iface)
sl@0
    78
{
sl@0
    79
  iface_base_init_count--;
sl@0
    80
  if (iface_base_init_count == 0)
sl@0
    81
    {
sl@0
    82
      /* destroy signals here */
sl@0
    83
    }
sl@0
    84
}
sl@0
    85
static void
sl@0
    86
print_foo (TestIface   *tiobj,
sl@0
    87
	   const gchar *string)
sl@0
    88
{
sl@0
    89
  if (!string)
sl@0
    90
    string = "<NULL>";
sl@0
    91
  g_print ("Iface-FOO: \"%s\" from %p\n", string, tiobj);
sl@0
    92
}
sl@0
    93
static void
sl@0
    94
test_object_test_iface_init (gpointer giface,
sl@0
    95
			     gpointer iface_data)
sl@0
    96
{
sl@0
    97
  TestIfaceClass *iface = giface;
sl@0
    98
sl@0
    99
  g_assert (iface_data == GUINT_TO_POINTER (42));
sl@0
   100
sl@0
   101
  g_assert (G_TYPE_FROM_INTERFACE (iface) == TEST_TYPE_IFACE);
sl@0
   102
sl@0
   103
  /* assert iface_base_init() was already called */
sl@0
   104
  g_assert (iface_base_init_count > 0);
sl@0
   105
sl@0
   106
  /* initialize stuff */
sl@0
   107
  iface->print_string = print_foo;
sl@0
   108
}
sl@0
   109
static void
sl@0
   110
iface_print_string (TestIface   *tiobj,
sl@0
   111
		    const gchar *string)
sl@0
   112
{
sl@0
   113
  TestIfaceClass *iface;
sl@0
   114
sl@0
   115
  g_return_if_fail (TEST_IS_IFACE (tiobj));
sl@0
   116
  g_return_if_fail (G_IS_OBJECT (tiobj)); /* ensured through prerequisite */
sl@0
   117
sl@0
   118
  iface = TEST_IFACE_GET_CLASS (tiobj);
sl@0
   119
  g_object_ref (tiobj);
sl@0
   120
  iface->print_string (tiobj, string);
sl@0
   121
  g_object_unref (tiobj);
sl@0
   122
}
sl@0
   123
sl@0
   124
sl@0
   125
/* --- TestObject --- */
sl@0
   126
#define TEST_TYPE_OBJECT            (test_object_get_type ())
sl@0
   127
#define TEST_OBJECT(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_OBJECT, TestObject))
sl@0
   128
#define TEST_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), TEST_TYPE_OBJECT, TestObjectClass))
sl@0
   129
#define TEST_IS_OBJECT(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_OBJECT))
sl@0
   130
#define TEST_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TEST_TYPE_OBJECT))
sl@0
   131
#define TEST_OBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_OBJECT, TestObjectClass))
sl@0
   132
#define TEST_OBJECT_GET_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), TEST_TYPE_OBJECT, TestObjectPrivate))
sl@0
   133
typedef struct _TestObject        TestObject;
sl@0
   134
typedef struct _TestObjectClass   TestObjectClass;
sl@0
   135
typedef struct _TestObjectPrivate TestObjectPrivate;
sl@0
   136
struct _TestObject
sl@0
   137
{
sl@0
   138
  GObject parent_instance;
sl@0
   139
};
sl@0
   140
struct _TestObjectClass
sl@0
   141
{
sl@0
   142
  GObjectClass parent_class;
sl@0
   143
sl@0
   144
  gchar* (*test_signal) (TestObject *tobject,
sl@0
   145
			 TestIface  *iface_object,
sl@0
   146
			 gpointer    tdata);
sl@0
   147
};
sl@0
   148
struct _TestObjectPrivate
sl@0
   149
{
sl@0
   150
  int     dummy1;
sl@0
   151
  gdouble dummy2;
sl@0
   152
};
sl@0
   153
static void	test_object_class_init	(TestObjectClass	*class);
sl@0
   154
static void	test_object_init	(TestObject		*tobject);
sl@0
   155
static gboolean	test_signal_accumulator	(GSignalInvocationHint	*ihint,
sl@0
   156
					 GValue            	*return_accu,
sl@0
   157
					 const GValue       	*handler_return,
sl@0
   158
					 gpointer                data);
sl@0
   159
static gchar*	test_object_test_signal	(TestObject		*tobject,
sl@0
   160
					 TestIface		*iface_object,
sl@0
   161
					 gpointer		 tdata);
sl@0
   162
static GType
sl@0
   163
test_object_get_type (void)
sl@0
   164
{
sl@0
   165
  static GType test_object_type = 0;
sl@0
   166
sl@0
   167
  if (!test_object_type)
sl@0
   168
    {
sl@0
   169
      static const GTypeInfo test_object_info =
sl@0
   170
      {
sl@0
   171
	sizeof (TestObjectClass),
sl@0
   172
	NULL,           /* base_init */
sl@0
   173
	NULL,           /* base_finalize */
sl@0
   174
	(GClassInitFunc) test_object_class_init,
sl@0
   175
	NULL,           /* class_finalize */
sl@0
   176
	NULL,           /* class_data */
sl@0
   177
	sizeof (TestObject),
sl@0
   178
	5,              /* n_preallocs */
sl@0
   179
	(GInstanceInitFunc) test_object_init,
sl@0
   180
      };
sl@0
   181
      GInterfaceInfo iface_info = { test_object_test_iface_init, NULL, GUINT_TO_POINTER (42) };
sl@0
   182
sl@0
   183
      test_object_type = g_type_register_static (G_TYPE_OBJECT, "TestObject", &test_object_info, 0);
sl@0
   184
      g_type_add_interface_static (test_object_type, TEST_TYPE_IFACE, &iface_info);
sl@0
   185
    }
sl@0
   186
sl@0
   187
  return test_object_type;
sl@0
   188
}
sl@0
   189
static void
sl@0
   190
test_object_class_init (TestObjectClass *class)
sl@0
   191
{
sl@0
   192
  /*  GObjectClass *gobject_class = G_OBJECT_CLASS (class); */
sl@0
   193
sl@0
   194
  class->test_signal = test_object_test_signal;
sl@0
   195
sl@0
   196
  g_signal_new ("test-signal",
sl@0
   197
		G_OBJECT_CLASS_TYPE (class),
sl@0
   198
		G_SIGNAL_RUN_FIRST | G_SIGNAL_RUN_LAST | G_SIGNAL_RUN_CLEANUP,
sl@0
   199
		G_STRUCT_OFFSET (TestObjectClass, test_signal),
sl@0
   200
		test_signal_accumulator, NULL,
sl@0
   201
		g_cclosure_marshal_STRING__OBJECT_POINTER,
sl@0
   202
		G_TYPE_STRING, 2, TEST_TYPE_IFACE, G_TYPE_POINTER);
sl@0
   203
sl@0
   204
  g_type_class_add_private (class, sizeof (TestObjectPrivate));
sl@0
   205
}
sl@0
   206
static void
sl@0
   207
test_object_init (TestObject *tobject)
sl@0
   208
{
sl@0
   209
  TestObjectPrivate *priv;
sl@0
   210
sl@0
   211
  priv = TEST_OBJECT_GET_PRIVATE (tobject);
sl@0
   212
sl@0
   213
  g_assert (priv);
sl@0
   214
  g_assert ((gchar *)priv >= (gchar *)tobject + sizeof (TestObject));
sl@0
   215
sl@0
   216
  priv->dummy1 = 54321;
sl@0
   217
}
sl@0
   218
/* Check to see if private data initialization in the
sl@0
   219
 * instance init function works.
sl@0
   220
 */
sl@0
   221
static void
sl@0
   222
test_object_check_private_init (TestObject *tobject)
sl@0
   223
{
sl@0
   224
  TestObjectPrivate *priv;
sl@0
   225
sl@0
   226
  priv = TEST_OBJECT_GET_PRIVATE (tobject);
sl@0
   227
sl@0
   228
  g_print ("private data during initialization: %u == %u\n", priv->dummy1, 54321);
sl@0
   229
  g_assert (priv->dummy1 == 54321);
sl@0
   230
}
sl@0
   231
static gboolean
sl@0
   232
test_signal_accumulator (GSignalInvocationHint *ihint,
sl@0
   233
			 GValue                *return_accu,
sl@0
   234
			 const GValue          *handler_return,
sl@0
   235
			 gpointer               data)
sl@0
   236
{
sl@0
   237
  gchar *accu_string = g_value_get_string (return_accu);
sl@0
   238
  gchar *new_string = g_value_get_string (handler_return);
sl@0
   239
  gchar *result_string;
sl@0
   240
sl@0
   241
  if (accu_string)
sl@0
   242
    result_string = g_strconcat (accu_string, new_string, NULL);
sl@0
   243
  else if (new_string)
sl@0
   244
    result_string = g_strdup (new_string);
sl@0
   245
  else
sl@0
   246
    result_string = NULL;
sl@0
   247
sl@0
   248
  g_value_take_string (return_accu, result_string);
sl@0
   249
sl@0
   250
  return TRUE;
sl@0
   251
}
sl@0
   252
static gchar*
sl@0
   253
test_object_test_signal (TestObject *tobject,
sl@0
   254
			 TestIface  *iface_object,
sl@0
   255
			 gpointer    tdata)
sl@0
   256
{
sl@0
   257
  g_message ("::test_signal default_handler called");
sl@0
   258
sl@0
   259
  g_return_val_if_fail (TEST_IS_IFACE (iface_object), NULL);
sl@0
   260
  
sl@0
   261
  return g_strdup ("<default_handler>");
sl@0
   262
}
sl@0
   263
sl@0
   264
sl@0
   265
/* --- TestIface for DerivedObject --- */
sl@0
   266
static void
sl@0
   267
print_bar (TestIface   *tiobj,
sl@0
   268
	   const gchar *string)
sl@0
   269
{
sl@0
   270
  TestIfaceClass *parent_iface;
sl@0
   271
sl@0
   272
  g_return_if_fail (TEST_IS_IFACE (tiobj));
sl@0
   273
sl@0
   274
  if (!string)
sl@0
   275
    string = "<NULL>";
sl@0
   276
  g_print ("Iface-BAR: \"%s\" from %p\n", string, tiobj);
sl@0
   277
sl@0
   278
  g_print ("chaining: ");
sl@0
   279
  parent_iface = g_type_interface_peek_parent (TEST_IFACE_GET_CLASS (tiobj));
sl@0
   280
  parent_iface->print_string (tiobj, string);
sl@0
   281
sl@0
   282
  g_assert (g_type_interface_peek_parent (parent_iface) == NULL);
sl@0
   283
}
sl@0
   284
sl@0
   285
static void
sl@0
   286
derived_object_test_iface_init (gpointer giface,
sl@0
   287
				gpointer iface_data)
sl@0
   288
{
sl@0
   289
  TestIfaceClass *iface = giface;
sl@0
   290
sl@0
   291
  g_assert (iface_data == GUINT_TO_POINTER (87));
sl@0
   292
sl@0
   293
  g_assert (G_TYPE_FROM_INTERFACE (iface) == TEST_TYPE_IFACE);
sl@0
   294
sl@0
   295
  /* assert test_object_test_iface_init() was already called */
sl@0
   296
  g_assert (iface->print_string == print_foo);
sl@0
   297
sl@0
   298
  /* override stuff */
sl@0
   299
  iface->print_string = print_bar;
sl@0
   300
}
sl@0
   301
sl@0
   302
sl@0
   303
/* --- DerivedObject --- */
sl@0
   304
#define DERIVED_TYPE_OBJECT            (derived_object_get_type ())
sl@0
   305
#define DERIVED_OBJECT(object)         (G_TYPE_CHECK_INSTANCE_CAST ((object), DERIVED_TYPE_OBJECT, DerivedObject))
sl@0
   306
#define DERIVED_OBJECT_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), DERIVED_TYPE_OBJECT, DerivedObjectClass))
sl@0
   307
#define DERIVED_IS_OBJECT(object)      (G_TYPE_CHECK_INSTANCE_TYPE ((object), DERIVED_TYPE_OBJECT))
sl@0
   308
#define DERIVED_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), DERIVED_TYPE_OBJECT))
sl@0
   309
#define DERIVED_OBJECT_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), DERIVED_TYPE_OBJECT, DerivedObjectClass))
sl@0
   310
#define DERIVED_OBJECT_GET_PRIVATE(o)  (G_TYPE_INSTANCE_GET_PRIVATE ((o), DERIVED_TYPE_OBJECT, DerivedObjectPrivate))
sl@0
   311
typedef struct _DerivedObject        DerivedObject;
sl@0
   312
typedef struct _TestObjectClass      DerivedObjectClass;
sl@0
   313
typedef struct _DerivedObjectPrivate DerivedObjectPrivate;
sl@0
   314
struct _DerivedObject
sl@0
   315
{
sl@0
   316
  TestObject parent_instance;
sl@0
   317
  int  dummy1;
sl@0
   318
  int  dummy2;
sl@0
   319
};
sl@0
   320
struct _DerivedObjectPrivate
sl@0
   321
{
sl@0
   322
  char dummy;
sl@0
   323
};
sl@0
   324
static void derived_object_class_init (DerivedObjectClass *class);
sl@0
   325
static void derived_object_init       (DerivedObject      *dobject);
sl@0
   326
GType
sl@0
   327
derived_object_get_type (void)
sl@0
   328
{
sl@0
   329
  static GType derived_object_type = 0;
sl@0
   330
sl@0
   331
  if (!derived_object_type)
sl@0
   332
    {
sl@0
   333
      static const GTypeInfo derived_object_info =
sl@0
   334
      {
sl@0
   335
	sizeof (DerivedObjectClass),
sl@0
   336
	NULL,           /* base_init */
sl@0
   337
	NULL,           /* base_finalize */
sl@0
   338
	(GClassInitFunc) derived_object_class_init,
sl@0
   339
	NULL,           /* class_finalize */
sl@0
   340
	NULL,           /* class_data */
sl@0
   341
	sizeof (DerivedObject),
sl@0
   342
	5,              /* n_preallocs */
sl@0
   343
	(GInstanceInitFunc) derived_object_init,
sl@0
   344
      };
sl@0
   345
      GInterfaceInfo iface_info = { derived_object_test_iface_init, NULL, GUINT_TO_POINTER (87) };
sl@0
   346
sl@0
   347
      derived_object_type = g_type_register_static (TEST_TYPE_OBJECT, "DerivedObject", &derived_object_info, 0);
sl@0
   348
      g_type_add_interface_static (derived_object_type, TEST_TYPE_IFACE, &iface_info);
sl@0
   349
    }
sl@0
   350
sl@0
   351
  return derived_object_type;
sl@0
   352
}
sl@0
   353
static void
sl@0
   354
derived_object_class_init (DerivedObjectClass *class)
sl@0
   355
{
sl@0
   356
  g_type_class_add_private (class, sizeof (DerivedObjectPrivate));
sl@0
   357
}
sl@0
   358
static void
sl@0
   359
derived_object_init (DerivedObject *dobject)
sl@0
   360
{
sl@0
   361
  TestObjectPrivate *test_priv;
sl@0
   362
  DerivedObjectPrivate *derived_priv;
sl@0
   363
sl@0
   364
  derived_priv = DERIVED_OBJECT_GET_PRIVATE (dobject);
sl@0
   365
sl@0
   366
  g_assert (derived_priv);
sl@0
   367
  g_assert ((gchar *)derived_priv >= (gchar *)TEST_OBJECT_GET_PRIVATE (dobject) + sizeof (TestObjectPrivate));
sl@0
   368
sl@0
   369
  test_priv = TEST_OBJECT_GET_PRIVATE (dobject);
sl@0
   370
  
sl@0
   371
  g_assert (test_priv);
sl@0
   372
  g_assert ((gchar *)test_priv >= (gchar *)dobject + sizeof (TestObject));
sl@0
   373
sl@0
   374
}
sl@0
   375
sl@0
   376
/* --- main --- */
sl@0
   377
int
sl@0
   378
main (int   argc,
sl@0
   379
      char *argv[])
sl@0
   380
{
sl@0
   381
  GTypeInfo info = { 0, };
sl@0
   382
  GTypeFundamentalInfo finfo = { 0, };
sl@0
   383
  GType type;
sl@0
   384
  TestObject *sigarg;
sl@0
   385
  DerivedObject *dobject;
sl@0
   386
  TestObjectPrivate *priv;
sl@0
   387
  gchar *string = NULL;
sl@0
   388
#ifdef __SYMBIAN32__
sl@0
   389
  g_log_set_handler (NULL,  G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL);
sl@0
   390
  g_set_print_handler(mrtPrintHandler);
sl@0
   391
  #endif /*__SYMBIAN32__*/
sl@0
   392
  g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
sl@0
   393
			  G_LOG_LEVEL_WARNING |
sl@0
   394
			  G_LOG_LEVEL_CRITICAL);
sl@0
   395
  g_type_init_with_debug_flags (G_TYPE_DEBUG_OBJECTS | G_TYPE_DEBUG_SIGNALS);
sl@0
   396
sl@0
   397
  /* test new fundamentals */
sl@0
   398
  g_assert (G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST) == g_type_fundamental_next ());
sl@0
   399
  type = g_type_register_fundamental (g_type_fundamental_next (), "FooShadow1", &info, &finfo, 0);
sl@0
   400
  g_assert (G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST + 1) == g_type_fundamental_next ());
sl@0
   401
  type = g_type_register_fundamental (g_type_fundamental_next (), "FooShadow2", &info, &finfo, 0);
sl@0
   402
  g_assert (G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST + 2) == g_type_fundamental_next ());
sl@0
   403
  g_assert (g_type_from_name ("FooShadow1") == G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST));
sl@0
   404
  g_assert (g_type_from_name ("FooShadow2") == G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_USER_FIRST + 1));
sl@0
   405
sl@0
   406
  /* to test past class initialization interface setups, create the class here */
sl@0
   407
  g_type_class_ref (TEST_TYPE_OBJECT);
sl@0
   408
sl@0
   409
  dobject = g_object_new (DERIVED_TYPE_OBJECT, NULL);
sl@0
   410
  test_object_check_private_init (TEST_OBJECT (dobject));
sl@0
   411
sl@0
   412
  sigarg = g_object_new (TEST_TYPE_OBJECT, NULL);
sl@0
   413
sl@0
   414
  g_print ("MAIN: emit test-signal:\n");
sl@0
   415
  g_signal_emit_by_name (dobject, "test-signal", sigarg, NULL, &string);
sl@0
   416
  g_message ("signal return: \"%s\"", string);
sl@0
   417
  g_assert (strcmp (string, "<default_handler><default_handler>") == 0);
sl@0
   418
  g_free (string);
sl@0
   419
sl@0
   420
  g_print ("MAIN: call iface print-string on test and derived object:\n");
sl@0
   421
  iface_print_string (TEST_IFACE (sigarg), "iface-string-from-test-type");
sl@0
   422
  iface_print_string (TEST_IFACE (dobject), "iface-string-from-derived-type");
sl@0
   423
sl@0
   424
  priv = TEST_OBJECT_GET_PRIVATE (dobject);
sl@0
   425
  g_print ("private data after initialization: %u == %u\n", priv->dummy1, 54321);
sl@0
   426
  g_assert (priv->dummy1 == 54321);
sl@0
   427
  
sl@0
   428
  g_object_unref (sigarg);
sl@0
   429
  g_object_unref (dobject);
sl@0
   430
sl@0
   431
  g_message ("%s done", argv[0]);
sl@0
   432
#ifdef __SYMBIAN32__
sl@0
   433
  testResultXml("testgobject");
sl@0
   434
  #endif /* EMULATOR */
sl@0
   435
  return 0;
sl@0
   436
}