summaryrefslogtreecommitdiff
path: root/src/bin/exactness
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2020-03-19 17:39:03 +0100
committerStefan Schmidt <s.schmidt@samsung.com>2020-03-24 12:24:04 +0100
commit9da0235d74637b3ee0049eddd1a3ef2c44a3849e (patch)
tree8c5a95a29353fb07abc18409d94c6ee0156d9738 /src/bin/exactness
parent8c91255595e7b05954d2ae905c36e9a4b5ac36b1 (diff)
exactness: remove exactness library and move code into binary folder
We do not want to have EAPI from exactness exposed at this point without any real user. I know of no application using the exactness library. If we come to that point we can move things back into a lib, but for now having the code shared between the various executables is all we need. Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com> Differential Revision: https://phab.enlightenment.org/D11545
Diffstat (limited to 'src/bin/exactness')
-rw-r--r--src/bin/exactness/common.c405
-rw-r--r--src/bin/exactness/common.h181
-rw-r--r--src/bin/exactness/exactness.c1
-rw-r--r--src/bin/exactness/injector.c1
-rw-r--r--src/bin/exactness/inspect.c1
-rw-r--r--src/bin/exactness/meson.build10
-rw-r--r--src/bin/exactness/player.c2
-rw-r--r--src/bin/exactness/recorder.c2
8 files changed, 589 insertions, 14 deletions
diff --git a/src/bin/exactness/common.c b/src/bin/exactness/common.c
index 4d770eb584..5646f4c3bb 100644
--- a/src/bin/exactness/common.c
+++ b/src/bin/exactness/common.c
@@ -1,3 +1,7 @@
1#ifdef HAVE_CONFIG_H
2# include <config.h>
3#endif
4
1#include "common.h" 5#include "common.h"
2 6
3static int _verbose = 0; 7static int _verbose = 0;
@@ -98,3 +102,404 @@ ex_prg_full_path_guess(const char *prg)
98 free(env_path); 102 free(env_path);
99 return ret; 103 return ret;
100} 104}
105
106typedef struct _Dummy
107{
108} _Dummy;
109
110static Eet_Data_Descriptor *
111_mouse_wheel_desc_make(void)
112{
113 Eet_Data_Descriptor_Class eddc;
114 Eet_Data_Descriptor *_d;
115 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Action_Mouse_Wheel);
116 _d = eet_data_descriptor_stream_new(&eddc);
117
118 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Mouse_Wheel, "direction", direction, EET_T_INT);
119 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Mouse_Wheel, "z", z, EET_T_INT);
120
121 return _d;
122}
123
124static Eet_Data_Descriptor *
125_key_down_up_desc_make(void)
126{
127 Eet_Data_Descriptor_Class eddc;
128 Eet_Data_Descriptor *_d;
129 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Action_Key_Down_Up);
130 _d = eet_data_descriptor_stream_new(&eddc);
131
132 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Key_Down_Up, "keyname", keyname, EET_T_STRING);
133 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Key_Down_Up, "key", key, EET_T_STRING);
134 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Key_Down_Up, "string", string, EET_T_STRING);
135 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Key_Down_Up, "compose", compose, EET_T_STRING);
136 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Key_Down_Up, "keycode", keycode, EET_T_INT);
137
138 return _d;
139}
140
141static Eet_Data_Descriptor *
142_multi_event_desc_make(void)
143{
144 Eet_Data_Descriptor_Class eddc;
145 Eet_Data_Descriptor *_d;
146 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Action_Multi_Event);
147 _d = eet_data_descriptor_stream_new(&eddc);
148
149 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "d", d, EET_T_UINT);
150 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "b", b, EET_T_UINT);
151 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "x", x, EET_T_UINT);
152 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "y", y, EET_T_UINT);
153 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "rad", rad, EET_T_DOUBLE);
154 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "radx", radx, EET_T_DOUBLE);
155 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "rady", rady, EET_T_DOUBLE);
156 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "pres", pres, EET_T_DOUBLE);
157 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "ang", ang, EET_T_DOUBLE);
158 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "fx", fx, EET_T_DOUBLE);
159 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "fy", fy, EET_T_DOUBLE);
160 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Event, "flags", flags, EET_T_INT);
161
162 return _d;
163}
164
165static Eet_Data_Descriptor *
166_multi_move_desc_make(void)
167{
168 Eet_Data_Descriptor_Class eddc;
169 Eet_Data_Descriptor *_d;
170 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Action_Multi_Move);
171 _d = eet_data_descriptor_stream_new(&eddc);
172
173 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "d", d, EET_T_UINT);
174 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "x", x, EET_T_UINT);
175 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "y", y, EET_T_UINT);
176 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "rad", rad, EET_T_DOUBLE);
177 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "radx", radx, EET_T_DOUBLE);
178 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "rady", rady, EET_T_DOUBLE);
179 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "pres", pres, EET_T_DOUBLE);
180 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "ang", ang, EET_T_DOUBLE);
181 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "fx", fx, EET_T_DOUBLE);
182 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Multi_Move, "fy", fy, EET_T_DOUBLE);
183
184 return _d;
185}
186
187static Eet_Data_Descriptor *
188_efl_event_desc_make(void)
189{
190 Eet_Data_Descriptor_Class eddc;
191 Eet_Data_Descriptor *_d;
192 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Action_Efl_Event);
193 _d = eet_data_descriptor_stream_new(&eddc);
194
195 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Efl_Event, "wdg_name", wdg_name, EET_T_STRING);
196 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Efl_Event, "event_name", event_name, EET_T_STRING);
197
198 return _d;
199}
200
201static Eet_Data_Descriptor *
202_click_on_desc_make(void)
203{
204 Eet_Data_Descriptor_Class eddc;
205 Eet_Data_Descriptor *_d;
206 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Action_Click_On);
207 _d = eet_data_descriptor_stream_new(&eddc);
208
209 EET_DATA_DESCRIPTOR_ADD_BASIC(_d, Exactness_Action_Click_On, "wdg_name", wdg_name, EET_T_STRING);
210
211 return _d;
212}
213
214static Eet_Data_Descriptor *
215_dummy_desc_make(void)
216{
217 Eet_Data_Descriptor_Class eddc;
218 Eet_Data_Descriptor *_d;
219 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, _Dummy);
220 _d = eet_data_descriptor_stream_new(&eddc);
221
222 return _d;
223}
224
225/* !!! SAME ORDER AS Exactness_Action_Type */
226static const char *_mapping[] =
227{
228 "",
229 "exactness_action_mouse_in",
230 "exactness_action_mouse_out",
231 "exactness_action_mouse_wheel",
232 "exactness_action_multi_down",
233 "exactness_action_multi_up",
234 "exactness_action_multi_move",
235 "exactness_action_key_down",
236 "exactness_action_key_up",
237 "exactness_action_take_shot",
238 "exactness_action_efl_event",
239 "exactness_action_click_on",
240 "exactness_action_stabilize"
241};
242
243const char *
244_exactness_action_type_to_string_get(Exactness_Action_Type type)
245{
246 if (type <= EXACTNESS_ACTION_LAST) return _mapping[type];
247 return NULL;
248}
249
250static const char *
251_variant_type_get(const void *data, Eina_Bool *unknow)
252{
253 const Exactness_Action *act = data;
254
255 if (unknow) *unknow = EINA_FALSE;
256 if (act->type <= EXACTNESS_ACTION_LAST) return _mapping[act->type];
257
258 return NULL;
259}
260
261static Eina_Bool
262_variant_type_set(const char *type,
263 void *data,
264 Eina_Bool unknow EINA_UNUSED)
265{
266 int i;
267 Exactness_Action *act = data;
268 for (i = 0; i <= EXACTNESS_ACTION_LAST; i++)
269 {
270 if (!strcmp(_mapping[i], type)) act->type = i;
271 }
272 return EINA_TRUE;
273}
274
275static Eet_Data_Descriptor *
276_unit_desc_make(void)
277{
278 Eet_Data_Descriptor_Class eddc;
279 static Eet_Data_Descriptor *unit_d = NULL;
280 static Eet_Data_Descriptor *action_d = NULL, *action_variant_d = NULL;
281 static Eet_Data_Descriptor *objs_d = NULL;
282 static Eet_Data_Descriptor *obj_d = NULL;
283 if (!obj_d)
284 {
285 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Object);
286 obj_d = eet_data_descriptor_stream_new(&eddc);
287 EET_DATA_DESCRIPTOR_ADD_BASIC(obj_d, Exactness_Object, "kl_name", kl_name, EET_T_STRING);
288 EET_DATA_DESCRIPTOR_ADD_BASIC(obj_d, Exactness_Object, "id", id, EET_T_ULONG_LONG);
289 EET_DATA_DESCRIPTOR_ADD_BASIC(obj_d, Exactness_Object, "parent_id", parent_id, EET_T_ULONG_LONG);
290 /* Evas stuff */
291 EET_DATA_DESCRIPTOR_ADD_BASIC(obj_d, Exactness_Object, "x", x, EET_T_INT);
292 EET_DATA_DESCRIPTOR_ADD_BASIC(obj_d, Exactness_Object, "y", y, EET_T_INT);
293 EET_DATA_DESCRIPTOR_ADD_BASIC(obj_d, Exactness_Object, "w", w, EET_T_INT);
294 EET_DATA_DESCRIPTOR_ADD_BASIC(obj_d, Exactness_Object, "h", h, EET_T_INT);
295
296 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Objects);
297 objs_d = eet_data_descriptor_stream_new(&eddc);
298 EET_DATA_DESCRIPTOR_ADD_LIST(objs_d, Exactness_Objects, "objs", objs, obj_d);
299 }
300 if (!unit_d)
301 {
302 Eet_Data_Descriptor *code_d = NULL;
303 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Source_Code);
304 code_d = eet_data_descriptor_stream_new(&eddc);
305 EET_DATA_DESCRIPTOR_ADD_BASIC(code_d, Exactness_Source_Code, "language", language, EET_T_STRING);
306 EET_DATA_DESCRIPTOR_ADD_BASIC(code_d, Exactness_Source_Code, "content", content, EET_T_STRING);
307 EET_DATA_DESCRIPTOR_ADD_BASIC(code_d, Exactness_Source_Code, "command", command, EET_T_STRING);
308
309 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Action);
310 action_d = eet_data_descriptor_stream_new(&eddc);
311
312 eddc.version = EET_DATA_DESCRIPTOR_CLASS_VERSION;
313 eddc.func.type_get = _variant_type_get;
314 eddc.func.type_set = _variant_type_set;
315 action_variant_d = eet_data_descriptor_stream_new(&eddc);
316
317 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
318 _mapping[EXACTNESS_ACTION_MOUSE_IN], _dummy_desc_make());
319 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
320 _mapping[EXACTNESS_ACTION_MOUSE_OUT], _dummy_desc_make());
321 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
322 _mapping[EXACTNESS_ACTION_MOUSE_WHEEL], _mouse_wheel_desc_make());
323 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
324 _mapping[EXACTNESS_ACTION_MULTI_DOWN], _multi_event_desc_make());
325 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
326 _mapping[EXACTNESS_ACTION_MULTI_UP], _multi_event_desc_make());
327 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
328 _mapping[EXACTNESS_ACTION_MULTI_MOVE], _multi_move_desc_make());
329 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
330 _mapping[EXACTNESS_ACTION_KEY_DOWN], _key_down_up_desc_make());
331 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
332 _mapping[EXACTNESS_ACTION_KEY_UP], _key_down_up_desc_make());
333 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
334 _mapping[EXACTNESS_ACTION_TAKE_SHOT], _dummy_desc_make());
335 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
336 _mapping[EXACTNESS_ACTION_EFL_EVENT], _efl_event_desc_make());
337 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
338 _mapping[EXACTNESS_ACTION_CLICK_ON], _click_on_desc_make());
339 EET_DATA_DESCRIPTOR_ADD_MAPPING(action_variant_d,
340 _mapping[EXACTNESS_ACTION_STABILIZE], _dummy_desc_make());
341
342 EET_DATA_DESCRIPTOR_ADD_BASIC(action_d, Exactness_Action, "n_evas", n_evas, EET_T_UINT);
343 EET_DATA_DESCRIPTOR_ADD_BASIC(action_d, Exactness_Action, "delay_ms", delay_ms, EET_T_UINT);
344 EET_DATA_DESCRIPTOR_ADD_VARIANT(action_d, Exactness_Action, "data", data, type, action_variant_d);
345
346 /* Exactness_Unit */
347 EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Exactness_Unit);
348 unit_d = eet_data_descriptor_stream_new(&eddc);
349 EET_DATA_DESCRIPTOR_ADD_LIST(unit_d, Exactness_Unit, "actions", actions, action_d);
350 EET_DATA_DESCRIPTOR_ADD_LIST(unit_d, Exactness_Unit, "objs", objs, objs_d);
351 EET_DATA_DESCRIPTOR_ADD_LIST(unit_d, Exactness_Unit, "codes", codes, code_d);
352 EET_DATA_DESCRIPTOR_ADD_BASIC(unit_d, Exactness_Unit, "fonts_path", fonts_path, EET_T_STRING);
353 EET_DATA_DESCRIPTOR_ADD_BASIC(unit_d, Exactness_Unit, "nb_shots", nb_shots, EET_T_UINT);
354 }
355
356 return unit_d;
357}
358/* END Event struct descriptors */
359
360Exactness_Unit *
361exactness_unit_file_read(const char *filename)
362{
363 int i;
364 Eina_List *itr, *itr2;
365 Exactness_Objects *e_objs;
366 Exactness_Object *e_obj, *e_parent;
367 Exactness_Unit *unit = NULL;
368 Eet_File *file;
369 eet_init();
370 file = eet_open(filename, EET_FILE_MODE_READ);
371 if (!file)
372 {
373 fprintf(stderr, "Impossible to extract EET from %s\n", filename);
374 return NULL;
375 }
376 unit = eet_data_read(file, _unit_desc_make(), "cache");
377 for (i = 0; i < unit->nb_shots; i++)
378 {
379 char entry[32];
380 Exactness_Image *ex_img = malloc(sizeof(*ex_img));
381 sprintf(entry, "images/%d", i + 1);
382 ex_img->pixels = eet_data_image_read(file, entry,
383 &ex_img->w, &ex_img->h, NULL,
384 NULL, NULL, NULL);
385 unit->imgs = eina_list_append(unit->imgs, ex_img);
386 }
387 EINA_LIST_FOREACH(unit->objs, itr, e_objs)
388 {
389 Eina_Hash *hash = eina_hash_pointer_new(NULL);
390 EINA_LIST_FOREACH(e_objs->objs, itr2, e_obj)
391 {
392 eina_hash_set(hash, &(e_obj->id), e_obj);
393 }
394 EINA_LIST_FOREACH(e_objs->objs, itr2, e_obj)
395 {
396 if (!e_obj->parent_id)
397 e_objs->main_objs = eina_list_append(e_objs->main_objs, e_obj);
398 else
399 {
400 e_parent = eina_hash_find(hash, &(e_obj->parent_id));
401 if (e_parent) e_parent->children = eina_list_append(e_parent->children, e_obj);
402 }
403 }
404 eina_hash_free(hash);
405 }
406 eet_close(file);
407 eet_shutdown();
408 return unit;
409}
410
411Eina_Bool
412exactness_unit_file_write(Exactness_Unit *unit, const char *filename)
413{
414 Eina_List *itr;
415 Exactness_Image *ex_img;
416 Eet_File *file;
417 int i = 1;
418 eet_init();
419 file = eet_open(filename, EET_FILE_MODE_WRITE);
420 eet_data_write(file, _unit_desc_make(), "cache", unit, EINA_TRUE);
421 EINA_LIST_FOREACH(unit->imgs, itr, ex_img)
422 {
423 char entry[32];
424 sprintf(entry, "images/%d", i++);
425 eet_data_image_write(file, entry,
426 ex_img->pixels, ex_img->w, ex_img->h, 0xFF,
427 0, 100, EET_IMAGE_LOSSLESS);
428 }
429 eet_close(file);
430 eet_shutdown();
431 return EINA_TRUE;
432}
433
434Eina_Bool
435exactness_image_compare(Exactness_Image *img1, Exactness_Image *img2, Exactness_Image **imgO)
436{
437 unsigned int w, h;
438 int *pxs1, *pxs2, *pxsO = NULL;
439 unsigned int w1 = img1 ? img1->w : 0, h1 = img1 ? img1->h : 0;
440 unsigned int w2 = img2 ? img2->w : 0, h2 = img2 ? img2->h : 0;
441 unsigned int wO = MAX(w1, w2);
442 unsigned int hO = MAX(h1, h2);
443 Eina_Bool ret = EINA_FALSE;
444 if (imgO) *imgO = NULL;
445 if (!wO || !hO) return EINA_FALSE;
446
447 pxs1 = img1 ? img1->pixels : NULL;
448 pxs2 = img2 ? img2->pixels : NULL;
449 if (imgO) pxsO = malloc(wO * hO * 4);
450
451 for (w = 0; w < wO; w++)
452 {
453 for (h = 0; h < hO; h++)
454 {
455 Eina_Bool valid1 = img1 ? w < w1 && h < h1 : EINA_FALSE;
456 Eina_Bool valid2 = img2 ? w < w2 && h < h2 : EINA_FALSE;
457 int px1 = valid1 ? pxs1[h * w1 + w] : 0;
458 int px2 = valid2 ? pxs2[h * w2 + w] : 0;
459 int r1 = (px1 & 0x00FF0000) >> 16;
460 int r2 = (px2 & 0x00FF0000) >> 16;
461 int g1 = (px1 & 0x0000FF00) >> 8;
462 int g2 = (px2 & 0x0000FF00) >> 8;
463 int b1 = (px1 & 0x000000FF);
464 int b2 = (px2 & 0x000000FF);
465 int new_r, new_g, new_b;
466 if (valid1 || valid2)
467 {
468 if (px1 != px2)
469 {
470 new_r = 0xFF;
471 new_g = ((g1 + g2) >> 1) >> 2;
472 new_b = ((b1 + b2) >> 1) >> 2;
473 ret = EINA_TRUE;
474 }
475 else
476 {
477 new_r = (((r1 + r2) >> 1) >> 2) + 0xC0;
478 new_g = (((g1 + g2) >> 1) >> 2) + 0xC0;
479 new_b = (((b1 + b2) >> 1) >> 2) + 0xC0;
480 }
481 }
482 else
483 {
484 new_r = new_g = new_b = 0x0;
485 }
486 if (pxsO) pxsO[h * wO + w] = 0xFF000000 | new_r << 16 | new_g << 8 | new_b;
487 }
488 }
489 if (imgO)
490 {
491 Exactness_Image *imgR = calloc(1, sizeof(Exactness_Image));
492 *imgO = imgR;
493 imgR->w = wO;
494 imgR->h = hO;
495 imgR->pixels = pxsO;
496 }
497 return ret;
498}
499
500void exactness_image_free(Exactness_Image *img)
501{
502 if (!img) return;
503 free(img->pixels);
504 free(img);
505}
diff --git a/src/bin/exactness/common.h b/src/bin/exactness/common.h
index b3bb2da8c1..b002a404c0 100644
--- a/src/bin/exactness/common.h
+++ b/src/bin/exactness/common.h
@@ -2,9 +2,9 @@
2# include <config.h> 2# include <config.h>
3#endif 3#endif
4 4
5#include <Eet.h>
6#include <Evas.h>
5#include <Elementary.h> 7#include <Elementary.h>
6#include <Exactness.h>
7#include <exactness_private.h>
8 8
9typedef struct 9typedef struct
10{ 10{
@@ -97,7 +97,184 @@ foo(Eina_Debug_Session *session, int srcid, void *buffer, int size) \
97 _buf += __len; \ 97 _buf += __len; \
98} 98}
99 99
100#define SHOT_DELIMITER '+'
101
102/**
103 * The type values for an Exactness action.
104 */
105typedef enum
106{
107 EXACTNESS_ACTION_UNKNOWN = 0,
108 EXACTNESS_ACTION_MOUSE_IN,
109 EXACTNESS_ACTION_MOUSE_OUT,
110 EXACTNESS_ACTION_MOUSE_WHEEL,
111 EXACTNESS_ACTION_MULTI_DOWN,
112 EXACTNESS_ACTION_MULTI_UP,
113 EXACTNESS_ACTION_MULTI_MOVE,
114 EXACTNESS_ACTION_KEY_DOWN,
115 EXACTNESS_ACTION_KEY_UP,
116 EXACTNESS_ACTION_TAKE_SHOT,
117 EXACTNESS_ACTION_EFL_EVENT,
118 EXACTNESS_ACTION_CLICK_ON,
119 EXACTNESS_ACTION_STABILIZE,
120 EXACTNESS_ACTION_LAST = EXACTNESS_ACTION_STABILIZE
121 /* Add any supported actions here and update _LAST */
122} Exactness_Action_Type;
123
124/**
125 * The type for the Exactness Mouse Wheel action.
126 */
127typedef struct
128{
129 int direction;
130 int z;
131} Exactness_Action_Mouse_Wheel;
132
133/**
134 * The type for the Exactness Key Down Up action.
135 */
136typedef struct
137{
138 const char *keyname;
139 const char *key;
140 const char *string;
141 const char *compose;
142 unsigned int keycode;
143} Exactness_Action_Key_Down_Up;
144
145/**
146 * The type for the Exactness Multi Event action.
147 */
148typedef struct
149{
150 int d;
151 int b; /* In case of simple mouse down/up, corresponds to the button */
152 int x;
153 int y;
154 double rad;
155 double radx;
156 double rady;
157 double pres;
158 double ang;
159 double fx;
160 double fy;
161 Evas_Button_Flags flags;
162} Exactness_Action_Multi_Event;
163
164/**
165 * The type for the Exactness Multi Move action.
166 */
167typedef struct
168{
169 int d;
170 int x;
171 int y;
172 double rad;
173 double radx;
174 double rady;
175 double pres;
176 double ang;
177 double fx;
178 double fy;
179} Exactness_Action_Multi_Move;
180
181/**
182 * The type for the Exactness EFL Event action.
183 */
184typedef struct
185{
186 char *wdg_name; /**< Name of the widget */
187 char *event_name; /**< Name of the event */
188} Exactness_Action_Efl_Event;
189
190/**
191 * The type for the Exactness Click on (widget) action.
192 */
193typedef struct
194{
195 char *wdg_name; /**< Name of the widget */
196} Exactness_Action_Click_On;
197
198/**
199 * The type for the Exactness action.
200 */
201typedef struct
202{
203 Exactness_Action_Type type; /**< The action type */
204 unsigned int n_evas; /**< The evas number on which the action has to be applied */
205 unsigned int delay_ms; /**< The delay (in ms) to wait for this action */
206 void *data; /**< The specific action data */
207} Exactness_Action;
208
209/**
210 * The type for the Exactness object.
211 */
212typedef struct
213{
214 long long id; /**< The Eo pointer */
215 long long parent_id; /**< The Eo parent pointer */
216 const char *kl_name; /**< The class name */
217
218 Eina_List *children; /* NOT EET */
219
220 /* Evas stuff */
221 int x; /**< The X coordinate */
222 int y; /**< The Y coordinate */
223 int w; /**< The object width */
224 int h; /**< The object height */
225} Exactness_Object;
226
227/**
228 * The type for the Exactness objects list.
229 */
230typedef struct
231{
232 Eina_List *objs; /**< List of all the objects */
233 /* main_objs not in EET */
234 Eina_List *main_objs; /**< List of the main objects */
235} Exactness_Objects;
236
237/**
238 * The type for the Exactness Image.
239 */
240typedef struct
241{
242 unsigned int w; /**< Width of the image */
243 unsigned int h; /**< Height of the image */
244 void *pixels; /**< Pixels of the image */
245} Exactness_Image;
246
247/**
248 * Description of the source code used to generate the tested application.
249 */
250typedef struct
251{
252 char *language; /**< String describing the language of the content e.g "C"...*/
253 char *content; /**< Content used as source */
254 char *command; /**< Command needed to generate the application from the content */
255} Exactness_Source_Code;
256
257/**
258 * An Exactness test unit, including the list of tested actions and produced images.
259 */
260typedef struct
261{
262 Eina_List *actions; /**< List of Exactness_Action */
263 /* imgs not in EET */
264 Eina_List *imgs; /**< List of Exactness_Image */
265 Eina_List *objs; /**< List of Exactness_Objects */
266 Eina_List *codes; /**< List of Exactness_Source_Code */
267 const char *fonts_path; /**< Path to the fonts to use, relative to the fonts dir given in parameter to the player/recorder */
268 int nb_shots; /**< The number of shots present in the unit */
269} Exactness_Unit;
270
100Evas *(*_evas_new)(void); 271Evas *(*_evas_new)(void);
272const char *_exactness_action_type_to_string_get(Exactness_Action_Type type);
273
274Eina_Bool exactness_image_compare(Exactness_Image *img1, Exactness_Image *img2, Exactness_Image **diff_img);
275Exactness_Unit *exactness_unit_file_read(const char *filename);
276Eina_Bool exactness_unit_file_write(Exactness_Unit *unit, const char *filename);
277void exactness_image_free(Exactness_Image *img);
101 278
102void ex_printf(int verbose, const char *fmt, ...); 279void ex_printf(int verbose, const char *fmt, ...);
103int ex_prg_invoke(const char *full_path, int argc, char **argv, Eina_Bool player); 280int ex_prg_invoke(const char *full_path, int argc, char **argv, Eina_Bool player);
diff --git a/src/bin/exactness/exactness.c b/src/bin/exactness/exactness.c
index ed999658c9..9fdd0066f5 100644
--- a/src/bin/exactness/exactness.c
+++ b/src/bin/exactness/exactness.c
@@ -7,7 +7,6 @@
7#include <Ecore_Evas.h> 7#include <Ecore_Evas.h>
8#include <Ecore_File.h> 8#include <Ecore_File.h>
9 9
10#include "exactness_private.h"
11#include "common.h" 10#include "common.h"
12 11
13#ifdef _WIN32 12#ifdef _WIN32
diff --git a/src/bin/exactness/injector.c b/src/bin/exactness/injector.c
index 7530fd8806..c10c58b6b4 100644
--- a/src/bin/exactness/injector.c
+++ b/src/bin/exactness/injector.c
@@ -13,7 +13,6 @@
13#include <Ecore_Getopt.h> 13#include <Ecore_Getopt.h>
14#include <Elementary.h> 14#include <Elementary.h>
15 15
16#include <Exactness.h>
17#include "common.h" 16#include "common.h"
18 17
19static Eina_Stringshare *_src_filename = NULL; 18static Eina_Stringshare *_src_filename = NULL;
diff --git a/src/bin/exactness/inspect.c b/src/bin/exactness/inspect.c
index eeb108b95b..68da3548a3 100644
--- a/src/bin/exactness/inspect.c
+++ b/src/bin/exactness/inspect.c
@@ -6,7 +6,6 @@
6#include <Ecore_Getopt.h> 6#include <Ecore_Getopt.h>
7#include <Ecore_Evas.h> 7#include <Ecore_Evas.h>
8#include <Elementary.h> 8#include <Elementary.h>
9#include <Exactness.h>
10#include <Efl_Ui.h> 9#include <Efl_Ui.h>
11 10
12#include "common.h" 11#include "common.h"
diff --git a/src/bin/exactness/meson.build b/src/bin/exactness/meson.build
index f835cd40ea..4dbfc73d1f 100644
--- a/src/bin/exactness/meson.build
+++ b/src/bin/exactness/meson.build
@@ -1,20 +1,20 @@
1exactness_bin = executable('exactness', 1exactness_bin = executable('exactness',
2 [ 'exactness.c', 'common.c', 'common.h' ], 2 [ 'exactness.c', 'common.c', 'common.h' ],
3 dependencies: [ ecore, ecore_evas, ecore_file, elementary, exactness ], 3 dependencies: [ ecore, ecore_evas, ecore_file, elementary],
4 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"', 4 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
5 install: true, 5 install: true,
6 ) 6 )
7 7
8exactness_inject_bin = executable('exactness_inject', 8exactness_inject_bin = executable('exactness_inject',
9 [ 'injector.c', 'common.c', 'common.h' ], 9 [ 'injector.c', 'common.c', 'common.h' ],
10 dependencies: [ elementary, exactness ], 10 dependencies: [ elementary ],
11 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"', 11 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
12 install: true, 12 install: true,
13 ) 13 )
14 14
15exactness_inspect_bin = executable('exactness_inspect', 15exactness_inspect_bin = executable('exactness_inspect',
16 [ 'inspect.c', 'common.c', 'common.h' ], 16 [ 'inspect.c', 'common.c', 'common.h' ],
17 dependencies: [ elementary, exactness ], 17 dependencies: [ elementary ],
18 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"', 18 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
19 install: true, 19 install: true,
20 ) 20 )
@@ -32,14 +32,14 @@ edjs = custom_target('player_entry',
32 32
33exactness_play_bin = executable('exactness_play', 33exactness_play_bin = executable('exactness_play',
34 [ 'player.c', 'common.c', 'common.h', edjs ], 34 [ 'player.c', 'common.c', 'common.h', edjs ],
35 dependencies: [ elementary, exactness ], 35 dependencies: [ elementary ],
36 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"', 36 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
37 install: true, 37 install: true,
38 ) 38 )
39 39
40exactness_record_bin = executable('exactness_record', 40exactness_record_bin = executable('exactness_record',
41 [ 'recorder.c', 'common.c', 'common.h' ], 41 [ 'recorder.c', 'common.c', 'common.h' ],
42 dependencies: [ elementary, exactness ], 42 dependencies: [ elementary ],
43 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"', 43 c_args: '-DDATA_DIR="'+join_paths(dir_data, 'exactness')+'"',
44 install: true, 44 install: true,
45 ) 45 )
diff --git a/src/bin/exactness/player.c b/src/bin/exactness/player.c
index cca1d37a0e..54514ae0be 100644
--- a/src/bin/exactness/player.c
+++ b/src/bin/exactness/player.c
@@ -27,9 +27,7 @@
27#include <Ecore_File.h> 27#include <Ecore_File.h>
28#include <Ecore_Con.h> 28#include <Ecore_Con.h>
29#include <Elementary.h> 29#include <Elementary.h>
30#include <Exactness.h>
31 30
32#include "exactness_private.h"
33#include "common.h" 31#include "common.h"
34 32
35#define CMD_LINE_MAX 256 33#define CMD_LINE_MAX 256
diff --git a/src/bin/exactness/recorder.c b/src/bin/exactness/recorder.c
index 57c0b208c0..3ecaff7695 100644
--- a/src/bin/exactness/recorder.c
+++ b/src/bin/exactness/recorder.c
@@ -20,9 +20,7 @@
20#include <Ecore_Getopt.h> 20#include <Ecore_Getopt.h>
21#include <Ecore_Con.h> 21#include <Ecore_Con.h>
22#include <Elementary.h> 22#include <Elementary.h>
23#include <Exactness.h>
24 23
25#include <exactness_private.h>
26#include "common.h" 24#include "common.h"
27 25
28#define STABILIZE_KEY_STR "F1" 26#define STABILIZE_KEY_STR "F1"