diff options
author | Lutz Mueller <lutz@users.sourceforge.net> | 2001-10-09 16:25:04 +0000 |
---|---|---|
committer | Lutz Mueller <lutz@users.sourceforge.net> | 2001-10-09 16:25:04 +0000 |
commit | 555b67ddb6e752dc4f86810e64e987b149dcc32b (patch) | |
tree | 2155315a6ba04344f9c3ea3b4b2e3ddde6c67b27 /tests/test-filesys.c | |
parent | f082f4a9e338531752fcfbd1bd4f0f8c79da705f (diff) | |
download | libgphoto2-555b67ddb6e752dc4f86810e64e987b149dcc32b.tar.gz |
2001-10-09 Lutz M�ller <urc8@rz.uni-karlsruhe.de>
* camlibs/agfa/agfa.c: delete_file_func, get_file_func
* camlibs/canon/canon.c: Add warning that upload and deletion is
broken
* camlibs/jd350e/jd350e.c: Tiny update
* camlibs/kodak/dc120/dc120.c: folder_list_func, file_list_func,
get_file_func, delete_file_func
* camlibs/kodak/dc240.c: Add warning that changes have to be made
* camlibs/konica/library.c: delete_all_func, delete_file_func
* camlibs/minolta/dimagev/dimagev.c: delete_file_func, put_file_func,
* camlibs/panasonic/dc1000.c: file_list_func, get_file_func,
put_file_func, delete_file_func
* camlibs/panasonic/dc1580.c: get_file_func, put_file_func,
delete_file_func
* camlibs/panasonic/l859.c: delete_file_func, delete_all_func
* camlibs/polaroid/pdc320.c: get_file_func, delete_all_func
* camlibs/polaroid/pdc640.c: get_file_func, delete_file_func
* camlibs/sierra/library.c:
* camlibs/sierra/sierra.c: delete_all_func, delete_file_func
* camlibs/sonydscf1/sonydscf1.c: delete_file_func
* camlibs/sonydscf55/sonydscf55.c: Tiny update
* camlibs/stv0680/stv0680.c: Tiny update
* frontens/command-line/interface.c: Don't show "" status and 0.0
progress
* libgphoto2/camera.c:
* include/gphoto2-camera.h: Remove put_file, delete_all and delete -
this should all be done using the filesystem. In the future,
file_get and the listing functions will also disappear.
* include/gphoto2-filesys.h:
* libgphoto2/filesys.c: Add deletion and upload.
* libgphoto2/jpeg.c: Kill unused variable
* tests/test-filesys.c: Update
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@2462 67ed7778-7388-44ab-90cf-0a291f65f57c
Diffstat (limited to 'tests/test-filesys.c')
-rw-r--r-- | tests/test-filesys.c | 58 |
1 files changed, 42 insertions, 16 deletions
diff --git a/tests/test-filesys.c b/tests/test-filesys.c index a74e7038e..ceb60a9ea 100644 --- a/tests/test-filesys.c +++ b/tests/test-filesys.c @@ -1,6 +1,7 @@ #include <gphoto2-filesys.h> #include <gphoto2-result.h> #include <gphoto2-core.h> +#include <gphoto2-debug.h> #include <stdio.h> @@ -32,7 +33,7 @@ static int file_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, void *data) { - printf (" -> The camera will list the files in '%s' here.\n", folder); + printf ("### -> The camera will list the files in '%s' here.\n", folder); if (!strcmp (folder, "/whatever")) { gp_list_append (list, "file1", NULL); @@ -46,7 +47,7 @@ static int folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, void *data) { - printf (" -> The camera will list the folders in '%s' here.\n", + printf ("### -> The camera will list the folders in '%s' here.\n", folder); if (!strcmp (folder, "/")) { @@ -56,6 +57,7 @@ folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, if (!strcmp (folder, "/whatever")) { gp_list_append (list, "directory", NULL); + gp_list_append (list, "dir", NULL); } if (!strcmp (folder, "/whatever/directory")) { @@ -65,6 +67,15 @@ folder_list_func (CameraFilesystem *fs, const char *folder, CameraList *list, return (GP_OK); } +static int +delete_file_func (CameraFilesystem *fs, const char *folder, const char *file, + void *data) +{ + printf ("Here we should delete %s from folder %s...\n", file, folder); + + return (GP_OK); +} + int main (int argc, char **argv) { @@ -74,12 +85,16 @@ main (int argc, char **argv) int x, count; const char *name; + gp_debug_set_level (GP_DEBUG_HIGH); + printf ("*** Creating file system...\n"); CHECK (gp_filesystem_new (&fs)); - printf ("*** Setting the info callbacks...\n"); + printf ("*** Setting the callbacks...\n"); CHECK (gp_filesystem_set_info_funcs (fs, get_info_func, set_info_func, NULL)); + CHECK (gp_filesystem_set_file_funcs (fs, NULL, delete_file_func, + NULL)); printf ("*** Adding a file...\n"); CHECK (gp_filesystem_append (fs, "/", "my.file")); @@ -87,20 +102,34 @@ main (int argc, char **argv) gp_filesystem_dump (fs); printf ("*** Removing this file...\n"); - CHECK (gp_filesystem_delete (fs, "/", "my.file")); + CHECK (gp_filesystem_delete_file (fs, "/", "my.file")); gp_filesystem_dump (fs); - printf ("*** Removing /...\n"); - CHECK (gp_filesystem_delete (fs, "/", NULL)); + printf ("*** Resetting...\n"); + CHECK (gp_filesystem_reset (fs)); gp_filesystem_dump (fs); - printf ("*** Adding some files...\n"); + printf ("*** Adding /...\n"); CHECK (gp_filesystem_append (fs, "/", NULL)); + + printf ("*** Adding /whatever ...\n"); CHECK (gp_filesystem_append (fs, "/whatever", NULL)); + + printf ("*** Adding /whatever/dir...\n"); CHECK (gp_filesystem_append (fs, "/whatever/dir", NULL)); - CHECK (gp_filesystem_populate (fs, "/whatever/dir", "file%i", 5)); + + printf ("*** Adding /whatever/dir/file1...\n"); + CHECK (gp_filesystem_append (fs, "/whatever/dir", "file1")); + + gp_filesystem_dump (fs); + + printf ("*** Adding /whatever/dir/file2...\n"); + CHECK (gp_filesystem_append (fs, "/whatever/dir", "file2")); + CHECK (gp_filesystem_append (fs, "/whatever/dir", "file3")); + CHECK (gp_filesystem_append (fs, "/whatever/dir", "file4")); + CHECK (gp_filesystem_append (fs, "/whatever/dir", "file5")); gp_filesystem_dump (fs); @@ -140,22 +169,19 @@ main (int argc, char **argv) &info)); printf ("*** Deleting a file...\n"); - CHECK (gp_filesystem_delete (fs, "/whatever/directory", "some.file2")); + CHECK (gp_filesystem_delete_file (fs, "/whatever/directory", "some.file2")); gp_filesystem_dump (fs); - printf ("*** Deleting a directory...\n"); - CHECK (gp_filesystem_delete (fs, "/whatever", NULL)); - - gp_filesystem_dump (fs); - - printf ("*** Formatting the filesystem...\n"); - CHECK (gp_filesystem_format (fs)); + printf ("*** Resetting the filesystem...\n"); + CHECK (gp_filesystem_reset (fs)); printf ("*** Setting the listing callbacks...\n"); CHECK (gp_filesystem_set_list_funcs (fs, file_list_func, folder_list_func, NULL)); + gp_filesystem_dump (fs); + printf ("*** Getting file list for folder '/whatever/directory'...\n"); CHECK (gp_filesystem_list_folders (fs, "/whatever/directory", &list)); |