[libpeas] Make multi args test more complex.



commit fbb4239e7ee2261cb92e88b10aa852d7bbc3ed51
Author: Garrett Regier <alias301 gmail com>
Date:   Sun Jun 12 02:40:38 2011 -0700

    Make multi args test more complex.
    
    This was the test used to find and fix the previous fixes.

 .../libpeas/introspection/introspection-callable.c |   14 +++++++-------
 .../libpeas/introspection/introspection-callable.h |   12 ++++++------
 .../libpeas/plugins/extension-c/callable-plugin.c  |   11 +++++------
 .../libpeas/plugins/extension-gjs/extension-gjs.js |    4 ++--
 .../plugins/extension-python/extension-python.py   |    4 ++--
 .../plugins/extension-seed/extension-seed.js       |    4 ++--
 tests/libpeas/testing/testing-extension.c          |   18 +++++++++---------
 7 files changed, 33 insertions(+), 34 deletions(-)
---
diff --git a/tests/libpeas/introspection/introspection-callable.c b/tests/libpeas/introspection/introspection-callable.c
index 112b6bb..ca09ef4 100644
--- a/tests/libpeas/introspection/introspection-callable.c
+++ b/tests/libpeas/introspection/introspection-callable.c
@@ -85,15 +85,15 @@ introspection_callable_call_single_arg (IntrospectionCallable *callable,
 /**
  * introspection_callable_call_multi_args:
  * @callable:
- * @called_1: (out):
- * @called_2: (out):
- * @called_3: (out):
+ * @in: (in):
+ * @out: (out):
+ * @inout: (inout):
  */
 void
 introspection_callable_call_multi_args (IntrospectionCallable *callable,
-                                        gboolean              *called_1,
-                                        gboolean              *called_2,
-                                        gboolean              *called_3)
+                                        gint                   in,
+                                        gint                  *out,
+                                        gint                  *inout)
 {
   IntrospectionCallableInterface *iface;
 
@@ -101,5 +101,5 @@ introspection_callable_call_multi_args (IntrospectionCallable *callable,
 
   iface = INTROSPECTION_CALLABLE_GET_IFACE (callable);
   if (iface->call_multi_args != NULL)
-    iface->call_multi_args (callable, called_1, called_2, called_3);
+    iface->call_multi_args (callable, in, out, inout);
 }
diff --git a/tests/libpeas/introspection/introspection-callable.h b/tests/libpeas/introspection/introspection-callable.h
index eced875..30bd615 100644
--- a/tests/libpeas/introspection/introspection-callable.h
+++ b/tests/libpeas/introspection/introspection-callable.h
@@ -47,9 +47,9 @@ struct _IntrospectionCallableInterface {
   void         (*call_single_arg)  (IntrospectionCallable *callable,
                                     gboolean              *called);
   void         (*call_multi_args)  (IntrospectionCallable *callable,
-                                    gboolean              *called_1,
-                                    gboolean              *called_2,
-                                    gboolean              *called_3);
+                                    gint                   in,
+                                    gint                  *out,
+                                    gint                  *inout);
 
   /* libpeas must have an invoker to implement an interface's vfunc */
   void         (*no_invoker_)      (IntrospectionCallable *callable);
@@ -66,9 +66,9 @@ void         introspection_callable_call_no_args     (IntrospectionCallable *cal
 void         introspection_callable_call_single_arg  (IntrospectionCallable *callable,
                                                       gboolean              *called);
 void         introspection_callable_call_multi_args  (IntrospectionCallable *callable,
-                                                      gboolean              *called_1,
-                                                      gboolean              *called_2,
-                                                      gboolean              *called_3);
+                                                      gint                   in,
+                                                      gint                  *out,
+                                                      gint                  *inout);
 
 G_END_DECLS
 
diff --git a/tests/libpeas/plugins/extension-c/callable-plugin.c b/tests/libpeas/plugins/extension-c/callable-plugin.c
index 26d98fc..27dc61e 100644
--- a/tests/libpeas/plugins/extension-c/callable-plugin.c
+++ b/tests/libpeas/plugins/extension-c/callable-plugin.c
@@ -62,13 +62,12 @@ testing_callable_plugin_call_single_arg (IntrospectionCallable *callable,
 
 static void
 testing_callable_plugin_call_multi_args (IntrospectionCallable *callable,
-                                         gboolean              *called_1,
-                                         gboolean              *called_2,
-                                         gboolean              *called_3)
+                                         gint                   in,
+                                         gint                  *out,
+                                         gint                  *inout)
 {
-  *called_1 = TRUE;
-  *called_2 = TRUE;
-  *called_3 = TRUE;
+  *out = *inout;
+  *inout = in;
 }
 
 static void
diff --git a/tests/libpeas/plugins/extension-gjs/extension-gjs.js b/tests/libpeas/plugins/extension-gjs/extension-gjs.js
index d855f50..0770992 100644
--- a/tests/libpeas/plugins/extension-gjs/extension-gjs.js
+++ b/tests/libpeas/plugins/extension-gjs/extension-gjs.js
@@ -10,8 +10,8 @@ callable_extension.prototype = {
   call_single_arg: function() {
     return true
   },
-  call_multi_args: function() {
-    return [ true, true, true ]
+  call_multi_args: function(in_, inout) {
+    return [ inout, in_ ]
   }
 };
 
diff --git a/tests/libpeas/plugins/extension-python/extension-python.py b/tests/libpeas/plugins/extension-python/extension-python.py
index e4e73e9..34298da 100644
--- a/tests/libpeas/plugins/extension-python/extension-python.py
+++ b/tests/libpeas/plugins/extension-python/extension-python.py
@@ -16,8 +16,8 @@ class CallablePythonPlugin(gobject.GObject, Introspection.Callable):
     def do_call_single_arg(self):
         return True
 
-    def do_call_multi_args(self):
-        return (True, True, True)
+    def do_call_multi_args(self, in_, inout):
+        return (inout, in_)
 
 class PropertiesPythonPlugin(gobject.GObject, Introspection.Properties):
     __gtype_name__ = "PropertiesPythonPlugin"
diff --git a/tests/libpeas/plugins/extension-seed/extension-seed.js b/tests/libpeas/plugins/extension-seed/extension-seed.js
index 2d60323..2735b29 100644
--- a/tests/libpeas/plugins/extension-seed/extension-seed.js
+++ b/tests/libpeas/plugins/extension-seed/extension-seed.js
@@ -10,8 +10,8 @@ callable_extension.prototype = {
   call_single_arg: function() {
     return true
   },
-  call_multi_args: function() {
-    return [ true, true, true ]
+  call_multi_args: function(in_, inout) {
+    return [ inout, in_ ]
   }
 };
 
diff --git a/tests/libpeas/testing/testing-extension.c b/tests/libpeas/testing/testing-extension.c
index 59a0515..c647dd3 100644
--- a/tests/libpeas/testing/testing-extension.c
+++ b/tests/libpeas/testing/testing-extension.c
@@ -289,7 +289,8 @@ testing_extension_call_multi_args_ (PeasEngine *engine)
   PeasPluginInfo *info;
   PeasExtension *extension;
   IntrospectionCallable *callable;
-  gboolean params[3] = { FALSE, FALSE, FALSE };
+  gint in, out, inout;
+  gint inout_saved;
 
   info = peas_engine_get_plugin_info (engine, extension_plugin);
 
@@ -301,15 +302,14 @@ testing_extension_call_multi_args_ (PeasEngine *engine)
 
   callable = INTROSPECTION_CALLABLE (extension);
 
-  g_assert (peas_extension_call (extension, "call_multi_args",
-                                 &params[0], &params[1], &params[2]));
-  g_assert (params[0] && params[1] && params[2]);
+  in = g_random_int ();
+  inout = g_random_int ();
+  inout_saved = inout;
 
-  memset (params, FALSE, G_N_ELEMENTS (params));
-
-  introspection_callable_call_multi_args (callable, &params[0],
-                                          &params[1], &params[2]);
-  g_assert (params[0] && params[1] && params[2]);
+  introspection_callable_call_multi_args (callable, in, &out, &inout);
+  
+  g_assert_cmpint (inout_saved, ==, out);
+  g_assert_cmpint (in, ==, inout);
 
   g_object_unref (extension);
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]