[libpeas] Don't use PeasActivatable in PeasExtension test
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Don't use PeasActivatable in PeasExtension test
- Date: Mon, 17 Jan 2011 13:34:49 +0000 (UTC)
commit d5eb7809b6052130e95a97a18e4dfe28626a0e27
Author: Garrett Regier <alias301 gmail com>
Date: Mon Jan 17 02:37:50 2011 -0800
Don't use PeasActivatable in PeasExtension test
This will make it easier to test diffrent plugin loaders.
tests/libpeas/extension.c | 39 +++++++-------------
.../libpeas/introspection/introspection-callable.c | 12 ++++++
.../libpeas/introspection/introspection-callable.h | 2 +
tests/libpeas/plugins/callable/callable-plugin.c | 6 +++
4 files changed, 33 insertions(+), 26 deletions(-)
---
diff --git a/tests/libpeas/extension.c b/tests/libpeas/extension.c
index 5823d31..81e6c71 100644
--- a/tests/libpeas/extension.c
+++ b/tests/libpeas/extension.c
@@ -73,17 +73,16 @@ test_extension_create_valid (PeasEngine *engine)
PeasPluginInfo *info;
PeasExtension *extension;
- info = peas_engine_get_plugin_info (engine, "loadable");
+ info = peas_engine_get_plugin_info (engine, "callable");
g_assert (peas_engine_load_plugin (engine, info));
extension = peas_engine_create_extension (engine, info,
- PEAS_TYPE_ACTIVATABLE,
- "object", NULL,
+ INTROSPECTION_TYPE_CALLABLE,
NULL);
g_assert (PEAS_IS_EXTENSION (extension));
- g_assert (PEAS_IS_ACTIVATABLE (extension));
+ g_assert (INTROSPECTION_IS_CALLABLE (extension));
g_object_unref (extension);
}
@@ -94,14 +93,13 @@ test_extension_create_invalid (PeasEngine *engine)
PeasPluginInfo *info;
PeasExtension *extension;
- info = peas_engine_get_plugin_info (engine, "loadable");
+ info = peas_engine_get_plugin_info (engine, "callable");
/* Not loaded */
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
{
extension = peas_engine_create_extension (engine, info,
- PEAS_TYPE_ACTIVATABLE,
- "object", NULL,
+ INTROSPECTION_TYPE_CALLABLE,
NULL);
/* Resident Modules */
g_object_unref (extension);
@@ -263,24 +261,21 @@ test_extension_call_invalid (PeasEngine *engine)
PeasPluginInfo *info;
PeasExtension *extension;
- info = peas_engine_get_plugin_info (engine, "loadable");
+ info = peas_engine_get_plugin_info (engine, "callable");
g_assert (peas_engine_load_plugin (engine, info));
extension = peas_engine_create_extension (engine, info,
- PEAS_TYPE_ACTIVATABLE,
- "object", NULL,
+ INTROSPECTION_TYPE_CALLABLE,
NULL);
- g_assert (PEAS_IS_ACTIVATABLE (extension));
-
if (g_test_trap_fork (0, G_TEST_TRAP_SILENCE_STDOUT | G_TEST_TRAP_SILENCE_STDERR))
{
peas_extension_call (extension, "invalid", NULL);
exit (0);
}
g_test_trap_assert_failed ();
- g_test_trap_assert_stderr ("*Method 'PeasActivatable.invalid' not found*");
+ g_test_trap_assert_stderr ("*Method 'IntrospectionCallable.invalid' not found*");
g_object_unref (extension);
}
@@ -290,21 +285,19 @@ test_extension_call_no_args (PeasEngine *engine)
{
PeasPluginInfo *info;
PeasExtension *extension;
+ IntrospectionCallable *callable;
- info = peas_engine_get_plugin_info (engine, "loadable");
+ info = peas_engine_get_plugin_info (engine, "callable");
g_assert (peas_engine_load_plugin (engine, info));
extension = peas_engine_create_extension (engine, info,
- PEAS_TYPE_ACTIVATABLE,
- "object", NULL,
+ INTROSPECTION_TYPE_CALLABLE,
NULL);
- g_assert (PEAS_IS_ACTIVATABLE (extension));
-
- activatable = PEAS_ACTIVATABLE (extension);
+ callable = INTROSPECTION_CALLABLE (extension);
- peas_activatable_activate (activatable);
+ introspection_callable_call_no_args (callable);
g_object_unref (extension);
}
@@ -325,8 +318,6 @@ test_extension_call_with_return (PeasEngine *engine)
INTROSPECTION_TYPE_CALLABLE,
NULL);
- g_assert (INTROSPECTION_IS_CALLABLE (extension));
-
callable = INTROSPECTION_CALLABLE (extension);
return_val = introspection_callable_call_with_return (callable);
@@ -351,8 +342,6 @@ test_extension_call_single_arg (PeasEngine *engine)
INTROSPECTION_TYPE_CALLABLE,
NULL);
- g_assert (INTROSPECTION_IS_CALLABLE (extension));
-
callable = INTROSPECTION_CALLABLE (extension);
introspection_callable_call_single_arg (callable, &called);
@@ -377,8 +366,6 @@ test_extension_call_multi_args (PeasEngine *engine)
INTROSPECTION_TYPE_CALLABLE,
NULL);
- g_assert (INTROSPECTION_IS_CALLABLE (extension));
-
callable = INTROSPECTION_CALLABLE (extension);
introspection_callable_call_multi_args (callable, ¶ms[0],
diff --git a/tests/libpeas/introspection/introspection-callable.c b/tests/libpeas/introspection/introspection-callable.c
index 356332e..80b5bc6 100644
--- a/tests/libpeas/introspection/introspection-callable.c
+++ b/tests/libpeas/introspection/introspection-callable.c
@@ -52,6 +52,18 @@ introspection_callable_call_with_return (IntrospectionCallable *callable)
return NULL;
}
+void
+introspection_callable_call_no_args (IntrospectionCallable *callable)
+{
+ IntrospectionCallableInterface *iface;
+
+ g_return_if_fail (INTROSPECTION_IS_CALLABLE (callable));
+
+ iface = INTROSPECTION_CALLABLE_GET_IFACE (callable);
+ if (iface->call_no_args != NULL)
+ iface->call_no_args (callable);
+}
+
/**
* introspection_callable_call_single_arg:
* @callable:
diff --git a/tests/libpeas/introspection/introspection-callable.h b/tests/libpeas/introspection/introspection-callable.h
index a98091f..a34db52 100644
--- a/tests/libpeas/introspection/introspection-callable.h
+++ b/tests/libpeas/introspection/introspection-callable.h
@@ -43,6 +43,7 @@ struct _IntrospectionCallableInterface {
/* Virtual public methods */
const gchar *(*call_with_return) (IntrospectionCallable *callable);
+ void (*call_no_args) (IntrospectionCallable *callable);
void (*call_single_arg) (IntrospectionCallable *callable,
gboolean *called);
void (*call_multi_args) (IntrospectionCallable *callable,
@@ -58,6 +59,7 @@ GType introspection_callable_get_type (void) G_GNUC_CONST;
const gchar *introspection_callable_call_with_return (IntrospectionCallable *callable);
+void introspection_callable_call_no_args (IntrospectionCallable *callable);
void introspection_callable_call_single_arg (IntrospectionCallable *callable,
gboolean *called);
void introspection_callable_call_multi_args (IntrospectionCallable *callable,
diff --git a/tests/libpeas/plugins/callable/callable-plugin.c b/tests/libpeas/plugins/callable/callable-plugin.c
index 3167295..8a6fdab 100644
--- a/tests/libpeas/plugins/callable/callable-plugin.c
+++ b/tests/libpeas/plugins/callable/callable-plugin.c
@@ -54,6 +54,11 @@ testing_callable_plugin_call_with_return (IntrospectionCallable *callable)
}
static void
+testing_callable_plugin_call_no_args (IntrospectionCallable *callable)
+{
+}
+
+static void
testing_callable_plugin_call_single_arg (IntrospectionCallable *callable,
gboolean *called)
{
@@ -80,6 +85,7 @@ static void
introspection_callable_iface_init (IntrospectionCallableInterface *iface)
{
iface->call_with_return = testing_callable_plugin_call_with_return;
+ iface->call_no_args = testing_callable_plugin_call_no_args;
iface->call_single_arg = testing_callable_plugin_call_single_arg;
iface->call_multi_args = testing_callable_plugin_call_multi_args;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]