2007-06-30 22:10:14 -07:00
|
|
|
#include "Efreet.h"
|
|
|
|
#include "Efreet_Mime.h"
|
2007-11-04 01:32:35 -08:00
|
|
|
#include "config.h"
|
2007-06-30 22:10:14 -07:00
|
|
|
#include <stdio.h>
|
2007-11-04 01:32:35 -08:00
|
|
|
#include <string.h>
|
2007-06-30 22:10:14 -07:00
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
2007-07-01 09:32:34 -07:00
|
|
|
int
|
|
|
|
ef_mime_cb_get(void)
|
2007-06-30 22:10:14 -07:00
|
|
|
{
|
|
|
|
const char *mime = NULL;
|
|
|
|
int misses = 0, i = 0;
|
2007-09-06 09:15:10 -07:00
|
|
|
struct
|
2007-07-03 08:07:00 -07:00
|
|
|
{
|
|
|
|
char *file;
|
|
|
|
char *mime;
|
|
|
|
} files[] = {
|
2008-05-06 20:04:12 -07:00
|
|
|
{PACKAGE_DATA_DIR"/test/test_type.desktop", "application/x-desktop"},
|
|
|
|
{PACKAGE_DATA_DIR"/test/entry.png", "image/png"},
|
|
|
|
{PACKAGE_DATA_DIR"/test/entry", "image/png"},
|
|
|
|
{PACKAGE_DATA_DIR"/test/sub", "inode/directory"},
|
2007-07-03 08:07:00 -07:00
|
|
|
{NULL, NULL}
|
|
|
|
};
|
2007-09-06 09:15:10 -07:00
|
|
|
|
|
|
|
|
2007-07-01 09:32:34 -07:00
|
|
|
if (!efreet_mime_init())
|
2007-06-30 22:10:14 -07:00
|
|
|
{
|
|
|
|
printf("Could not init efreet\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2010-08-21 06:52:25 -07:00
|
|
|
for (i = 0; files[i].file; ++i)
|
2007-09-06 09:15:10 -07:00
|
|
|
{
|
2007-07-03 08:07:00 -07:00
|
|
|
mime = efreet_mime_type_get(files[i].file);
|
2007-07-01 09:32:34 -07:00
|
|
|
if (!mime)
|
2007-09-06 09:15:10 -07:00
|
|
|
{
|
2007-07-03 08:07:00 -07:00
|
|
|
printf("Got %s as null instead of %s\n", files[i].file, files[i].mime);
|
|
|
|
misses ++;
|
|
|
|
}
|
|
|
|
else if (strcmp(mime, files[i].mime))
|
2007-07-01 09:32:34 -07:00
|
|
|
{
|
2007-07-03 08:07:00 -07:00
|
|
|
printf("Got %s as %s instead of %s\n", files[i].file, mime, files[i].mime);
|
2007-07-01 09:32:34 -07:00
|
|
|
misses ++;
|
|
|
|
}
|
2007-06-30 22:10:14 -07:00
|
|
|
}
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2007-06-30 22:10:14 -07:00
|
|
|
efreet_mime_shutdown();
|
2007-09-06 09:15:10 -07:00
|
|
|
|
2007-06-30 22:10:14 -07:00
|
|
|
return !misses;
|
|
|
|
}
|