os/ossrv/glib/tsrc/BC/tests/gobject/ifaceproperties.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, 2003 Red Hat, Inc.
sl@0
     3
 * Portion Copyright © 2008 Nokia Corporation and/or its subsidiary(-ies). 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
#undef	G_LOG_DOMAIN
sl@0
    21
#define	G_LOG_DOMAIN "TestIfaceProperties"
sl@0
    22
sl@0
    23
#undef G_DISABLE_ASSERT
sl@0
    24
#undef G_DISABLE_CHECKS
sl@0
    25
#undef G_DISABLE_CAST_CHECKS
sl@0
    26
sl@0
    27
#include <string.h>
sl@0
    28
sl@0
    29
#include <glib-object.h>
sl@0
    30
#include <gobject_global.h>
sl@0
    31
sl@0
    32
#include "testcommon.h"
sl@0
    33
#ifdef SYMBIAN
sl@0
    34
#include "mrt2_glib2_test.h"
sl@0
    35
#endif /*SYMBIAN*/
sl@0
    36
sl@0
    37
sl@0
    38
sl@0
    39
/* This test tests interface properties, implementing interface
sl@0
    40
 * properties and #GParamSpecOverride.
sl@0
    41
 *
sl@0
    42
 * Four properties are tested:
sl@0
    43
 *
sl@0
    44
 * prop1: Defined in TestIface, Implemented in BaseObject with a GParamSpecOverride
sl@0
    45
 * prop2: Defined in TestIface, Implemented in BaseObject with a new property
sl@0
    46
 * prop3: Defined in TestIface, Implemented in BaseObject, Overridden in DerivedObject
sl@0
    47
 * prop4: Defined in BaseObject, Overridden in DerivedObject
sl@0
    48
 */
sl@0
    49
   
sl@0
    50
static GType base_object_get_type ();
sl@0
    51
static GType derived_object_get_type ();
sl@0
    52
sl@0
    53
enum {
sl@0
    54
  BASE_PROP_0,
sl@0
    55
  BASE_PROP1,
sl@0
    56
  BASE_PROP2,
sl@0
    57
  BASE_PROP3,
sl@0
    58
  BASE_PROP4
sl@0
    59
};
sl@0
    60
sl@0
    61
enum {
sl@0
    62
  DERIVED_PROP_0,
sl@0
    63
  DERIVED_PROP3,
sl@0
    64
  DERIVED_PROP4
sl@0
    65
};
sl@0
    66
sl@0
    67
sl@0
    68
/*
sl@0
    69
 * BaseObject, a parent class for DerivedObject
sl@0
    70
 */
sl@0
    71
#define BASE_TYPE_OBJECT          (base_object_get_type ())
sl@0
    72
#define BASE_OBJECT(obj)	  (G_TYPE_CHECK_INSTANCE_CAST ((obj), BASE_TYPE_OBJECT, BaseObject))
sl@0
    73
typedef struct _BaseObject        BaseObject;
sl@0
    74
typedef struct _BaseObjectClass   BaseObjectClass;
sl@0
    75
sl@0
    76
struct _BaseObject
sl@0
    77
{
sl@0
    78
  GObject parent_instance;
sl@0
    79
sl@0
    80
  gint val1;
sl@0
    81
  gint val2;
sl@0
    82
  gint val3;
sl@0
    83
  gint val4;
sl@0
    84
};
sl@0
    85
struct _BaseObjectClass
sl@0
    86
{
sl@0
    87
  GObjectClass parent_class;
sl@0
    88
};
sl@0
    89
sl@0
    90
GObjectClass *base_parent_class;
sl@0
    91
sl@0
    92
/*
sl@0
    93
 * DerivedObject, the child class of DerivedObject
sl@0
    94
 */
sl@0
    95
#define DERIVED_TYPE_OBJECT          (derived_object_get_type ())
sl@0
    96
typedef struct _DerivedObject        DerivedObject;
sl@0
    97
typedef struct _DerivedObjectClass   DerivedObjectClass;
sl@0
    98
sl@0
    99
struct _DerivedObject
sl@0
   100
{
sl@0
   101
  BaseObject parent_instance;
sl@0
   102
};
sl@0
   103
struct _DerivedObjectClass
sl@0
   104
{
sl@0
   105
  BaseObjectClass parent_class;
sl@0
   106
};
sl@0
   107
