diff --git a/src/bin/tsuite.h b/src/bin/tsuite.h index 9fa9534..ac4b46a 100644 --- a/src/bin/tsuite.h +++ b/src/bin/tsuite.h @@ -3,6 +3,7 @@ #include #include +#include #define fail_if(expr) \ do { \ @@ -56,58 +57,5 @@ void tsuite_shot_do(char *name); char *tsuite_test_name_get(); Eina_Bool write_events_get(void); void write_events_set(Eina_Bool val); -/* Macro declaring a function argument to be unused */ -#define __UNUSED__ __attribute__((unused)) - -enum _Tsuite_Event_Type -{ /* Add any supported events here */ - TSUITE_EVENT_NOT_SUPPORTED = 0, - TSUITE_EVENT_MOUSE_IN, - TSUITE_EVENT_MOUSE_OUT, - TSUITE_EVENT_MOUSE_DOWN, - TSUITE_EVENT_MOUSE_UP, - TSUITE_EVENT_MOUSE_MOVE, - TSUITE_EVENT_MOUSE_WHEEL, - TSUITE_EVENT_MULTI_DOWN, - TSUITE_EVENT_MULTI_UP, - TSUITE_EVENT_MULTI_MOVE, - TSUITE_EVENT_KEY_DOWN, - TSUITE_EVENT_KEY_UP, - TSUITE_EVENT_TAKE_SHOT -}; -typedef enum _Tsuite_Event_Type Tsuite_Event_Type; - -struct _eet_event_type_mapping -{ - Tsuite_Event_Type t; - const char *name; -}; -typedef struct _eet_event_type_mapping eet_event_type_mapping; - -struct _Variant_Type_st -{ - const char *type; - Eina_Bool unknow : 1; -}; -typedef struct _Variant_Type_st Variant_Type_st; - -struct _Variant_st -{ - Variant_Type_st t; - void *data; /* differently than the union type, we - * don't need to pre-allocate the memory - * for the field*/ -}; -typedef struct _Variant_st Variant_st; -/* Moved to tsuite_file_data.h -struct _Timer_Data -{ - Eet_File *fp; - unsigned int recent_event_time; - Evas *e; - Eina_List *current_event; -}; -typedef struct _Timer_Data Timer_Data; -*/ void variant_list_append(Variant_st *v); #endif diff --git a/src/lib/tsuite_evas_hook.c b/src/lib/tsuite_evas_hook.c index 9e61798..a206979 100644 --- a/src/lib/tsuite_evas_hook.c +++ b/src/lib/tsuite_evas_hook.c @@ -8,12 +8,11 @@ #include #include #include "tsuite_file_data.h" -#include "tsuite.h" #define TSUITE_MAX_PATH 1024 #define SHOT_KEY_STR "F2" #define IMAGE_FILENAME_EXT ".png" -#define DEBUG_TSUITE 1 + /* START - EET Handling code */ struct _Eet_Event_Type { @@ -118,52 +117,6 @@ evt_time_get(unsigned int tm, Variant_st *v) } } -void -tsuite_init(Evas_Object *win, char *name, api_data *d) -{ - tsuite_cleanup(); - if (!name) - return; - - ts.name = strdup(name); /* Freed by tsuite_cleanup */ - ts.win = win; - if (d) - { /* This field is not used when testing APPs */ - ts.api = d; - ts.api->win = win; - } - - ts.e = evas_object_evas_get(ts.win); -} - -/** - * @internal - * - * This function do cleanup for Tsuite - * @param Tsuite_Data * data for cleanup. - * - * @ingroup Tsuite - */ -void -tsuite_cleanup(void) -{ - if (ts.name) - free(ts.name); - - if (ts.api) - { - if (ts.api->data && ts.api->free_data) - free(ts.api->data); - - free(ts.api); - } - -/* if (ts.win) - evas_object_del(ts.win); -*/ - memset(&ts, 0, sizeof(ts)); -} - EAPI void tsuite_evas_hook_init(void) { /* Pointer taken from tsuite.c */ @@ -194,11 +147,9 @@ tsuite_evas_hook_reset(void) void tsuite_shot_do(char *name) { - printf("<%s> --- 1 ---\n", __func__); if (!ts.e) return; - printf("<%s> --- 2 ---\n", __func__); Ecore_Evas *ee, *ee_orig; Evas_Object *o; unsigned int *pixels; @@ -219,20 +170,20 @@ tsuite_shot_do(char *name) } else { - filename = malloc(strlen(ts.name) + strlen(IMAGE_FILENAME_EXT) + + filename = malloc(strlen(_hook_setting->test_name) + strlen(IMAGE_FILENAME_EXT) + dir_name_len + 8); /* also space for serial */ ts.serial++; if (_hook_setting->dest_dir) sprintf(filename, "%s/", _hook_setting->dest_dir); - sprintf(filename + dir_name_len, "%s_%d%s", ts.name ,ts.serial, - IMAGE_FILENAME_EXT); + sprintf(filename + dir_name_len, "%s_%d%s", _hook_setting->test_name, + ts.serial, IMAGE_FILENAME_EXT); } - printf("<%s> file=<%s>--- 3 ---\n", __func__, filename); /* A bit hackish, get the ecore_evas from the Evas canvas */ ee_orig = evas_data_attach_get(ts.e); + printf("<%s> ts.e=<%p> ee_orig=<%p>\n", __func__, ts.e, ee_orig); ecore_evas_manual_render(ee_orig); pixels = (void *)ecore_evas_buffer_pixels_get(ee_orig); @@ -290,7 +241,6 @@ ecore_shutdown(void) int (*_ecore_shutdown)(void) = dlsym(RTLD_NEXT, "ecore_shutdown"); - printf("<%s> Calling %s\n", __FILE__, __func__); if (_hook_setting) { if (vr_list && _hook_setting->recording) @@ -300,13 +250,12 @@ ecore_shutdown(void) free(_hook_setting); _hook_setting = NULL; - printf("<%s> TSUITE_SHUTDOWN! %s\n", __FILE__, __func__); } if (ts.td) free(ts.td); - tsuite_cleanup(); + memset(&ts, 0, sizeof(Tsuite_Data)); return _ecore_shutdown(); } @@ -317,26 +266,9 @@ evas_new(void) dlsym(RTLD_NEXT, "evas_new"); ts.e = _evas_new(); - printf("<%s> Calling %s\n", __FILE__, __func__); return ts.e; } -Evas_Object * -elm_win_add(Evas_Object *parent, const char *name, Elm_Win_Type type) -{ - printf("<%s> Calling %s\n", __FILE__, __func__); - Evas_Object * (*_elm_win_add)(Evas_Object *, const char*, Elm_Win_Type) = - dlsym(RTLD_NEXT, "elm_win_add"); - - Evas_Object *win = _elm_win_add(parent, name, type); - - ts.name = strdup(name); /* Freed by tsuite_cleanup */ - ts.win = win; -// ts.e = evas_object_evas_get(ts.win); - - return win; -} - static Eina_Bool tsuite_feed_event(void *data) { diff --git a/src/lib/tsuite_file_data.h b/src/lib/tsuite_file_data.h index cdc12c3..83558f7 100644 --- a/src/lib/tsuite_file_data.h +++ b/src/lib/tsuite_file_data.h @@ -1,10 +1,53 @@ #ifndef _TSUITE_EVAS_HOOK_H #define _TSUITE_EVAS_HOOK_H -#include "tsuite.h" - #define CACHE_FILE_ENTRY "cache" +/* Macro declaring a function argument to be unused */ +#define __UNUSED__ __attribute__((unused)) + +enum _Tsuite_Event_Type +{ /* Add any supported events here */ + TSUITE_EVENT_NOT_SUPPORTED = 0, + TSUITE_EVENT_MOUSE_IN, + TSUITE_EVENT_MOUSE_OUT, + TSUITE_EVENT_MOUSE_DOWN, + TSUITE_EVENT_MOUSE_UP, + TSUITE_EVENT_MOUSE_MOVE, + TSUITE_EVENT_MOUSE_WHEEL, + TSUITE_EVENT_MULTI_DOWN, + TSUITE_EVENT_MULTI_UP, + TSUITE_EVENT_MULTI_MOVE, + TSUITE_EVENT_KEY_DOWN, + TSUITE_EVENT_KEY_UP, + TSUITE_EVENT_TAKE_SHOT +}; +typedef enum _Tsuite_Event_Type Tsuite_Event_Type; + +struct _eet_event_type_mapping +{ + Tsuite_Event_Type t; + const char *name; +}; +typedef struct _eet_event_type_mapping eet_event_type_mapping; + +struct _Variant_Type_st +{ + const char *type; + Eina_Bool unknow : 1; +}; +typedef struct _Variant_Type_st Variant_Type_st; + +struct _Variant_st +{ + Variant_Type_st t; + void *data; /* differently than the union type, we + * don't need to pre-allocate the memory + * for the field*/ +}; +typedef struct _Variant_st Variant_st; + + struct _Timer_Data { Eet_File *fp; @@ -14,21 +57,10 @@ struct _Timer_Data }; typedef struct _Timer_Data Timer_Data; -/** - * @internal - * - * @struct _Tsuite_Data - * Struct holds test-suite data-properties - * - * @ingroup Tsuite - */ struct _Tsuite_Data { - char *name; /**< Test Name */ - int serial; /**< Serial number of currnen-file */ - api_data *api; + int serial; /**< Serial number of current-file */ Evas *e; - Evas_Object *win; Timer_Data *td; }; typedef struct _Tsuite_Data Tsuite_Data;