Page MenuHomePhabricator

tests/elm: add basic timestamping for event helpers
Needs ReviewPublic

Authored by zmike on Mon, Jan 6, 11:29 AM.



this enables various internal components which use timestamps to have timestamps
that can be used

Depends on D11027

Diff Detail

rEFL core/efl
Lint OK
No Unit Test Coverage
Build Status
Buildable 15447
zmike created this revision.Mon, Jan 6, 11:29 AM
zmike requested review of this revision.Mon, Jan 6, 11:29 AM
zmike updated this revision to Diff 28128.Mon, Jan 13, 12:12 PM
zmike edited the summary of this revision. (Show Details)


How about using global variable static unsigned int ts ?

static unsigned int ts = 0; //global variable in suite_helpers.c

Because the timestamp of each function begins with 0 so timestamp 0 is used in the functions at the same time.

//In test code
drag_object(...); //timestamp 0 is used with evas_event_feed_mouse_move
wheel_object_at(...); //timestamp 0 is used with evas_event_feed_mouse_move

BTW, can we use the real timestamp value here?
It seems that the unit of input event timestamp is 1ms.

unsigned int cur_timestamp = (unsigned int)(ecore_time_get() * 1000);
evas_event_feed_mouse_move(e, x, y, cur_timestamp, NULL);
cur_timestamp = (unsigned int)(ecore_time_get() * 1000);
evas_event_feed_mouse_down(e, 1, 0, cur_timestamp, NULL);

I am not sure if the above code may cause a problem. (usleep() increases ecore_time_get() but usleep() does not increase ecore_loop_time_get())

zmike added a comment.EditedFri, Jan 17, 6:29 AM

Hm these are good points. We can use unsigned int here and start with a value of 1.

I considered using the real time, however, and I decided to just use local monotonic variables for two reasons:

  • continually calling ecore_time_get() is going to slow down input tests
  • there is no checking for timestamp ordering outside of specific input sequences (e.g., a complete gesture recognizer codepath will only verify the events in the sequence of the gesture and not for successive gestures)

I suppose I could change it to use a monotonic global uint which resets on test shutdown, which should have the same effect.

We never specifically check for the use of ms anywhere, so I'm not sure it would be especially useful? The purpose of having timestamps is just to detect event ordering and set thresholds for changing behaviors, and 1ms is already too fast to be a "real" event in this case, so it seems to me there isn't much point in converting to that.

zmike updated this revision to Diff 28254.Fri, Jan 17, 7:41 AM
zmike added a reviewer: CHAN.