diff options
author | Colin Walters <walters@verbum.org> | 2009-06-04 15:35:01 -0400 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2009-06-04 15:38:59 -0400 |
commit | b2da39874d5beca5cd1dcfbd91def27c0aad517b (patch) | |
tree | 71d2a661b15d9814ba04a872674b881f069f5fff /tests | |
parent | 382b4c3fd52b770fb935ce26bf117fe71cde96e5 (diff) | |
download | gobject-introspection-b2da39874d5beca5cd1dcfbd91def27c0aad517b.tar.gz |
Move Everything into gir/, since it's a public library
Everything isn't a test for quite a while now, it's a public library.
So move it to gir/.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/Makefile.am | 2 | ||||
-rw-r--r-- | tests/everything/Everything-1.0-expected.gir | 1228 | ||||
-rw-r--r-- | tests/everything/Makefile.am | 56 | ||||
-rw-r--r-- | tests/everything/everything.c | 1498 | ||||
-rw-r--r-- | tests/everything/everything.h | 292 |
5 files changed, 1 insertions, 3075 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am index bdaaa334..80c20942 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1 +1 @@ -SUBDIRS = . scanner everything repository invoke offsets +SUBDIRS = . scanner repository invoke offsets diff --git a/tests/everything/Everything-1.0-expected.gir b/tests/everything/Everything-1.0-expected.gir deleted file mode 100644 index aaacee55..00000000 --- a/tests/everything/Everything-1.0-expected.gir +++ /dev/null @@ -1,1228 +0,0 @@ -<?xml version="1.0"?> -<!-- This file was automatically generated from C sources - DO NOT EDIT! -To affect the contents of this file, edit the original C definitions, -and/or use gtk-doc annotations. --> -<repository version="1.0" - xmlns="http://www.gtk.org/introspection/core/1.0" - xmlns:c="http://www.gtk.org/introspection/c/1.0" - xmlns:glib="http://www.gtk.org/introspection/glib/1.0"> - <include name="GLib" version="2.0"/> - <include name="GObject" version="2.0"/> - <package name="gobject-2.0"/> - <namespace name="Everything" - version="1.0" - shared-library="libgirepository-everything-1.0.so.1" - c:prefix="Everything"> - <record name="TestBoxed" - c:type="TestBoxed" - glib:type-name="TestBoxed" - glib:get-type="test_boxed_get_type"> - <field name="some_int8" writable="1"> - <type name="int8" c:type="gint8"/> - </field> - <field name="nested_a" writable="1"> - <type name="TestSimpleBoxedA" c:type="TestSimpleBoxedA"/> - </field> - <field name="priv" writable="1"> - <type name="TestBoxedPrivate" c:type="TestBoxedPrivate*"/> - </field> - <constructor name="new" c:identifier="test_boxed_new"> - <return-value transfer-ownership="full"> - <type name="TestBoxed" c:type="TestBoxed*"/> - </return-value> - </constructor> - <method name="copy" c:identifier="test_boxed_copy"> - <return-value transfer-ownership="full"> - <type name="TestBoxed" c:type="TestBoxed*"/> - </return-value> - </method> - <method name="equals" c:identifier="test_boxed_equals"> - <return-value transfer-ownership="none"> - <type name="boolean" c:type="gboolean"/> - </return-value> - <parameters> - <parameter name="other" transfer-ownership="none"> - <type name="TestBoxed" c:type="TestBoxed*"/> - </parameter> - </parameters> - </method> - </record> - <record name="TestBoxedPrivate" c:type="TestBoxedPrivate"> - </record> - <callback name="TestCallback" c:type="TestCallback"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - </callback> - <callback name="TestCallbackUserData" c:type="TestCallbackUserData"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="user_data" transfer-ownership="none" closure="0"> - <type name="any" c:type="gpointer"/> - </parameter> - </parameters> - </callback> - <enumeration name="TestEnum" - glib:type-name="TestEnum" - glib:get-type="test_enum_get_type" - c:type="TestEnum"> - <member name="value1" - value="0" - c:identifier="TEST_VALUE1" - glib:nick="value1"/> - <member name="value2" - value="1" - c:identifier="TEST_VALUE2" - glib:nick="value2"/> - <member name="value3" - value="42" - c:identifier="TEST_VALUE3" - glib:nick="value3"/> - </enumeration> - <bitfield name="TestFlags" - glib:type-name="TestFlags" - glib:get-type="test_flags_get_type" - c:type="TestFlags"> - <member name="flag1" - value="1" - c:identifier="TEST_FLAG1" - glib:nick="flag1"/> - <member name="flag2" - value="2" - c:identifier="TEST_FLAG2" - glib:nick="flag2"/> - <member name="flag2" - value="4" - c:identifier="TEST_FLAG3" - glib:nick="flag2"/> - </bitfield> - <interface name="TestInterface" - c:type="EverythingTestInterface" - glib:type-name="EverythingTestInterface" - glib:get-type="test_interface_get_type" - glib:type-struct="TestInterfaceIface"> - </interface> - <record name="TestInterfaceIface" - c:type="TestInterfaceIface" - glib:is-gtype-struct-for="TestInterface"> - <field name="base_iface"> - <type name="GObject.TypeInterface" c:type="GTypeInterface"/> - </field> - </record> - <class name="TestObj" - c:type="TestObj" - parent="GObject.Object" - glib:type-name="TestObj" - glib:get-type="test_obj_get_type" - glib:type-struct="TestObjClass"> - <constructor name="new_from_file" - c:identifier="test_obj_new_from_file" - throws="1"> - <return-value transfer-ownership="full"> - <type name="TestObj" c:type="TestObj*"/> - </return-value> - <parameters> - <parameter name="x" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> - </parameter> - </parameters> - </constructor> - <function name="static_method" c:identifier="test_obj_static_method"> - <return-value transfer-ownership="none"> - <type name="double" c:type="double"/> - </return-value> - <parameters> - <parameter name="x" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - </parameters> - </function> - <virtual-method name="matrix" invoker="do_matrix"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="somestr" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> - </parameter> - </parameters> - </virtual-method> - <method name="set_bare" c:identifier="test_obj_set_bare"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="bare" transfer-ownership="none" allow-none="1"> - <type name="GObject.Object" c:type="GObject*"/> - </parameter> - </parameters> - </method> - <method name="do_matrix" - c:identifier="test_obj_do_matrix" - doc="This method is virtual. Notably its name differs from the virtual -slot name, which makes it useful for testing bindings handle this -case."> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="somestr" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> - </parameter> - </parameters> - </method> - <property name="bare" writable="1"> - <type name="GObject.Object" c:type="GObject"/> - </property> - <field name="parent_instance"> - <type name="GObject.Object" c:type="GObject"/> - </field> - <field name="bare"> - <type name="GObject.Object" c:type="GObject*"/> - </field> - <glib:signal name="test"> - <return-value transfer-ownership="full"> - <type name="none" c:type="void"/> - </return-value> - </glib:signal> - <glib:signal name="test-with-static-scope-arg"> - <return-value transfer-ownership="full"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="object" transfer-ownership="none"> - <type name="TestSimpleBoxedA" c:type="TestSimpleBoxedA"/> - </parameter> - </parameters> - </glib:signal> - </class> - <record name="TestObjClass" - c:type="TestObjClass" - glib:is-gtype-struct-for="TestObj"> - <field name="parent_class"> - <type name="GObject.ObjectClass" c:type="GObjectClass"/> - </field> - <callback name="matrix" c:type="matrix"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="obj" transfer-ownership="none"> - <type name="TestObj" c:type="TestObj*"/> - </parameter> - <parameter name="somestr" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> - </parameter> - </parameters> - </callback> - <field name="test_signal"> - <type name="uint" c:type="guint"/> - </field> - <field name="test_signal_with_static_scope_arg"> - <type name="uint" c:type="guint"/> - </field> - </record> - <record name="TestSimpleBoxedA" - c:type="TestSimpleBoxedA" - glib:type-name="TestSimpleBoxedA" - glib:get-type="test_simple_boxed_a_get_type"> - <field name="some_int" writable="1"> - <type name="int" c:type="gint"/> - </field> - <field name="some_int8" writable="1"> - <type name="int8" c:type="gint8"/> - </field> - <field name="some_double" writable="1"> - <type name="double" c:type="gdouble"/> - </field> - <field name="some_enum" writable="1"> - <type name="TestEnum" c:type="TestEnum"/> - </field> - <method name="copy" c:identifier="test_simple_boxed_a_copy"> - <return-value transfer-ownership="full"> - <type name="TestSimpleBoxedA" c:type="TestSimpleBoxedA*"/> - </return-value> - </method> - <method name="equals" c:identifier="test_simple_boxed_a_equals"> - <return-value transfer-ownership="none"> - <type name="boolean" c:type="gboolean"/> - </return-value> - <parameters> - <parameter name="other_a" transfer-ownership="none"> - <type name="TestSimpleBoxedA" c:type="TestSimpleBoxedA*"/> - </parameter> - </parameters> - </method> - </record> - <record name="TestSimpleBoxedB" - c:type="TestSimpleBoxedB" - glib:type-name="TestSimpleBoxedB" - glib:get-type="test_simple_boxed_b_get_type"> - <field name="some_int8" writable="1"> - <type name="int8" c:type="gint8"/> - </field> - <field name="nested_a" writable="1"> - <type name="TestSimpleBoxedA" c:type="TestSimpleBoxedA"/> - </field> - <method name="copy" c:identifier="test_simple_boxed_b_copy"> - <return-value transfer-ownership="full"> - <type name="TestSimpleBoxedB" c:type="TestSimpleBoxedB*"/> - </return-value> - </method> - </record> - <record name="TestStructA" c:type="TestStructA"> - <field name="some_int" writable="1"> - <type name="int" c:type="gint"/> - </field> - <field name="some_int8" writable="1"> - <type name="int8" c:type="gint8"/> - </field> - <field name="some_double" writable="1"> - <type name="double" c:type="gdouble"/> - </field> - <field name="some_enum" writable="1"> - <type name="TestEnum" c:type="TestEnum"/> - </field> - <method name="clone" - c:identifier="test_struct_a_clone" - doc="Make a copy of a TestStructA"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="a_out" transfer-ownership="none"> - <type name="TestStructA" c:type="TestStructA*"/> - </parameter> - </parameters> - </method> - </record> - <record name="TestStructB" c:type="TestStructB"> - <field name="some_int8" writable="1"> - <type name="int8" c:type="gint8"/> - </field> - <field name="nested_a" writable="1"> - <type name="TestStructA" c:type="TestStructA"/> - </field> - <method name="clone" - c:identifier="test_struct_b_clone" - doc="Make a copy of a TestStructB"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="b_out" transfer-ownership="none"> - <type name="TestStructB" c:type="TestStructB*"/> - </parameter> - </parameters> - </method> - </record> - <record name="TestStructC" c:type="_TestStructC"> - <field name="another_int" writable="1"> - <type name="int" c:type="gint"/> - </field> - <field name="obj" writable="1"> - <type name="GObject.Object" c:type="GObject*"/> - </field> - </record> - <class name="TestWi8021x" - c:type="TestWi8021x" - parent="GObject.Object" - glib:type-name="TestWi8021x" - glib:get-type="test_wi_802_1x_get_type" - glib:type-struct="TestWi8021xClass"> - <constructor name="new" c:identifier="test_wi_802_1x_new"> - <return-value transfer-ownership="full"> - <type name="TestWi8021x" c:type="TestWi8021x*"/> - </return-value> - </constructor> - <function name="static_method" - c:identifier="test_wi_802_1x_static_method"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="x" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - </parameters> - </function> - <method name="get_testbool" c:identifier="test_wi_802_1x_get_testbool"> - <return-value transfer-ownership="none"> - <type name="boolean" c:type="gboolean"/> - </return-value> - </method> - <method name="set_testbool" c:identifier="test_wi_802_1x_set_testbool"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="v" transfer-ownership="none"> - <type name="boolean" c:type="gboolean"/> - </parameter> - </parameters> - </method> - <property name="testbool" writable="1"> - <type name="boolean" c:type="gboolean"/> - </property> - <field name="parent_instance"> - <type name="GObject.Object" c:type="GObject"/> - </field> - <field name="testbool"> - <type name="boolean" c:type="gboolean"/> - </field> - </class> - <record name="TestWi8021xClass" - c:type="TestWi8021xClass" - glib:is-gtype-struct-for="TestWi8021x"> - <field name="parent_class"> - <type name="GObject.ObjectClass" c:type="GObjectClass"/> - </field> - </record> - <function name="test_array_gint16_in" c:identifier="test_array_gint16_in"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="n_ints" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - <parameter name="ints" transfer-ownership="none" doc="List of ints"> - <array length="0" c:type="gint16*"> - <type name="int16"/> - </array> - </parameter> - </parameters> - </function> - <function name="test_array_gint32_in" c:identifier="test_array_gint32_in"> - <return-value transfer-ownership="none"> - <type name="int32" c:type="gint32"/> - </return-value> - <parameters> - <parameter name="n_ints" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - <parameter name="ints" transfer-ownership="none" doc="List of ints"> - <array length="0" c:type="gint32*"> - <type name="int32"/> - </array> - </parameter> - </parameters> - </function> - <function name="test_array_gint64_in" c:identifier="test_array_gint64_in"> - <return-value transfer-ownership="none"> - <type name="int64" c:type="gint64"/> - </return-value> - <parameters> - <parameter name="n_ints" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - <parameter name="ints" transfer-ownership="none" doc="List of ints"> - <array length="0" c:type="gint64*"> - <type name="int64"/> - </array> - </parameter> - </parameters> - </function> - <function name="test_array_gint8_in" c:identifier="test_array_gint8_in"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="n_ints" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - <parameter name="ints" transfer-ownership="none" doc="List of ints"> - <array length="0" c:type="gint8*"> - <type name="int8"/> - </array> - </parameter> - </parameters> - </function> - <function name="test_array_gtype_in" c:identifier="test_array_gtype_in"> - <return-value transfer-ownership="full"> - <type name="utf8" c:type="char*"/> - </return-value> - <parameters> - <parameter name="n_types" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - <parameter name="types" transfer-ownership="none" doc="List of types"> - <array length="0" c:type="GType*"> - <type name="GType"/> - </array> - </parameter> - </parameters> - </function> - <function name="test_array_int_full_out" - c:identifier="test_array_int_full_out"> - <return-value transfer-ownership="full" doc="a new array of integers."> - <array length="0" c:type="int*"> - <type name="int"/> - </array> - </return-value> - <parameters> - <parameter name="len" direction="out" transfer-ownership="full"> - <type name="int" c:type="int*"/> - </parameter> - </parameters> - </function> - <function name="test_array_int_in" c:identifier="test_array_int_in"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="n_ints" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - <parameter name="ints" transfer-ownership="none" doc="List of ints"> - <array length="0" c:type="int*"> - <type name="int"/> - </array> - </parameter> - </parameters> - </function> - <function name="test_array_int_none_out" - c:identifier="test_array_int_none_out"> - <return-value transfer-ownership="none" - doc="a static array of integers."> - <array length="0" c:type="int*"> - <type name="int"/> - </array> - </return-value> - <parameters> - <parameter name="len" direction="out" transfer-ownership="full"> - <type name="int" c:type="int*"/> - </parameter> - </parameters> - </function> - <function name="test_boolean" c:identifier="test_boolean"> - <return-value transfer-ownership="none"> - <type name="boolean" c:type="gboolean"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="boolean" c:type="gboolean"/> - </parameter> - </parameters> - </function> - <function name="test_callback" c:identifier="test_callback"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="callback" transfer-ownership="none" scope="call"> - <type name="TestCallback" c:type="TestCallback"/> - </parameter> - </parameters> - </function> - <function name="test_callback_destroy_notify" - c:identifier="test_callback_destroy_notify" - doc="Notified - callback persists until a DestroyNotify delegate -is invoked."> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="callback" - transfer-ownership="none" - scope="notified" - closure="1" - destroy="2"> - <type name="TestCallbackUserData" c:type="TestCallbackUserData"/> - </parameter> - <parameter name="user_data" transfer-ownership="none"> - <type name="any" c:type="gpointer"/> - </parameter> - <parameter name="notify" transfer-ownership="none"> - <type name="GLib.DestroyNotify" c:type="GDestroyNotify"/> - </parameter> - </parameters> - </function> - <function name="test_callback_infinte" - c:identifier="test_callback_infinte" - doc="Infinite - callback persists forever."> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="callback" - transfer-ownership="none" - scope="infinte" - closure="1"> - <type name="TestCallbackUserData" c:type="TestCallbackUserData"/> - </parameter> - <parameter name="user_data" transfer-ownership="none"> - <type name="any" c:type="gpointer"/> - </parameter> - </parameters> - </function> - <function name="test_callback_thaw_notifications" - c:identifier="test_callback_thaw_notifications" - doc="Invokes all callbacks installed by #test_callback_destroy_notify(), -adding up their return values, and removes them, invoking the -corresponding destroy notfications."> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - </function> - <function name="test_callback_user_data" - c:identifier="test_callback_user_data" - doc="Call - callback parameter persists for the duration of the method -call and can be released on return."> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="callback" - transfer-ownership="none" - scope="call" - closure="1"> - <type name="TestCallbackUserData" c:type="TestCallbackUserData"/> - </parameter> - <parameter name="user_data" transfer-ownership="none"> - <type name="any" c:type="gpointer"/> - </parameter> - </parameters> - </function> - <function name="test_closure" c:identifier="test_closure"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="closure" transfer-ownership="none"> - <type name="GObject.Closure" c:type="GClosure*"/> - </parameter> - </parameters> - </function> - <function name="test_closure_one_arg" c:identifier="test_closure_one_arg"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="closure" transfer-ownership="none"> - <type name="GObject.Closure" c:type="GClosure*"/> - </parameter> - <parameter name="arg" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - </parameters> - </function> - <function name="test_double" c:identifier="test_double"> - <return-value transfer-ownership="none"> - <type name="double" c:type="gdouble"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="double" c:type="gdouble"/> - </parameter> - </parameters> - </function> - <function name="test_enum_param" c:identifier="test_enum_param"> - <return-value transfer-ownership="none"> - <type name="utf8" c:type="gchar*"/> - </return-value> - <parameters> - <parameter name="e" transfer-ownership="none"> - <type name="TestEnum" c:type="TestEnum"/> - </parameter> - </parameters> - </function> - <function name="test_filename_return" c:identifier="test_filename_return"> - <return-value transfer-ownership="full" doc="list of strings"> - <type name="GLib.SList" c:type="GSList*"> - <type name="filename"/> - </type> - </return-value> - </function> - <function name="test_float" c:identifier="test_float"> - <return-value transfer-ownership="none"> - <type name="float" c:type="gfloat"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="float" c:type="gfloat"/> - </parameter> - </parameters> - </function> - <function name="test_ghash_container_in" - c:identifier="test_ghash_container_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="container"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_ghash_container_return" - c:identifier="test_ghash_container_return"> - <return-value transfer-ownership="container"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_ghash_everything_in" - c:identifier="test_ghash_everything_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="full"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_ghash_everything_return" - c:identifier="test_ghash_everything_return"> - <return-value transfer-ownership="full"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_ghash_free" c:identifier="test_ghash_free"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="full"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_ghash_nothing_in" - c:identifier="test_ghash_nothing_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_ghash_nothing_in2" - c:identifier="test_ghash_nothing_in2"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_ghash_nothing_return" - c:identifier="test_ghash_nothing_return"> - <return-value transfer-ownership="none"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_ghash_nothing_return2" - c:identifier="test_ghash_nothing_return2"> - <return-value transfer-ownership="none"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_ghash_null_in" c:identifier="test_ghash_null_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none" allow-none="1"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_ghash_null_return" - c:identifier="test_ghash_null_return"> - <return-value transfer-ownership="none"> - <type name="GLib.HashTable" c:type="GHashTable*"> - <type name="utf8"/> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_glist_container_in" - c:identifier="test_glist_container_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="container"> - <type name="GLib.List" c:type="GList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_glist_container_return" - c:identifier="test_glist_container_return"> - <return-value transfer-ownership="container"> - <type name="GLib.List" c:type="GList*"> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_glist_everything_in" - c:identifier="test_glist_everything_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="full"> - <type name="GLib.List" c:type="GList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_glist_everything_return" - c:identifier="test_glist_everything_return"> - <return-value transfer-ownership="full"> - <type name="GLib.List" c:type="GList*"> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_glist_free" c:identifier="test_glist_free"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="full"> - <type name="GLib.List" c:type="GList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_glist_nothing_in" - c:identifier="test_glist_nothing_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="GLib.List" c:type="GList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_glist_nothing_in2" - c:identifier="test_glist_nothing_in2"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="GLib.List" c:type="GList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_glist_nothing_return" - c:identifier="test_glist_nothing_return"> - <return-value transfer-ownership="none"> - <type name="GLib.List" c:type="GList*"> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_glist_nothing_return2" - c:identifier="test_glist_nothing_return2"> - <return-value transfer-ownership="none"> - <type name="GLib.List" c:type="GList*"> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_gslist_container_in" - c:identifier="test_gslist_container_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="container"> - <type name="GLib.SList" c:type="GSList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_gslist_container_return" - c:identifier="test_gslist_container_return"> - <return-value transfer-ownership="container"> - <type name="GLib.SList" c:type="GSList*"> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_gslist_everything_in" - c:identifier="test_gslist_everything_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="full"> - <type name="GLib.SList" c:type="GSList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_gslist_everything_return" - c:identifier="test_gslist_everything_return"> - <return-value transfer-ownership="full"> - <type name="GLib.SList" c:type="GSList*"> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_gslist_free" c:identifier="test_gslist_free"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="full"> - <type name="GLib.SList" c:type="GSList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_gslist_nothing_in" - c:identifier="test_gslist_nothing_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="GLib.SList" c:type="GSList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_gslist_nothing_in2" - c:identifier="test_gslist_nothing_in2"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="GLib.SList" c:type="GSList*"> - <type name="utf8"/> - </type> - </parameter> - </parameters> - </function> - <function name="test_gslist_nothing_return" - c:identifier="test_gslist_nothing_return"> - <return-value transfer-ownership="none"> - <type name="GLib.SList" c:type="GSList*"> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_gslist_nothing_return2" - c:identifier="test_gslist_nothing_return2"> - <return-value transfer-ownership="none"> - <type name="GLib.SList" c:type="GSList*"> - <type name="utf8"/> - </type> - </return-value> - </function> - <function name="test_gtype" c:identifier="test_gtype"> - <return-value transfer-ownership="none"> - <type name="GType" c:type="GType"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="GType" c:type="GType"/> - </parameter> - </parameters> - </function> - <function name="test_int" c:identifier="test_int"> - <return-value transfer-ownership="none"> - <type name="int" c:type="gint"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="int" c:type="gint"/> - </parameter> - </parameters> - </function> - <function name="test_int16" c:identifier="test_int16"> - <return-value transfer-ownership="none"> - <type name="int16" c:type="gint16"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="int16" c:type="gint16"/> - </parameter> - </parameters> - </function> - <function name="test_int32" c:identifier="test_int32"> - <return-value transfer-ownership="none"> - <type name="int32" c:type="gint32"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="int32" c:type="gint32"/> - </parameter> - </parameters> - </function> - <function name="test_int64" c:identifier="test_int64"> - <return-value transfer-ownership="none"> - <type name="int64" c:type="gint64"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="int64" c:type="gint64"/> - </parameter> - </parameters> - </function> - <function name="test_int8" c:identifier="test_int8"> - <return-value transfer-ownership="none"> - <type name="int8" c:type="gint8"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="int8" c:type="gint8"/> - </parameter> - </parameters> - </function> - <function name="test_int_value_arg" c:identifier="test_int_value_arg"> - <return-value transfer-ownership="none"> - <type name="int" c:type="int"/> - </return-value> - <parameters> - <parameter name="v" transfer-ownership="none"> - <type name="GObject.Value" c:type="GValue*"/> - </parameter> - </parameters> - </function> - <function name="test_long" c:identifier="test_long"> - <return-value transfer-ownership="none"> - <type name="long" c:type="glong"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="long" c:type="glong"/> - </parameter> - </parameters> - </function> - <function name="test_simple_boxed_a_const_return" - c:identifier="test_simple_boxed_a_const_return"> - <return-value transfer-ownership="none"> - <type name="TestSimpleBoxedA" c:type="TestSimpleBoxedA*"/> - </return-value> - </function> - <function name="test_size" c:identifier="test_size"> - <return-value transfer-ownership="none"> - <type name="size_t" c:type="gsize"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="size_t" c:type="gsize"/> - </parameter> - </parameters> - </function> - <function name="test_ssize" c:identifier="test_ssize"> - <return-value transfer-ownership="none"> - <type name="ssize_t" c:type="gssize"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="ssize_t" c:type="gssize"/> - </parameter> - </parameters> - </function> - <function name="test_strv_in" c:identifier="test_strv_in"> - <return-value transfer-ownership="none"> - <type name="boolean" c:type="gboolean"/> - </return-value> - <parameters> - <parameter name="arr" transfer-ownership="none"> - <array c:type="char**"> - <type name="utf8"/> - </array> - </parameter> - </parameters> - </function> - <function name="test_strv_out" c:identifier="test_strv_out"> - <return-value transfer-ownership="container"> - <array c:type="char**"> - <type name="utf8"/> - </array> - </return-value> - </function> - <function name="test_timet" c:identifier="test_timet"> - <return-value transfer-ownership="none"> - <type name="time_t" c:type="time_t"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="time_t" c:type="time_t"/> - </parameter> - </parameters> - </function> - <function name="test_uint" c:identifier="test_uint"> - <return-value transfer-ownership="none"> - <type name="uint" c:type="guint"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="uint" c:type="guint"/> - </parameter> - </parameters> - </function> - <function name="test_uint16" c:identifier="test_uint16"> - <return-value transfer-ownership="none"> - <type name="uint16" c:type="guint16"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="uint16" c:type="guint16"/> - </parameter> - </parameters> - </function> - <function name="test_uint32" c:identifier="test_uint32"> - <return-value transfer-ownership="none"> - <type name="uint32" c:type="guint32"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="uint32" c:type="guint32"/> - </parameter> - </parameters> - </function> - <function name="test_uint64" c:identifier="test_uint64"> - <return-value transfer-ownership="none"> - <type name="uint64" c:type="guint64"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="uint64" c:type="guint64"/> - </parameter> - </parameters> - </function> - <function name="test_uint8" c:identifier="test_uint8"> - <return-value transfer-ownership="none"> - <type name="uint8" c:type="guint8"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="uint8" c:type="guint8"/> - </parameter> - </parameters> - </function> - <function name="test_ulong" c:identifier="test_ulong"> - <return-value transfer-ownership="none"> - <type name="ulong" c:type="gulong"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="ulong" c:type="gulong"/> - </parameter> - </parameters> - </function> - <function name="test_utf8_const_in" c:identifier="test_utf8_const_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="none"> - <type name="utf8" c:type="char*"/> - </parameter> - </parameters> - </function> - <function name="test_utf8_const_return" - c:identifier="test_utf8_const_return"> - <return-value transfer-ownership="none"> - <type name="utf8" c:type="char*"/> - </return-value> - </function> - <function name="test_utf8_inout" c:identifier="test_utf8_inout"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="inout" direction="inout" transfer-ownership="full"> - <type name="utf8" c:type="char**"/> - </parameter> - </parameters> - </function> - <function name="test_utf8_nonconst_in" - c:identifier="test_utf8_nonconst_in"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="in" transfer-ownership="full"> - <type name="utf8" c:type="char*"/> - </parameter> - </parameters> - </function> - <function name="test_utf8_nonconst_return" - c:identifier="test_utf8_nonconst_return"> - <return-value transfer-ownership="full"> - <type name="utf8" c:type="char*"/> - </return-value> - </function> - <function name="test_utf8_out" c:identifier="test_utf8_out"> - <return-value transfer-ownership="none"> - <type name="none" c:type="void"/> - </return-value> - <parameters> - <parameter name="out" direction="out" transfer-ownership="full"> - <type name="utf8" c:type="char**"/> - </parameter> - </parameters> - </function> - <function name="test_value_return" c:identifier="test_value_return"> - <return-value transfer-ownership="none" - doc="the int wrapped in a GValue."> - <type name="GObject.Value" c:type="GValue*"/> - </return-value> - <parameters> - <parameter name="i" transfer-ownership="none"> - <type name="int" c:type="int"/> - </parameter> - </parameters> - </function> - </namespace> -</repository> diff --git a/tests/everything/Makefile.am b/tests/everything/Makefile.am deleted file mode 100644 index 4f21112e..00000000 --- a/tests/everything/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -include $(top_srcdir)/common.mk - -LT_CURRENT = 1 -LT_REVISION = 0 -LT_AGE = 0 -LT_VERSION = $(LT_CURRENT):$(LT_REVISION):$(LT_AGE) -TYPELIB_VERSION = $(LT_CURRENT).0 - -AM_CFLAGS = $(GOBJECT_CFLAGS) -AM_LDFLAGS = -version-info $(LT_VERSION) -LIBS = $(GOBJECT_LIBS) - -typelibsdir = $(libdir)/girepository-1.0 -typelibs_DATA = $(TYPELIBS) - -girsdir = $(datadir)/gir-1.0 -girs_DATA = $(GIRS) - -lib_LTLIBRARIES = libgirepository-everything-1.0.la - -libgirepository_everything_1_0_la_SOURCES = $(srcdir)/everything.c $(srcdir)/everything.h - -if OS_WIN32 -AM_LDFLAGS += -no-undefined -endif - -GIRS = -CHECKGIRS = $(GIRS:.gir=.gir.check) -EXPECTEDGIRS = $(GIRS:.gir=-expected.gir) -TYPELIBS = $(GIRS:.gir=.typelib) -TXMLS = $(GIRS:.gir=.tgir) -CLEANFILES = $(TYPELIBS) $(TXMLS) $(GIRS) -BUILT_SOURCES = $(TYPELIBS) $(TXMLS) $(GIRS) -EXTRA_DIST = $(EXPECTEDGIRS) - -Everything-$(TYPELIB_VERSION).gir: libgirepository-everything-1.0.la everything.c everything.h $(SCANNER_BIN) $(SCANNER_LIBS) - $(CHECK_DEBUG) $(SCANNER) \ - --include=GObject-2.0 \ - --libtool="$(SHAVE_SAVED_LIBTOOL)" \ - --library=girepository-everything-1.0 \ - --namespace=Everything --nsversion=$(TYPELIB_VERSION) \ - --pkg gobject-2.0 \ - $(srcdir)/everything.h $(srcdir)/everything.c \ - --output $@ -GIRS += Everything-$(TYPELIB_VERSION).gir - -%.typelib: %.gir $(top_builddir)/tools/g-ir-compiler$(EXEEXT) Makefile - LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}:$(top_builddir)/girepository/.libs $(top_builddir)/tools/g-ir-compiler --includedir=. --includedir=$(top_builddir)/gir $< -o $@ - -%.tgir: %.typelib $(top_builddir)/tools/g-ir-generate$(EXEEXT) Makefile - LD_LIBRARY_PATH=$${LD_LIBRARY_PATH:+$$LD_LIBRARY_PATH:}:$(top_builddir)/girepository/.libs $(top_builddir)/tools/g-ir-generate --includedir=. --includedir=$(top_builddir)/gir $< -o $@ - -%.gir.check: %.gir - @diff -u -U 10 $(srcdir)/$*-expected.gir $*.gir && echo " TEST $*.gir" - -check-local: $(CHECKGIRS) diff --git a/tests/everything/everything.c b/tests/everything/everything.c deleted file mode 100644 index f2a2e309..00000000 --- a/tests/everything/everything.c +++ /dev/null @@ -1,1498 +0,0 @@ -#include <string.h> -#include "everything.h" - -/* basic types */ -gboolean test_boolean (gboolean in) -{ - return in; -} - -gint8 test_int8 (gint8 in) -{ - return in; -} - -guint8 test_uint8 (guint8 in) -{ - return in; -} - -gint16 test_int16 (gint16 in) -{ - return in; -} - -guint16 test_uint16 (guint16 in) -{ - return in; -} - -gint32 test_int32 (gint32 in) -{ - return in; -} - -guint32 test_uint32 (guint32 in) -{ - return in; -} - -gint64 test_int64 (gint64 in) -{ - return in; -} - -guint64 test_uint64 (guint64 in) -{ - return in; -} - -gint test_int (gint in) -{ - return in; -} - -guint test_uint (guint in) -{ - return in; -} - -glong test_long (glong in) -{ - return in; -} - -gulong test_ulong (gulong in) -{ - return in; -} - -gssize test_ssize (gssize in) -{ - return in; -} - -gsize test_size (gsize in) -{ - return in; -} - -gfloat test_float (gfloat in) -{ - return in; -} - -gdouble test_double (gdouble in) -{ - return in; -} - - -time_t test_timet (time_t in) -{ - return in; -} - -GType test_gtype (GType in) -{ - return in; -} - -int test_closure (GClosure *closure) -{ - GValue return_value = {0, }; - int ret; - - g_value_init (&return_value, G_TYPE_INT); - - g_closure_invoke (closure, - &return_value, - 0, NULL, - NULL); - - ret = g_value_get_int (&return_value); - - g_value_unset(&return_value); - - return ret; -} - -int test_closure_one_arg (GClosure *closure, int arg) -{ - GValue return_value = {0, }; - GValue arguments[1]; - int ret; - - g_value_init (&return_value, G_TYPE_INT); - - memset (&arguments[0], 0, sizeof (arguments)); - g_value_init (&arguments[0], G_TYPE_INT); - g_value_set_int (&arguments[0], arg); - - g_closure_invoke (closure, - &return_value, - 1, arguments, - NULL); - - ret = g_value_get_int (&return_value); - - g_value_unset(&return_value); - g_value_unset(&arguments[0]); - - return ret; -} - -/** - * test_value_arg: - * @v: (transfer none): a GValue expected to contain an int - * - * Return value: the int contained in the GValue. - */ -int test_int_value_arg(const GValue *v) { - int i; - - i = g_value_get_int (v); - - return i; -} - -static GValue value; -/** - * test_value_return: - * @i: an int - * - * Return value: (transfer none): the int wrapped in a GValue. - */ -const GValue *test_value_return(int i) { - memset(&value, '\0', sizeof(GValue)); - - g_value_init (&value, G_TYPE_INT); - g_value_set_int (&value, i); - - return &value; -} - - -/************************************************************************/ -/* utf8 */ -/* insert BLACK HEART SUIT to ensure UTF-8 doesn't get mangled */ -static const char utf8_const[] = "const \xe2\x99\xa5 utf8"; -static const char utf8_nonconst[] = "nonconst \xe2\x99\xa5 utf8"; - -/** - * test_utf8_const_return: - * Return value: <const char*> UTF-8 string - */ -G_CONST_RETURN char *test_utf8_const_return (void) -{ - /* transfer mode none */ - return utf8_const; -} - -/** - * test_utf8_nonconst_return: - * Return value: <char*> UTF-8 string - */ -char *test_utf8_nonconst_return (void) -{ - /* transfer mode full */ - return g_strdup (utf8_nonconst); -} - -void test_utf8_nonconst_in (char *in) -{ - /* transfer mode full */ - g_assert (strcmp (in, utf8_nonconst) == 0); - g_free(in); -} - -void test_utf8_const_in (const char *in) -{ - /* transfer mode none */ - g_assert (strcmp (in, utf8_const) == 0); -} - -/** - * test_utf8_out: - * @out: (out) (transfer full): - */ -void test_utf8_out (char **out) -{ - /* out parameter, transfer mode full */ - *out = g_strdup (utf8_nonconst); -} - -/** - * test_utf8_inout: - * @inout: (inout): - */ -void test_utf8_inout (char **inout) -{ - /* inout parameter, transfer mode full */ - g_assert (strcmp (*inout, utf8_const) == 0); - g_free(*inout); - *inout = g_strdup (utf8_nonconst); -} - -/** - * test_filename_return: - * - * Return value: (element-type filename) (transfer full): list of strings - */ -GSList *test_filename_return (void) -{ - GSList *filenames = NULL; - filenames = g_slist_prepend (filenames, g_filename_from_utf8("/etc/fstab", -1, NULL, NULL, NULL)); - filenames = g_slist_prepend (filenames, g_filename_from_utf8("åäö", -1, NULL, NULL, NULL)); - return filenames; -} - -/* non-basic-types */ - -static const char *test_sequence[] = {"1", "2", "3"}; - -/* array */ - -/** - * test_array_int_in: - * @n_ints: - * @ints: (array length=n_ints): List of ints - */ -int -test_array_int_in (int n_ints, int *ints) -{ - int i, sum = 0; - for (i = 0; i < n_ints; i++) - sum += ints[i]; - return sum; -} - -/** - * test_array_gint8_in: - * @n_ints: - * @ints: (array length=n_ints): List of ints - */ -int -test_array_gint8_in (int n_ints, gint8 *ints) -{ - int i, sum = 0; - for (i = 0; i < n_ints; i++) - sum += ints[i]; - return sum; -} - -/** - * test_array_gint16_in: - * @n_ints: - * @ints: (array length=n_ints): List of ints - */ -int -test_array_gint16_in (int n_ints, gint16 *ints) -{ - int i, sum = 0; - for (i = 0; i < n_ints; i++) - sum += ints[i]; - return sum; -} - -/** - * test_array_gint32_in: - * @n_ints: - * @ints: (array length=n_ints): List of ints - */ -gint32 -test_array_gint32_in (int n_ints, gint32 *ints) -{ - int i; - gint32 sum = 0; - for (i = 0; i < n_ints; i++) - sum += ints[i]; - return sum; -} - -/** - * test_array_gint64_in: - * @n_ints: - * @ints: (array length=n_ints): List of ints - */ -gint64 -test_array_gint64_in (int n_ints, gint64 *ints) -{ - int i; - gint64 sum = 0; - for (i = 0; i < n_ints; i++) - sum += ints[i]; - return sum; -} - -/** - * test_strv_in: - * @arr: (array zero-terminated=1) (transfer none): - */ -gboolean -test_strv_in (char **arr) -{ - if (g_strv_length (arr) != 3) - return FALSE; - if (strcmp (arr[0], "1") != 0) - return FALSE; - if (strcmp (arr[1], "2") != 0) - return FALSE; - if (strcmp (arr[2], "3") != 0) - return FALSE; - return TRUE; -} - -/** - * test_strv_in_container: - * @arr: (array zero-terminated=1) (transfer container): - */ -gboolean -test_strv_in_container (char **arr) -{ - gboolean result = test_strv_in (arr); - g_free (arr); - return result; -} - -/** - * test_array_gtype_in: - * @n_types: - * @types: (array length=n_types): List of types - * Return value: string representation of provided types - * */ -char * -test_array_gtype_in (int n_types, GType *types) -{ - GString *string; - int i; - - string = g_string_new ("["); - for (i = 0; i < n_types; i++) - { - g_string_append (string, g_type_name (types[i])); - g_string_append_c (string, ','); - } - g_string_append_c (string, ']'); - return g_string_free (string, FALSE); -} - -/** - * test_strv_out: - * - * Return value: (array zero-terminated=1) (transfer container): - */ -char ** -test_strv_out (void) -{ - char **ret = g_new (char *, 4); - ret[0] = "1"; - ret[1] = "2"; - ret[2] = "3"; - ret[3] = NULL; - return ret; -} - -/** - * test_strv_outarg: - * @retp: (array zero-terminated=1) (out) (transfer container): - */ -void -test_strv_outarg (char ***retp) -{ - char **ret = g_new (char *, 4); - ret[0] = "1"; - ret[1] = "2"; - ret[2] = "3"; - ret[3] = NULL; - *retp = ret; -} - -/** - * test_array_int_in_take: - * @n_ints: - * @ints: (array length=n_ints) (transfer full): List of ints - */ -int test_array_int_in_take (int n_ints, int *ints) -{ - int i, sum = 0; - for (i = 0; i < n_ints; i++) - sum += ints[i]; - g_free (ints); - return sum; -} - -/** - * test_array_int_full_out: - * @len: length of the returned array. - * Returns: (array length=len) (transfer full): a new array of integers. - */ -int * -test_array_int_full_out(int *len) { - int *result, i; - *len = 5; - result = g_malloc0(sizeof(*result) * (*len)); - for (i=1; i < (*len); i++) - result[i] = result[i-1] + 1; - return result; -} - -/** - * test_array_int_none_out: - * @len: length of the returned array. - * Returns: (array length=len) (transfer none): a static array of integers. - */ -int * -test_array_int_none_out(int *len) { - static int result[5] = { 1, 2, 3, 4, 5 }; - *len = 5; - return result; -} - -/* interface */ - -/************************************************************************/ -/* GList */ - -static /*const*/ GList *test_sequence_list() -{ - static GList *list = NULL; - if (!list) { - gsize i; - for (i = 0; i < G_N_ELEMENTS(test_sequence); ++i) { - list = g_list_prepend (list, (gpointer)test_sequence[i]); - } - list = g_list_reverse (list); - } - return list; -} - -/** - * test_glist_free: - * @in: (element-type utf8) (transfer full): - */ -void test_glist_free (GList *in) -{ - g_list_foreach (in, (GFunc)g_free, NULL); - g_list_free (in); -} - -/** - * test_glist_nothing_return: - * - * Return value: (element-type utf8) (transfer none): - */ -G_CONST_RETURN GList *test_glist_nothing_return (void) -{ - return test_sequence_list (); -} - -/** - * test_glist_nothing_return2: - * - * Return value: (element-type utf8) (transfer none): - */ -GList *test_glist_nothing_return2 (void) -{ - return test_sequence_list (); -} - -/** - * test_glist_container_return: - * - * Return value: (element-type utf8) (transfer container): - */ -GList *test_glist_container_return (void) -{ - return g_list_copy (test_sequence_list ()); -} - -/** - * test_glist_everything_return: - * - * Return value: (element-type utf8) (transfer full): - */ -GList *test_glist_everything_return (void) -{ - GList *list; - GList *l; - - list = g_list_copy (test_sequence_list ()); - for (l = list; l != NULL; l = l->next) - l->data = g_strdup (l->data); - return list; -} - -static void assert_test_sequence_list (const GList *in) -{ - const GList *l; - gsize i; - - for (i = 0, l = in; l != NULL; ++i, l = l->next) { - g_assert (i < G_N_ELEMENTS(test_sequence)); - g_assert (strcmp (l->data, test_sequence[i]) == 0); - } - g_assert (i == G_N_ELEMENTS(test_sequence)); -} - -/** - * test_glist_nothing_in: - * @in: (element-type utf8): - */ -void test_glist_nothing_in (const GList *in) -{ - assert_test_sequence_list (in); -} - -/** - * test_glist_nothing_in2: - * @in: (element-type utf8): - */ -void test_glist_nothing_in2 (GList *in) -{ - assert_test_sequence_list (in); -} - -/** - * test_glist_container_in: - * @in: (element-type utf8) (transfer container): - */ -void test_glist_container_in (GList *in) -{ - assert_test_sequence_list (in); - g_list_free (in); -} - -/** - * test_glist_everything_in: - * @in: (element-type utf8) (transfer full): - */ -void test_glist_everything_in (GList *in) -{ - assert_test_sequence_list (in); - test_glist_free (in); -} - -/************************************************************************/ -/* GSList */ - -static /*const*/ GSList *test_sequence_slist() -{ - static GSList *list = NULL; - if (!list) { - gsize i; - for (i = 0; i < G_N_ELEMENTS(test_sequence); ++i) { - list = g_slist_prepend (list, (gpointer)test_sequence[i]); - } - list = g_slist_reverse (list); - } - return list; -} - -/** - * test_gslist_free: - * @in: (element-type utf8) (transfer full): - */ -void test_gslist_free (GSList *in) -{ - g_slist_foreach (in, (GFunc)g_free, NULL); - g_slist_free (in); -} - -/** - * test_gslist_nothing_return: - * - * Return value: (element-type utf8) (transfer none): - */ -G_CONST_RETURN GSList *test_gslist_nothing_return (void) -{ - return test_sequence_slist (); -} - -/** - * test_gslist_nothing_return2: - * - * Return value: (element-type utf8) (transfer none): - */ -GSList *test_gslist_nothing_return2 (void) -{ - return test_sequence_slist (); -} - -/** - * test_gslist_container_return: - * - * Return value: (element-type utf8) (transfer container): - */ -GSList *test_gslist_container_return (void) -{ - return g_slist_copy (test_sequence_slist ()); -} - -/** - * test_gslist_everything_return: - * - * Return value: (element-type utf8) (transfer full): - */ -GSList *test_gslist_everything_return (void) -{ - GSList *list; - GSList *l; - - list = g_slist_copy (test_sequence_slist ()); - for (l = list; l != NULL; l = l->next) - l->data = g_strdup (l->data); - return list; -} - -static void assert_test_sequence_slist (const GSList *in) -{ - const GSList *l; - gsize i; - - for (i = 0, l = in; l != NULL; ++i, l = l->next) { - g_assert (i < G_N_ELEMENTS(test_sequence)); - g_assert (strcmp (l->data, test_sequence[i]) == 0); - } - g_assert (i == G_N_ELEMENTS(test_sequence)); -} - -/** - * test_gslist_nothing_in: - * @in: (element-type utf8): - */ -void test_gslist_nothing_in (const GSList *in) -{ - assert_test_sequence_slist (in); -} - -/** - * test_gslist_nothing_in2: - * @in: (element-type utf8): - */ -void test_gslist_nothing_in2 (GSList *in) -{ - assert_test_sequence_slist (in); -} - -/** - * test_gslist_container_in: - * @in: (element-type utf8) (transfer container): - */ -void test_gslist_container_in (GSList *in) -{ - assert_test_sequence_slist (in); - g_slist_free (in); -} - -/** - * test_gslist_everything_in: - * @in: (element-type utf8) (transfer full): - */ -void test_gslist_everything_in (GSList *in) -{ - assert_test_sequence_slist (in); - test_gslist_free (in); -} - -/************************************************************************/ -/* GHash */ - -static char *table_data[3][2] = { - { "foo", "bar" }, { "baz", "bat" }, { "qux", "quux" } -}; - -static GHashTable *test_table_ghash_new_container() -{ - GHashTable *hash; - int i; - hash = g_hash_table_new(g_str_hash, g_str_equal); - for (i=0; i<3; i++) - g_hash_table_insert(hash, table_data[i][0], table_data[i][1]); - return hash; -} - -static GHashTable *test_table_ghash_new_full() -{ - GHashTable *hash; - int i; - hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); - for (i=0; i<3; i++) - g_hash_table_insert(hash, - g_strdup(table_data[i][0]), - g_strdup(table_data[i][1])); - return hash; -} - -static /*const*/ GHashTable *test_table_ghash_const() -{ - static GHashTable *hash = NULL; - if (!hash) { - hash = test_table_ghash_new_container(); - } - return hash; -} - -/** - * test_ghash_free: - * @in: (transfer full) (element-type utf8 utf8) - */ -void test_ghash_free (GHashTable *in) -{ - /* keys and values are deleted iff an appropriate element destroy function - * was registered */ - g_hash_table_unref(in); -} - -/** - * test_ghash_null_return: - * - * Return value: (element-type utf8 utf8) (transfer none) (allow-none): - */ -G_CONST_RETURN GHashTable *test_ghash_null_return (void) -{ - return NULL; -} - -/** - * test_ghash_nothing_return: - * - * Return value: (element-type utf8 utf8) (transfer none): - */ -G_CONST_RETURN GHashTable *test_ghash_nothing_return (void) -{ - return test_table_ghash_const (); -} - -/** - * test_ghash_nothing_return2: - * - * Return value: (element-type utf8 utf8) (transfer none): - */ -GHashTable *test_ghash_nothing_return2 (void) -{ - return test_table_ghash_const (); -} - -/** - * test_ghash_container_return: - * - * Return value: (element-type utf8 utf8) (transfer container): - */ -GHashTable *test_ghash_container_return (void) -{ - return test_table_ghash_new_container (); -} - -/** - * test_ghash_everything_return: - * - * Return value: (element-type utf8 utf8) (transfer full): - */ -GHashTable *test_ghash_everything_return (void) -{ - return test_table_ghash_new_full (); -} - -static void assert_test_table_ghash (const GHashTable *in) -{ - GHashTable *h = test_table_ghash_const(); - GHashTableIter iter; - gpointer key, value; - - g_assert(g_hash_table_size(h) == - g_hash_table_size((GHashTable*)in)); - - g_hash_table_iter_init(&iter, (GHashTable*)in); - while (g_hash_table_iter_next (&iter, &key, &value)) - g_assert( strcmp(g_hash_table_lookup(h, (char*)key), (char*)value) == 0); -} - -/** - * test_ghash_null_in: - * @in: (element-type utf8 utf8) (allow-none): - */ -void test_ghash_null_in (const GHashTable *in) -{ - g_assert (in == NULL); -} - -/** - * test_ghash_nothing_in: - * @in: (element-type utf8 utf8): - */ -void test_ghash_nothing_in (const GHashTable *in) -{ - assert_test_table_ghash (in); -} - -/** - * test_ghash_nothing_in2: - * @in: (element-type utf8 utf8): - */ -void test_ghash_nothing_in2 (GHashTable *in) -{ - assert_test_table_ghash (in); -} - -/** - * test_ghash_container_in: - * @in: (transfer container) (element-type utf8 utf8): - */ -void test_ghash_container_in (GHashTable *in) -{ - assert_test_table_ghash (in); - /* be careful and explicitly steal all the elements from the ghash before - * freeing it. */ - g_hash_table_steal_all (in); - g_hash_table_destroy (in); -} - -static gboolean ghash_freer(gpointer key, gpointer value, gpointer user_data) { - g_free(key); - g_free(value); - return TRUE; -} - -/** - * test_ghash_everything_in: - * @in: (transfer full) (element-type utf8 utf8): - */ -void test_ghash_everything_in (GHashTable *in) -{ - assert_test_table_ghash (in); - /* free the elements, then free the container. Don't rely on the - * GHashTable's key/value destructor functions. */ - g_hash_table_foreach_steal (in, ghash_freer, NULL); - /* okay, dealloc the hash table. */ - g_hash_table_destroy (in); -} - -/************************************************************************/ - -/* error? */ - -/* enums / flags */ - -GType -test_enum_get_type (void) -{ - static GType etype = 0; - if (G_UNLIKELY(etype == 0)) { - static const GEnumValue values[] = { - { TEST_VALUE1, "TEST_VALUE1", "value1" }, - { TEST_VALUE2, "TEST_VALUE2", "value2" }, - { TEST_VALUE3, "TEST_VALUE3", "value3" }, - { 0, NULL, NULL } - }; - etype = g_enum_register_static (g_intern_static_string ("TestEnum"), values); - } - - return etype; -} - -GType -test_flags_get_type (void) -{ - static GType etype = 0; - if (G_UNLIKELY(etype == 0)) { - static const GFlagsValue values[] = { - { TEST_FLAG1, "TEST_FLAG1", "flag1" }, - { TEST_FLAG2, "TEST_FLAG2", "flag2" }, - { TEST_FLAG3, "TEST_FLAG3", "flag2" }, - { 0, NULL, NULL } - }; - etype = g_flags_register_static (g_intern_static_string ("TestFlags"), values); - } - - return etype; -} - -const gchar * -test_enum_param(TestEnum e) -{ - GEnumValue *ev; - GEnumClass *ec; - - ec = g_type_class_ref (test_enum_get_type ()); - ev = g_enum_get_value (ec, e); - g_type_class_unref (ec); - - return ev->value_nick; - -} - -/* structures */ - -/** - * test_struct_a_clone: - * @a: the structure - * @a_out: the cloned structure - * - * Make a copy of a TestStructA - */ -void -test_struct_a_clone (TestStructA *a, - TestStructA *a_out) -{ - *a_out = *a; -} - -/** - * test_struct_b_clone: - * @b: the structure - * @b_out: the cloned structure - * - * Make a copy of a TestStructB - */ -void -test_struct_b_clone (TestStructB *b, - TestStructB *b_out) -{ - *b_out = *b; -} - -/* plain-old-data boxed types */ - -TestSimpleBoxedA * -test_simple_boxed_a_copy (TestSimpleBoxedA *a) -{ - TestSimpleBoxedA *new_a = g_slice_new (TestSimpleBoxedA); - - *new_a = *a; - - return new_a; -} - -static void -test_simple_boxed_a_free (TestSimpleBoxedA *a) -{ - g_slice_free (TestSimpleBoxedA, a); -} - -GType -test_simple_boxed_a_get_type (void) -{ - static GType our_type = 0; - - if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("TestSimpleBoxedA"), - (GBoxedCopyFunc)test_simple_boxed_a_copy, - (GBoxedFreeFunc)test_simple_boxed_a_free); - return our_type; -} - -TestSimpleBoxedB * -test_simple_boxed_b_copy (TestSimpleBoxedB *b) -{ - TestSimpleBoxedB *new_b = g_slice_new (TestSimpleBoxedB); - - *new_b = *b; - - return new_b; -} - -gboolean -test_simple_boxed_a_equals (TestSimpleBoxedA *a, - TestSimpleBoxedA *other_a) -{ - return (a->some_int == other_a->some_int && - a->some_int8 == other_a->some_int8 && - a->some_double == other_a->some_double); -} - -const TestSimpleBoxedA* -test_simple_boxed_a_const_return (void) -{ - static TestSimpleBoxedA simple_a = { - 5, 6, 7.0 - }; - - return &simple_a; -} - -static void -test_simple_boxed_b_free (TestSimpleBoxedB *a) -{ - g_slice_free (TestSimpleBoxedB, a); -} - -GType -test_simple_boxed_b_get_type (void) -{ - static GType our_type = 0; - - if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("TestSimpleBoxedB"), - (GBoxedCopyFunc)test_simple_boxed_b_copy, - (GBoxedFreeFunc)test_simple_boxed_b_free); - return our_type; -} - -/* opaque boxed */ - -struct _TestBoxedPrivate -{ - guint magic; -}; - -TestBoxed * -test_boxed_new (void) -{ - TestBoxed *boxed = g_slice_new0(TestBoxed); - boxed->priv = g_slice_new0(TestBoxedPrivate); - boxed->priv->magic = 0xdeadbeef; - - return boxed; -} - -TestBoxed * -test_boxed_copy (TestBoxed *boxed) -{ - TestBoxed *new_boxed = test_boxed_new(); - TestBoxedPrivate *save; - - save = new_boxed->priv; - *new_boxed = *boxed; - new_boxed->priv = save; - - return new_boxed; -} - -gboolean -test_boxed_equals (TestBoxed *boxed, - TestBoxed *other) -{ - return (other->some_int8 == boxed->some_int8 && - test_simple_boxed_a_equals(&other->nested_a, &boxed->nested_a)); -} - -static void -test_boxed_free (TestBoxed *boxed) -{ - g_assert (boxed->priv->magic == 0xdeadbeef); - - g_slice_free (TestBoxedPrivate, boxed->priv); - g_slice_free (TestBoxed, boxed); -} - -GType -test_boxed_get_type (void) -{ - static GType our_type = 0; - - if (our_type == 0) - our_type = g_boxed_type_register_static (g_intern_static_string ("TestBoxed"), - (GBoxedCopyFunc)test_boxed_copy, - (GBoxedFreeFunc)test_boxed_free); - return our_type; -} - -G_DEFINE_TYPE(TestObj, test_obj, G_TYPE_OBJECT); - -enum -{ - PROP_TEST_OBJ_BARE = 1 -}; - -static void -test_obj_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - TestObj *self = TEST_OBJECT (object); - - switch (property_id) - { - case PROP_TEST_OBJ_BARE: - test_obj_set_bare (self, g_value_get_object (value)); - break; - - default: - /* We don't have any other property... */ - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -test_obj_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - TestObj *self = TEST_OBJECT (object); - - switch (property_id) - { - case PROP_TEST_OBJ_BARE: - g_value_set_object (value, self->bare); - break; - - default: - /* We don't have any other property... */ - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -test_obj_dispose (GObject *gobject) -{ - TestObj *self = TEST_OBJECT (gobject); - - if (self->bare) - { - g_object_unref (self->bare); - - self->bare = NULL; - } - - /* Chain up to the parent class */ - G_OBJECT_CLASS (test_obj_parent_class)->dispose (gobject); -} - -static int -test_obj_default_matrix (TestObj *obj, const char *somestr) -{ - return 42; -} - -static void -test_obj_class_init (TestObjClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; - GType param_types[1]; - - klass->test_signal = - g_signal_newv ("test", - G_TYPE_FROM_CLASS (gobject_class), - G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, - NULL /* closure */, - NULL /* accumulator */, - NULL /* accumulator data */, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE /* return_type */, - 0 /* n_params */, - NULL /* param_types */); - - param_types[0] = test_simple_boxed_a_get_type() | G_SIGNAL_TYPE_STATIC_SCOPE; - klass->test_signal_with_static_scope_arg = - g_signal_newv ("test-with-static-scope-arg", - G_TYPE_FROM_CLASS (gobject_class), - G_SIGNAL_RUN_LAST | G_SIGNAL_NO_RECURSE | G_SIGNAL_NO_HOOKS, - NULL /* closure */, - NULL /* accumulator */, - NULL /* accumulator data */, - g_cclosure_marshal_VOID__BOXED, - G_TYPE_NONE /* return_type */, - 1 /* n_params */, - param_types); - - gobject_class->set_property = test_obj_set_property; - gobject_class->get_property = test_obj_get_property; - gobject_class->dispose = test_obj_dispose; - - pspec = g_param_spec_object ("bare", - "Bare property", - "A contained object", - G_TYPE_OBJECT, - G_PARAM_READWRITE); - g_object_class_install_property (gobject_class, - PROP_TEST_OBJ_BARE, - pspec); - - klass->matrix = test_obj_default_matrix; -} - -static void -test_obj_init (TestObj *obj) -{ - obj->bare = NULL; -} - -TestObj * -test_obj_new_from_file (const char *x, GError **error) -{ - return g_object_new (TEST_TYPE_OBJ, NULL); -} - -/** - * test_obj_set_bare: - * @bare: (allow-none): - */ -void -test_obj_set_bare (TestObj *obj, GObject *bare) -{ - if (obj->bare) - g_object_unref (obj->bare); - obj->bare = bare; - if (obj->bare) - g_object_ref (obj->bare); -} - -double -test_obj_static_method (int x) -{ - return x; -} - -/** - * test_obj_do_matrix: - * @obj: A #TestObj - * @somestr: Meaningless string - * - * This method is virtual. Notably its name differs from the virtual - * slot name, which makes it useful for testing bindings handle this - * case. - * - * Virtual: matrix - */ -int -test_obj_do_matrix (TestObj *obj, const char *somestr) -{ - return TEST_OBJ_GET_CLASS (obj)->matrix (obj, somestr); -} - -typedef struct _CallbackInfo CallbackInfo; - -struct _CallbackInfo -{ - TestCallbackUserData callback; - GDestroyNotify notify; - gpointer user_data; -}; - - -/** - * test_callback: - * @callback: (scope call): - * - **/ -int -test_callback (TestCallback callback) -{ - return callback(); -} - -/** - * test_callback_user_data: - * @callback: (scope call): - * - * Call - callback parameter persists for the duration of the method - * call and can be released on return. - **/ -int -test_callback_user_data (TestCallbackUserData callback, - gpointer user_data) -{ - return callback(user_data); -} - -static GSList *notified_callbacks = NULL; - -/** - * test_callback_destroy_notify: - * @callback: (scope notified): - * - * Notified - callback persists until a DestroyNotify delegate - * is invoked. - **/ -int -test_callback_destroy_notify (TestCallbackUserData callback, - gpointer user_data, - GDestroyNotify notify) -{ - int retval; - CallbackInfo *info; - - retval = callback(user_data); - - info = g_new(CallbackInfo, 1); - info->callback = callback; - info->notify = notify; - info->user_data = user_data; - - notified_callbacks = g_slist_prepend(notified_callbacks, info); - - return retval; -} - -/** - * test_callback_thaw_notifications: - * - * Invokes all callbacks installed by #test_callback_destroy_notify(), - * adding up their return values, and removes them, invoking the - * corresponding destroy notfications. - * - * Return value: Sum of the return values of the invoked callbacks. - */ -int -test_callback_thaw_notifications (void) -{ - int retval = 0; - GSList *node; - - for (node = notified_callbacks; node != NULL; node = node->next) - { - CallbackInfo *info = (CallbackInfo *)node->data; - retval += info->callback (info->user_data); - if (info->notify) - info->notify (info->user_data); - g_free (info); - } - - g_slist_free (notified_callbacks); - notified_callbacks = NULL; - - return retval; -} - -/** - * test_callback_infinte: - * @callback: (scope infinte): - * - * Infinite - callback persists forever. - **/ - -static GSList *infinite_callbacks = NULL; - -int -test_callback_infinte (TestCallbackUserData callback, - gpointer user_data) -{ - infinite_callbacks = g_slist_prepend(infinite_callbacks, callback); - - return callback(user_data); -} - -/* interface */ - -static void -test_interface_class_init(void *g_iface) -{ -} - -GType -test_interface_get_type(void) -{ - static GType type = 0; - if (type == 0) { - type = g_type_register_static_simple (G_TYPE_INTERFACE, - "EverythingTestInterface", - sizeof (TestInterfaceIface), - (GClassInitFunc) test_interface_class_init, - 0, NULL, 0); - } - - return type; -} - -/* gobject with non-standard prefix */ -G_DEFINE_TYPE(TestWi8021x, test_wi_802_1x, G_TYPE_OBJECT); - -enum -{ - PROP_TEST_WI_802_1X_TESTBOOL = 1 -}; - -static void -test_wi_802_1x_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - TestWi8021x *self = TEST_WI_802_1X (object); - - switch (property_id) - { - case PROP_TEST_WI_802_1X_TESTBOOL: - test_wi_802_1x_set_testbool (self, g_value_get_boolean (value)); - break; - - default: - /* We don't have any other property... */ - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -test_wi_802_1x_get_property (GObject *object, - guint property_id, - GValue *value, - GParamSpec *pspec) -{ - TestWi8021x *self = TEST_WI_802_1X (object); - - switch (property_id) - { - case PROP_TEST_WI_802_1X_TESTBOOL: - g_value_set_boolean (value, test_wi_802_1x_get_testbool (self)); - break; - - default: - /* We don't have any other property... */ - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static void -test_wi_802_1x_dispose (GObject *gobject) -{ - /* Chain up to the parent class */ - G_OBJECT_CLASS (test_wi_802_1x_parent_class)->dispose (gobject); -} - -static void -test_wi_802_1x_class_init (TestWi8021xClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GParamSpec *pspec; - - gobject_class->set_property = test_wi_802_1x_set_property; - gobject_class->get_property = test_wi_802_1x_get_property; - gobject_class->dispose = test_wi_802_1x_dispose; - - pspec = g_param_spec_boolean ("testbool", - "Nick for testbool", - "Blurb for testbool", - TRUE, - G_PARAM_READWRITE); - g_object_class_install_property (gobject_class, - PROP_TEST_WI_802_1X_TESTBOOL, - pspec); -} - -static void -test_wi_802_1x_init (TestWi8021x *obj) -{ - obj->testbool = TRUE; -} - -TestWi8021x * -test_wi_802_1x_new (void) -{ - return g_object_new (TEST_TYPE_WI_802_1X, NULL); -} - -void -test_wi_802_1x_set_testbool (TestWi8021x *obj, gboolean val) -{ - obj->testbool = val; -} - -gboolean -test_wi_802_1x_get_testbool (TestWi8021x *obj) -{ - return obj->testbool; -} - -int -test_wi_802_1x_static_method (int x) -{ - return 2*x; -} diff --git a/tests/everything/everything.h b/tests/everything/everything.h deleted file mode 100644 index a4120dc2..00000000 --- a/tests/everything/everything.h +++ /dev/null @@ -1,292 +0,0 @@ -#ifndef __GITESTTYPES_H__ -#define __GITESTTYPES_H__ - -#include <glib-object.h> -#include <time.h> - -/* basic types */ -gboolean test_boolean (gboolean in); -gint8 test_int8 (gint8 in); -guint8 test_uint8 (guint8 in); -gint16 test_int16 (gint16 in); -guint16 test_uint16 (guint16 in); -gint32 test_int32 (gint32 in); -guint32 test_uint32 (guint32 in); -gint64 test_int64 (gint64 in); -guint64 test_uint64 (guint64 in); -gint test_int (gint in); -guint test_uint (guint in); -glong test_long (glong in); -gulong test_ulong (gulong in); -gssize test_ssize (gssize in); -gsize test_size (gsize in); -gfloat test_float (gfloat in); -gdouble test_double (gdouble in); -time_t test_timet (time_t in); -GType test_gtype (GType in); - -/* utf8 */ -G_CONST_RETURN char *test_utf8_const_return (void); -char *test_utf8_nonconst_return (void); -void test_utf8_nonconst_in (char *in); -void test_utf8_const_in (const char *in); -void test_utf8_out (char **out); -void test_utf8_inout (char **inout); -GSList *test_filename_return (void); - -/* non-basic-types */ -/* array */ -gboolean test_strv_in (char **arr); -int test_array_int_in (int n_ints, int *ints); -int test_array_gint8_in (int n_ints, gint8 *ints); -int test_array_gint16_in (int n_ints, gint16 *ints); -gint32 test_array_gint32_in (int n_ints, gint32 *ints); -gint64 test_array_gint64_in (int n_ints, gint64 *ints); -char *test_array_gtype_in (int n_types, GType *types); -char **test_strv_out (void); -void test_strv_outarg (char ***retp); - -/* transfer tests */ -int test_array_int_in_take (int n_ints, int *ints); -gboolean test_strv_in_container (char **arr); - -int *test_array_int_full_out(int *len); -int *test_array_int_none_out(int *len); - -/* interface */ -/* GList */ -G_CONST_RETURN GList *test_glist_nothing_return (void); -GList *test_glist_nothing_return2 (void); -GList *test_glist_container_return (void); -GList *test_glist_everything_return (void); -void test_glist_nothing_in (const GList *in); -void test_glist_nothing_in2 (GList *in); -void test_glist_container_in (GList *in); -void test_glist_everything_in (GList *in); -void test_glist_free (GList *in); - -/* GSList */ -G_CONST_RETURN GSList *test_gslist_nothing_return (void); -GSList *test_gslist_nothing_return2 (void); -GSList *test_gslist_container_return (void); -GSList *test_gslist_everything_return (void); -void test_gslist_nothing_in (const GSList *in); -void test_gslist_nothing_in2 (GSList *in); -void test_gslist_container_in (GSList *in); -void test_gslist_everything_in (GSList *in); -void test_gslist_free (GSList *in); - -/* GHashTable */ -G_CONST_RETURN GHashTable *test_ghash_null_return (void); -G_CONST_RETURN GHashTable *test_ghash_nothing_return (void); -GHashTable *test_ghash_nothing_return2 (void); -GHashTable *test_ghash_container_return (void); -GHashTable *test_ghash_everything_return (void); -void test_ghash_null_in (const GHashTable *in); -void test_ghash_nothing_in (const GHashTable *in); -void test_ghash_nothing_in2 (GHashTable *in); -void test_ghash_container_in (GHashTable *in); -void test_ghash_everything_in (GHashTable *in); -void test_ghash_free (GHashTable *in); - -/* error? */ - -/* closure */ -int test_closure (GClosure *closure); -int test_closure_one_arg (GClosure *closure, int arg); - -/* value */ -int test_int_value_arg(const GValue *v); -const GValue *test_value_return(int i); - -/* enums / flags */ - -typedef enum -{ - TEST_VALUE1, - TEST_VALUE2, - TEST_VALUE3 = 42 -} TestEnum; - -typedef enum -{ - TEST_FLAG1 = 1 << 0, - TEST_FLAG2 = 1 << 1, - TEST_FLAG3 = 1 << 2, -} TestFlags; - -GType test_enum_get_type (void) G_GNUC_CONST; -#define TEST_TYPE_ENUM (test_enum_get_type ()) -GType test_flags_get_type (void) G_GNUC_CONST; -#define TES_TYPE_FLAGS (test_flags_get_type ()) - -const gchar * test_enum_param(TestEnum e); - -/* structures */ -typedef struct _TestStructA TestStructA; -typedef struct _TestStructB TestStructB; - -struct _TestStructA -{ - gint some_int; - gint8 some_int8; - gdouble some_double; - TestEnum some_enum; -}; - -void test_struct_a_clone (TestStructA *a, - TestStructA *a_out); - -struct _TestStructB -{ - gint8 some_int8; - TestStructA nested_a; -}; - -void test_struct_b_clone (TestStructB *b, - TestStructB *b_out); - -/* This one has a non-basic member */ -struct _TestStructC -{ - gint another_int; - GObject *obj; -}; - -/* plain-old-data boxed types */ -typedef struct _TestSimpleBoxedA TestSimpleBoxedA; -typedef struct _TestSimpleBoxedB TestSimpleBoxedB; - -struct _TestSimpleBoxedA -{ - gint some_int; - gint8 some_int8; - gdouble some_double; - TestEnum some_enum; -}; - -GType test_simple_boxed_a_get_type (void); -TestSimpleBoxedA * test_simple_boxed_a_copy (TestSimpleBoxedA *a); -gboolean test_simple_boxed_a_equals (TestSimpleBoxedA *a, - TestSimpleBoxedA *other_a); -const TestSimpleBoxedA *test_simple_boxed_a_const_return (void); - - -struct _TestSimpleBoxedB -{ - gint8 some_int8; - TestSimpleBoxedA nested_a; -}; - -GType test_simple_boxed_b_get_type (void); -TestSimpleBoxedB *test_simple_boxed_b_copy (TestSimpleBoxedB *b); - -/* opaque boxed */ -typedef struct _TestBoxed TestBoxed; -typedef struct _TestBoxedPrivate TestBoxedPrivate; - -struct _TestBoxed -{ - gint8 some_int8; - TestSimpleBoxedA nested_a; - - TestBoxedPrivate *priv; -}; - -GType test_boxed_get_type (void); -TestBoxed *test_boxed_new (void); -TestBoxed *test_boxed_copy (TestBoxed *boxed); -gboolean test_boxed_equals (TestBoxed *boxed, - TestBoxed *other); - -/* gobject */ -#define TEST_TYPE_OBJ (test_obj_get_type ()) -#define TEST_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_OBJ, TestObj)) -#define TEST_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_OBJ)) -#define TEST_OBJ_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_OBJ, TestObjClass)) - -typedef struct _TestObj TestObj; -typedef struct _TestObjClass TestObjClass; - -/** - * TestObj: - * @bare: (allow-none): - */ -struct _TestObj -{ - GObject parent_instance; - - GObject *bare; -}; - -struct _TestObjClass -{ - GObjectClass parent_class; - - int (*matrix) (TestObj *obj, const char *somestr); - - guint test_signal; - guint test_signal_with_static_scope_arg; -}; - -GType test_obj_get_type (void); -TestObj* test_obj_new_from_file (const char *x, GError **error); -void test_obj_set_bare (TestObj *obj, GObject *bare); -double test_obj_static_method (int x); - -/* virtual */ -int test_obj_do_matrix (TestObj *obj, const char *somestr); - -/* callback */ -typedef int (*TestCallback) (); -typedef int (*TestCallbackUserData) (gpointer user_data); - -int test_callback (TestCallback callback); -int test_callback_user_data (TestCallbackUserData callback, - gpointer user_data); -int test_callback_destroy_notify (TestCallbackUserData callback, - gpointer user_data, - GDestroyNotify notify); -int test_callback_thaw_notifications (void); -int test_callback_infinte (TestCallbackUserData callback, - gpointer user_data); - -/* interface */ -#define TEST_TYPE_INTERFACE (test_interface_get_type ()) -#define TEST_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_INTERFACE, TestInterface)) -#define TEST_IS_INTERFACE(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_INTERFACE)) -#define TEST_INTERFACE_GET_IFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), TEST_TYPE_INTERFACE, TestInterfaceIface)) - -typedef struct _TestInterfaceIface TestInterfaceIface; - -struct _TestInterfaceIface { - GTypeInterface base_iface; -}; - -GType test_interface_get_type (void) G_GNUC_CONST; - -/* gobject with non-standard prefix */ -#define TEST_TYPE_WI_802_1X (test_wi_802_1x_get_type ()) -#define TEST_WI_802_1X(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), TEST_TYPE_WI_802_1X, TestWi8021x)) -#define TEST_IS_WI_802_1X(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), TEST_TYPE_WI_802_1X)) -#define TEST_WI_802_1X_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TEST_TYPE_WI_802_1X, TestWi8021xClass)) - -typedef struct -{ - GObject parent_instance; - - gboolean testbool; -} TestWi8021x; - -typedef struct -{ - GObjectClass parent_class; -} TestWi8021xClass; - -GType test_wi_802_1x_get_type (void); -TestWi8021x* test_wi_802_1x_new (void); -gboolean test_wi_802_1x_get_testbool (TestWi8021x *obj); -void test_wi_802_1x_set_testbool (TestWi8021x *obj, gboolean v); -int test_wi_802_1x_static_method (int x); - -#endif /* __GITESTTYPES_H__ */ |