[libpeas] Do not test the properties for C extensions



commit a261fde4521da1181dcf14181546d8c3168b0a4c
Author: Garrett Regier <garrettregier gmail com>
Date:   Mon Sep 19 01:34:17 2011 -0700

    Do not test the properties for C extensions
    
    Because C extensions are no longer wrapped testing
    the properties is just pointless.

 tests/libpeas/extension-c.c                        |   15 +-
 tests/libpeas/plugins/extension-c/Makefile.am      |    4 +-
 .../plugins/extension-c/extension-c-plugin.c       |    6 -
 .../plugins/extension-c/properties-plugin.c        |  180 --------------------
 .../plugins/extension-c/properties-plugin.h        |   55 ------
 tests/libpeas/testing/testing-extension.h          |   34 ++--
 6 files changed, 30 insertions(+), 264 deletions(-)
---
diff --git a/tests/libpeas/extension-c.c b/tests/libpeas/extension-c.c
index ec9f6f9..bfe6556 100644
--- a/tests/libpeas/extension-c.c
+++ b/tests/libpeas/extension-c.c
@@ -23,11 +23,10 @@
 #include <config.h>
 #endif
 
-#include "libpeas/peas-extension-base.h"
+#include "libpeas/peas.h"
 
 #include "testing/testing-extension.h"
 #include "introspection/introspection-callable.h"
-#include "introspection/introspection-properties.h"
 
 static void
 test_extension_c_instance_refcount (PeasEngine *engine)
@@ -59,12 +58,12 @@ test_extension_c_plugin_info (PeasEngine *engine)
   PeasPluginInfo *info;
   PeasExtension *extension;
 
-  info = peas_engine_get_plugin_info (engine, "extension-c");
+  info = peas_engine_get_plugin_info (engine, "loadable");
 
   g_assert (peas_engine_load_plugin (engine, info));
 
   extension = peas_engine_create_extension (engine, info,
-                                            INTROSPECTION_TYPE_PROPERTIES,
+                                            PEAS_TYPE_ACTIVATABLE,
                                             NULL);
 
   g_assert (PEAS_IS_EXTENSION_BASE (extension));
