summaryrefslogtreecommitdiff
path: root/tests/scanner
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2012-01-04 21:38:03 -0500
committerJasper St. Pierre <jstpierre@mecheye.net>2012-02-03 11:52:33 -0500
commite089f7413ba3b191776037a89d3fc8f72582811b (patch)
tree975415983f7e5698c9733adaef47666afa92f972 /tests/scanner
parentb46da5f5e37e9748f6aa657fb5d49beaca7e5f0b (diff)
downloadgobject-introspection-e089f7413ba3b191776037a89d3fc8f72582811b.tar.gz
tests: Add another simple boxed type with a complex constructor
Diffstat (limited to 'tests/scanner')
-rw-r--r--tests/scanner/Regress-1.0-expected.gir30
-rw-r--r--tests/scanner/regress.c29
-rw-r--r--tests/scanner/regress.h12
3 files changed, 71 insertions, 0 deletions
diff --git a/tests/scanner/Regress-1.0-expected.gir b/tests/scanner/Regress-1.0-expected.gir
index ebdacf56..fd798ffc 100644
--- a/tests/scanner/Regress-1.0-expected.gir
+++ b/tests/scanner/Regress-1.0-expected.gir
@@ -141,6 +141,36 @@ use it should be.</doc>
</parameters>
</method>
</record>
+ <record name="TestBoxedB"
+ c:type="RegressTestBoxedB"
+ glib:type-name="RegressTestBoxedB"
+ glib:get-type="regress_test_boxed_b_get_type"
+ c:symbol-prefix="test_boxed_b">
+ <field name="some_int8" writable="1">
+ <type name="gint8" c:type="gint8"/>
+ </field>
+ <field name="some_long" writable="1">
+ <type name="glong" c:type="glong"/>
+ </field>
+ <constructor name="new" c:identifier="regress_test_boxed_b_new">
+ <return-value transfer-ownership="full">
+ <type name="TestBoxedB" c:type="RegressTestBoxedB*"/>
+ </return-value>
+ <parameters>
+ <parameter name="some_int8" transfer-ownership="none">
+ <type name="gint8" c:type="gint8"/>
+ </parameter>
+ <parameter name="some_long" transfer-ownership="none">
+ <type name="glong" c:type="glong"/>
+ </parameter>
+ </parameters>
+ </constructor>
+ <method name="copy" c:identifier="regress_test_boxed_b_copy">
+ <return-value transfer-ownership="full">
+ <type name="TestBoxedB" c:type="RegressTestBoxedB*"/>
+ </return-value>
+ </method>
+ </record>
<record name="TestBoxedPrivate"
c:type="RegressTestBoxedPrivate"
disguised="1">
diff --git a/tests/scanner/regress.c b/tests/scanner/regress.c
index 0f00ec8d..e90dbba0 100644
--- a/tests/scanner/regress.c
+++ b/tests/scanner/regress.c
@@ -1656,6 +1656,35 @@ regress_test_boxed_get_type (void)
return our_type;
}
+RegressTestBoxedB *
+regress_test_boxed_b_new (gint8 some_int8, glong some_long)
+{
+ RegressTestBoxedB *boxed;
+
+ boxed = g_slice_new (RegressTestBoxedB);
+ boxed->some_int8 = some_int8;
+ boxed->some_long = some_long;
+
+ return boxed;
+}
+
+RegressTestBoxedB *
+regress_test_boxed_b_copy (RegressTestBoxedB *boxed)
+{
+ return regress_test_boxed_b_new (boxed->some_int8, boxed->some_long);
+}
+
+static void
+regress_test_boxed_b_free (RegressTestBoxedB *boxed)
+{
+ g_slice_free (RegressTestBoxedB, boxed);
+}
+
+G_DEFINE_BOXED_TYPE(RegressTestBoxedB,
+ regress_test_boxed_b,
+ regress_test_boxed_b_copy,
+ regress_test_boxed_b_free);
+
G_DEFINE_TYPE(RegressTestObj, regress_test_obj, G_TYPE_OBJECT);
enum
diff --git a/tests/scanner/regress.h b/tests/scanner/regress.h
index 8fe44e2b..9cefb05c 100644
--- a/tests/scanner/regress.h
+++ b/tests/scanner/regress.h
@@ -313,6 +313,18 @@ RegressTestBoxed *regress_test_boxed_copy (RegressTestBoxed *boxed);
gboolean regress_test_boxed_equals (RegressTestBoxed *boxed,
RegressTestBoxed *other);
+typedef struct _RegressTestBoxedB RegressTestBoxedB;
+
+struct _RegressTestBoxedB
+{
+ gint8 some_int8;
+ glong some_long;
+};
+
+GType regress_test_boxed_b_get_type (void);
+RegressTestBoxedB *regress_test_boxed_b_new (gint8 some_int8, glong some_long);
+RegressTestBoxedB *regress_test_boxed_b_copy (RegressTestBoxedB *boxed);
+
/* gobject */
#define REGRESS_TEST_TYPE_OBJ (regress_test_obj_get_type ())
#define REGRESS_TEST_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), REGRESS_TEST_TYPE_OBJ, RegressTestObj))