Separate code related to recording and to playing hooks.
Hooks mixed in a same file leads to less readability.
This commit is contained in:
parent
081a86902c
commit
0eb607e7df
|
@ -15,7 +15,7 @@ exactness_LDADD = \
|
||||||
@EFL_LIBS@
|
@EFL_LIBS@
|
||||||
|
|
||||||
exactness_helper_LDADD = \
|
exactness_helper_LDADD = \
|
||||||
@EFL_LIBS@ ../lib/libexactness.la
|
@EFL_LIBS@ ../lib/libexactness_player.la
|
||||||
|
|
||||||
exactness_CFLAGS = \
|
exactness_CFLAGS = \
|
||||||
@EFL_CFLAGS@ \
|
@EFL_CFLAGS@ \
|
||||||
|
|
|
@ -9,8 +9,6 @@
|
||||||
#include "exactness_config.h"
|
#include "exactness_config.h"
|
||||||
#include "exactness_private.h"
|
#include "exactness_private.h"
|
||||||
|
|
||||||
#define LIBEXACTNESS_PATH PACKAGE_LIBDIR "/exactness/libexactness.so"
|
|
||||||
|
|
||||||
#define CONFIG "ELM_SCALE=1 ELM_FINGER_SIZE=10"
|
#define CONFIG "ELM_SCALE=1 ELM_FINGER_SIZE=10"
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -55,12 +53,12 @@ _run_command_prepare(const List_Entry *ent, Run_Mode mode, char *buf)
|
||||||
{
|
{
|
||||||
eina_strbuf_append_printf(sbuf, "TSUITE_DEST_DIR='%s' ",
|
eina_strbuf_append_printf(sbuf, "TSUITE_DEST_DIR='%s' ",
|
||||||
exactness_config.dest_dir);
|
exactness_config.dest_dir);
|
||||||
eina_strbuf_append(sbuf, "TSUITE_RECORDING='rec' ");
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
eina_strbuf_append_printf(sbuf, "LD_PRELOAD='%s' %s %s %s",
|
eina_strbuf_append_printf(sbuf, "LD_PRELOAD='%s/exactness/libexactness_%s.so' %s %s %s",
|
||||||
LIBEXACTNESS_PATH, CONFIG, exactness_config.wrap_command, ent->command);
|
PACKAGE_LIBDIR, mode == RUN_RECORD ? "recorder" : "player",
|
||||||
|
CONFIG, exactness_config.wrap_command, ent->command);
|
||||||
strncpy(buf, eina_strbuf_string_get(sbuf), SCHEDULER_CMD_SIZE-1);
|
strncpy(buf, eina_strbuf_string_get(sbuf), SCHEDULER_CMD_SIZE-1);
|
||||||
eina_strbuf_free(sbuf);
|
eina_strbuf_free(sbuf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,13 +12,24 @@ EXTRA_DIST = \
|
||||||
exactness_private.h
|
exactness_private.h
|
||||||
|
|
||||||
pkgdir = $(libdir)/exactness
|
pkgdir = $(libdir)/exactness
|
||||||
pkg_LTLIBRARIES = libexactness.la
|
pkg_LTLIBRARIES = libexactness_recorder.la libexactness_player.la
|
||||||
|
|
||||||
libexactness_la_SOURCES = \
|
libexactness_recorder_la_SOURCES = \
|
||||||
tsuite_hook_recorder.c \
|
tsuite_hook_recorder.c \
|
||||||
|
tsuite_common.c \
|
||||||
tsuite_file_data.c
|
tsuite_file_data.c
|
||||||
|
|
||||||
libexactness_la_LDFLAGS = -avoid-version -rdynamic
|
libexactness_recorder_la_LDFLAGS = -avoid-version -rdynamic
|
||||||
libexactness_la_DEPENDENCIES = $(top_builddir)/config.h
|
libexactness_recorder_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||||
libexactness_la_LIBADD = @EFL_LIBS@
|
libexactness_recorder_la_LIBADD = @EFL_LIBS@
|
||||||
libexactness_la_CFLAGS = @EFL_CFLAGS@
|
libexactness_recorder_la_CFLAGS = @EFL_CFLAGS@
|
||||||
|
|
||||||
|
libexactness_player_la_SOURCES = \
|
||||||
|
tsuite_hook_player.c \
|
||||||
|
tsuite_common.c \
|
||||||
|
tsuite_file_data.c
|
||||||
|
|
||||||
|
libexactness_player_la_LDFLAGS = -avoid-version -rdynamic
|
||||||
|
libexactness_player_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||||
|
libexactness_player_la_LIBADD = @EFL_LIBS@
|
||||||
|
libexactness_player_la_CFLAGS = @EFL_CFLAGS@
|
||||||
|
|
|
@ -0,0 +1,83 @@
|
||||||
|
#include "tsuite_file_data.h"
|
||||||
|
|
||||||
|
unsigned int
|
||||||
|
evt_time_get(unsigned int tm, Variant_st *v)
|
||||||
|
{
|
||||||
|
switch(tsuite_event_mapping_type_get(v->t.type))
|
||||||
|
{
|
||||||
|
case TSUITE_EVENT_MOUSE_IN:
|
||||||
|
{
|
||||||
|
mouse_in_mouse_out *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_OUT:
|
||||||
|
{
|
||||||
|
mouse_in_mouse_out *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_DOWN:
|
||||||
|
{
|
||||||
|
mouse_down_mouse_up *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_UP:
|
||||||
|
{
|
||||||
|
mouse_down_mouse_up *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_MOVE:
|
||||||
|
{
|
||||||
|
mouse_move *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_WHEEL:
|
||||||
|
{
|
||||||
|
mouse_wheel *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MULTI_DOWN:
|
||||||
|
{
|
||||||
|
multi_event *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MULTI_UP:
|
||||||
|
{
|
||||||
|
multi_event *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MULTI_MOVE:
|
||||||
|
{
|
||||||
|
multi_move *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_KEY_DOWN:
|
||||||
|
{
|
||||||
|
key_down_key_up *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_KEY_UP:
|
||||||
|
{
|
||||||
|
key_down_key_up *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE:
|
||||||
|
{
|
||||||
|
key_down_key_up_with_keycode *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_KEY_UP_WITH_KEYCODE:
|
||||||
|
{
|
||||||
|
key_down_key_up_with_keycode *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_TAKE_SHOT:
|
||||||
|
{
|
||||||
|
take_screenshot *t = v->data;
|
||||||
|
return t->timestamp;
|
||||||
|
}
|
||||||
|
default: /* All non-input events are not handeled */
|
||||||
|
return tm;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -51,9 +51,10 @@ tsuite_event_mapping_type_str_get(Tsuite_Event_Type t)
|
||||||
}
|
}
|
||||||
|
|
||||||
Lists_st *
|
Lists_st *
|
||||||
free_events(Lists_st *st, char *recording)
|
free_events(Lists_st *st, Eina_Bool recording)
|
||||||
{
|
{
|
||||||
Variant_st *v;
|
Variant_st *v;
|
||||||
|
if (!st) goto end;
|
||||||
EINA_LIST_FREE(st->variant_list, v)
|
EINA_LIST_FREE(st->variant_list, v)
|
||||||
{
|
{
|
||||||
if (recording)
|
if (recording)
|
||||||
|
@ -76,6 +77,7 @@ free_events(Lists_st *st, char *recording)
|
||||||
}
|
}
|
||||||
|
|
||||||
free(st); /* Allocated when reading data from EET file */
|
free(st); /* Allocated when reading data from EET file */
|
||||||
|
end:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -251,7 +251,7 @@ const char * _variant_type_get(const void *data, Eina_Bool *unknow);
|
||||||
Eina_Bool _variant_type_set(const char *type, void *data, Eina_Bool unknow);
|
Eina_Bool _variant_type_set(const char *type, void *data, Eina_Bool unknow);
|
||||||
|
|
||||||
EAPI Tsuite_Event_Type tsuite_event_mapping_type_get(const char *name);
|
EAPI Tsuite_Event_Type tsuite_event_mapping_type_get(const char *name);
|
||||||
EAPI Lists_st * free_events(Lists_st *st, char *recording);
|
EAPI Lists_st * free_events(Lists_st *st, Eina_Bool recording);
|
||||||
EAPI void write_events(const char *filename, Lists_st *vr_list);
|
EAPI void write_events(const char *filename, Lists_st *vr_list);
|
||||||
EAPI Lists_st *read_events(const char *filename, Timer_Data *td);
|
EAPI Lists_st *read_events(const char *filename, Timer_Data *td);
|
||||||
EAPI unsigned int evt_time_get(unsigned int tm, Variant_st *v);
|
EAPI unsigned int evt_time_get(unsigned int tm, Variant_st *v);
|
||||||
|
|
|
@ -0,0 +1,546 @@
|
||||||
|
#define _GNU_SOURCE 1
|
||||||
|
#define EFL_EO_API_SUPPORT
|
||||||
|
#define EFL_BETA_API_SUPPORT
|
||||||
|
#include <Eo.h>
|
||||||
|
#include <Eet.h>
|
||||||
|
#include <Evas.h>
|
||||||
|
#include <Ecore.h>
|
||||||
|
#include <Ecore_Evas.h>
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/sysinfo.h>
|
||||||
|
#include <dlfcn.h>
|
||||||
|
#include "tsuite_file_data.h"
|
||||||
|
#include "exactness_private.h"
|
||||||
|
|
||||||
|
#define TSUITE_MAX_PATH 1024
|
||||||
|
#define IMAGE_FILENAME_EXT ".png"
|
||||||
|
|
||||||
|
struct _evas_hook_setting
|
||||||
|
{
|
||||||
|
char *dest_dir;
|
||||||
|
char *test_name;
|
||||||
|
char *file_name;
|
||||||
|
Eina_Bool verbose;
|
||||||
|
};
|
||||||
|
typedef struct _evas_hook_setting evas_hook_setting;
|
||||||
|
|
||||||
|
static Lists_st *vr_list = NULL;
|
||||||
|
static evas_hook_setting *_hook_setting = NULL;
|
||||||
|
static Tsuite_Data ts;
|
||||||
|
static Eina_List *evas_list = NULL; /* List of Evas pointers */
|
||||||
|
static int ignore_evas_new = 0; /* Counter to know if we should ignore evas new or not. */
|
||||||
|
|
||||||
|
static void
|
||||||
|
_tsuite_verbosef(const char *fmt, ...)
|
||||||
|
{
|
||||||
|
va_list ap;
|
||||||
|
if (!_hook_setting->verbose)
|
||||||
|
return;
|
||||||
|
|
||||||
|
va_start(ap, fmt);
|
||||||
|
vprintf(fmt, ap);
|
||||||
|
va_end(ap);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
*
|
||||||
|
* This function takes actual shot and saves it in PNG
|
||||||
|
* @param data Tsuite_Data pointer initiated by user
|
||||||
|
* @param obj Window pointer
|
||||||
|
* @param obj name file name. Will use name_+serial if NULL
|
||||||
|
*
|
||||||
|
* @ingroup Tsuite
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
_shot_do(char *name, Evas *e)
|
||||||
|
{
|
||||||
|
if (!e)
|
||||||
|
return;
|
||||||
|
|
||||||
|
Ecore_Evas *ee = NULL, *ee_orig;
|
||||||
|
Evas_Object *o;
|
||||||
|
unsigned int *pixels;
|
||||||
|
int w, h,dir_name_len = 0;
|
||||||
|
char *filename;
|
||||||
|
if (_hook_setting->dest_dir)
|
||||||
|
dir_name_len = strlen(_hook_setting->dest_dir) + 1; /* includes space of a '/' */
|
||||||
|
|
||||||
|
if (name)
|
||||||
|
{
|
||||||
|
filename = malloc(strlen(name) + strlen(IMAGE_FILENAME_EXT) +
|
||||||
|
dir_name_len + 4);
|
||||||
|
|
||||||
|
if (_hook_setting->dest_dir)
|
||||||
|
sprintf(filename, "%s/", _hook_setting->dest_dir);
|
||||||
|
|
||||||
|
sprintf(filename + dir_name_len, "%s%s", name, IMAGE_FILENAME_EXT);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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%c%03d%s", _hook_setting->test_name,
|
||||||
|
SHOT_DELIMITER, ts.serial, IMAGE_FILENAME_EXT);
|
||||||
|
}
|
||||||
|
_tsuite_verbosef("Shot taken (%s).\n", filename);
|
||||||
|
|
||||||
|
ee_orig = ecore_evas_ecore_evas_get(e);
|
||||||
|
|
||||||
|
ecore_evas_manual_render(ee_orig);
|
||||||
|
pixels = (void *)ecore_evas_buffer_pixels_get(ee_orig);
|
||||||
|
if (!pixels) goto end;
|
||||||
|
ecore_evas_geometry_get(ee_orig, NULL, NULL, &w, &h);
|
||||||
|
if ((w < 1) || (h < 1)) goto end;
|
||||||
|
|
||||||
|
ignore_evas_new++;
|
||||||
|
ee = ecore_evas_buffer_new(1, 1);
|
||||||
|
ignore_evas_new--;
|
||||||
|
|
||||||
|
o = evas_object_image_add(ecore_evas_get(ee));
|
||||||
|
evas_object_image_alpha_set(o, ecore_evas_alpha_get(ee_orig));
|
||||||
|
evas_object_image_size_set(o, w, h);
|
||||||
|
evas_object_image_data_set(o, pixels);
|
||||||
|
|
||||||
|
if (!evas_object_image_save(o, filename, NULL, NULL))
|
||||||
|
{
|
||||||
|
printf("Cannot save widget to <%s>\n", filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
if (ee)
|
||||||
|
{
|
||||||
|
ecore_evas_free(ee);
|
||||||
|
}
|
||||||
|
free(filename);
|
||||||
|
}
|
||||||
|
|
||||||
|
static int _ecore_init_count = 0;
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
ecore_init(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
int (*_ecore_init)(void) =
|
||||||
|
dlsym(RTLD_NEXT, "ecore_init");
|
||||||
|
|
||||||
|
_ecore_init_count++;
|
||||||
|
|
||||||
|
if ((_ecore_init_count == 1) && (!_hook_setting))
|
||||||
|
{
|
||||||
|
const char *tmp;
|
||||||
|
_hook_setting = calloc(1, sizeof(evas_hook_setting));
|
||||||
|
_hook_setting->dest_dir = getenv("TSUITE_DEST_DIR");
|
||||||
|
_hook_setting->test_name = getenv("TSUITE_TEST_NAME");
|
||||||
|
_hook_setting->file_name = getenv("TSUITE_FILE_NAME");
|
||||||
|
tmp = getenv("TSUITE_VERBOSE");
|
||||||
|
if (tmp)
|
||||||
|
_hook_setting->verbose = atoi(tmp);
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("<%s> test_name=<%s>\n", __func__, _hook_setting->test_name);
|
||||||
|
printf("<%s> dest_dir=<%s>\n", __func__, _hook_setting->dest_dir);
|
||||||
|
printf("<%s> recording=<%s>\n", __func__, _hook_setting->recording);
|
||||||
|
printf("<%s> rec file is <%s>\n", __func__, _hook_setting->file_name);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
ret = _ecore_init();
|
||||||
|
eet_init();
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI int
|
||||||
|
ecore_shutdown(void)
|
||||||
|
{
|
||||||
|
int (*_ecore_shutdown)(void) =
|
||||||
|
dlsym(RTLD_NEXT, "ecore_shutdown");
|
||||||
|
|
||||||
|
_ecore_init_count--;
|
||||||
|
|
||||||
|
if (_ecore_init_count == 0)
|
||||||
|
{
|
||||||
|
if (_hook_setting)
|
||||||
|
{
|
||||||
|
vr_list = free_events(vr_list, EINA_FALSE);
|
||||||
|
|
||||||
|
free(_hook_setting);
|
||||||
|
_hook_setting = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ts.td)
|
||||||
|
free(ts.td);
|
||||||
|
|
||||||
|
evas_list = eina_list_free(evas_list);
|
||||||
|
|
||||||
|
memset(&ts, 0, sizeof(Tsuite_Data));
|
||||||
|
}
|
||||||
|
|
||||||
|
eet_shutdown();
|
||||||
|
return _ecore_shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Evas *
|
||||||
|
evas_new(void)
|
||||||
|
{
|
||||||
|
Evas * (*_evas_new)(void) = dlsym(RTLD_NEXT, __FUNCTION__);
|
||||||
|
|
||||||
|
Evas *evas = _evas_new();
|
||||||
|
if (ignore_evas_new == 0)
|
||||||
|
{
|
||||||
|
evas_list = eina_list_append(evas_list, evas);
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("Appended EVAS=<%p> list size=<%d>\n", evas, eina_list_count(evas_list));
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
return evas;
|
||||||
|
}
|
||||||
|
|
||||||
|
EAPI Ecore_Evas *
|
||||||
|
ecore_evas_new(const char *engine_name EINA_UNUSED, int x, int y,
|
||||||
|
int w, int h, const char *extra_options)
|
||||||
|
{
|
||||||
|
Ecore_Evas * (*_ecore_evas_new)(const char *engine_name, int x, int y,
|
||||||
|
int w, int h, const char *extra_options) = dlsym(RTLD_NEXT, __FUNCTION__);
|
||||||
|
|
||||||
|
return _ecore_evas_new("buffer", x, y, w, h, extra_options);
|
||||||
|
}
|
||||||
|
|
||||||
|
static Eina_Bool
|
||||||
|
tsuite_feed_event(void *data)
|
||||||
|
{
|
||||||
|
Timer_Data *td = data;
|
||||||
|
time_t evt_time;
|
||||||
|
if (!td)
|
||||||
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
static Evas_Object *rect = NULL;
|
||||||
|
if (_hook_setting->verbose)
|
||||||
|
{
|
||||||
|
if (!rect)
|
||||||
|
{
|
||||||
|
rect = evas_object_rectangle_add(eina_list_data_get(evas_list));
|
||||||
|
evas_object_repeat_events_set(rect, EINA_TRUE);
|
||||||
|
evas_object_color_set(rect, 255, 0, 0, 255);
|
||||||
|
evas_object_resize(rect, 15, 15);
|
||||||
|
evas_object_layer_set(rect, 100);
|
||||||
|
evas_object_show(rect);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Variant_st *v = eina_list_data_get(td->current_event);
|
||||||
|
switch(tsuite_event_mapping_type_get(v->t.type))
|
||||||
|
{
|
||||||
|
case TSUITE_EVENT_MOUSE_IN:
|
||||||
|
{
|
||||||
|
mouse_in_mouse_out *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
_tsuite_verbosef("Mouse in\n");
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_mouse_in timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||||
|
#endif
|
||||||
|
evas_event_feed_mouse_in(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
time(NULL), NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_OUT:
|
||||||
|
{
|
||||||
|
mouse_in_mouse_out *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
_tsuite_verbosef("Mouse out\n");
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_mouse_out timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
||||||
|
#endif
|
||||||
|
evas_event_feed_mouse_out(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
time(NULL), NULL);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_DOWN:
|
||||||
|
{
|
||||||
|
mouse_down_mouse_up *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
_tsuite_verbosef("Mouse down\n");
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_mouse_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||||
|
#endif
|
||||||
|
if (rect) evas_object_color_set(rect, 255, 255, 0, 255);
|
||||||
|
evas_event_feed_mouse_down(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->b, t->flags, time(NULL),
|
||||||
|
NULL);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_UP:
|
||||||
|
{
|
||||||
|
mouse_down_mouse_up *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
_tsuite_verbosef("Mouse up\n");
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_mouse_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
||||||
|
#endif
|
||||||
|
evas_event_feed_mouse_up(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->b, t->flags, time(NULL),
|
||||||
|
NULL);
|
||||||
|
if (rect) evas_object_color_set(rect, 255, 0, 0, 255);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_MOVE:
|
||||||
|
{
|
||||||
|
mouse_move *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_mouse_move (x,y)=(%d,%d) timestamp=<%u> t->n_evas=<%d>\n", __func__, t->x, t->y, t->timestamp,t->n_evas);
|
||||||
|
#endif
|
||||||
|
evas_event_feed_mouse_move(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->x, t->y, time(NULL), NULL);
|
||||||
|
|
||||||
|
if (rect)
|
||||||
|
{
|
||||||
|
evas_object_move(rect, t->x, t->y);
|
||||||
|
evas_object_color_set(rect, 255, 0, 0, 255);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MOUSE_WHEEL:
|
||||||
|
{
|
||||||
|
mouse_wheel *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
_tsuite_verbosef("Mouse wheel\n");
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_mouse_wheel timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||||
|
#endif
|
||||||
|
evas_event_feed_mouse_wheel(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->direction, t->z,
|
||||||
|
time(NULL), NULL);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MULTI_DOWN:
|
||||||
|
{
|
||||||
|
multi_event *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_multi_down timestamp=<%u>, t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
||||||
|
#endif
|
||||||
|
if (!t->d)
|
||||||
|
{
|
||||||
|
evas_event_feed_mouse_down(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->b, t->flags, time(NULL), NULL);
|
||||||
|
if (rect) evas_object_color_set(rect, 255, 255, 0, 255);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
evas_event_feed_multi_down(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->d, t->x, t->y, t->rad,
|
||||||
|
t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
|
||||||
|
t->flags, time(NULL), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MULTI_UP:
|
||||||
|
{
|
||||||
|
multi_event *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_multi_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
||||||
|
#endif
|
||||||
|
if (!t->d)
|
||||||
|
{
|
||||||
|
evas_event_feed_mouse_up(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->b, t->flags, time(NULL), NULL);
|
||||||
|
if (rect) evas_object_color_set(rect, 255, 0, 0, 255);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
evas_event_feed_multi_up(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->d, t->x, t->y, t->rad,
|
||||||
|
t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
|
||||||
|
t->flags, time(NULL), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_MULTI_MOVE:
|
||||||
|
{
|
||||||
|
multi_move *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_multi_move timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||||
|
#endif
|
||||||
|
if (!t->d)
|
||||||
|
{
|
||||||
|
evas_event_feed_mouse_move(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->x, t->y, time(NULL), NULL);
|
||||||
|
if (rect)
|
||||||
|
{
|
||||||
|
evas_object_move(rect, t->x, t->y);
|
||||||
|
evas_object_color_set(rect, 255, 0, 0, 255);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
evas_event_feed_multi_move(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->d, t->x, t->y, t->rad,
|
||||||
|
t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
|
||||||
|
time(NULL), NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_KEY_DOWN:
|
||||||
|
{
|
||||||
|
key_down_key_up *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_key_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||||
|
#endif
|
||||||
|
evas_event_feed_key_down(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->keyname, t->key, t->string,
|
||||||
|
t->compose, time(NULL), NULL);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_KEY_UP:
|
||||||
|
{
|
||||||
|
key_down_key_up *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_key_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||||
|
#endif
|
||||||
|
evas_event_feed_key_up(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->keyname, t->key, t->string,
|
||||||
|
t->compose, time(NULL), NULL);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE:
|
||||||
|
{
|
||||||
|
key_down_key_up_with_keycode *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_key_down_with_keycode timestamp=<%u> t->n_evas=<%d> t->keycode=<%u>\n", __func__, t->timestamp, t->n_evas, t->keycode);
|
||||||
|
#endif
|
||||||
|
evas_event_feed_key_down_with_keycode(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->keyname, t->key, t->string,
|
||||||
|
t->compose, time(NULL), NULL, t->keycode);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TSUITE_EVENT_KEY_UP_WITH_KEYCODE:
|
||||||
|
{
|
||||||
|
key_down_key_up_with_keycode *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s evas_event_feed_key_up_with_keycode timestamp=<%u> t->n_evas=<%d> t->keycode=<%u>\n", __func__, t->timestamp, t->n_evas, t->keycode);
|
||||||
|
#endif
|
||||||
|
evas_event_feed_key_up(eina_list_nth(evas_list, t->n_evas),
|
||||||
|
t->keyname, t->key, t->string,
|
||||||
|
t->compose, time(NULL), NULL);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case TSUITE_EVENT_TAKE_SHOT:
|
||||||
|
{
|
||||||
|
take_screenshot *t = v->data;
|
||||||
|
evt_time = t->timestamp;
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s take shot timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
||||||
|
#endif
|
||||||
|
if (rect) evas_object_color_set(rect, 0, 0, 255, 255);
|
||||||
|
_shot_do(NULL,
|
||||||
|
eina_list_nth(evas_list, t->n_evas)); /* Serial name based on test-name */
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: /* All non-input events are not handeled */
|
||||||
|
evt_time = td->recent_event_time;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
double timer_time;
|
||||||
|
td->current_event = eina_list_next(td->current_event);
|
||||||
|
|
||||||
|
if (!td->current_event)
|
||||||
|
{ /* Finished reading all events */
|
||||||
|
ecore_main_loop_quit();
|
||||||
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
td->recent_event_time = evt_time;
|
||||||
|
|
||||||
|
unsigned int current_event_time = evt_time_get(evt_time, eina_list_data_get(td->current_event));
|
||||||
|
|
||||||
|
if (current_event_time < td->recent_event_time) /* Could happen with refeed event */
|
||||||
|
current_event_time = td->recent_event_time;
|
||||||
|
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf(" %s td->recent_event_time=<%u> current_event_time=<%u>\n", __func__, td->recent_event_time, current_event_time);
|
||||||
|
#endif
|
||||||
|
timer_time = (current_event_time - td->recent_event_time) / 1000.0;
|
||||||
|
|
||||||
|
if (!td->recent_event_time)
|
||||||
|
timer_time = 0.0;
|
||||||
|
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf(" %s timer_time=<%f>\n", __func__, timer_time);
|
||||||
|
#endif
|
||||||
|
ecore_timer_add(timer_time, tsuite_feed_event, td);
|
||||||
|
|
||||||
|
return ECORE_CALLBACK_CANCEL;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
ecore_main_loop_begin(void)
|
||||||
|
{
|
||||||
|
void (*_ecore_main_loop_begin)(void) =
|
||||||
|
dlsym(RTLD_NEXT, "ecore_main_loop_begin");
|
||||||
|
|
||||||
|
|
||||||
|
if (_hook_setting->file_name)
|
||||||
|
{
|
||||||
|
double diff_time = 0; /* Time to wait before feeding the first event */
|
||||||
|
ts.td = calloc(1, sizeof(Timer_Data));
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("<%s> rec file is <%s>\n", __func__, _hook_setting->file_name);
|
||||||
|
#endif
|
||||||
|
vr_list = read_events(_hook_setting->file_name, ts.td);
|
||||||
|
if (ts.td->current_event)
|
||||||
|
{
|
||||||
|
/* Got first event in list, run test */
|
||||||
|
|
||||||
|
/* Calculate the time to wait before feeding the first event */
|
||||||
|
unsigned int current_event_time = evt_time_get(0, eina_list_data_get(ts.td->current_event));
|
||||||
|
if (current_event_time > vr_list->first_timestamp)
|
||||||
|
diff_time = (current_event_time - vr_list->first_timestamp) / 1000.0;
|
||||||
|
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf("%s first_time_stamp=<%u> current_event_time=<%u>\n", __func__, vr_list->first_timestamp, current_event_time);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if (diff_time)
|
||||||
|
{
|
||||||
|
#ifdef DEBUG_TSUITE
|
||||||
|
printf(" Waiting <%f>\n", diff_time);
|
||||||
|
#endif
|
||||||
|
ecore_timer_add(diff_time, tsuite_feed_event, ts.td);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
tsuite_feed_event(ts.td);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return _ecore_main_loop_begin();
|
||||||
|
}
|
|
@ -5,7 +5,6 @@
|
||||||
#include <Eet.h>
|
#include <Eet.h>
|
||||||
#include <Evas.h>
|
#include <Evas.h>
|
||||||
#include <Ecore.h>
|
#include <Ecore.h>
|
||||||
#include <Ecore_Evas.h>
|
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -23,7 +22,6 @@
|
||||||
|
|
||||||
struct _evas_hook_setting
|
struct _evas_hook_setting
|
||||||
{
|
{
|
||||||
char *recording;
|
|
||||||
char *dest_dir;
|
char *dest_dir;
|
||||||
char *test_name;
|
char *test_name;
|
||||||
char *file_name;
|
char *file_name;
|
||||||
|
@ -36,7 +34,6 @@ static Lists_st *vr_list = NULL;
|
||||||
static evas_hook_setting *_hook_setting = NULL;
|
static evas_hook_setting *_hook_setting = NULL;
|
||||||
static Tsuite_Data ts;
|
static Tsuite_Data ts;
|
||||||
static Eina_List *evas_list = NULL; /* List of Evas pointers */
|
static Eina_List *evas_list = NULL; /* List of Evas pointers */
|
||||||
static int ignore_evas_new = 0; /* Counter to know if we should ignore evas new or not. */
|
|
||||||
|
|
||||||
static Tsuite_Event_Type
|
static Tsuite_Event_Type
|
||||||
tsuite_event_pointer_type_get(Efl_Pointer_Action t)
|
tsuite_event_pointer_type_get(Efl_Pointer_Action t)
|
||||||
|
@ -90,7 +87,7 @@ _is_hook_duplicate(const Variant_st *v, Tsuite_Event_Type ev_type, const void *i
|
||||||
/* Adding variant to list, this list is later written to EET file */
|
/* Adding variant to list, this list is later written to EET file */
|
||||||
#define ADD_TO_LIST(EVT_TYPE, INFO) \
|
#define ADD_TO_LIST(EVT_TYPE, INFO) \
|
||||||
do { /* This macro will add event to EET data list */ \
|
do { /* This macro will add event to EET data list */ \
|
||||||
if (vr_list && _hook_setting->recording) \
|
if (vr_list) \
|
||||||
{ \
|
{ \
|
||||||
const Variant_st *prev_v = eina_list_last_data_get(vr_list->variant_list); \
|
const Variant_st *prev_v = eina_list_last_data_get(vr_list->variant_list); \
|
||||||
if (!prev_v || !_is_hook_duplicate(prev_v, EVT_TYPE, &INFO, sizeof(INFO))) \
|
if (!prev_v || !_is_hook_duplicate(prev_v, EVT_TYPE, &INFO, sizeof(INFO))) \
|
||||||
|
@ -126,109 +123,6 @@ evas_list_find(void *ptr)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_tsuite_verbosef(const char *fmt, ...)
|
|
||||||
{
|
|
||||||
va_list ap;
|
|
||||||
if (!_hook_setting->verbose)
|
|
||||||
return;
|
|
||||||
|
|
||||||
va_start(ap, fmt);
|
|
||||||
vprintf(fmt, ap);
|
|
||||||
va_end(ap);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* This function initiates Tsuite_Data
|
|
||||||
* @param name defines test-name
|
|
||||||
* @param Pointer_Event Pointer to PE.
|
|
||||||
*
|
|
||||||
* @ingroup Tsuite
|
|
||||||
*/
|
|
||||||
|
|
||||||
unsigned int
|
|
||||||
evt_time_get(unsigned int tm, Variant_st *v)
|
|
||||||
{
|
|
||||||
switch(tsuite_event_mapping_type_get(v->t.type))
|
|
||||||
{
|
|
||||||
case TSUITE_EVENT_MOUSE_IN:
|
|
||||||
{
|
|
||||||
mouse_in_mouse_out *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_OUT:
|
|
||||||
{
|
|
||||||
mouse_in_mouse_out *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_DOWN:
|
|
||||||
{
|
|
||||||
mouse_down_mouse_up *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_UP:
|
|
||||||
{
|
|
||||||
mouse_down_mouse_up *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_MOVE:
|
|
||||||
{
|
|
||||||
mouse_move *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_WHEEL:
|
|
||||||
{
|
|
||||||
mouse_wheel *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MULTI_DOWN:
|
|
||||||
{
|
|
||||||
multi_event *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MULTI_UP:
|
|
||||||
{
|
|
||||||
multi_event *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MULTI_MOVE:
|
|
||||||
{
|
|
||||||
multi_move *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_KEY_DOWN:
|
|
||||||
{
|
|
||||||
key_down_key_up *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_KEY_UP:
|
|
||||||
{
|
|
||||||
key_down_key_up *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE:
|
|
||||||
{
|
|
||||||
key_down_key_up_with_keycode *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_KEY_UP_WITH_KEYCODE:
|
|
||||||
{
|
|
||||||
key_down_key_up_with_keycode *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_TAKE_SHOT:
|
|
||||||
{
|
|
||||||
take_screenshot *t = v->data;
|
|
||||||
return t->timestamp;
|
|
||||||
}
|
|
||||||
default: /* All non-input events are not handeled */
|
|
||||||
return tm;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_evas_hook_init(void)
|
_evas_hook_init(void)
|
||||||
{ /* Pointer taken from tsuite.c */
|
{ /* Pointer taken from tsuite.c */
|
||||||
|
@ -247,91 +141,6 @@ _evas_hook_init(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
_evas_hook_reset(void)
|
|
||||||
{ /* tsuite.c informs us that vr_list is no longer valid */
|
|
||||||
if (vr_list)
|
|
||||||
vr_list = free_events(vr_list, _hook_setting->recording);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @internal
|
|
||||||
*
|
|
||||||
* This function takes actual shot and saves it in PNG
|
|
||||||
* @param data Tsuite_Data pointer initiated by user
|
|
||||||
* @param obj Window pointer
|
|
||||||
* @param obj name file name. Will use name_+serial if NULL
|
|
||||||
*
|
|
||||||
* @ingroup Tsuite
|
|
||||||
*/
|
|
||||||
static void
|
|
||||||
_shot_do(char *name, Evas *e)
|
|
||||||
{
|
|
||||||
if (!e)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Ecore_Evas *ee = NULL, *ee_orig;
|
|
||||||
Evas_Object *o;
|
|
||||||
unsigned int *pixels;
|
|
||||||
int w, h,dir_name_len = 0;
|
|
||||||
char *filename;
|
|
||||||
if (_hook_setting->dest_dir)
|
|
||||||
dir_name_len = strlen(_hook_setting->dest_dir) + 1; /* includes space of a '/' */
|
|
||||||
|
|
||||||
if (name)
|
|
||||||
{
|
|
||||||
filename = malloc(strlen(name) + strlen(IMAGE_FILENAME_EXT) +
|
|
||||||
dir_name_len + 4);
|
|
||||||
|
|
||||||
if (_hook_setting->dest_dir)
|
|
||||||
sprintf(filename, "%s/", _hook_setting->dest_dir);
|
|
||||||
|
|
||||||
sprintf(filename + dir_name_len, "%s%s", name, IMAGE_FILENAME_EXT);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
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%c%03d%s", _hook_setting->test_name,
|
|
||||||
SHOT_DELIMITER, ts.serial, IMAGE_FILENAME_EXT);
|
|
||||||
}
|
|
||||||
_tsuite_verbosef("Shot taken (%s).\n", filename);
|
|
||||||
|
|
||||||
ee_orig = ecore_evas_ecore_evas_get(e);
|
|
||||||
|
|
||||||
ecore_evas_manual_render(ee_orig);
|
|
||||||
pixels = (void *)ecore_evas_buffer_pixels_get(ee_orig);
|
|
||||||
if (!pixels) goto end;
|
|
||||||
ecore_evas_geometry_get(ee_orig, NULL, NULL, &w, &h);
|
|
||||||
if ((w < 1) || (h < 1)) goto end;
|
|
||||||
|
|
||||||
ignore_evas_new++;
|
|
||||||
ee = ecore_evas_buffer_new(1, 1);
|
|
||||||
ignore_evas_new--;
|
|
||||||
|
|
||||||
o = evas_object_image_add(ecore_evas_get(ee));
|
|
||||||
evas_object_image_alpha_set(o, ecore_evas_alpha_get(ee_orig));
|
|
||||||
evas_object_image_size_set(o, w, h);
|
|
||||||
evas_object_image_data_set(o, pixels);
|
|
||||||
|
|
||||||
if (!evas_object_image_save(o, filename, NULL, NULL))
|
|
||||||
{
|
|
||||||
printf("Cannot save widget to <%s>\n", filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
end:
|
|
||||||
if (ee)
|
|
||||||
{
|
|
||||||
ecore_evas_free(ee);
|
|
||||||
}
|
|
||||||
free(filename);
|
|
||||||
}
|
|
||||||
|
|
||||||
static int _ecore_init_count = 0;
|
static int _ecore_init_count = 0;
|
||||||
|
|
||||||
EAPI int
|
EAPI int
|
||||||
|
@ -348,7 +157,6 @@ ecore_init(void)
|
||||||
{
|
{
|
||||||
const char *tmp;
|
const char *tmp;
|
||||||
_hook_setting = calloc(1, sizeof(evas_hook_setting));
|
_hook_setting = calloc(1, sizeof(evas_hook_setting));
|
||||||
_hook_setting->recording = getenv("TSUITE_RECORDING");
|
|
||||||
_hook_setting->dest_dir = getenv("TSUITE_DEST_DIR");
|
_hook_setting->dest_dir = getenv("TSUITE_DEST_DIR");
|
||||||
_hook_setting->test_name = getenv("TSUITE_TEST_NAME");
|
_hook_setting->test_name = getenv("TSUITE_TEST_NAME");
|
||||||
_hook_setting->file_name = getenv("TSUITE_FILE_NAME");
|
_hook_setting->file_name = getenv("TSUITE_FILE_NAME");
|
||||||
|
@ -369,7 +177,6 @@ ecore_init(void)
|
||||||
|
|
||||||
if (initing)
|
if (initing)
|
||||||
{
|
{
|
||||||
if (_hook_setting->recording)
|
|
||||||
_evas_hook_init();
|
_evas_hook_init();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -388,10 +195,10 @@ ecore_shutdown(void)
|
||||||
{
|
{
|
||||||
if (_hook_setting)
|
if (_hook_setting)
|
||||||
{
|
{
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list)
|
||||||
write_events(_hook_setting->file_name, vr_list);
|
write_events(_hook_setting->file_name, vr_list);
|
||||||
|
|
||||||
_evas_hook_reset();
|
vr_list = free_events(vr_list, EINA_TRUE);
|
||||||
|
|
||||||
free(_hook_setting);
|
free(_hook_setting);
|
||||||
_hook_setting = NULL;
|
_hook_setting = NULL;
|
||||||
|
@ -497,7 +304,7 @@ _event_key_cb(void *data, const Efl_Event *event)
|
||||||
{
|
{
|
||||||
if (_hook_setting)
|
if (_hook_setting)
|
||||||
{
|
{
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list)
|
||||||
write_events(_hook_setting->file_name, vr_list);
|
write_events(_hook_setting->file_name, vr_list);
|
||||||
#ifdef DEBUG_TSUITE
|
#ifdef DEBUG_TSUITE
|
||||||
printf("Save events: %s timestamp=<%u>\n", __func__, timestamp);
|
printf("Save events: %s timestamp=<%u>\n", __func__, timestamp);
|
||||||
|
@ -511,7 +318,7 @@ _event_key_cb(void *data, const Efl_Event *event)
|
||||||
{
|
{
|
||||||
if (!strcmp(key, shot_key) || !strcmp(key, SAVE_KEY_STR)) return;
|
if (!strcmp(key, shot_key) || !strcmp(key, SAVE_KEY_STR)) return;
|
||||||
}
|
}
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list)
|
||||||
{ /* Construct duplicate strings, free them when list if freed */
|
{ /* Construct duplicate strings, free them when list if freed */
|
||||||
key_down_key_up_with_keycode t;
|
key_down_key_up_with_keycode t;
|
||||||
t.timestamp = timestamp;
|
t.timestamp = timestamp;
|
||||||
|
@ -543,366 +350,17 @@ EFL_CALLBACKS_ARRAY_DEFINE(_event_pointer_callbacks,
|
||||||
EAPI Evas *
|
EAPI Evas *
|
||||||
evas_new(void)
|
evas_new(void)
|
||||||
{
|
{
|
||||||
Evas *evas;
|
|
||||||
Evas * (*_evas_new)(void) = dlsym(RTLD_NEXT, __FUNCTION__);
|
Evas * (*_evas_new)(void) = dlsym(RTLD_NEXT, __FUNCTION__);
|
||||||
|
Evas *evas = _evas_new();
|
||||||
evas = _evas_new();
|
|
||||||
if (ignore_evas_new == 0)
|
|
||||||
{
|
|
||||||
evas_list = eina_list_append(evas_list, evas);
|
evas_list = eina_list_append(evas_list, evas);
|
||||||
efl_event_callback_array_add(evas, _event_pointer_callbacks(), evas);
|
efl_event_callback_array_add(evas, _event_pointer_callbacks(), evas);
|
||||||
#ifdef DEBUG_TSUITE
|
#ifdef DEBUG_TSUITE
|
||||||
printf("Appended EVAS=<%p> list size=<%d>\n", evas, eina_list_count(evas_list));
|
printf("Appended EVAS=<%p> list size=<%d>\n", evas, eina_list_count(evas_list));
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
|
|
||||||
return evas;
|
return evas;
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Ecore_Evas *
|
|
||||||
ecore_evas_new(const char *engine_name, int x, int y,
|
|
||||||
int w, int h, const char *extra_options)
|
|
||||||
{
|
|
||||||
Ecore_Evas *ecore_evas;
|
|
||||||
Ecore_Evas * (*_ecore_evas_new)(const char *engine_name, int x, int y,
|
|
||||||
int w, int h, const char *extra_options) = dlsym(RTLD_NEXT, __FUNCTION__);
|
|
||||||
|
|
||||||
if(!_hook_setting->recording)
|
|
||||||
ecore_evas = _ecore_evas_new("buffer", x, y, w, h, extra_options);
|
|
||||||
else
|
|
||||||
ecore_evas = _ecore_evas_new(engine_name, x, y, w, h, extra_options);
|
|
||||||
return ecore_evas;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Eina_Bool
|
|
||||||
tsuite_feed_event(void *data)
|
|
||||||
{
|
|
||||||
Timer_Data *td = data;
|
|
||||||
time_t evt_time;
|
|
||||||
if (!td)
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
static Evas_Object *rect = NULL;
|
|
||||||
if (_hook_setting->verbose)
|
|
||||||
{
|
|
||||||
if (!rect)
|
|
||||||
{
|
|
||||||
rect = evas_object_rectangle_add(eina_list_data_get(evas_list));
|
|
||||||
evas_object_repeat_events_set(rect, EINA_TRUE);
|
|
||||||
evas_object_color_set(rect, 255, 0, 0, 255);
|
|
||||||
evas_object_resize(rect, 15, 15);
|
|
||||||
evas_object_layer_set(rect, 100);
|
|
||||||
evas_object_show(rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Variant_st *v = eina_list_data_get(td->current_event);
|
|
||||||
switch(tsuite_event_mapping_type_get(v->t.type))
|
|
||||||
{
|
|
||||||
case TSUITE_EVENT_MOUSE_IN:
|
|
||||||
{
|
|
||||||
mouse_in_mouse_out *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
_tsuite_verbosef("Mouse in\n");
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_mouse_in timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
|
||||||
#endif
|
|
||||||
evas_event_feed_mouse_in(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
time(NULL), NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_OUT:
|
|
||||||
{
|
|
||||||
mouse_in_mouse_out *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
_tsuite_verbosef("Mouse out\n");
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_mouse_out timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
|
||||||
#endif
|
|
||||||
evas_event_feed_mouse_out(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
time(NULL), NULL);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_DOWN:
|
|
||||||
{
|
|
||||||
mouse_down_mouse_up *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
_tsuite_verbosef("Mouse down\n");
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_mouse_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
|
||||||
#endif
|
|
||||||
if (rect) evas_object_color_set(rect, 255, 255, 0, 255);
|
|
||||||
evas_event_feed_mouse_down(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->b, t->flags, time(NULL),
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_UP:
|
|
||||||
{
|
|
||||||
mouse_down_mouse_up *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
_tsuite_verbosef("Mouse up\n");
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_mouse_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
|
||||||
#endif
|
|
||||||
evas_event_feed_mouse_up(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->b, t->flags, time(NULL),
|
|
||||||
NULL);
|
|
||||||
if (rect) evas_object_color_set(rect, 255, 0, 0, 255);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_MOVE:
|
|
||||||
{
|
|
||||||
mouse_move *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_mouse_move (x,y)=(%d,%d) timestamp=<%u> t->n_evas=<%d>\n", __func__, t->x, t->y, t->timestamp,t->n_evas);
|
|
||||||
#endif
|
|
||||||
evas_event_feed_mouse_move(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->x, t->y, time(NULL), NULL);
|
|
||||||
|
|
||||||
if (rect)
|
|
||||||
{
|
|
||||||
evas_object_move(rect, t->x, t->y);
|
|
||||||
evas_object_color_set(rect, 255, 0, 0, 255);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MOUSE_WHEEL:
|
|
||||||
{
|
|
||||||
mouse_wheel *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
_tsuite_verbosef("Mouse wheel\n");
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_mouse_wheel timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
|
||||||
#endif
|
|
||||||
evas_event_feed_mouse_wheel(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->direction, t->z,
|
|
||||||
time(NULL), NULL);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MULTI_DOWN:
|
|
||||||
{
|
|
||||||
multi_event *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_multi_down timestamp=<%u>, t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
|
||||||
#endif
|
|
||||||
if (!t->d)
|
|
||||||
{
|
|
||||||
evas_event_feed_mouse_down(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->b, t->flags, time(NULL), NULL);
|
|
||||||
if (rect) evas_object_color_set(rect, 255, 255, 0, 255);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
evas_event_feed_multi_down(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->d, t->x, t->y, t->rad,
|
|
||||||
t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
|
|
||||||
t->flags, time(NULL), NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MULTI_UP:
|
|
||||||
{
|
|
||||||
multi_event *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_multi_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp,t->n_evas);
|
|
||||||
#endif
|
|
||||||
if (!t->d)
|
|
||||||
{
|
|
||||||
evas_event_feed_mouse_up(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->b, t->flags, time(NULL), NULL);
|
|
||||||
if (rect) evas_object_color_set(rect, 255, 0, 0, 255);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
evas_event_feed_multi_up(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->d, t->x, t->y, t->rad,
|
|
||||||
t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
|
|
||||||
t->flags, time(NULL), NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_MULTI_MOVE:
|
|
||||||
{
|
|
||||||
multi_move *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_multi_move timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
|
||||||
#endif
|
|
||||||
if (!t->d)
|
|
||||||
{
|
|
||||||
evas_event_feed_mouse_move(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->x, t->y, time(NULL), NULL);
|
|
||||||
if (rect)
|
|
||||||
{
|
|
||||||
evas_object_move(rect, t->x, t->y);
|
|
||||||
evas_object_color_set(rect, 255, 0, 0, 255);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
evas_event_feed_multi_move(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->d, t->x, t->y, t->rad,
|
|
||||||
t->radx, t->rady, t->pres, t->ang, t->fx, t->fy,
|
|
||||||
time(NULL), NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_KEY_DOWN:
|
|
||||||
{
|
|
||||||
key_down_key_up *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_key_down timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
|
||||||
#endif
|
|
||||||
evas_event_feed_key_down(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->keyname, t->key, t->string,
|
|
||||||
t->compose, time(NULL), NULL);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_KEY_UP:
|
|
||||||
{
|
|
||||||
key_down_key_up *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_key_up timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
|
||||||
#endif
|
|
||||||
evas_event_feed_key_up(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->keyname, t->key, t->string,
|
|
||||||
t->compose, time(NULL), NULL);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_KEY_DOWN_WITH_KEYCODE:
|
|
||||||
{
|
|
||||||
key_down_key_up_with_keycode *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_key_down_with_keycode timestamp=<%u> t->n_evas=<%d> t->keycode=<%u>\n", __func__, t->timestamp, t->n_evas, t->keycode);
|
|
||||||
#endif
|
|
||||||
evas_event_feed_key_down_with_keycode(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->keyname, t->key, t->string,
|
|
||||||
t->compose, time(NULL), NULL, t->keycode);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TSUITE_EVENT_KEY_UP_WITH_KEYCODE:
|
|
||||||
{
|
|
||||||
key_down_key_up_with_keycode *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s evas_event_feed_key_up_with_keycode timestamp=<%u> t->n_evas=<%d> t->keycode=<%u>\n", __func__, t->timestamp, t->n_evas, t->keycode);
|
|
||||||
#endif
|
|
||||||
evas_event_feed_key_up(eina_list_nth(evas_list, t->n_evas),
|
|
||||||
t->keyname, t->key, t->string,
|
|
||||||
t->compose, time(NULL), NULL);
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case TSUITE_EVENT_TAKE_SHOT:
|
|
||||||
{
|
|
||||||
take_screenshot *t = v->data;
|
|
||||||
evt_time = t->timestamp;
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s take shot timestamp=<%u> t->n_evas=<%d>\n", __func__, t->timestamp, t->n_evas);
|
|
||||||
#endif
|
|
||||||
if (rect) evas_object_color_set(rect, 0, 0, 255, 255);
|
|
||||||
_shot_do(NULL,
|
|
||||||
eina_list_nth(evas_list, t->n_evas)); /* Serial name based on test-name */
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default: /* All non-input events are not handeled */
|
|
||||||
evt_time = td->recent_event_time;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
double timer_time;
|
|
||||||
td->current_event = eina_list_next(td->current_event);
|
|
||||||
|
|
||||||
if (!td->current_event)
|
|
||||||
{ /* Finished reading all events */
|
|
||||||
ecore_main_loop_quit();
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
td->recent_event_time = evt_time;
|
|
||||||
|
|
||||||
unsigned int current_event_time = evt_time_get(evt_time, eina_list_data_get(td->current_event));
|
|
||||||
|
|
||||||
if (current_event_time < td->recent_event_time) /* Could happen with refeed event */
|
|
||||||
current_event_time = td->recent_event_time;
|
|
||||||
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf(" %s td->recent_event_time=<%u> current_event_time=<%u>\n", __func__, td->recent_event_time, current_event_time);
|
|
||||||
#endif
|
|
||||||
timer_time = (current_event_time - td->recent_event_time) / 1000.0;
|
|
||||||
|
|
||||||
if (!td->recent_event_time)
|
|
||||||
timer_time = 0.0;
|
|
||||||
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf(" %s timer_time=<%f>\n", __func__, timer_time);
|
|
||||||
#endif
|
|
||||||
ecore_timer_add(timer_time, tsuite_feed_event, td);
|
|
||||||
|
|
||||||
return ECORE_CALLBACK_CANCEL;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
ecore_main_loop_begin(void)
|
|
||||||
{
|
|
||||||
void (*_ecore_main_loop_begin)(void) =
|
|
||||||
dlsym(RTLD_NEXT, "ecore_main_loop_begin");
|
|
||||||
|
|
||||||
|
|
||||||
if (!_hook_setting->recording && _hook_setting->file_name)
|
|
||||||
{
|
|
||||||
double diff_time = 0; /* Time to wait before feeding the first event */
|
|
||||||
ts.td = calloc(1, sizeof(Timer_Data));
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("<%s> rec file is <%s>\n", __func__, _hook_setting->file_name);
|
|
||||||
#endif
|
|
||||||
vr_list = read_events(_hook_setting->file_name, ts.td);
|
|
||||||
if (ts.td->current_event)
|
|
||||||
{
|
|
||||||
/* Got first event in list, run test */
|
|
||||||
|
|
||||||
/* Calculate the time to wait before feeding the first event */
|
|
||||||
unsigned int current_event_time = evt_time_get(0, eina_list_data_get(ts.td->current_event));
|
|
||||||
if (current_event_time > vr_list->first_timestamp)
|
|
||||||
diff_time = (current_event_time - vr_list->first_timestamp) / 1000.0;
|
|
||||||
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf("%s first_time_stamp=<%u> current_event_time=<%u>\n", __func__, vr_list->first_timestamp, current_event_time);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (diff_time)
|
|
||||||
{
|
|
||||||
#ifdef DEBUG_TSUITE
|
|
||||||
printf(" Waiting <%f>\n", diff_time);
|
|
||||||
#endif
|
|
||||||
ecore_timer_add(diff_time, tsuite_feed_event, ts.td);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
tsuite_feed_event(ts.td);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return _ecore_main_loop_begin();
|
|
||||||
}
|
|
||||||
|
|
||||||
static Tsuite_Event_Type
|
static Tsuite_Event_Type
|
||||||
tsuite_event_type_get(Evas_Callback_Type t)
|
tsuite_event_type_get(Evas_Callback_Type t)
|
||||||
{
|
{
|
||||||
|
@ -1158,7 +616,7 @@ evas_event_feed_key_down(Evas *e, const char *keyname, const char *key,
|
||||||
{
|
{
|
||||||
if (_hook_setting)
|
if (_hook_setting)
|
||||||
{
|
{
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list)
|
||||||
write_events(_hook_setting->file_name, vr_list);
|
write_events(_hook_setting->file_name, vr_list);
|
||||||
#ifdef DEBUG_TSUITE
|
#ifdef DEBUG_TSUITE
|
||||||
printf("Save events: %s timestamp=<%u>\n", __func__, timestamp);
|
printf("Save events: %s timestamp=<%u>\n", __func__, timestamp);
|
||||||
|
@ -1167,7 +625,7 @@ evas_event_feed_key_down(Evas *e, const char *keyname, const char *key,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list)
|
||||||
{ /* Construct duplicate strings, free them when list if freed */
|
{ /* Construct duplicate strings, free them when list if freed */
|
||||||
key_down_key_up t;
|
key_down_key_up t;
|
||||||
t.timestamp = timestamp;
|
t.timestamp = timestamp;
|
||||||
|
@ -1216,7 +674,7 @@ evas_event_feed_key_up(Evas *e, const char *keyname, const char *key,
|
||||||
printf("Calling %s timestamp=<%u>\n", __func__, timestamp);
|
printf("Calling %s timestamp=<%u>\n", __func__, timestamp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list)
|
||||||
{ /* Construct duplicate strings, free them when list if freed */
|
{ /* Construct duplicate strings, free them when list if freed */
|
||||||
key_down_key_up t;
|
key_down_key_up t;
|
||||||
t.timestamp = timestamp;
|
t.timestamp = timestamp;
|
||||||
|
@ -1261,7 +719,7 @@ evas_event_feed_key_down_with_keycode(Evas *e, const char *keyname, const char *
|
||||||
{
|
{
|
||||||
if (_hook_setting)
|
if (_hook_setting)
|
||||||
{
|
{
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list)
|
||||||
write_events(_hook_setting->file_name, vr_list);
|
write_events(_hook_setting->file_name, vr_list);
|
||||||
#ifdef DEBUG_TSUITE
|
#ifdef DEBUG_TSUITE
|
||||||
printf("Save events: %s timestamp=<%u>\n", __func__, timestamp);
|
printf("Save events: %s timestamp=<%u>\n", __func__, timestamp);
|
||||||
|
@ -1270,7 +728,7 @@ evas_event_feed_key_down_with_keycode(Evas *e, const char *keyname, const char *
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list)
|
||||||
{ /* Construct duplicate strings, free them when list if freed */
|
{ /* Construct duplicate strings, free them when list if freed */
|
||||||
key_down_key_up_with_keycode t;
|
key_down_key_up_with_keycode t;
|
||||||
t.timestamp = timestamp;
|
t.timestamp = timestamp;
|
||||||
|
@ -1320,7 +778,7 @@ evas_event_feed_key_up_with_keycode(Evas *e, const char *keyname, const char *ke
|
||||||
printf("Calling %s timestamp=<%u>\n", __func__, timestamp);
|
printf("Calling %s timestamp=<%u>\n", __func__, timestamp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (vr_list && _hook_setting->recording)
|
if (vr_list)
|
||||||
{ /* Construct duplicate strings, free them when list if freed */
|
{ /* Construct duplicate strings, free them when list if freed */
|
||||||
key_down_key_up_with_keycode t;
|
key_down_key_up_with_keycode t;
|
||||||
t.timestamp = timestamp;
|
t.timestamp = timestamp;
|
||||||
|
|
Loading…
Reference in New Issue