exactness: Cleaned tsuite_evas_hook
TODO: Need to add support of multiple evas for messaging Signed-off-by: Aharon Hillel <a.hillel@partner.samsung.com> SVN revision: 67922
This commit is contained in:
parent
034738063c
commit
b9406b348a
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <Eina.h>
|
#include <Eina.h>
|
||||||
#include <Eet.h>
|
#include <Eet.h>
|
||||||
|
#include <tsuite_file_data.h>
|
||||||
|
|
||||||
#define fail_if(expr) \
|
#define fail_if(expr) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -56,58 +57,5 @@ void tsuite_shot_do(char *name);
|
||||||
char *tsuite_test_name_get();
|
char *tsuite_test_name_get();
|
||||||
Eina_Bool write_events_get(void);
|
Eina_Bool write_events_get(void);
|
||||||
void write_events_set(Eina_Bool val);
|
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);
|
void variant_list_append(Variant_st *v);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <dlfcn.h>
|
#include <dlfcn.h>
|
||||||
#include "tsuite_file_data.h"
|
#include "tsuite_file_data.h"
|
||||||
#include "tsuite.h"
|
|
||||||
|
|
||||||
#define TSUITE_MAX_PATH 1024
|
#define TSUITE_MAX_PATH 1024
|
||||||
#define SHOT_KEY_STR "F2"
|
#define SHOT_KEY_STR "F2"
|
||||||
#define IMAGE_FILENAME_EXT ".png"
|
#define IMAGE_FILENAME_EXT ".png"
|
||||||
#define DEBUG_TSUITE 1
|
|
||||||
/* START - EET Handling code */
|
/* START - EET Handling code */
|
||||||
struct _Eet_Event_Type
|
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
|
EAPI void
|
||||||
tsuite_evas_hook_init(void)
|
tsuite_evas_hook_init(void)
|
||||||
{ /* Pointer taken from tsuite.c */
|
{ /* Pointer taken from tsuite.c */
|
||||||
|
@ -194,11 +147,9 @@ tsuite_evas_hook_reset(void)
|
||||||
void
|
void
|
||||||
tsuite_shot_do(char *name)
|
tsuite_shot_do(char *name)
|
||||||
{
|
{
|
||||||
printf("<%s> --- 1 ---\n", __func__);
|
|
||||||
if (!ts.e)
|
if (!ts.e)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
printf("<%s> --- 2 ---\n", __func__);
|
|
||||||
Ecore_Evas *ee, *ee_orig;
|
Ecore_Evas *ee, *ee_orig;
|
||||||
Evas_Object *o;
|
Evas_Object *o;
|
||||||
unsigned int *pixels;
|
unsigned int *pixels;
|
||||||
|
@ -219,20 +170,20 @@ tsuite_shot_do(char *name)
|
||||||
}
|
}
|
||||||
else
|
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 */
|
dir_name_len + 8); /* also space for serial */
|
||||||
|
|
||||||
ts.serial++;
|
ts.serial++;
|
||||||
if (_hook_setting->dest_dir)
|
if (_hook_setting->dest_dir)
|
||||||
sprintf(filename, "%s/", _hook_setting->dest_dir);
|
sprintf(filename, "%s/", _hook_setting->dest_dir);
|
||||||
|
|
||||||
sprintf(filename + dir_name_len, "%s_%d%s", ts.name ,ts.serial,
|
sprintf(filename + dir_name_len, "%s_%d%s", _hook_setting->test_name,
|
||||||
IMAGE_FILENAME_EXT);
|
ts.serial, IMAGE_FILENAME_EXT);
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("<%s> file=<%s>--- 3 ---\n", __func__, filename);
|
|
||||||
/* A bit hackish, get the ecore_evas from the Evas canvas */
|
/* A bit hackish, get the ecore_evas from the Evas canvas */
|
||||||
ee_orig = evas_data_attach_get(ts.e);
|
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);
|
ecore_evas_manual_render(ee_orig);
|
||||||
pixels = (void *)ecore_evas_buffer_pixels_get(ee_orig);
|
pixels = (void *)ecore_evas_buffer_pixels_get(ee_orig);
|
||||||
|
@ -290,7 +241,6 @@ ecore_shutdown(void)
|
||||||
int (*_ecore_shutdown)(void) =
|
int (*_ecore_shutdown)(void) =
|
||||||
dlsym(RTLD_NEXT, "ecore_shutdown");
|
dlsym(RTLD_NEXT, "ecore_shutdown");
|
||||||
|
|
||||||
printf("<%s> Calling %s\n", __FILE__, __func__);
|
|
||||||
if (_hook_setting)
|
if (_hook_setting)
|
||||||
{
|
{
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list && _hook_setting->recording)
|
||||||
|
@ -300,13 +250,12 @@ ecore_shutdown(void)
|
||||||
|
|
||||||
free(_hook_setting);
|
free(_hook_setting);
|
||||||
_hook_setting = NULL;
|
_hook_setting = NULL;
|
||||||
printf("<%s> TSUITE_SHUTDOWN! %s\n", __FILE__, __func__);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ts.td)
|
if (ts.td)
|
||||||
free(ts.td);
|
free(ts.td);
|
||||||
|
|
||||||
tsuite_cleanup();
|
memset(&ts, 0, sizeof(Tsuite_Data));
|
||||||
return _ecore_shutdown();
|
return _ecore_shutdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,26 +266,9 @@ evas_new(void)
|
||||||
dlsym(RTLD_NEXT, "evas_new");
|
dlsym(RTLD_NEXT, "evas_new");
|
||||||
|
|
||||||
ts.e = _evas_new();
|
ts.e = _evas_new();
|
||||||
printf("<%s> Calling %s\n", __FILE__, __func__);
|
|
||||||
return ts.e;
|
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
|
static Eina_Bool
|
||||||
tsuite_feed_event(void *data)
|
tsuite_feed_event(void *data)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,10 +1,53 @@
|
||||||
#ifndef _TSUITE_EVAS_HOOK_H
|
#ifndef _TSUITE_EVAS_HOOK_H
|
||||||
#define _TSUITE_EVAS_HOOK_H
|
#define _TSUITE_EVAS_HOOK_H
|
||||||
|
|
||||||
#include "tsuite.h"
|
|
||||||
|
|
||||||
#define CACHE_FILE_ENTRY "cache"
|
#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
|
struct _Timer_Data
|
||||||
{
|
{
|
||||||
Eet_File *fp;
|
Eet_File *fp;
|
||||||
|
@ -14,21 +57,10 @@ struct _Timer_Data
|
||||||
};
|
};
|
||||||
typedef struct _Timer_Data Timer_Data;
|
typedef struct _Timer_Data Timer_Data;
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* @struct _Tsuite_Data
|
|
||||||
* Struct holds test-suite data-properties
|
|
||||||
*
|
|
||||||
* @ingroup Tsuite
|
|
||||||
*/
|
|
||||||
struct _Tsuite_Data
|
struct _Tsuite_Data
|
||||||
{
|
{
|
||||||
char *name; /**< Test Name */
|
int serial; /**< Serial number of current-file */
|
||||||
int serial; /**< Serial number of currnen-file */
|
|
||||||
api_data *api;
|
|
||||||
Evas *e;
|
Evas *e;
|
||||||
Evas_Object *win;
|
|
||||||
Timer_Data *td;
|
Timer_Data *td;
|
||||||
};
|
};
|
||||||
typedef struct _Tsuite_Data Tsuite_Data;
|
typedef struct _Tsuite_Data Tsuite_Data;
|
||||||
|
|
Loading…
Reference in New Issue