summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/test-mock.c25
1 files changed, 21 insertions, 4 deletions
diff --git a/test/test-mock.c b/test/test-mock.c
index 85c1ba4..7876f5b 100644
--- a/test/test-mock.c
+++ b/test/test-mock.c
@@ -8,15 +8,31 @@ typedef struct {
UcaCamera *camera;
} Fixture;
+static gchar *
+build_mock_plugin_path (void)
+{
+ gchar *cwd;
+ gchar *plugin_path;
+
+ cwd = g_get_current_dir ();
+ plugin_path = g_build_filename (cwd, "plugins", "mock", NULL);
+ g_free (cwd);
+ return plugin_path;
+}
+
static void
fixture_setup (Fixture *fixture, gconstpointer data)
{
+ gchar *plugin_path;
GError *error = NULL;
- fixture->manager = uca_plugin_manager_new ();
- uca_plugin_manager_add_path (fixture->manager, "./src");
+ plugin_path = build_mock_plugin_path ();
+ g_setenv ("UCA_CAMERA_PATH", plugin_path, TRUE);
+ g_free (plugin_path);
- fixture->camera = uca_plugin_manager_get_camera (fixture->manager, "mock", &error);
+ fixture->manager = uca_plugin_manager_new ();
+ fixture->camera = uca_plugin_manager_get_camera (fixture->manager,
+ "mock", &error, NULL);
g_assert (error == NULL);
g_assert (fixture->camera);
}
@@ -39,7 +55,8 @@ static void
test_factory (Fixture *fixture, gconstpointer data)
{
GError *error = NULL;
- UcaCamera *camera = uca_plugin_manager_get_camera (fixture->manager, "fox994m3a0yxmy", &error);
+ UcaCamera *camera = uca_plugin_manager_get_camera (fixture->manager,
+ "fox994m3a0yxmy", &error, NULL);
g_assert_error (error, UCA_PLUGIN_MANAGER_ERROR, UCA_PLUGIN_MANAGER_ERROR_MODULE_NOT_FOUND);
g_assert (camera == NULL);
}