summaryrefslogtreecommitdiff
path: root/src/tests/ef_mime.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/tests/ef_mime.c')
-rw-r--r--src/tests/ef_mime.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/tests/ef_mime.c b/src/tests/ef_mime.c
new file mode 100644
index 0000000..2cb9e21
--- /dev/null
+++ b/src/tests/ef_mime.c
@@ -0,0 +1,57 @@
+#include "Efreet.h"
+#include "Efreet_Mime.h"
+#include "config.h"
+#include <stdio.h>
+#include <string.h>
+#include <sys/time.h>
+#include <Ecore.h>
+
+#define THEME "Tango"
+#define SIZE 128
+
+int
+ef_mime_cb_get(void)
+{
+ const char *mime = NULL, *icon;
+ int misses = 0, i = 0;
+ struct
+ {
+ char *file;
+ char *mime;
+ } files[] = {
+ {PKG_DATA_DIR"/test/test_type.desktop", "application/x-desktop"},
+ {PKG_DATA_DIR"/test/entry.png", "image/png"},
+ {PKG_DATA_DIR"/test/entry", "image/png"},
+ {PKG_DATA_DIR"/test/sub", "inode/directory"},
+ {NULL, NULL}
+ };
+ double start;
+
+ if (!efreet_mime_init())
+ {
+ printf("Could not init efreet\n");
+ return 1;
+ }
+
+ for (i = 0; files[i].file; ++i)
+ {
+ mime = efreet_mime_type_get(files[i].file);
+ if (!mime)
+ {
+ printf("Got %s as null instead of %s\n", files[i].file, files[i].mime);
+ misses ++;
+ }
+ else if (strcmp(mime, files[i].mime))
+ {
+ printf("Got %s as %s instead of %s\n", files[i].file, mime, files[i].mime);
+ misses ++;
+ }
+ 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);
+ }
+
+ efreet_mime_shutdown();
+
+ return !misses;
+}