From ab3daf33ae08a9eceb510876b08d013d0441c070 Mon Sep 17 00:00:00 2001 From: Aharon Hillel Date: Thu, 23 Feb 2012 13:57:56 +0000 Subject: [PATCH] elementary: Added infra for API testing in elementary_test Signed-off-by: Aharon Hillel SVN revision: 68319 --- legacy/elementary/src/bin/Makefile.am | 3 ++- legacy/elementary/src/bin/test.c | 4 ++-- legacy/elementary/src/bin/test.h | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 3 deletions(-) create mode 100644 legacy/elementary/src/bin/test.h diff --git a/legacy/elementary/src/bin/Makefile.am b/legacy/elementary/src/bin/Makefile.am index f006327d32..74f07466f6 100644 --- a/legacy/elementary/src/bin/Makefile.am +++ b/legacy/elementary/src/bin/Makefile.am @@ -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 diff --git a/legacy/elementary/src/bin/test.c b/legacy/elementary/src/bin/test.c index f5b653fca1..e4a60fb986 100644 --- a/legacy/elementary/src/bin/test.c +++ b/legacy/elementary/src/bin/test.c @@ -1,4 +1,5 @@ #include +#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/legacy/elementary/src/bin/test.h b/legacy/elementary/src/bin/test.h new file mode 100644 index 0000000000..0f0e6fe9ef --- /dev/null +++ b/legacy/elementary/src/bin/test.h @@ -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