summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-08-31 23:14:16 +0200
committerMatthias Vogelgesang <matthias.vogelgesang@gmail.com>2012-09-19 15:11:06 +0200
commit034204d3d8d1a32b1a20e50697c5f81db6fb20cf (patch)
treed2c8265bacbd591aa53865310437a6bfa4366c45 /test
parent539b6cebd615d71b377941e250117ebb99e49c27 (diff)
downloaduca-034204d3d8d1a32b1a20e50697c5f81db6fb20cf.tar.gz
uca-034204d3d8d1a32b1a20e50697c5f81db6fb20cf.tar.bz2
uca-034204d3d8d1a32b1a20e50697c5f81db6fb20cf.tar.xz
uca-034204d3d8d1a32b1a20e50697c5f81db6fb20cf.zip
Initial plugin manager
Diffstat (limited to 'test')
-rw-r--r--test/CMakeLists.txt90
-rw-r--r--test/benchmark.c35
-rw-r--r--test/test-mock.c9
3 files changed, 76 insertions, 58 deletions
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index ce45d71..8fe702b 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -36,51 +36,51 @@ if (HAVE_PYLON_CAMERA)
link_directories(${PYLON_LIB_DIRS} ${LIBPYLONCAM_LIBDIR})
endif()
-add_executable(grab grab.c)
-add_executable(grab-async grab-async.c)
+#add_executable(grab grab.c)
+#add_executable(grab-async grab-async.c)
add_executable(benchmark benchmark.c)
target_link_libraries(benchmark uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
-target_link_libraries(grab uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
-target_link_libraries(grab-async uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
-
-add_executable(grab_pylon grab_pylon.c)
-target_link_libraries(grab_pylon uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
-
-if (NOT DEFINED WITH_CONTROL_GUI)
- set(WITH_CONTROL_GUI TRUE)
-endif()
-
-if (GTK2_FOUND AND WITH_CONTROL_GUI)
- include_directories(${GTK2_INCLUDE_DIRS})
-
- add_executable(control
- control.c
- egg-property-cell-renderer.c
- egg-property-tree-view.c)
-
- target_link_libraries(control uca
- ${GTK2_LIBRARIES} ${GTHREAD2_LIBRARIES})
-
- install(TARGETS control
- RUNTIME DESTINATION bin)
-
- install(FILES control.glade
- DESTINATION share/libuca)
-endif()
-
-if (HAVE_MOCK_CAMERA)
- add_executable(test-mock test-mock.c)
-
- target_link_libraries(test-mock
- uca
- ${GLIB2_LIBRARIES}
- ${GOBJECT2_LIBRARIES})
-
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gtester.xsl
- ${CMAKE_CURRENT_BINARY_DIR}/gtester.xsl)
-endif()
-
-add_executable(test-all test-all.c)
-target_link_libraries(test-all uca
- ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
+#target_link_libraries(grab uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
+#target_link_libraries(grab-async uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
+
+#add_executable(grab_pylon grab_pylon.c)
+#target_link_libraries(grab_pylon uca ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
+#
+#if (NOT DEFINED WITH_CONTROL_GUI)
+# set(WITH_CONTROL_GUI TRUE)
+#endif()
+#
+#if (GTK2_FOUND AND WITH_CONTROL_GUI)
+# include_directories(${GTK2_INCLUDE_DIRS})
+#
+# add_executable(control
+# control.c
+# egg-property-cell-renderer.c
+# egg-property-tree-view.c)
+#
+# target_link_libraries(control uca
+# ${GTK2_LIBRARIES} ${GTHREAD2_LIBRARIES})
+#
+# install(TARGETS control
+# RUNTIME DESTINATION bin)
+#
+# install(FILES control.glade
+# DESTINATION share/libuca)
+#endif()
+
+#if (HAVE_MOCK_CAMERA)
+# add_executable(test-mock test-mock.c)
+#
+# target_link_libraries(test-mock
+# uca
+# ${GLIB2_LIBRARIES}
+# ${GOBJECT2_LIBRARIES})
+#
+# configure_file(${CMAKE_CURRENT_SOURCE_DIR}/gtester.xsl
+# ${CMAKE_CURRENT_BINARY_DIR}/gtester.xsl)
+#endif()
+
+#add_executable(test-all test-all.c)
+#target_link_libraries(test-all uca
+# ${GLIB2_LIBRARIES} ${GOBJECT2_LIBRARIES})
diff --git a/test/benchmark.c b/test/benchmark.c
index 0b4f6f8..1604cdb 100644
--- a/test/benchmark.c
+++ b/test/benchmark.c
@@ -20,6 +20,7 @@
#include <string.h>
#include <stdlib.h>
#include "uca-camera.h"
+#include "uca-plugin-manager.h"
typedef void (*GrabFrameFunc) (UcaCamera *camera, gpointer buffer, guint n_frames);
@@ -37,20 +38,26 @@ sigint_handler(int signal)
static void
print_usage (void)
{
- gchar **types;
-
- g_print ("Usage: benchmark (");
- types = uca_camera_get_types ();
+ /* gchar **types; */
+ GList *types;
+ UcaPluginManager *manager;
+
+ manager = uca_plugin_manager_new ();
+ g_print ("Usage: benchmark [");
+ /* types = uca_camera_get_types (); */
+ types = uca_plugin_manager_get_available_cameras (manager);
+
+ if (g_list_length (types) == 0) {
+ g_print ("] -- no camera plugin found\n");
+ return;
+ }
- for (guint i = 0; types[i] != NULL; i++) {
- if (types[i+1] == NULL)
- g_print ("%s)", types[i]);
- else
- g_print ("%s | ", types[i]);
+ for (GList *it = g_list_first (types); it != NULL; it = g_list_next (it)) {
+ gchar *name = (gchar *) it->data;
+ g_print ("`%s' ", name);
}
- g_print ("\n");
- g_strfreev (types);
+ g_print ("]\n");
}
static void
@@ -227,10 +234,12 @@ benchmark (UcaCamera *camera)
int
main (int argc, char *argv[])
{
+ UcaPluginManager *manager;
GIOChannel *log_channel;
GError *error = NULL;
(void) signal (SIGINT, sigint_handler);
+ g_type_init();
if (argc < 2) {
print_usage();
@@ -241,8 +250,8 @@ main (int argc, char *argv[])
g_assert_no_error (error);
g_log_set_handler (NULL, G_LOG_LEVEL_MASK, log_handler, log_channel);
- g_type_init();
- camera = uca_camera_new(argv[1], &error);
+ manager = uca_plugin_manager_new ();
+ camera = uca_plugin_manager_new_camera (manager, argv[1], &error);
if (camera == NULL) {
g_error ("Initialization: %s", error->message);
diff --git a/test/test-mock.c b/test/test-mock.c
index 7594a3a..625a3fe 100644
--- a/test/test-mock.c
+++ b/test/test-mock.c
@@ -1,6 +1,7 @@
#include <glib.h>
#include "uca-camera.h"
+#include "uca-plugin-manager.h"
#include "cameras/uca-mock-camera.h"
typedef struct {
@@ -160,6 +161,14 @@ static void test_signal(Fixture *fixture, gconstpointer data)
int main(int argc, char *argv[])
{
g_type_init();
+
+ UcaPluginManager *manager = uca_plugin_manager_new ();
+ GList *list = uca_plugin_manager_get_available_cameras (manager);
+
+ g_list_free (list);
+
+ g_object_unref (manager);
+
g_test_init(&argc, &argv, NULL);
g_test_bug_base("http://ufo.kit.edu/ufo/ticket");