summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastian Winkler <buz@netbuz.org>2012-04-19 08:01:18 +0200
committerMartin Pitt <martinpitt@gnome.org>2012-04-19 09:12:39 +0200
commit7b8ef1e9b3ae3c616c03c3b8d9571f5dba026923 (patch)
treece74269f5f47fe6e7a4598cf2fbe9d2dc2e25a35
parent1f8ed9239fcb570611518279a1a24be1ffab0a54 (diff)
downloadgobject-introspection-7b8ef1e9b3ae3c616c03c3b8d9571f5dba026923.tar.gz
tests: Add GType property TestObj:gtype
Needed for https://bugzilla.gnome.org/show_bug.cgi?id=674351 https://bugzilla.gnome.org/show_bug.cgi?id=674366 Signed-off-by: Martin Pitt <martinpitt@gnome.org>
-rw-r--r--tests/scanner/Regress-1.0-expected.gir6
-rw-r--r--tests/scanner/regress.c24
-rw-r--r--tests/scanner/regress.h1
3 files changed, 30 insertions, 1 deletions
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index f88fd9e4..4a1b49ab 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -956,6 +956,9 @@ raise an error.</doc>
<property name="float" writable="1" transfer-ownership="none">
<type name="gfloat"/>
</property>
+ <property name="gtype" writable="1" transfer-ownership="none">
+ <type name="GType"/>
+ </property>
<property name="hash-table" writable="1" transfer-ownership="container">
<type name="GLib.HashTable">
<type name="utf8"/>
@@ -1018,6 +1021,9 @@ raise an error.</doc>
<field name="string">
<type name="utf8" c:type="char*"/>
</field>
+ <field name="gtype">
+ <type name="GType" c:type="GType"/>
+ </field>
<glib:signal name="all"
when="first"
no-recurse="1"
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 5f129603..5254fa34 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -1816,7 +1816,8 @@ enum
PROP_TEST_OBJ_INT,
PROP_TEST_OBJ_FLOAT,
PROP_TEST_OBJ_DOUBLE,
- PROP_TEST_OBJ_STRING
+ PROP_TEST_OBJ_STRING,
+ PROP_TEST_OBJ_GTYPE
};
static void
@@ -1876,6 +1877,10 @@ regress_test_obj_set_property (GObject *object,
self->string = g_value_dup_string (value);
break;
+ case PROP_TEST_OBJ_GTYPE:
+ self->gtype = g_value_get_gtype (value);
+ break;
+
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -1929,6 +1934,10 @@ regress_test_obj_get_property (GObject *object,
g_value_set_string (value, self->string);
break;
+ case PROP_TEST_OBJ_GTYPE:
+ g_value_set_gtype (value, self->gtype);
+ break;
+
default:
/* We don't have any other property... */
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
@@ -2258,6 +2267,18 @@ regress_test_obj_class_init (RegressTestObjClass *klass)
pspec);
+ /**
+ * TestObj:gtype:
+ */
+ pspec = g_param_spec_gtype ("gtype",
+ "GType property",
+ "A GType property",
+ G_TYPE_NONE,
+ G_PARAM_READWRITE);
+ g_object_class_install_property (gobject_class,
+ PROP_TEST_OBJ_GTYPE,
+ pspec);
+
klass->matrix = regress_test_obj_default_matrix;
}
@@ -2267,6 +2288,7 @@ regress_test_obj_init (RegressTestObj *obj)
obj->bare = NULL;
obj->boxed = NULL;
obj->hash_table = NULL;
+ obj->gtype = G_TYPE_INVALID;
}
/**
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 1740145f..c2a25c13 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -353,6 +353,7 @@ struct _RegressTestObj
float some_float;
double some_double;
char* string;
+ GType gtype;
};
struct _RegressTestObjClass