/*
This file is part of GNUnet.
- (C) 2004, 2005, 2006, 2008, 2009 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2004, 2005, 2006, 2008, 2009 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
* - other API functions may not yet be tested (such as
* filedata-from-callback)
*/
-
#include "platform.h"
#include "gnunet_util_lib.h"
#include "gnunet_fs_service.h"
-#define VERBOSE GNUNET_EXTRA_LOGGING
/**
* File-size we use for testing.
fidir =
GNUNET_FS_file_information_create_empty_directory (fs,
"file_information-context-dir",
- kuri, meta, &bo);
+ kuri, meta, &bo, NULL);
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi1));
GNUNET_assert (GNUNET_OK == GNUNET_FS_file_information_add (fidir, fi2));
GNUNET_FS_uri_destroy (kuri);
}
-static int
-testThumbnail ()
-{
- struct GNUNET_CONTAINER_MetaData *m;
- struct GNUNET_CONTAINER_MetaData *d;
- struct EXTRACTOR_PluginList *ex;
- unsigned char *thumb;
- size_t size;
- char *date;
-
- ex = EXTRACTOR_plugin_add_config (NULL, "thumbnailgtk",
- EXTRACTOR_OPTION_DEFAULT_POLICY);
- if (ex == NULL)
- {
- FPRINTF (stderr,
- "Test incomplete, have no GTK thumbnail extractor available.\n", NULL);
- return 0; /* can not test, no thumbnailer */
- }
- ex = EXTRACTOR_plugin_add_config (ex, "mime",
- EXTRACTOR_OPTION_DEFAULT_POLICY);
- m = GNUNET_CONTAINER_meta_data_create ();
- if (3 !=
- GNUNET_FS_meta_data_extract_from_file (m,
- "test_fs_file_information_meta_data_image.jpg",
- ex))
- {
- GNUNET_break (0);
- EXTRACTOR_plugin_remove_all (ex);
- GNUNET_CONTAINER_meta_data_destroy (m);
- return 1;
- }
- EXTRACTOR_plugin_remove_all (ex);
- d = GNUNET_CONTAINER_meta_data_duplicate (m);
- GNUNET_CONTAINER_meta_data_destroy (m);
- thumb = NULL;
- size = GNUNET_CONTAINER_meta_data_get_thumbnail (d, &thumb);
- if (size == 0)
- {
- GNUNET_break (0);
- GNUNET_CONTAINER_meta_data_destroy (d);
- return 1;
- }
- GNUNET_free (thumb);
- GNUNET_CONTAINER_meta_data_add_publication_date (d);
- date =
- GNUNET_CONTAINER_meta_data_get_by_type (d,
- EXTRACTOR_METATYPE_PUBLICATION_DATE);
- if (date == NULL)
- {
- GNUNET_break (0);
- GNUNET_CONTAINER_meta_data_destroy (d);
- return 1;
- }
- GNUNET_free (date);
- GNUNET_CONTAINER_meta_data_destroy (d);
- return 0;
-}
-
-
-
int
main (int argc, char *argv[])
{
"test-fs-file_information",
"-c",
"test_fs_file_information_data.conf",
-#if VERBOSE
- "-L", "DEBUG",
-#endif
NULL
};
struct GNUNET_GETOPT_CommandLineOption options[] = {
};
GNUNET_log_setup ("test_fs_file_information",
-#if VERBOSE
- "DEBUG",
-#else
"WARNING",
-#endif
NULL);
- if (0 != testThumbnail ())
- return 1;
GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1, argvx,
"test-fs-file_information", "nohelp", options, &run,
NULL);