@@ -94,7 +93,13 @@ main (int   argc,
   g_test_init (&argc, &argv, NULL);
   g_type_init ();
 
-  EXTENSION_TESTS (c);
+  /* Only test the basics */
+  EXTENSION_TESTS_INIT (c);
+
+  /* We still need to add the callable tests
+   * because of peas_extension_call()
+   */
+  EXTENSION_TESTS_CALLABLE (c);
 
   EXTENSION_TEST (c, "instance-refcount", instance_refcount);
   EXTENSION_TEST (c, "plugin-info", plugin_info);
diff --git a/tests/libpeas/plugins/extension-c/Makefile.am b/tests/libpeas/plugins/extension-c/Makefile.am
index cf11914..87e6b9b 100644
--- a/tests/libpeas/plugins/extension-c/Makefile.am
+++ b/tests/libpeas/plugins/extension-c/Makefile.am
@@ -13,9 +13,7 @@ libextension_c_la_SOURCES = \
 	callable-plugin.c	\
 	callable-plugin.h	\
 	extension-c-plugin.c	\
-	extension-c-plugin.h	\
-	properties-plugin.c	\
-	properties-plugin.h
+	extension-c-plugin.h
 
 libextension_c_la_LDFLAGS = $(TEST_PLUGIN_LIBTOOL_FLAGS)
 libextension_c_la_LIBADD = \
diff --git a/tests/libpeas/plugins/extension-c/extension-c-plugin.c b/tests/libpeas/plugins/extension-c/extension-c-plugin.c
index e6a1a34..0f933c8 100644
--- a/tests/libpeas/plugins/extension-c/extension-c-plugin.c
+++ b/tests/libpeas/plugins/extension-c/extension-c-plugin.c
@@ -26,21 +26,15 @@
 #include "extension-c-plugin.h"
 
 #include "introspection-callable.h"
-#include "introspection-properties.h"
 
 #include "callable-plugin.h"
-#include "properties-plugin.h"
 
 G_MODULE_EXPORT void
 peas_register_types (PeasObjectModule *module)
 {
   testing_callable_plugin_register (G_TYPE_MODULE (module));
-  testing_properties_plugin_register (G_TYPE_MODULE (module));
 
   peas_object_module_register_extension_type (module,
                                               INTROSPECTION_TYPE_CALLABLE,
                                               TESTING_TYPE_CALLABLE_PLUGIN);
-  peas_object_module_register_extension_type (module,
-                                              INTROSPECTION_TYPE_PROPERTIES,
-                                              TESTING_TYPE_PROPERTIES_PLUGIN);
 }
diff --git a/tests/libpeas/testing/testing-extension.h b/tests/libpeas/testing/testing-extension.h
index 1fbc8ca..dafb73c 100644
--- a/tests/libpeas/testing/testing-extension.h
+++ b/tests/libpeas/testing/testing-extension.h
@@ -58,14 +58,6 @@ void testing_extension_properties_read_only_      (PeasEngine *engine);
 void testing_extension_properties_write_only_     (PeasEngine *engine);
 void testing_extension_properties_readwrite_      (PeasEngine *engine);
 
-/* This also tests that loaders are loaded lazily */
-#define _EXTENSION_TESTS_INIT(loader) \
-  testing_init (); \
-  peas_engine_enable_loader (peas_engine_get_default (), #loader); \
-  g_assert (g_type_from_name ("PeasPluginLoader") == G_TYPE_INVALID); \
-  g_object_unref (peas_engine_get_default ()); \
-  testing_extension_set_plugin_ ("extension-" #loader)
-
 #define _EXTENSION_TEST(loader, path, ftest) \
   g_test_add ("/extension/" #loader "/" path, TestingExtensionFixture_, \
               (gpointer) testing_extension_##ftest##_, \
@@ -73,8 +65,13 @@ void testing_extension_properties_readwrite_      (PeasEngine *engine);
               testing_extension_test_runner_, \
               testing_extension_test_teardown_)
 
-#define EXTENSION_TESTS(loader) \
-  _EXTENSION_TESTS_INIT(loader); \
+/* This also tests that loaders are loaded lazily */
+#define EXTENSION_TESTS_INIT(loader) \
+  testing_init (); \
+  peas_engine_enable_loader (peas_engine_get_default (), #loader); \
+  g_assert (g_type_from_name ("PeasPluginLoader") == G_TYPE_INVALID); \
+  g_object_unref (peas_engine_get_default ()); \
+  testing_extension_set_plugin_ ("extension-" #loader); \
 \
   _EXTENSION_TEST (loader, "garbage-collect", garbage_collect); \
 \
@@ -84,17 +81,24 @@ void testing_extension_properties_readwrite_      (PeasEngine *engine);
   _EXTENSION_TEST (loader, "create-valid", create_valid); \
   _EXTENSION_TEST (loader, "create-invalid", create_invalid); \
 \
-  _EXTENSION_TEST (loader, "reload", reload); \
-\
+  _EXTENSION_TEST (loader, "reload", reload)
+
+#define EXTENSION_TESTS_CALLABLE(loader) \
   _EXTENSION_TEST (loader, "call-no-args", call_no_args); \
   _EXTENSION_TEST (loader, "call-with-return", call_with_return); \
   _EXTENSION_TEST (loader, "call-single-arg", call_single_arg); \
-  _EXTENSION_TEST (loader, "call-multi-args", call_multi_args); \
-\
+  _EXTENSION_TEST (loader, "call-multi-args", call_multi_args)
+
+#define EXTENSION_TESTS_PROPERTIES(loader) \
   _EXTENSION_TEST (loader, "properties-construct-only", properties_construct_only); \
   _EXTENSION_TEST (loader, "properties-read-only", properties_read_only); \
   _EXTENSION_TEST (loader, "properties-write-only", properties_write_only); \
-  _EXTENSION_TEST (loader, "properties-readwrite", properties_readwrite);
+  _EXTENSION_TEST (loader, "properties-readwrite", properties_readwrite)
+
+#define EXTENSION_TESTS(loader) \
+  EXTENSION_TESTS_INIT (loader); \
+  EXTENSION_TESTS_CALLABLE (loader); \
+  EXTENSION_TESTS_PROPERTIES (loader)
 
 /* This macro is there to add loader-specific tests. */
 #define EXTENSION_TEST(loader, path, func) \



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