summaryrefslogtreecommitdiff
path: root/tests/test-filesys.c
diff options
context:
space:
mode:
authorLutz Mueller <lutz@users.sourceforge.net>2002-01-26 00:18:52 +0000
committerLutz Mueller <lutz@users.sourceforge.net>2002-01-26 00:18:52 +0000
commitc8f5ed6a4b40858cd1849ed0c558d57b17c11c8f (patch)
tree33a9aa0755673fc75f76ac450aa9c270bb0e1642 /tests/test-filesys.c
parent4a193fa5f06cad5fe9a7d46dcab68030794c7dd0 (diff)
downloadlibgphoto2-c8f5ed6a4b40858cd1849ed0c558d57b17c11c8f.tar.gz
Get the test program to run again.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4014 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'tests/test-filesys.c')
-rw-r--r--tests/test-filesys.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/tests/test-filesys.c b/tests/test-filesys.c
index a304bd910..06a811aaa 100644
--- a/tests/test-filesys.c
+++ b/tests/test-filesys.c
@@ -28,9 +28,26 @@
#include <gphoto2-filesys.h>
#include <gphoto2-result.h>
+#include <gphoto2-port-log.h>
#define CHECK(r) {int ret = r; if (ret < 0) {printf ("Got error: %s\n", gp_result_as_string (ret)); return (1);}}
+static void
+log_func (GPLogLevel level, const char *domain,
+ const char *format, va_list args, void *data)
+{
+ vprintf (format, args);
+ printf ("\n");
+}
+
+static void
+error_func (GPContext *context, const char *format, va_list args, void *data)
+{
+ printf ("### ");
+ vprintf (format, args);
+ printf ("\n");
+}
+
static int
set_info_func (CameraFilesystem *fs, const char *folder, const char *file,
CameraFileInfo info, void *data, GPContext *context)
@@ -48,7 +65,7 @@ get_info_func (CameraFilesystem *fs, const char *folder, const char *file,
info->preview.fields = GP_FILE_INFO_NONE;
info->file.fields = GP_FILE_INFO_NAME;
- strcpy (info->file.name, "Some file on the camera");
+ strcpy (info->file.name, file);
return (GP_OK);
}
@@ -108,11 +125,16 @@ main (int argc, char **argv)
CameraList list;
int x, count;
const char *name;
+ GPContext *context;
#ifdef HAVE_MCHECK_H
mtrace();
#endif
+ gp_log_add_func (GP_LOG_DEBUG, log_func, NULL);
+ context = gp_context_new ();
+ gp_context_set_error_func (context, error_func, NULL);
+
printf ("*** Creating file system...\n");
CHECK (gp_filesystem_new (&fs));
@@ -237,6 +259,8 @@ main (int argc, char **argv)
printf ("*** Freeing file system...\n");
CHECK (gp_filesystem_free (fs));
+ gp_context_unref (context);
+
#ifdef HAVE_MCHECK_H
muntrace();
#endif