summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2015-10-20 12:18:59 +0900
committerNicolas Aguirre <aguirre.nicolas@gmail.com>2015-11-12 10:15:03 +0100
commit7c70f1d47174e46d6a8ff48f6e4742e8f93e7afc (patch)
tree78af2b4b1445c40ec17e84eb98a30b5f79b0c84f
parent1ff72418a677bc5a91ca2e2895bae44b009518bf (diff)
elm test - genlist test - add bounce option test for testing performance
for release we need to test performance - esp of evas and eo in real life usage and scroling is just such one. this adds a simple automated scrolling test to genlist test (hit the button or ELM_TEST_AUTOBOUNCE=1 elementary_test -to genlist) so you can get consistent input and benchmark info
-rw-r--r--src/bin/test_genlist.c74
1 files changed, 68 insertions, 6 deletions
diff --git a/src/bin/test_genlist.c b/src/bin/test_genlist.c
index 6f3f7a2c3..cf77362e6 100644
--- a/src/bin/test_genlist.c
+++ b/src/bin/test_genlist.c
@@ -279,9 +279,9 @@ _gl_longpress(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_
279} 279}
280 280
281static void 281static void
282_gl_changed(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info) 282_gl_changed(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
283{ 283{
284 printf("changed %p\n", event_info); 284// printf("changed %p\n", event_info);
285} 285}
286 286
287static void 287static void
@@ -292,18 +292,64 @@ _cleanup_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
292 free(api); 292 free(api);
293} 293}
294 294
295typedef struct
296{
297 Evas_Object *gl;
298 Elm_Object_Item *it1, *it2;
299 int state;
300} Bounce;
301
302static Eina_Bool
303_bounce_cb(void *data)
304{
305 Bounce *bounce = data;
306 bounce->state++;
307 if (bounce->state > 1) bounce->state = 0;
308 if (bounce->state == 1)
309 elm_genlist_item_bring_in(bounce->it2, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
310 else
311 elm_genlist_item_bring_in(bounce->it1, ELM_GENLIST_ITEM_SCROLLTO_MIDDLE);
312 return EINA_TRUE;
313}
314
315static void
316_btbounce_cb(void *data, Evas_Object *obj, void *event_info EINA_UNUSED)
317{
318 Ecore_Timer *tim = evas_object_data_get(obj, "timer");
319 if (!tim)
320 {
321 _bounce_cb(data);
322 tim = ecore_timer_add(0.5, _bounce_cb, data);
323 evas_object_data_set(obj, "timer", tim);
324 }
325}
326
327static void
328_btdel_cb(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event_info EINA_UNUSED)
329{
330 Bounce *bounce = data;
331 Ecore_Timer *tim = evas_object_data_get(obj, "timer");
332 if (tim)
333 {
334 ecore_timer_del(tim);
335 evas_object_data_del(obj, "timer");
336 }
337 free(bounce);
338}
339
295void 340void
296test_genlist(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 341test_genlist(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
297{ 342{
298 Evas_Object *win, *gl, *bt_50, *bt_1500, *bx, *bxx, *bt; 343 Evas_Object *win, *gl, *bt_50, *bt_1500, *bx, *bxx, *bt;
299 Evas_Object *over; 344 Evas_Object *over;
300 Elm_Object_Item *gli; 345 Elm_Object_Item *gli;
301 int i; 346 int i, max;
347 Bounce *bounce;
302 api_data *api = calloc(1, sizeof(api_data)); 348 api_data *api = calloc(1, sizeof(api_data));
303 349
304 win = elm_win_util_standard_add("genlist", "Genlist"); 350 win = elm_win_util_standard_add("genlist", "Genlist");
305 elm_win_autodel_set(win, EINA_TRUE); 351 elm_win_autodel_set(win, EINA_TRUE);
306 evas_object_event_callback_add(win, EVAS_CALLBACK_FREE, _cleanup_cb, api); 352 evas_object_event_callback_add(win, EVAS_CALLBACK_DEL, _cleanup_cb, api);
307 353
308 bxx = elm_box_add(win); 354 bxx = elm_box_add(win);
309 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 355 evas_object_size_hint_weight_set(bxx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
@@ -364,7 +410,18 @@ test_genlist(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i
364 evas_object_show(bt_1500); 410 evas_object_show(bt_1500);
365 elm_box_pack_end(bx, bt_1500); 411 elm_box_pack_end(bx, bt_1500);
366 412
367 for (i = 0; i < 2000; i++) 413 bounce = calloc(1, sizeof(Bounce));
414 bt = elm_button_add(win);
415 elm_object_text_set(bt, "Bounce");
416 evas_object_show(bt);
417 elm_box_pack_end(bx, bt);
418 bounce->gl = gl;
419 evas_object_smart_callback_add(bt, "clicked", _btbounce_cb, bounce);
420 evas_object_event_callback_add(bt, EVAS_CALLBACK_DEL, _btdel_cb, bounce);
421
422 max = 2000;
423 if (getenv("ELM_TEST_AUTOBOUNCE")) max = 200;
424 for (i = 0; i < max; i++)
368 { 425 {
369 if (i == 5) 426 if (i == 5)
370 { 427 {
@@ -389,12 +446,17 @@ test_genlist(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_i
389 evas_object_smart_callback_add(bt_50, "clicked", _bt50_cb, gli); 446 evas_object_smart_callback_add(bt_50, "clicked", _bt50_cb, gli);
390 else if (i == 1500) 447 else if (i == 1500)
391 evas_object_smart_callback_add(bt_1500, "clicked", _bt1500_cb, gli); 448 evas_object_smart_callback_add(bt_1500, "clicked", _bt1500_cb, gli);
449
450 if (i == 100) bounce->it1 = gli;
451 if (i == 120) bounce->it2 = gli;
392 } 452 }
393 elm_genlist_item_class_free(api->itc1); 453 elm_genlist_item_class_free(api->itc1);
394 454
395 evas_object_resize(win, 480, 800); 455 evas_object_resize(win, 480, 400);
396 explode_win_enable(win); 456 explode_win_enable(win);
397 evas_object_show(win); 457 evas_object_show(win);
458
459 if (max == 200) _btbounce_cb(bounce, bt, NULL);
398} 460}
399 461
400 462