tasn pushed a commit to branch master.

commit c99fdfb239c571a33166fc89a586254c5d5e5318
Author: Tom Hacohen <[email protected]>
Date:   Fri May 17 15:47:08 2013 +0100

    Added some verbose support (including cursor in simulation).
---
 src/bin/run_test.c         | 12 ++++++++----
 src/lib/tsuite_evas_hook.c | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 4 deletions(-)

diff --git a/src/bin/run_test.c b/src/bin/run_test.c
index 24301b9..6ff5ab2 100644
--- a/src/bin/run_test.c
+++ b/src/bin/run_test.c
@@ -15,7 +15,8 @@
 void
 run_test_simulation(const List_Entry *ent, char *buf)
 {
-   snprintf(buf, SCHEDULER_CMD_SIZE, "TSUITE_DEST_DIR='%s' 
TSUITE_FILE_NAME='%s/%s.rec' TSUITE_TEST_NAME='%s' LD_PRELOAD='%s' %s",
+   snprintf(buf, SCHEDULER_CMD_SIZE, "TSUITE_VERBOSE=%d TSUITE_DEST_DIR='%s' 
TSUITE_FILE_NAME='%s/%s.rec' TSUITE_TEST_NAME='%s' LD_PRELOAD='%s' %s",
+         exactness_config.verbose,
          exactness_config.dest_dir,
          exactness_config.base_dir, ent->name,
          ent->name, LIBEXACTNESS_PATH,
@@ -25,7 +26,8 @@ run_test_simulation(const List_Entry *ent, char *buf)
 void
 run_test_play(const List_Entry *ent, char *buf)
 {
-   snprintf(buf, SCHEDULER_CMD_SIZE, "ELM_ENGINE='buffer' 
TSUITE_DEST_DIR='%s/" CURRENT_SUBDIR "' TSUITE_FILE_NAME='%s/%s.rec' 
TSUITE_TEST_NAME='%s' LD_PRELOAD='%s' %s",
+   snprintf(buf, SCHEDULER_CMD_SIZE, "TSUITE_VERBOSE=%d ELM_ENGINE='buffer' 
TSUITE_DEST_DIR='%s/" CURRENT_SUBDIR "' TSUITE_FILE_NAME='%s/%s.rec' 
TSUITE_TEST_NAME='%s' LD_PRELOAD='%s' %s",
+         exactness_config.verbose,
          exactness_config.dest_dir,
          exactness_config.base_dir, ent->name,
          ent->name, LIBEXACTNESS_PATH,
@@ -37,7 +39,8 @@ run_test_play(const List_Entry *ent, char *buf)
 void
 run_test_record(const List_Entry *ent, char *buf)
 {
-   snprintf(buf, SCHEDULER_CMD_SIZE, "TSUITE_RECORDING='rec' 
TSUITE_DEST_DIR='%s' TSUITE_FILE_NAME='%s/%s.rec' TSUITE_TEST_NAME='%s' 
LD_PRELOAD='%s' %s",
+   snprintf(buf, SCHEDULER_CMD_SIZE, "TSUITE_VERBOSE=%d TSUITE_RECORDING='rec' 
TSUITE_DEST_DIR='%s' TSUITE_FILE_NAME='%s/%s.rec' TSUITE_TEST_NAME='%s' 
LD_PRELOAD='%s' %s",
+         exactness_config.verbose,
          exactness_config.dest_dir,
          exactness_config.base_dir, ent->name,
          ent->name, LIBEXACTNESS_PATH,
@@ -47,7 +50,8 @@ run_test_record(const List_Entry *ent, char *buf)
 void
 run_test_init(const List_Entry *ent, char *buf)
 {
-   snprintf(buf, SCHEDULER_CMD_SIZE, "ELM_ENGINE='buffer' 
TSUITE_DEST_DIR='%s/" ORIG_SUBDIR "' TSUITE_FILE_NAME='%s/%s.rec' 
TSUITE_TEST_NAME='%s' LD_PRELOAD='%s' %s",
+   snprintf(buf, SCHEDULER_CMD_SIZE, "TSUITE_VERBOSE=%d ELM_ENGINE='buffer' 
TSUITE_DEST_DIR='%s/" ORIG_SUBDIR "' TSUITE_FILE_NAME='%s/%s.rec' 
TSUITE_TEST_NAME='%s' LD_PRELOAD='%s' %s",
+         exactness_config.verbose,
          exactness_config.dest_dir,
          exactness_config.base_dir, ent->name,
          ent->name, LIBEXACTNESS_PATH,
diff --git a/src/lib/tsuite_evas_hook.c b/src/lib/tsuite_evas_hook.c
index bb9ed13..3af3b93 100644
--- a/src/lib/tsuite_evas_hook.c
+++ b/src/lib/tsuite_evas_hook.c
@@ -27,6 +27,7 @@ struct _evas_hook_setting
    char *dest_dir;
    char *test_name;
    char *file_name;
+   Eina_Bool verbose;
 };
 typedef struct _evas_hook_setting evas_hook_setting;
 
@@ -36,6 +37,18 @@ static evas_hook_setting *_hook_setting = NULL;
 static Tsuite_Data ts;
 static Eina_List *evas_list = NULL; /* List of Evas pointers */
 
+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
  *
@@ -210,11 +223,15 @@ ecore_init(void)
 
    if (!_hook_setting)
      {
+        const char *tmp;
         _hook_setting = calloc(1, sizeof(evas_hook_setting));
         _hook_setting->recording = getenv("TSUITE_RECORDING");
         _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);
@@ -291,6 +308,19 @@ tsuite_feed_event(void *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))
@@ -299,6 +329,7 @@ tsuite_feed_event(void *data)
            {
               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
@@ -310,6 +341,7 @@ tsuite_feed_event(void *data)
            {
               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
@@ -321,6 +353,7 @@ tsuite_feed_event(void *data)
            {
               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
@@ -334,6 +367,7 @@ tsuite_feed_event(void *data)
            {
               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
@@ -352,12 +386,18 @@ tsuite_feed_event(void *data)
 #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);
+                }
               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
@@ -439,6 +479,7 @@ tsuite_feed_event(void *data)
            {
               take_screenshot *t = v->data;
               evt_time = t->timestamp;
+              _tsuite_verbosef("Shot taken.\n");
 #ifdef DEBUG_TSUITE
               printf("%s take shot  timestamp=<%u> t->n_evas=<%d>\n", 
__func__, t->timestamp, t->n_evas);
 #endif

-- 

------------------------------------------------------------------------------
AlienVault Unified Security Management (USM) platform delivers complete
security visibility with the essential security capabilities. Easily and
efficiently configure, manage, and operate all of your security controls
from a single console and one unified framework. Download a free trial.
http://p.sf.net/sfu/alienvault_d2d

Reply via email to