elementary: Added infra for API testing in elementary_test
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 23 Feb 2012 13:57:56 +0000 (13:57 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Thu, 23 Feb 2012 13:57:56 +0000 (13:57 +0000)
Signed-off-by: Aharon Hillel <a.hillel@partner.samsung.com>
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/elementary@68319 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/bin/Makefile.am
src/bin/test.c
src/bin/test.h [new file with mode: 0644]

index f006327..74f0746 100644 (file)
@@ -112,7 +112,8 @@ test_web.c \
 test_win_inline.c \
 test_win_socket.c \
 test_win_plug.c \
-test_win_state.c
+test_win_state.c \
+test.h
 
 if HAVE_EIO
 elementary_test_SOURCES += test_eio.c
index f5b653f..e4a60fb 100644 (file)
@@ -1,4 +1,5 @@
 #include <Elementary.h>
+#include "test.h"
 #ifdef HAVE_CONFIG_H
 # include "elementary_config.h"
 #endif
@@ -198,10 +199,9 @@ elm_test_add(Eina_List **p_list, const char *icon, const char *category, const c
    *p_list = eina_list_sorted_insert(*p_list, elm_test_sort, t);
 }
 
-static void
+void
 my_win_del(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
 {
-   /* called when my_win_main is requested to be deleted */
    elm_exit(); /* exit the program's main loop that runs in elm_run() */
 }
 
diff --git a/src/bin/test.h b/src/bin/test.h
new file mode 100644 (file)
index 0000000..0f0e6fe
--- /dev/null
@@ -0,0 +1,19 @@
+#ifndef _TEST_H
+#define _TEST_H
+
+#define fail_if(expr) \
+   do { \
+        if ( expr ) \
+          { \
+             FILE *fp; \
+             char buf[1024]; \
+             sprintf(buf, "fail_%s.txt", elm_win_title_get(win)); \
+             if ((fp = fopen(buf, "a")) != NULL) \
+               { \
+                  fprintf(fp, "Failed at %s:%d on <%s>\n", \
+                        __FILE__, __LINE__, #expr); \
+                  fclose(fp); \
+               } \
+          } \
+   } while(0)
+#endif