regress: Add API to test signals with (u)int64 params
authorNicolas Dufresne <nicolas.dufresne@collabora.com>
Tue, 11 Sep 2012 20:07:11 +0000 (16:07 -0400)
committerMartin Pitt <martinpitt@gnome.org>
Wed, 12 Sep 2012 04:28:50 +0000 (06:28 +0200)
https://bugzilla.gnome.org/show_bug.cgi?id=683596

Co-Authored-By: Martin Pitt <martinpitt@gnome.org>
tests/scanner/Regress-1.0-expected.gir
tests/scanner/regress.c
tests/scanner/regress.h

index 1d82676..a3e77db 100644 (file)
@@ -742,12 +742,24 @@ case.</doc>
           <type name="none" c:type="void"/>
         </return-value>
       </method>
+      <method name="emit_sig_with_int64"
+              c:identifier="regress_test_obj_emit_sig_with_int64">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
       <method name="emit_sig_with_obj"
               c:identifier="regress_test_obj_emit_sig_with_obj">
         <return-value transfer-ownership="none">
           <type name="none" c:type="void"/>
         </return-value>
       </method>
+      <method name="emit_sig_with_uint64"
+              c:identifier="regress_test_obj_emit_sig_with_uint64">
+        <return-value transfer-ownership="none">
+          <type name="none" c:type="void"/>
+        </return-value>
+      </method>
       <method name="forced_method" c:identifier="regress_forced_method">
         <return-value transfer-ownership="none">
           <type name="none" c:type="void"/>
@@ -1206,6 +1218,19 @@ raise an error.</doc>
           </parameter>
         </parameters>
       </glib:signal>
+      <glib:signal name="sig-with-int64-prop" when="last">
+        <doc xml:whitespace="preserve">You can use this with regress_test_obj_emit_sig_with_int64, or raise from
+the introspection client langage.</doc>
+        <return-value transfer-ownership="none">
+          <type name="gint64"/>
+        </return-value>
+        <parameters>
+          <parameter name="i" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an integer</doc>
+            <type name="gint64"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
       <glib:signal name="sig-with-obj" when="last">
         <doc xml:whitespace="preserve">Test transfer none GObject as a param (tests refcounting).
 Use with regress_test_obj_emit_sig_with_obj</doc>
@@ -1233,6 +1258,19 @@ Use with regress_test_obj_emit_sig_with_obj</doc>
           </parameter>
         </parameters>
       </glib:signal>
+      <glib:signal name="sig-with-uint64-prop" when="last">
+        <doc xml:whitespace="preserve">You can use this with regress_test_obj_emit_sig_with_uint64, or raise from
+the introspection client langage.</doc>
+        <return-value transfer-ownership="none">
+          <type name="guint64"/>
+        </return-value>
+        <parameters>
+          <parameter name="i" transfer-ownership="none">
+            <doc xml:whitespace="preserve">an integer</doc>
+            <type name="guint64"/>
+          </parameter>
+        </parameters>
+      </glib:signal>
       <glib:signal name="test" when="last" no-recurse="1" no-hooks="1">
         <return-value transfer-ownership="none">
           <type name="none"/>
index e72c5aa..2fba9fd 100644 (file)
@@ -2132,6 +2132,8 @@ enum {
   REGRESS_TEST_OBJ_SIGNAL_FIRST,
   REGRESS_TEST_OBJ_SIGNAL_CLEANUP,
   REGRESS_TEST_OBJ_SIGNAL_ALL,
+  REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_INT64_PROP,
+  REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_UINT64_PROP,
   N_REGRESS_TEST_OBJ_SIGNALS
 };
 
@@ -2298,6 +2300,46 @@ regress_test_obj_class_init (RegressTestObjClass *klass)
                  G_TYPE_NONE,
                   0);
 
+  /**
+   * RegressTestObj::sig-with-int64-prop:
+   * @self: an object
+   * @i: an integer
+   *
+   * You can use this with regress_test_obj_emit_sig_with_int64, or raise from
+   * the introspection client langage.
+   */
+  regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_INT64_PROP] =
+    g_signal_new ("sig-with-int64-prop",
+                 G_TYPE_FROM_CLASS (gobject_class),
+                 G_SIGNAL_RUN_LAST,
+                 0,
+                 NULL,
+                 NULL,
+                 g_cclosure_marshal_VOID__BOXED,
+                 G_TYPE_INT64,
+                 1,
+                 G_TYPE_INT64);
+
+  /**
+   * RegressTestObj::sig-with-uint64-prop:
+   * @self: an object
+   * @i: an integer
+   *
+   * You can use this with regress_test_obj_emit_sig_with_uint64, or raise from
+   * the introspection client langage.
+   */
+  regress_test_obj_signals[REGRESS_TEST_OBJ_SIGNAL_SIG_WITH_UINT64_PROP] =
+    g_signal_new ("sig-with-uint64-prop",
+                 G_TYPE_FROM_CLASS (gobject_class),
+                 G_SIGNAL_RUN_LAST,
+                 0,
+                 NULL,
+                 NULL,
+                 g_cclosure_marshal_VOID__BOXED,
+                 G_TYPE_UINT64,
+                 1,
+                 G_TYPE_UINT64);
+
   gobject_class->set_property = regress_test_obj_set_property;
   gobject_class->get_property = regress_test_obj_get_property;
   gobject_class->dispose = regress_test_obj_dispose;
@@ -2519,6 +2561,26 @@ regress_test_obj_emit_sig_with_foreign_struct (RegressTestObj *obj)
   cairo_destroy (cr);
 }
 
+void
+regress_test_obj_emit_sig_with_int64 (RegressTestObj *obj)
+{
+  gint64 ret = 0;
+  RegressTestObj *obj_param = regress_constructor ();
+  g_signal_emit_by_name (obj, "sig-with-int64-prop", G_MAXINT64, &ret);
+  g_object_unref (obj_param);
+  g_assert (ret == G_MAXINT64);
+}
+
+void
+regress_test_obj_emit_sig_with_uint64 (RegressTestObj *obj)
+{
+  guint64 ret = 0;
+  RegressTestObj *obj_param = regress_constructor ();
+  g_signal_emit_by_name (obj, "sig-with-uint64-prop", G_MAXUINT64, &ret);
+  g_object_unref (obj_param);
+  g_assert (ret == G_MAXUINT64);
+}
+
 int
 regress_test_obj_instance_method (RegressTestObj *obj)
 {
index 949a376..f2dae49 100644 (file)
@@ -479,6 +479,8 @@ RegressTestObj*   regress_test_obj_new_from_file (const char *x, GError **error)
 void       regress_test_obj_set_bare (RegressTestObj *obj, GObject *bare);
 void       regress_test_obj_emit_sig_with_obj (RegressTestObj *obj);
 void       regress_test_obj_emit_sig_with_foreign_struct (RegressTestObj *obj);
+void       regress_test_obj_emit_sig_with_int64 (RegressTestObj *obj);
+void       regress_test_obj_emit_sig_with_uint64 (RegressTestObj *obj);
 int        regress_test_obj_instance_method (RegressTestObj *obj);
 double     regress_test_obj_static_method (int x);
 void       regress_forced_method (RegressTestObj *obj);