summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2010-12-19 03:12:14 +0000
committerCarsten Haitzler <raster@rasterman.com>2010-12-19 03:12:14 +0000
commite1ac73922dd86ec4147ed697785b5b3c2c508775 (patch)
tree67d2c9d1e9e3ffbfbc036c4e32a62c6995b61466 /legacy
parent26158c95105b7aae41227fddb693dd99accee4fa (diff)
move ethumb tests to TEST
SVN revision: 55640
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ethumb/configure.ac1
-rw-r--r--legacy/ethumb/src/Makefile.am2
-rw-r--r--legacy/ethumb/src/tests/Makefile.am22
-rw-r--r--legacy/ethumb/src/tests/ethumb_dbus.c124
4 files changed, 1 insertions, 148 deletions
diff --git a/legacy/ethumb/configure.ac b/legacy/ethumb/configure.ac
index fde6791fb7..a150dbf4c8 100644
--- a/legacy/ethumb/configure.ac
+++ b/legacy/ethumb/configure.ac
@@ -203,7 +203,6 @@ src/lib/client/Makefile
203src/plugins/Makefile 203src/plugins/Makefile
204src/plugins/emotion/Makefile 204src/plugins/emotion/Makefile
205src/plugins/epdf/Makefile 205src/plugins/epdf/Makefile
206src/tests/Makefile
207data/Makefile 206data/Makefile
208data/frames/Makefile 207data/frames/Makefile
209m4/Makefile 208m4/Makefile
diff --git a/legacy/ethumb/src/Makefile.am b/legacy/ethumb/src/Makefile.am
index 31c7f284ec..e55545e4cf 100644
--- a/legacy/ethumb/src/Makefile.am
+++ b/legacy/ethumb/src/Makefile.am
@@ -1,3 +1,3 @@
1MAINTAINERCLEANFILES = Makefile.in 1MAINTAINERCLEANFILES = Makefile.in
2 2
3SUBDIRS = lib bin plugins tests 3SUBDIRS = lib bin plugins
diff --git a/legacy/ethumb/src/tests/Makefile.am b/legacy/ethumb/src/tests/Makefile.am
deleted file mode 100644
index fa6cfb6b51..0000000000
--- a/legacy/ethumb/src/tests/Makefile.am
+++ /dev/null
@@ -1,22 +0,0 @@
1MAINTAINERCLEANFILES = Makefile.in
2
3AM_CPPFLAGS = \
4 -I$(top_srcdir)/src/lib \
5 -I$(top_srcdir)/src/lib/client \
6 @EINA_CFLAGS@ @EVAS_CFLAGS@ @ECORE_CFLAGS@ @ECORE_EVAS_CFLAGS@ \
7 @EDJE_CFLAGS@ @ECORE_FILE_CFLAGS@
8
9check_PROGRAMS =
10
11if USE_MODULE_ETHUMBD
12
13AM_CPPFLAGS += @EDBUS_CFLAGS@
14check_PROGRAMS += ethumb_dbus
15ethumb_dbus_SOURCES = ethumb_dbus.c
16ethumb_dbus_LDADD = \
17 @EINA_LIBS@ @EVAS_LIBS@ @ECORE_LIBS@ @ECORE_EVAS_LIBS@ @EDJE_LIBS@ \
18 @ECORE_FILE_LIBS@ @EDBUS_LIBS@ \
19 $(top_builddir)/src/lib/libethumb.la \
20 $(top_builddir)/src/lib/client/libethumb_client.la
21
22endif
diff --git a/legacy/ethumb/src/tests/ethumb_dbus.c b/legacy/ethumb/src/tests/ethumb_dbus.c
deleted file mode 100644
index d9e2f10281..0000000000
--- a/legacy/ethumb/src/tests/ethumb_dbus.c
+++ /dev/null
@@ -1,124 +0,0 @@
1/**
2 * @file
3 *
4 * Copyright (C) 2009 by ProFUSION embedded systems
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library;
18 * if not, see <http://www.gnu.org/licenses/>.
19 *
20 * @author Rafael Antognolli <antognolli@profusion.mobi>
21 */
22#ifdef HAVE_CONFIG_H
23#include "config.h"
24#endif
25#include <stdio.h>
26#include <stdlib.h>
27#include <string.h>
28#include <limits.h>
29#include <dirent.h>
30#include <Ethumb.h>
31#include <Ethumb_Client.h>
32#include <Eina.h>
33#include <Ecore_Getopt.h>
34#include <Ecore.h>
35
36static void
37_on_server_die_cb(void *data __UNUSED__, Ethumb_Client *client __UNUSED__)
38{
39 ecore_main_loop_quit();
40}
41
42static void
43_queue_add_cb(void *data __UNUSED__, Ethumb_Client *client __UNUSED__, int id, const char *file, const char *key __UNUSED__, const char *thumb_path, const char *thumb_key __UNUSED__, Eina_Bool success)
44{
45 fprintf(stderr, ">>> %hhu file ready: %s; thumb ready: %s; id = %d\n", success, file, thumb_path, id);
46}
47
48static void
49_request_thumbnails(Ethumb_Client *client, void *data)
50{
51 const char *path = data;
52 DIR *dir;
53 struct dirent *de;
54 char buf[PATH_MAX];
55
56 dir = opendir(path);
57 if (!dir)
58 {
59 fprintf(stderr, "ERROR: could not open directory: %s\n", path);
60 return;
61 }
62
63 ethumb_client_format_set(client, ETHUMB_THUMB_JPEG);
64 ethumb_client_aspect_set(client, ETHUMB_THUMB_CROP);
65 ethumb_client_crop_align_set(client, 0.2, 0.2);
66 ethumb_client_size_set(client, 192, 192);
67 ethumb_client_category_set(client, "custom");
68
69 while ((de = readdir(dir)))
70 {
71 if (de->d_type != DT_REG)
72 continue;
73 snprintf(buf, sizeof(buf), "%s/%s", path, de->d_name);
74 ethumb_client_file_set(client, buf, NULL);
75 ethumb_client_generate(client, _queue_add_cb, NULL, NULL);
76 }
77
78 closedir(dir);
79}
80
81static void
82_connect_cb(void *data, Ethumb_Client *client, Eina_Bool success)
83{
84 fprintf(stderr, "connected: %d\n", success);
85 if (!success)
86 {
87 ecore_main_loop_quit();
88 return;
89 }
90
91 _request_thumbnails(client, data);
92}
93
94int
95main(int argc, char *argv[])
96{
97 Ethumb_Client *client;
98
99 if (argc < 2)
100 {
101 fprintf(stderr, "ERROR: directory not specified.\n");
102 fprintf(stderr, "usage:\n\tethumb_dbus <images directory>\n");
103 return -2;
104 }
105
106 ethumb_client_init();
107 client = ethumb_client_connect(_connect_cb, argv[1], NULL);
108 if (!client)
109 {
110 fprintf(stderr, "ERROR: couldn't connect to server.\n");
111 ethumb_client_shutdown();
112 return -1;
113 }
114 ethumb_client_on_server_die_callback_set(client, _on_server_die_cb, NULL, NULL);
115
116 fprintf(stderr, "*** debug\n");
117 ecore_main_loop_begin();
118
119 ethumb_client_disconnect(client);
120
121 ethumb_client_shutdown();
122
123 return 0;
124}