sl@0
   108
/*
sl@0
   109
 * The interface
sl@0
   110
 */
sl@0
   111
typedef struct _TestIfaceClass TestIfaceClass;
sl@0
   112
sl@0
   113
struct _TestIfaceClass
sl@0
   114
{
sl@0
   115
  GTypeInterface base_iface;
sl@0
   116
};
sl@0
   117
sl@0
   118
#define TEST_TYPE_IFACE (test_iface_get_type ())
sl@0
   119
sl@0
   120
/* The paramspecs installed on our interface
sl@0
   121
 */
sl@0
   122
static GParamSpec *iface_spec1, *iface_spec2, *iface_spec3;
sl@0
   123
sl@0
   124
/* The paramspecs inherited by our derived object
sl@0
   125
 */
sl@0
   126
static GParamSpec *inherited_spec1, *inherited_spec2, *inherited_spec3, *inherited_spec4;
sl@0
   127
sl@0
   128
static void
sl@0
   129
test_iface_default_init (TestIfaceClass *iface_vtable)
sl@0
   130
{
sl@0
   131
  inherited_spec1 = iface_spec1 = g_param_spec_int ("prop1",
sl@0
   132
						    "Prop1",
sl@0
   133
						    "Property 1",
sl@0
   134
						    G_MININT, /* min */
sl@0
   135
						    0xFFFF,  /* max */
sl@0
   136
						    42,       /* default */
sl@0
   137
						    G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
sl@0
   138
  g_object_interface_install_property (iface_vtable, iface_spec1);
sl@0
   139
sl@0
   140
  iface_spec2 = g_param_spec_int ("prop2",
sl@0
   141
				  "Prop2",
sl@0
   142
				  "Property 2",
sl@0
   143
				  G_MININT, /* min */
sl@0
   144
				  G_MAXINT, /* max */
sl@0
   145
				  0,	       /* default */
sl@0
   146
				  G_PARAM_WRITABLE);
sl@0
   147
  g_object_interface_install_property (iface_vtable, iface_spec2);
sl@0
   148
    
sl@0
   149
  inherited_spec3 = iface_spec3 = g_param_spec_int ("prop3",
sl@0
   150
						    "Prop3",
sl@0
   151
						    "Property 3",
sl@0
   152
						    G_MININT, /* min */
sl@0
   153
						    G_MAXINT, /* max */
sl@0
   154
						    0,	       /* default */
sl@0
   155
						    G_PARAM_READWRITE);
sl@0
   156
  g_object_interface_install_property (iface_vtable, iface_spec3);
sl@0
   157
}
sl@0
   158
sl@0
   159
static DEFINE_IFACE (TestIface, test_iface, NULL, test_iface_default_init)
sl@0
   160
sl@0
   161
sl@0
   162
static GObject*
sl@0
   163
base_object_constructor  (GType                  type,
sl@0
   164
			  guint                  n_construct_properties,
sl@0
   165
			  GObjectConstructParam *construct_properties)
sl@0
   166
{
sl@0
   167
  /* The constructor is the one place where a GParamSpecOverride is visible
sl@0
   168
   * to the outside world, so we do a bunch of checks here
sl@0
   169
   */
sl@0
   170
  GValue value1 = { 0, };
sl@0
   171
  GValue value2 = { 0, };
sl@0
   172
  GParamSpec *pspec;
sl@0
   173
sl@0
   174
  g_assert (n_construct_properties == 1);
sl@0
   175
sl@0
   176
  pspec = construct_properties->pspec;
sl@0
   177
sl@0
   178
  /* Check we got the param spec we expected
sl@0
   179
   */
sl@0
   180
  g_assert (G_IS_PARAM_SPEC_OVERRIDE (pspec));
sl@0
   181
  g_assert (pspec->param_id == BASE_PROP1);
sl@0
   182
  g_assert (strcmp (g_param_spec_get_name (pspec), "prop1") == 0);
sl@0
   183
  g_assert (g_param_spec_get_redirect_target (pspec) == iface_spec1);
sl@0
   184
sl@0
   185
  /* Test redirection of the nick and blurb to the redirect target
sl@0
   186
   */
sl@0
   187
  g_assert (strcmp (g_param_spec_get_nick (pspec), "Prop1") == 0);
sl@0
   188
  g_assert (strcmp (g_param_spec_get_blurb (pspec), "Property 1") == 0);
sl@0
   189
sl@0
   190
  /* Test forwarding of the various GParamSpec methods to the redirect target
sl@0
   191
   */
sl@0
   192
  g_value_init (&value1, G_TYPE_INT);
sl@0
   193
  g_value_init (&value2, G_TYPE_INT);
sl@0
   194
  
sl@0
   195
  g_param_value_set_default (pspec, &value1);
sl@0
   196
  g_assert (g_value_get_int (&value1) == 42);
sl@0
   197
sl@0
   198
  g_value_reset (&value1);
sl@0
   199
  g_value_set_int (&value1, 0x10000);
sl@0
   200
  g_assert (g_param_value_validate (pspec, &value1));
sl@0
   201
  g_assert (g_value_get_int (&value1) == 0xFFFF);
sl@0
   202
  g_assert (!g_param_value_validate (pspec, &value1));
sl@0
   203
  
sl@0
   204
  g_value_reset (&value1);
sl@0
   205
  g_value_set_int (&value1, 1);
sl@0
   206
  g_value_set_int (&value2, 2);
sl@0
   207
  g_assert (g_param_values_cmp (pspec, &value1, &value2) < 0);
sl@0
   208
  g_assert (g_param_values_cmp (pspec, &value2, &value1) > 0);
sl@0
   209
  
sl@0
   210
  g_value_unset (&value1);
sl@0
   211
  g_value_unset (&value2);
sl@0
   212
sl@0
   213
  return base_parent_class->constructor (type,
sl@0
   214
					 n_construct_properties,
sl@0
   215
					 construct_properties);
sl@0
   216
}
sl@0
   217
sl@0
   218
static void
sl@0
   219
base_object_set_property (GObject      *object,
sl@0
   220
			  guint         prop_id,
sl@0
   221
			  const GValue *value,
sl@0
   222
			  GParamSpec   *pspec)
sl@0
   223
{
sl@0
   224
  BaseObject *base_object = BASE_OBJECT (object);
sl@0
   225
  
sl@0
   226
  switch (prop_id)
sl@0
   227
    {
sl@0
   228
    case BASE_PROP1:
sl@0
   229
      g_assert (pspec == inherited_spec1);
sl@0
   230
      base_object->val1 = g_value_get_int (value);
sl@0
   231
      break;
sl@0
   232
    case BASE_PROP2:
sl@0
   233
      g_assert (pspec == inherited_spec2);
sl@0
   234
      base_object->val2 = g_value_get_int (value);
sl@0
   235
      break;
sl@0
   236
    case BASE_PROP3:
sl@0
   237
      g_assert_not_reached ();
sl@0
   238
      break;
sl@0
   239
    case BASE_PROP4:
sl@0
   240
      g_assert_not_reached ();
sl@0
   241
      break;
sl@0
   242
    default:
sl@0
   243
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
sl@0
   244
      break;
sl@0
   245
    }
sl@0
   246
}
sl@0
   247
sl@0
   248
static void
sl@0
   249
base_object_get_property (GObject                *object,
sl@0
   250
			  guint                   prop_id,
sl@0
   251
			  GValue                 *value,
sl@0
   252
			  GParamSpec             *pspec)
sl@0
   253
{
sl@0
   254
  BaseObject *base_object = BASE_OBJECT (object);
sl@0
   255
sl@0
   256
  switch (prop_id)
sl@0
   257
    {
sl@0
   258
    case BASE_PROP1:
sl@0
   259
      g_assert (pspec == inherited_spec1);
sl@0
   260
      g_value_set_int (value, base_object->val1);
sl@0
   261
      break;
sl@0
   262
    case BASE_PROP2:
sl@0
   263
      g_assert (pspec == inherited_spec2);
sl@0
   264
      g_value_set_int (value, base_object->val2);
sl@0
   265
      break;
sl@0
   266
    case BASE_PROP3:
sl@0
   267
      g_assert_not_reached ();
sl@0
   268
      break;
sl@0
   269
    case BASE_PROP4:
sl@0
   270
      g_assert_not_reached ();
sl@0
   271
      break;
sl@0
   272
    default:
sl@0
   273
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
sl@0
   274
      break;
sl@0
   275
    }
sl@0
   276
}
sl@0
   277
sl@0
   278
static void
sl@0
   279
base_object_notify (GObject    *object,
sl@0
   280
		    GParamSpec *pspec)
sl@0
   281
{
sl@0
   282
  /* The property passed to notify is the redirect target, not the
sl@0
   283
   * GParamSpecOverride
sl@0
   284
   */
sl@0
   285
  g_assert (pspec == inherited_spec1 ||
sl@0
   286
	    pspec == inherited_spec2 ||
sl@0
   287
	    pspec == inherited_spec3 ||
sl@0
   288
	    pspec == inherited_spec4);
sl@0
   289
}
sl@0
   290
sl@0
   291
static void
sl@0
   292
base_object_class_init (BaseObjectClass *class)
sl@0
   293
{
sl@0
   294
  GObjectClass *object_class = G_OBJECT_CLASS (class);
sl@0
   295
sl@0
   296
  base_parent_class= g_type_class_peek_parent (class);
sl@0
   297
sl@0
   298
  object_class->constructor = base_object_constructor;
sl@0
   299
  object_class->set_property = base_object_set_property;
sl@0
   300
  object_class->get_property = base_object_get_property;
sl@0
   301
  object_class->notify = base_object_notify;
sl@0
   302
sl@0
   303
  g_object_class_override_property (object_class, BASE_PROP1, "prop1");
sl@0
   304
sl@0
   305
  /* We override this one using a real property, not GParamSpecOverride
sl@0
   306
   * We change the flags from READONLY to READWRITE to show that we
sl@0
   307
   * can make the flags less restrictive
sl@0
   308
   */
sl@0
   309
  inherited_spec2 = g_param_spec_int ("prop2",
sl@0
   310
				      "Prop2",
sl@0
   311
				      "Property 2",
sl@0
   312
				      G_MININT, /* min */
sl@0
   313
				      G_MAXINT, /* max */
sl@0
   314
				      0,	       /* default */
sl@0
   315
				      G_PARAM_READWRITE);
sl@0
   316
  g_object_class_install_property (object_class, BASE_PROP2, inherited_spec2);
sl@0
   317
sl@0
   318
  g_object_class_override_property (object_class, BASE_PROP3, "prop3");
sl@0
   319
  
sl@0
   320
  inherited_spec4 = g_param_spec_int ("prop4",
sl@0
   321
				      "Prop4",
sl@0
   322
				      "Property 4",
sl@0
   323
				      G_MININT, /* min */
sl@0
   324
				      G_MAXINT, /* max */
sl@0
   325
				      0,	       /* default */
sl@0
   326
				      G_PARAM_READWRITE);
sl@0
   327
  g_object_class_install_property (object_class, BASE_PROP4, inherited_spec4);
sl@0
   328
}
sl@0
   329
sl@0
   330
static void
sl@0
   331
base_object_init (BaseObject *base_object)
sl@0
   332
{
sl@0
   333
  base_object->val1 = 42;
sl@0
   334
}
sl@0
   335
sl@0
   336
static DEFINE_TYPE_FULL (BaseObject, base_object,
sl@0
   337
			 base_object_class_init, NULL, base_object_init,
sl@0
   338
			 G_TYPE_OBJECT,
sl@0
   339
			 INTERFACE (NULL, TEST_TYPE_IFACE))
sl@0
   340
sl@0
   341
static void
sl@0
   342
derived_object_set_property (GObject      *object,
sl@0
   343
			     guint         prop_id,
sl@0
   344
			     const GValue *value,
sl@0
   345
			     GParamSpec   *pspec)
sl@0
   346
{
sl@0
   347
  BaseObject *base_object = BASE_OBJECT (object);
sl@0
   348
sl@0
   349
  switch (prop_id)
sl@0
   350
    {
sl@0
   351
    case DERIVED_PROP3:
sl@0
   352
      g_assert (pspec == inherited_spec3);
sl@0
   353
      base_object->val3 = g_value_get_int (value);
sl@0
   354
      break;
sl@0
   355
    case DERIVED_PROP4:
sl@0
   356
      g_assert (pspec == inherited_spec4);
sl@0
   357
      base_object->val4 = g_value_get_int (value);
sl@0
   358
      break;
sl@0
   359
    default:
sl@0
   360
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
sl@0
   361
      break;
sl@0
   362
    }
sl@0
   363
}
sl@0
   364
sl@0
   365
static void
sl@0
   366
derived_object_get_property (GObject                *object,
sl@0
   367
			     guint                   prop_id,
sl@0
   368
			     GValue                 *value,
sl@0
   369
			     GParamSpec             *pspec)
sl@0
   370
{
sl@0
   371
  BaseObject *base_object = BASE_OBJECT (object);
sl@0
   372
sl@0
   373
  switch (prop_id)
sl@0
   374
    {
sl@0
   375
    case DERIVED_PROP3:
sl@0
   376
      g_assert (pspec == inherited_spec3);
sl@0
   377
      g_value_set_int (value, base_object->val3);
sl@0
   378
      break;
sl@0
   379
    case DERIVED_PROP4:
sl@0
   380
      g_assert (pspec == inherited_spec4);
sl@0
   381
      g_value_set_int (value, base_object->val4);
sl@0
   382
      break;
sl@0
   383
    default:
sl@0
   384
      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
sl@0
   385
      break;
sl@0
   386
    }
sl@0
   387
}
sl@0
   388
sl@0
   389
static void
sl@0
   390
derived_object_class_init (DerivedObjectClass *class)
sl@0
   391
{
sl@0
   392
  GObjectClass *object_class = G_OBJECT_CLASS (class);
sl@0
   393
sl@0
   394
  object_class->set_property = derived_object_set_property;
sl@0
   395
  object_class->get_property = derived_object_get_property;
sl@0
   396
sl@0
   397
  /* Overriding a property that is itself overridding an interface property */
sl@0
   398
  g_object_class_override_property (object_class, DERIVED_PROP3, "prop3");
sl@0
   399
sl@0
   400
  /* Overriding a property not from an interface */
sl@0
   401
  g_object_class_override_property (object_class, DERIVED_PROP4, "prop4");
sl@0
   402
}
sl@0
   403
sl@0
   404
static DEFINE_TYPE (DerivedObject, derived_object,
sl@0
   405
		    derived_object_class_init, NULL, NULL,
sl@0
   406
		    BASE_TYPE_OBJECT)
sl@0
   407
sl@0
   408
/* Helper function for testing ...list_properties()
sl@0
   409
 */
sl@0
   410
static void
sl@0
   411
assert_in_properties (GParamSpec  *param_spec,
sl@0
   412
		      GParamSpec **properties,
sl@0
   413
		      gint         n_properties)
sl@0
   414
{
sl@0
   415
  gint i;
sl@0
   416
  gboolean found = FALSE;
sl@0
   417
sl@0
   418
  for (i = 0; i < n_properties; i++)
sl@0
   419
    {
sl@0
   420
      if (properties[i] == param_spec)
sl@0
   421
	found = TRUE;
sl@0
   422
    }
sl@0
   423
sl@0
   424
  g_assert (found);
sl@0
   425
}
sl@0
   426
sl@0
   427
int
sl@0
   428
main (gint   argc,
sl@0
   429
      gchar *argv[])
sl@0
   430
{
sl@0
   431
sl@0
   432
  BaseObject *object;
sl@0
   433
  GObjectClass *object_class;
sl@0
   434
  TestIfaceClass *iface_vtable;
sl@0
   435
  GParamSpec **properties;
sl@0
   436
  gint n_properties;
sl@0
   437
  gint val1, val2, val3, val4;
sl@0
   438
  
sl@0
   439
  #ifdef SYMBIAN
sl@0
   440
  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
   441
  g_set_print_handler(mrtPrintHandler);
sl@0
   442
  #endif /*SYMBIAN*/
sl@0
   443
	
sl@0
   444
  g_log_set_always_fatal (g_log_set_always_fatal (G_LOG_FATAL_MASK) |
sl@0
   445
			  G_LOG_LEVEL_WARNING |
sl@0
   446
			  G_LOG_LEVEL_CRITICAL);
sl@0
   447
  g_type_init ();
sl@0
   448
sl@0
   449
  object = g_object_new (DERIVED_TYPE_OBJECT, NULL);
sl@0
   450
sl@0
   451
  /* Test setting and getting the properties
sl@0
   452
   */
sl@0
   453
  g_object_set (object,
sl@0
   454
		"prop1", 0x0101,
sl@0
   455
		"prop2", 0x0202,
sl@0
   456
		"prop3", 0x0303,
sl@0
   457
		"prop4", 0x0404,
sl@0
   458
		NULL);
sl@0
   459
  g_object_get (object,
sl@0
   460
		"prop1", &val1,
sl@0
   461
		"prop2", &val2,
sl@0
   462
		"prop3", &val3,
sl@0
   463
		"prop4", &val4,
sl@0
   464
		NULL);
sl@0
   465
sl@0
   466
  g_assert (val1 == 0x0101);
sl@0
   467
  g_assert (val2 == 0x0202);
sl@0
   468
  g_assert (val3 == 0x0303);
sl@0
   469
  g_assert (val4 == 0x0404);
sl@0
   470
sl@0
   471
  /* Test that the right spec is passed on explicit notifications
sl@0
   472
   */
sl@0
   473
  g_object_freeze_notify (G_OBJECT (object));
sl@0
   474
  g_object_notify (G_OBJECT (object), "prop1");
sl@0
   475
  g_object_notify (G_OBJECT (object), "prop2");
sl@0
   476
  g_object_notify (G_OBJECT (object), "prop3");
sl@0
   477
  g_object_notify (G_OBJECT (object), "prop4");
sl@0
   478
  g_object_thaw_notify (G_OBJECT (object));
sl@0
   479
sl@0
   480
  /* Test g_object_class_find_property() for overridden properties
sl@0
   481
   */
sl@0
   482
  object_class = G_OBJECT_GET_CLASS (object);
sl@0
   483
sl@0
   484
  g_assert (g_object_class_find_property (object_class, "prop1") == inherited_spec1);
sl@0
   485
  g_assert (g_object_class_find_property (object_class, "prop2") == inherited_spec2);
sl@0
   486
  g_assert (g_object_class_find_property (object_class, "prop3") == inherited_spec3);
sl@0
   487
  g_assert (g_object_class_find_property (object_class, "prop4") == inherited_spec4);
sl@0
   488
sl@0
   489
  /* Test g_object_class_list_properties() for overridden properties
sl@0
   490
   */
sl@0
   491
  properties = g_object_class_list_properties (object_class,(guint *) &n_properties);
sl@0
   492
  g_assert (n_properties == 4);
sl@0
   493
  assert_in_properties (inherited_spec1, properties, n_properties);
sl@0
   494
  assert_in_properties (inherited_spec2, properties, n_properties);
sl@0
   495
  assert_in_properties (inherited_spec3, properties, n_properties);
sl@0
   496
  assert_in_properties (inherited_spec4, properties, n_properties);
sl@0
   497
  g_free (properties);
sl@0
   498
sl@0
   499
  /* Test g_object_interface_find_property()
sl@0
   500
   */
sl@0
   501
  iface_vtable = g_type_default_interface_peek (TEST_TYPE_IFACE);
sl@0
   502
sl@0
   503
  g_assert (g_object_interface_find_property (iface_vtable, "prop1") == iface_spec1);
sl@0
   504
  g_assert (g_object_interface_find_property (iface_vtable, "prop2") == iface_spec2);
sl@0
   505
  g_assert (g_object_interface_find_property (iface_vtable, "prop3") == iface_spec3);
sl@0
   506
sl@0
   507
  /* Test g_object_interface_list_properties()
sl@0
   508
   */
sl@0
   509
  properties = g_object_interface_list_properties (iface_vtable, (guint *)&n_properties);
sl@0
   510
  g_assert (n_properties == 3);
sl@0
   511
  assert_in_properties (iface_spec1, properties, n_properties);
sl@0
   512
  assert_in_properties (iface_spec2, properties, n_properties);
sl@0
   513
  assert_in_properties (iface_spec3, properties, n_properties);
sl@0
   514
  g_free (properties);
sl@0
   515
sl@0
   516
  g_object_unref (object);
sl@0
   517
  
sl@0
   518
  #ifdef SYMBIAN
sl@0
   519
   testResultXml("ifaceproperties");
sl@0
   520
  #endif /*SYMBIAN*/
sl@0
   521
	
sl@0
   522
sl@0
   523
sl@0
   524
  return 0;
sl@0
   525
}