2013-07-22 19:25:22 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include <config.h>
|
|
|
|
#endif
|
|
|
|
|
2011-01-16 11:07:19 -08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
|
|
|
#include <sys/time.h>
|
2016-02-04 05:42:13 -08:00
|
|
|
|
2011-01-16 11:07:19 -08:00
|
|
|
#include <Ecore.h>
|
2016-02-04 05:42:13 -08:00
|
|
|
#include <Efreet.h>
|
|
|
|
#include <Efreet_Mime.h>
|
|
|
|
|
2013-01-09 05:39:36 -08:00
|
|
|
#include "ef_test.h"
|
2011-01-16 11:07:19 -08:00
|
|
|
|
|
|
|
#define THEME "Tango"
|
|
|
|
#define SIZE 128
|
|
|
|
|
|
|
|
int
|
|
|
|
ef_mime_cb_get(void)
|
|
|
|
{
|
2013-01-14 13:04:30 -08:00
|
|
|
const char *mime = NULL, *icon;
|
|
|
|
int misses = 0, i = 0;
|
|
|
|
struct
|
|
|
|
{
|
2011-01-16 11:07:19 -08:00
|
|
|
char *file;
|
|
|
|
char *mime;
|
2013-01-14 13:04:30 -08:00
|
|
|
} files[] = {
|
2013-01-08 15:45:48 -08:00
|
|
|
{"test_type.desktop", "application/x-desktop"},
|
|
|
|
{"entry.png", "image/png"},
|
|
|
|
{"entry", "image/png"},
|
|
|
|
{"sub", "inode/directory"},
|
2013-01-14 13:04:30 -08:00
|
|
|
{ }
|
|
|
|
};
|
|
|
|
double start;
|
2011-01-16 11:07:19 -08:00
|
|
|
|
2013-01-14 13:04:30 -08:00
|
|
|
if (!efreet_mime_init())
|
|
|
|
{
|
2011-01-16 11:07:19 -08:00
|
|
|
printf("Could not init efreet\n");
|
|
|
|
return 1;
|
2013-01-14 13:04:30 -08:00
|
|
|
}
|
2011-01-16 11:07:19 -08:00
|
|
|
|
2013-01-14 13:04:30 -08:00
|
|
|
for (i = 0; files[i].file; ++i)
|
|
|
|
{
|
2013-01-08 15:45:48 -08:00
|
|
|
mime = efreet_mime_type_get(ef_test_path_get(files[i].file));
|
2011-01-16 11:07:19 -08:00
|
|
|
if (!mime)
|
2013-01-14 13:04:30 -08:00
|
|
|
{
|
|
|
|
printf("Got %s as null instead of %s\n", files[i].file, files[i].mime);
|
|
|
|
misses ++;
|
|
|
|
}
|
2011-01-16 11:07:19 -08:00
|
|
|
else if (strcmp(mime, files[i].mime))
|
2013-01-14 13:04:30 -08:00
|
|
|
{
|
|
|
|
printf("Got %s as %s instead of %s\n", files[i].file, mime, files[i].mime);
|
|
|
|
misses ++;
|
|
|
|
}
|
2011-01-16 11:07:19 -08:00
|
|
|
start = ecore_time_get();
|
|
|
|
icon = efreet_mime_type_icon_get(files[i].mime, THEME, SIZE);
|
|
|
|
printf("mime icon: %s %s %f\n", files[i].mime, icon, ecore_time_get() - start);
|
2013-01-14 13:04:30 -08:00
|
|
|
}
|
2011-01-16 11:07:19 -08:00
|
|
|
|
2013-01-14 13:04:30 -08:00
|
|
|
efreet_mime_shutdown();
|
2011-01-16 11:07:19 -08:00
|
|
|
|
2013-01-14 13:04:30 -08:00
|
|
|
return !misses;
|
2011-01-16 11:07:19 -08:00
|
|
|
}
|