summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-05-28 12:01:50 -0400
committerMike Blumenkrantz <zmike@samsung.com>2019-05-28 12:01:50 -0400
commit52b2701bc3bfb64a3f6ca4ce0b992ac83d7c9e73 (patch)
tree3fc3a69ea8c1a6f98a06c324bdffce0b939a9d9a
parenta21974367ce9337fb599782ae667e6488d2a34d4 (diff)
efl_ui_suite: fix errors in focus tests
Summary: there have been a few cases where things were just wrong. Like missing regular nodes in a focus manager that received focus, and stuff like this. This now fixes all those cases. Reviewers: zmike, cedric, segfaultxavi Reviewed By: zmike Subscribers: #reviewers, #committers Tags: #efl Differential Revision: https://phab.enlightenment.org/D9021
-rw-r--r--src/Makefile_Elementary.am1
-rw-r--r--src/lib/elementary/Efl_Ui.h1
-rw-r--r--src/tests/elementary/efl_ui_test_focus.c258
-rw-r--r--src/tests/elementary/efl_ui_test_focus_common.c27
-rw-r--r--src/tests/elementary/efl_ui_test_focus_common.h3
-rw-r--r--src/tests/elementary/focus_manager_test.eo4
-rw-r--r--src/tests/elementary/meson.build3
7 files changed, 145 insertions, 152 deletions
diff --git a/src/Makefile_Elementary.am b/src/Makefile_Elementary.am
index 31f62e9ab3..614ee74c0a 100644
--- a/src/Makefile_Elementary.am
+++ b/src/Makefile_Elementary.am
@@ -158,6 +158,7 @@ elm_private_eolian_files = \
158 lib/elementary/efl_ui_focus_parent_provider_standard.eo \ 158 lib/elementary/efl_ui_focus_parent_provider_standard.eo \
159 lib/elementary/efl_ui_state_model.eo \ 159 lib/elementary/efl_ui_state_model.eo \
160 tests/elementary/focus_test.eo \ 160 tests/elementary/focus_test.eo \
161 tests/elementary/focus_manager_test.eo \
161 tests/elementary/focus_test_sub_main.eo \ 162 tests/elementary/focus_test_sub_main.eo \
162 lib/elementary/efl_ui_selection_manager.eo \ 163 lib/elementary/efl_ui_selection_manager.eo \
163 lib/elementary/efl_datetime_manager.eo \ 164 lib/elementary/efl_datetime_manager.eo \
diff --git a/src/lib/elementary/Efl_Ui.h b/src/lib/elementary/Efl_Ui.h
index 34f0549f4d..0b64b0405e 100644
--- a/src/lib/elementary/Efl_Ui.h
+++ b/src/lib/elementary/Efl_Ui.h
@@ -152,6 +152,7 @@ typedef Eo Efl_Ui_Focus_Manager;
152# ifdef EFL_BETA_API_SUPPORT 152# ifdef EFL_BETA_API_SUPPORT
153EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel); 153EAPI void efl_ui_focus_relation_free(Efl_Ui_Focus_Relations *rel);
154# endif 154# endif
155# include <efl_ui_focus_manager_window_root.eo.h>
155# include <efl_ui_focus_manager_calc.eo.h> 156# include <efl_ui_focus_manager_calc.eo.h>
156# include <efl_ui_focus_manager_sub.eo.h> 157# include <efl_ui_focus_manager_sub.eo.h>
157# include <efl_ui_focus_manager_root_focus.eo.h> 158# include <efl_ui_focus_manager_root_focus.eo.h>
diff --git a/src/tests/elementary/efl_ui_test_focus.c b/src/tests/elementary/efl_ui_test_focus.c
index 16fce9fb05..38a2ac0200 100644
--- a/src/tests/elementary/efl_ui_test_focus.c
+++ b/src/tests/elementary/efl_ui_test_focus.c
@@ -2,13 +2,11 @@
2 2
3EFL_START_TEST(focus_unregister_twice) 3EFL_START_TEST(focus_unregister_twice)
4{ 4{
5 Efl_Ui_Focus_Object *r1 = efl_add_ref(FOCUS_TEST_CLASS, NULL); 5 Efl_Ui_Focus_Object *r1, *r2;
6 Efl_Ui_Focus_Object *r2 = efl_add_ref(FOCUS_TEST_CLASS, NULL);
7 6
8 Efl_Ui_Focus_Manager *m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 7 Efl_Ui_Focus_Manager *m = focus_test_manager_new(&r1, EINA_TRUE);
9 efl_ui_focus_manager_root_set(efl_added, r1)
10 );
11 8
9 r2 = efl_add_ref(FOCUS_TEST_CLASS, NULL);
12 fail_if(!efl_ui_focus_manager_calc_register(m, r2, r1, NULL)); 10 fail_if(!efl_ui_focus_manager_calc_register(m, r2, r1, NULL));
13 11
14 efl_ui_focus_manager_calc_unregister(m, r1); 12 efl_ui_focus_manager_calc_unregister(m, r1);
@@ -16,7 +14,6 @@ EFL_START_TEST(focus_unregister_twice)
16 efl_ui_focus_manager_calc_unregister(m, r1); 14 efl_ui_focus_manager_calc_unregister(m, r1);
17 15
18 efl_unref(r2); 16 efl_unref(r2);
19 efl_unref(r1);
20 efl_unref(m); 17 efl_unref(m);
21 18
22} 19}
@@ -24,20 +21,22 @@ EFL_END_TEST
24 21
25EFL_START_TEST(focus_register_twice) 22EFL_START_TEST(focus_register_twice)
26{ 23{
27 Efl_Ui_Focus_Object *r1 = focus_test_object_new("r1", 0, 0, 10, 10); 24 Efl_Ui_Focus_Object *r1, *r2, *r3;
28 Efl_Ui_Focus_Object *r2 = focus_test_object_new("r2", 0, 10, 10, 10);
29 25
30 Efl_Ui_Focus_Manager *m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 26 Efl_Ui_Focus_Manager *m = focus_test_manager_new(&r1, EINA_TRUE);
31 efl_ui_focus_manager_root_set(efl_added, r1) 27 Efl_Ui_Focus_Manager *m2 = focus_test_manager_new(&r3, EINA_TRUE);
32 ); 28
29 r2 = efl_add_ref(FOCUS_TEST_CLASS, NULL);
33 30
34 fail_if(!efl_ui_focus_manager_calc_register(m, r2, r1, NULL)); 31 fail_if(!efl_ui_focus_manager_calc_register(m, r2, r1, NULL));
35 //same confguration don't error out 32 //same confguration don't error out
36 fail_if(!efl_ui_focus_manager_calc_register(m, r2, r1, NULL)); 33 fail_if(!efl_ui_focus_manager_calc_register(m, r2, r1, NULL));
34
35 EXPECT_ERROR_START;
37 //different confidurations error out 36 //different confidurations error out
38 fail_if(efl_ui_focus_manager_calc_register(m, r2, r1, r1)); 37 fail_if(efl_ui_focus_manager_calc_register(m, r2, r1, m2));
38 EXPECT_ERROR_END;
39 39
40 efl_unref(r1);
41 efl_unref(m); 40 efl_unref(m);
42 41
43} 42}
@@ -50,7 +49,7 @@ EFL_START_TEST(pos_check)
50 49
51 focus_test_setup_cross(&middle, &south, &north, &east, &west); 50 focus_test_setup_cross(&middle, &south, &north, &east, &west);
52 51
53 m = focus_test_manager_new(&root); 52 m = focus_test_manager_new(&root, EINA_TRUE);
54 efl_ui_focus_manager_calc_register(m, middle, root, NULL); 53 efl_ui_focus_manager_calc_register(m, middle, root, NULL);
55 efl_ui_focus_manager_calc_register(m, north, root, NULL); 54 efl_ui_focus_manager_calc_register(m, north, root, NULL);
56 efl_ui_focus_manager_calc_register(m, south, root, NULL); 55 efl_ui_focus_manager_calc_register(m, south, root, NULL);
@@ -122,7 +121,7 @@ EFL_START_TEST(pos_check2)
122 south_east = focus_test_object_new("south_east", 60, 60, 5, 5); 121 south_east = focus_test_object_new("south_east", 60, 60, 5, 5);
123 south_west = focus_test_object_new("south_west", 20, 60, 5, 5); 122 south_west = focus_test_object_new("south_west", 20, 60, 5, 5);
124 123
125 m = focus_test_manager_new(&root); 124 m = focus_test_manager_new(&root, EINA_TRUE);
126 efl_ui_focus_manager_calc_register(m, middle, root, NULL); 125 efl_ui_focus_manager_calc_register(m, middle, root, NULL);
127 efl_ui_focus_manager_calc_register(m, north_east, root, NULL); 126 efl_ui_focus_manager_calc_register(m, north_east, root, NULL);
128 efl_ui_focus_manager_calc_register(m, north_west, root, NULL); 127 efl_ui_focus_manager_calc_register(m, north_west, root, NULL);
@@ -156,18 +155,12 @@ EFL_START_TEST(pos_check2)
156EFL_END_TEST 155EFL_END_TEST
157EFL_START_TEST(redirect) 156EFL_START_TEST(redirect)
158{ 157{
159 TEST_OBJ_NEW(root, 0, 0, 20, 20); 158 Efl_Ui_Focus_Object *root, *root2;
160 TEST_OBJ_NEW(root2, 0, 0, 20, 20);
161 TEST_OBJ_NEW(one, 0, 0, 20, 20); 159 TEST_OBJ_NEW(one, 0, 0, 20, 20);
162 TEST_OBJ_NEW(two, 20, 0, 20, 20); 160 TEST_OBJ_NEW(two, 20, 0, 20, 20);
163 161
164 Efl_Ui_Focus_Manager *m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 162 Efl_Ui_Focus_Manager *m = focus_test_manager_new(&root, EINA_TRUE);
165 efl_ui_focus_manager_root_set(efl_added, root) 163 Efl_Ui_Focus_Manager *m2 = focus_test_manager_new(&root2, EINA_TRUE);
166 );
167
168 Efl_Ui_Focus_Manager *m2 = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL,
169 efl_ui_focus_manager_root_set(efl_added, root2)
170 );
171 164
172 efl_ui_focus_manager_calc_register(m2, one, root2, NULL); 165 efl_ui_focus_manager_calc_register(m2, one, root2, NULL);
173 efl_ui_focus_manager_calc_register(m2, two, root2, NULL); 166 efl_ui_focus_manager_calc_register(m2, two, root2, NULL);
@@ -192,7 +185,7 @@ EFL_START_TEST(border_check)
192 185
193 focus_test_setup_cross(&middle, &south, &north, &east, &west); 186 focus_test_setup_cross(&middle, &south, &north, &east, &west);
194 187
195 m = focus_test_manager_new(&root); 188 m = focus_test_manager_new(&root, EINA_TRUE);
196 efl_ui_focus_manager_calc_register(m, middle, root, NULL); 189 efl_ui_focus_manager_calc_register(m, middle, root, NULL);
197 efl_ui_focus_manager_calc_register(m, south, root, NULL); 190 efl_ui_focus_manager_calc_register(m, south, root, NULL);
198 efl_ui_focus_manager_calc_register(m, north, root, NULL); 191 efl_ui_focus_manager_calc_register(m, north, root, NULL);
@@ -226,7 +219,7 @@ EFL_START_TEST(logical_chain)
226 219
227 TEST_OBJ_NEW(root, 0, 0, 20, 20); 220 TEST_OBJ_NEW(root, 0, 0, 20, 20);
228 221
229 m = focus_test_manager_new(&lroot); 222 m = focus_test_manager_new(&lroot, EINA_TRUE);
230 223
231 fail_if(!m); 224 fail_if(!m);
232 225
@@ -326,32 +319,31 @@ _check_chain(Efl_Ui_Focus_Manager *m, Efl_Ui_Focus_Object *objects[])
326EFL_START_TEST(logical_chain_multi_redirect) 319EFL_START_TEST(logical_chain_multi_redirect)
327{ 320{
328 Efl_Ui_Focus_Manager *m, *m2, *m3, *m4; 321 Efl_Ui_Focus_Manager *m, *m2, *m3, *m4;
329 Efl_Ui_Focus_Object *root,*root2, *root3, *root4, *c1_1, *c1_2, *c1_3, *c2, *c3, *c4; 322 Efl_Ui_Focus_Object *root,*root2, *root3, *root4, *c2, *c3, *c4;
330 323
331 m = focus_test_manager_new(&root); 324 m = focus_test_manager_new(&root, EINA_TRUE);
332 m2 = focus_test_manager_new(&root2);
333 m3 = focus_test_manager_new(&root3);
334 m4 = focus_test_manager_new(&root4);
335 c1_1 = focus_test_object_new("child1", 0, 0, 20, 20);
336 c1_2 = focus_test_object_new("child2", 0, 0, 20, 20);
337 c1_3 = focus_test_object_new("child3", 0, 0, 20, 20);
338 focus_test_manager_set(c1_1, m2);
339 focus_test_manager_set(c1_2, m3);
340 focus_test_manager_set(c1_3, m4);
341 c2 = focus_test_object_new("child1", 0, 0, 20, 20);
342 c3 = focus_test_object_new("child2", 0, 0, 20, 20);
343 c4 = focus_test_object_new("child3", 0, 0, 20, 20);
344 325
345 Efl_Ui_Focus_Object *objects[] = {c2, c3, c4, NULL}; 326 //Create 3 linked focus managers
327 m2 = focus_test_manager_new(&root2, EINA_FALSE);
328 efl_ui_focus_manager_calc_register_logical(m, root2, root, m2);
329 focus_test_manager_set(root2, m);
330
331 m3 = focus_test_manager_new(&root3, EINA_FALSE);
332 efl_ui_focus_manager_calc_register_logical(m, root3, root, m3);
333 focus_test_manager_set(root3, m);
346 334
347 efl_ui_focus_manager_calc_register(m, c1_1, root, m2); 335 m4 = focus_test_manager_new(&root4, EINA_FALSE);
348 efl_ui_focus_manager_calc_register(m, c1_2, root, m3); 336 efl_ui_focus_manager_calc_register_logical(m, root4, root, m4);
349 efl_ui_focus_manager_calc_register(m, c1_3, root, m4); 337 focus_test_manager_set(root4, m);
350 338
339 c2 = focus_test_object_new("child1", 0, 0, 20, 20);
340 c3 = focus_test_object_new("child2", 0, 0, 20, 20);
341 c4 = focus_test_object_new("child3", 0, 0, 20, 20);
351 efl_ui_focus_manager_calc_register(m2, c2, root2, NULL); 342 efl_ui_focus_manager_calc_register(m2, c2, root2, NULL);
352 efl_ui_focus_manager_calc_register(m3, c3, root3, NULL); 343 efl_ui_focus_manager_calc_register(m3, c3, root3, NULL);
353 efl_ui_focus_manager_calc_register(m4, c4, root4, NULL); 344 efl_ui_focus_manager_calc_register(m4, c4, root4, NULL);
354 345
346 Efl_Ui_Focus_Object *objects[] = {c2, c3, c4, NULL};
355 _check_chain(m, objects); 347 _check_chain(m, objects);
356 348
357 efl_unref(m2); 349 efl_unref(m2);
@@ -364,11 +356,11 @@ EFL_START_TEST(logical_chain_single_redirect)
364 Efl_Ui_Focus_Manager *m, *m2; 356 Efl_Ui_Focus_Manager *m, *m2;
365 Efl_Ui_Focus_Object *root,*root2, *c1_1, *c1_2, *c1_3, *c2_1, *c2_2, *c2_3; 357 Efl_Ui_Focus_Object *root,*root2, *c1_1, *c1_2, *c1_3, *c2_1, *c2_2, *c2_3;
366 358
367 m = focus_test_manager_new(&root); 359 m = focus_test_manager_new(&root, EINA_TRUE);
368 m2 = focus_test_manager_new(&root2); 360 m2 = focus_test_manager_new(&root2, EINA_FALSE);
361 focus_test_manager_set(root2, m);
369 c1_1 = focus_test_object_new("child1", 0, 0, 20, 20); 362 c1_1 = focus_test_object_new("child1", 0, 0, 20, 20);
370 c1_2 = focus_test_object_new("child2", 0, 0, 20, 20); 363 c1_2 = root2;
371 focus_test_manager_set(c1_2, m2);
372 c1_3 = focus_test_object_new("child3", 0, 0, 20, 20); 364 c1_3 = focus_test_object_new("child3", 0, 0, 20, 20);
373 c2_1 = focus_test_object_new("child1", 0, 0, 20, 20); 365 c2_1 = focus_test_object_new("child1", 0, 0, 20, 20);
374 c2_2 = focus_test_object_new("child2", 0, 0, 20, 20); 366 c2_2 = focus_test_object_new("child2", 0, 0, 20, 20);
@@ -395,7 +387,9 @@ EFL_START_TEST(finalize_check)
395{ 387{
396 Efl_Ui_Focus_Manager *m; 388 Efl_Ui_Focus_Manager *m;
397 389
390 EXPECT_ERROR_START;
398 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL); 391 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL);
392 EXPECT_ERROR_END;
399 fail_if(m); 393 fail_if(m);
400 394
401 efl_unref(m); 395 efl_unref(m);
@@ -405,21 +399,19 @@ EFL_END_TEST
405EFL_START_TEST(redirect_param) 399EFL_START_TEST(redirect_param)
406{ 400{
407 Efl_Ui_Focus_Manager *m, *m2; 401 Efl_Ui_Focus_Manager *m, *m2;
402 Efl_Ui_Focus_Object *root,*root2;
408 403
409 TEST_OBJ_NEW(root, 0, 20, 20, 20);
410 TEST_OBJ_NEW(root2, 0, 20, 20, 20);
411 TEST_OBJ_NEW(child, 0, 20, 20, 20); 404 TEST_OBJ_NEW(child, 0, 20, 20, 20);
405 TEST_OBJ_NEW(child2, 0, 20, 20, 20);
412 406
413 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 407 m = focus_test_manager_new(&root, EINA_TRUE);
414 efl_ui_focus_manager_root_set(efl_added, root) 408 m2 = focus_test_manager_new(&root2, EINA_FALSE);
415 ); 409 efl_ui_focus_manager_calc_register_logical(m, root2, root, m2);
416 410 focus_test_manager_set(root2, m);
417 m2 = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL,
418 efl_ui_focus_manager_root_set(efl_added, root2)
419 );
420 411
421 efl_ui_focus_manager_calc_register(m, child, root, m2); 412 efl_ui_focus_manager_calc_register(m, child, root, m2);
422 efl_ui_focus_manager_focus_set(m, child); 413 efl_ui_focus_manager_calc_register(m2, child2, root2, NULL);
414 efl_ui_focus_manager_focus_set(m, root2);
423 415
424 ck_assert_ptr_eq(efl_ui_focus_manager_redirect_get(m), m2); 416 ck_assert_ptr_eq(efl_ui_focus_manager_redirect_get(m), m2);
425 417
@@ -431,29 +423,35 @@ EFL_END_TEST
431EFL_START_TEST(invalid_args_check) 423EFL_START_TEST(invalid_args_check)
432{ 424{
433 Efl_Ui_Focus_Manager *m; 425 Efl_Ui_Focus_Manager *m;
426 Efl_Ui_Focus_Object *root;
434 427
435 TEST_OBJ_NEW(root, 0, 20, 20, 20);
436 TEST_OBJ_NEW(child, 0, 20, 20, 20); 428 TEST_OBJ_NEW(child, 0, 20, 20, 20);
437 TEST_OBJ_NEW(child2, 0, 20, 20, 20); 429 TEST_OBJ_NEW(child2, 0, 20, 20, 20);
438 430
439 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 431 m = focus_test_manager_new(&root, EINA_TRUE);
440 efl_ui_focus_manager_root_set(efl_added, root)
441 );
442 432
443 //no child and no parent 433 //no child and no parent
434 EXPECT_ERROR_START;
444 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, NULL, NULL, NULL), 0); 435 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, NULL, NULL, NULL), 0);
436 EXPECT_ERROR_END;
437 EXPECT_ERROR_START;
445 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, child, NULL, NULL), 0); 438 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, child, NULL, NULL), 0);
439 EXPECT_ERROR_END;
440 EXPECT_ERROR_START;
446 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, NULL, root, NULL), 0); 441 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, NULL, root, NULL), 0);
447 442 EXPECT_ERROR_END;
448 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, child, root, NULL), 1); 443 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, child, root, NULL), 1);
449 444 EXPECT_ERROR_START;
450 ck_assert_int_eq(efl_ui_focus_manager_calc_update_parent(m, child, NULL), 0); 445 ck_assert_int_eq(efl_ui_focus_manager_calc_update_parent(m, child, NULL), 0);
446 EXPECT_ERROR_END;
447 EXPECT_ERROR_START;
451 ck_assert_int_eq(efl_ui_focus_manager_calc_update_parent(m, NULL, NULL), 0); 448 ck_assert_int_eq(efl_ui_focus_manager_calc_update_parent(m, NULL, NULL), 0);
449 EXPECT_ERROR_END;
450 EXPECT_ERROR_START;
452 ck_assert_int_eq(efl_ui_focus_manager_calc_update_parent(m, child, child2), 0); 451 ck_assert_int_eq(efl_ui_focus_manager_calc_update_parent(m, child, child2), 0);
453 452 EXPECT_ERROR_END;
454 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, child2, root, NULL), 1); 453 ck_assert_int_eq(efl_ui_focus_manager_calc_register(m, child2, root, NULL), 1);
455 ck_assert_int_eq(efl_ui_focus_manager_calc_update_parent(m, child, child2), 1); 454 ck_assert_int_eq(efl_ui_focus_manager_calc_update_parent(m, child, child2), 1);
456
457 efl_unref(m); 455 efl_unref(m);
458} 456}
459EFL_END_TEST 457EFL_END_TEST
@@ -462,15 +460,13 @@ EFL_START_TEST(order_check)
462{ 460{
463 Efl_Ui_Focus_Manager *m; 461 Efl_Ui_Focus_Manager *m;
464 Eina_List *order = NULL; 462 Eina_List *order = NULL;
463 Efl_Ui_Focus_Object *root;
465 464
466 TEST_OBJ_NEW(root, 0, 20, 20, 20);
467 TEST_OBJ_NEW(child1, 0, 20, 20, 20); 465 TEST_OBJ_NEW(child1, 0, 20, 20, 20);
468 TEST_OBJ_NEW(child2, 0, 20, 20, 20); 466 TEST_OBJ_NEW(child2, 0, 20, 20, 20);
469 TEST_OBJ_NEW(child3, 0, 20, 20, 20); 467 TEST_OBJ_NEW(child3, 0, 20, 20, 20);
470 468
471 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 469 m = focus_test_manager_new(&root, EINA_TRUE);
472 efl_ui_focus_manager_root_set(efl_added, root)
473 );
474 470
475 //no child and no parent 471 //no child and no parent
476 efl_ui_focus_manager_calc_register(m, child1, root, NULL); 472 efl_ui_focus_manager_calc_register(m, child1, root, NULL);
@@ -488,8 +484,9 @@ EFL_START_TEST(order_check)
488 //negativ check 484 //negativ check
489 order = eina_list_append(order, child1); 485 order = eina_list_append(order, child1);
490 order = eina_list_append(order, child2); 486 order = eina_list_append(order, child2);
487 EXPECT_ERROR_START;
491 ck_assert_int_eq(efl_ui_focus_manager_calc_update_children(m, root, order), 0); 488 ck_assert_int_eq(efl_ui_focus_manager_calc_update_children(m, root, order), 0);
492 489 EXPECT_ERROR_END;
493 efl_unref(m); 490 efl_unref(m);
494} 491}
495EFL_END_TEST 492EFL_END_TEST
@@ -497,16 +494,14 @@ EFL_END_TEST
497EFL_START_TEST(logical_shift) 494EFL_START_TEST(logical_shift)
498{ 495{
499 Efl_Ui_Focus_Manager *m; 496 Efl_Ui_Focus_Manager *m;
497 Efl_Ui_Focus_Object *root;
500 498
501 TEST_OBJ_NEW(root, 0, 0, 10, 10);
502 TEST_OBJ_NEW(child, 0, 0, 10, 10); 499 TEST_OBJ_NEW(child, 0, 0, 10, 10);
503 TEST_OBJ_NEW(sub, 0, 0, 10, 10); 500 TEST_OBJ_NEW(sub, 0, 0, 10, 10);
504 TEST_OBJ_NEW(sub_sub, 0, 0, 10, 10); 501 TEST_OBJ_NEW(sub_sub, 0, 0, 10, 10);
505 TEST_OBJ_NEW(sub_child, 0, 0, 10, 10); 502 TEST_OBJ_NEW(sub_child, 0, 0, 10, 10);
506 503
507 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 504 m = focus_test_manager_new(&root, EINA_TRUE);
508 efl_ui_focus_manager_root_set(efl_added, root)
509 );
510 505
511 efl_ui_focus_manager_calc_register(m, child, root, NULL); 506 efl_ui_focus_manager_calc_register(m, child, root, NULL);
512 efl_ui_focus_manager_calc_register_logical(m, sub, root, NULL); 507 efl_ui_focus_manager_calc_register_logical(m, sub, root, NULL);
@@ -519,9 +514,10 @@ EFL_START_TEST(logical_shift)
519 efl_ui_focus_manager_focus_set(m, sub); 514 efl_ui_focus_manager_focus_set(m, sub);
520 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(m), sub_child); 515 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(m), sub_child);
521 516
517 EXPECT_ERROR_START;
522 efl_ui_focus_manager_focus_set(m, sub_sub); 518 efl_ui_focus_manager_focus_set(m, sub_sub);
523 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(m), sub_child); 519 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(m), sub_child);
524 520 EXPECT_ERROR_END;
525 efl_unref(m); 521 efl_unref(m);
526} 522}
527EFL_END_TEST 523EFL_END_TEST
@@ -529,21 +525,14 @@ EFL_END_TEST
529EFL_START_TEST(root_redirect_chain) 525EFL_START_TEST(root_redirect_chain)
530{ 526{
531 Efl_Ui_Focus_Manager *m, *m2; 527 Efl_Ui_Focus_Manager *m, *m2;
528 Efl_Ui_Focus_Object *root, *root2;
532 529
533 TEST_OBJ_NEW(root, 0, 20, 20, 20);
534 TEST_OBJ_NEW(root2, 0, 20, 20, 20);
535 TEST_OBJ_NEW(child, 0, 20, 20, 20); 530 TEST_OBJ_NEW(child, 0, 20, 20, 20);
536 531
537 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 532 m = focus_test_manager_new(&root, EINA_TRUE);
538 efl_ui_focus_manager_root_set(efl_added, root) 533 m2 = focus_test_manager_new(&root2, EINA_TRUE);
539 );
540
541 focus_test_manager_set(root2, m); 534 focus_test_manager_set(root2, m);
542 535
543 m2 = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL,
544 efl_ui_focus_manager_root_set(efl_added, root2)
545 );
546
547 efl_ui_focus_manager_calc_register(m, root2, root, m2); 536 efl_ui_focus_manager_calc_register(m, root2, root, m2);
548 efl_ui_focus_manager_calc_register(m2, child, root2, NULL); 537 efl_ui_focus_manager_calc_register(m2, child, root2, NULL);
549 efl_ui_focus_manager_focus_set(m2, child); 538 efl_ui_focus_manager_focus_set(m2, child);
@@ -558,35 +547,30 @@ EFL_END_TEST
558EFL_START_TEST(root_redirect_chain_unset) 547EFL_START_TEST(root_redirect_chain_unset)
559{ 548{
560 Efl_Ui_Focus_Manager *m, *m2, *m3, *m4; 549 Efl_Ui_Focus_Manager *m, *m2, *m3, *m4;
550 Efl_Ui_Focus_Object *root, *root2, *root3, *root4;
561 551
562 TEST_OBJ_NEW(root, 0, 20, 20, 20);
563 TEST_OBJ_NEW(root2, 0, 20, 20, 20);
564 TEST_OBJ_NEW(child, 0, 20, 20, 20); 552 TEST_OBJ_NEW(child, 0, 20, 20, 20);
553 TEST_OBJ_NEW(child2, 0, 20, 20, 20);
554 TEST_OBJ_NEW(child3, 0, 20, 20, 20);
565 555
566 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 556 m = focus_test_manager_new(&root, EINA_TRUE);
567 efl_ui_focus_manager_root_set(efl_added, root) 557 m2 = focus_test_manager_new(&root2, EINA_FALSE);
568 ); 558 m3 = focus_test_manager_new(&root3, EINA_FALSE);
569 559 m4 = focus_test_manager_new(&root4, EINA_FALSE);
570 focus_test_manager_set(root2, m); 560 focus_test_manager_set(root2, m);
561 focus_test_manager_set(root3, m);
562 focus_test_manager_set(root4, m3);
571 563
572 m2 = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 564 efl_ui_focus_manager_calc_register(m, root2, root, m2);
573 efl_ui_focus_manager_root_set(efl_added, root2) 565 efl_ui_focus_manager_calc_register(m, root3, root, m3);
574 ); 566 efl_ui_focus_manager_calc_register(m2, child, root2, NULL);
575 567 efl_ui_focus_manager_calc_register(m3, child2, root3, NULL);
576 m3 = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 568 efl_ui_focus_manager_calc_register(m3, root4, root3, NULL);
577 efl_ui_focus_manager_root_set(efl_added, root2) 569 efl_ui_focus_manager_calc_register(m4, child3, root4, NULL);
578 );
579
580 m4 = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL,
581 efl_ui_focus_manager_root_set(efl_added, root2)
582 );
583 570
584 efl_ui_focus_manager_redirect_set(m, m3); 571 efl_ui_focus_manager_redirect_set(m, m3);
585 efl_ui_focus_manager_redirect_set(m3, m4); 572 efl_ui_focus_manager_redirect_set(m3, m4);
586 efl_ui_focus_manager_redirect_set(m4, m2);
587 573
588 efl_ui_focus_manager_calc_register(m, root2, root, m2);
589 efl_ui_focus_manager_calc_register(m2, child, root2, NULL);
590 efl_ui_focus_manager_focus_set(m2, child); 574 efl_ui_focus_manager_focus_set(m2, child);
591 575
592 ck_assert_ptr_eq(efl_ui_focus_manager_redirect_get(m), m2); 576 ck_assert_ptr_eq(efl_ui_focus_manager_redirect_get(m), m2);
@@ -605,16 +589,11 @@ static Efl_Ui_Focus_Manager_Calc*
605_recursive_triangle_manager(int recusion_depth, Efl_Ui_Focus_Object **most_right, Efl_Ui_Focus_Object **most_left, Eina_List **managers) 589_recursive_triangle_manager(int recusion_depth, Efl_Ui_Focus_Object **most_right, Efl_Ui_Focus_Object **most_left, Eina_List **managers)
606{ 590{
607 Efl_Ui_Focus_Manager *m, *m_child1 = NULL, *m_child3 = NULL; 591 Efl_Ui_Focus_Manager *m, *m_child1 = NULL, *m_child3 = NULL;
608 Efl_Ui_Focus_Object *child1, *child3; 592 Efl_Ui_Focus_Object *child1, *child3, *root;
609 593
610 TEST_OBJ_NEW(root, 0, 20, 20, 20);
611 TEST_OBJ_NEW(child2, 0, 20, 20, 20); 594 TEST_OBJ_NEW(child2, 0, 20, 20, 20);
612 595
613 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 596 m = focus_test_manager_new(&root, recusion_depth == 0);
614 efl_ui_focus_manager_root_set(efl_added, root)
615 );
616
617 printf("New manaager %p\n", m);
618 597
619 if (recusion_depth < 3) 598 if (recusion_depth < 3)
620 { 599 {
@@ -636,20 +615,14 @@ _recursive_triangle_manager(int recusion_depth, Efl_Ui_Focus_Object **most_right
636 if (most_left) 615 if (most_left)
637 { 616 {
638 *most_left = child1; 617 *most_left = child1;
639 printf("SETTING %p\n", child1);
640 } 618 }
641 619
642 if (most_right) 620 if (most_right)
643 { 621 {
644 *most_right = child3; 622 *most_right = child3;
645 printf("SETTING %p\n", child3);
646 } 623 }
647 } 624 }
648 625
649 printf("Child 1 %p\n", child1);
650 printf("Child 2 %p\n", child2);
651 printf("Child 3 %p\n", child3);
652
653 efl_ui_focus_manager_calc_register(m, child1, root, m_child1); 626 efl_ui_focus_manager_calc_register(m, child1, root, m_child1);
654 efl_ui_focus_manager_calc_register(m, child2, root, NULL); 627 efl_ui_focus_manager_calc_register(m, child2, root, NULL);
655 efl_ui_focus_manager_calc_register(m, child3, root, m_child3); 628 efl_ui_focus_manager_calc_register(m, child3, root, m_child3);
@@ -681,14 +654,12 @@ EFL_START_TEST(first_touch_check)
681 m = _recursive_triangle_manager(0, &most_right, &most_left, &managers); 654 m = _recursive_triangle_manager(0, &most_right, &most_left, &managers);
682 655
683 efl_ui_focus_manager_setup_on_first_touch(m, EFL_UI_FOCUS_DIRECTION_NEXT, efl_ui_focus_manager_root_get(m)); 656 efl_ui_focus_manager_setup_on_first_touch(m, EFL_UI_FOCUS_DIRECTION_NEXT, efl_ui_focus_manager_root_get(m));
684 printf("%p %p\n", most_left, most_right);
685 657
686 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(_get_highest_redirect(m)), most_left); 658 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(_get_highest_redirect(m)), most_left);
687 659
688 efl_ui_focus_manager_reset_history(m); 660 efl_ui_focus_manager_reset_history(m);
689 661
690 efl_ui_focus_manager_setup_on_first_touch(m, EFL_UI_FOCUS_DIRECTION_PREVIOUS, efl_ui_focus_manager_root_get(m)); 662 efl_ui_focus_manager_setup_on_first_touch(m, EFL_UI_FOCUS_DIRECTION_PREVIOUS, efl_ui_focus_manager_root_get(m));
691 printf("%s\n", efl_name_get(efl_ui_focus_manager_focus_get(_get_highest_redirect(m))));
692 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(_get_highest_redirect(m)), most_right); 663 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(_get_highest_redirect(m)), most_right);
693 664
694 EINA_LIST_FREE(managers, m) 665 EINA_LIST_FREE(managers, m)
@@ -701,7 +672,7 @@ EFL_START_TEST(test_request_subchild_empty)
701 Efl_Ui_Focus_Manager *m; 672 Efl_Ui_Focus_Manager *m;
702 Efl_Ui_Focus_Object *root; 673 Efl_Ui_Focus_Object *root;
703 674
704 m = focus_test_manager_new(&root); 675 m = focus_test_manager_new(&root, EINA_TRUE);
705 676
706 ck_assert_ptr_eq(efl_ui_focus_manager_request_subchild(m, root), NULL); 677 ck_assert_ptr_eq(efl_ui_focus_manager_request_subchild(m, root), NULL);
707 678
@@ -714,7 +685,7 @@ EFL_START_TEST(test_request_subchild_one_element)
714 Efl_Ui_Focus_Manager *m; 685 Efl_Ui_Focus_Manager *m;
715 Efl_Ui_Focus_Object *root, *c1; 686 Efl_Ui_Focus_Object *root, *c1;
716 687
717 m = focus_test_manager_new(&root); 688 m = focus_test_manager_new(&root, EINA_TRUE);
718 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 689 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
719 efl_ui_focus_manager_calc_register(m, c1, root, NULL); 690 efl_ui_focus_manager_calc_register(m, c1, root, NULL);
720 691
@@ -730,7 +701,7 @@ EFL_START_TEST(test_request_subchild_child_alongside)
730 Efl_Ui_Focus_Manager *m; 701 Efl_Ui_Focus_Manager *m;
731 Efl_Ui_Focus_Object *root, *c1, *c2; 702 Efl_Ui_Focus_Object *root, *c1, *c2;
732 703
733 m = focus_test_manager_new(&root); 704 m = focus_test_manager_new(&root, EINA_TRUE);
734 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 705 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
735 c2 = focus_test_object_new("child2", 0, 0, 20, 20); 706 c2 = focus_test_object_new("child2", 0, 0, 20, 20);
736 efl_ui_focus_manager_calc_register(m, c1, root, NULL); 707 efl_ui_focus_manager_calc_register(m, c1, root, NULL);
@@ -749,7 +720,7 @@ EFL_START_TEST(test_request_subchild_child_logical_regular)
749 Efl_Ui_Focus_Manager *m; 720 Efl_Ui_Focus_Manager *m;
750 Efl_Ui_Focus_Object *root, *c1, *c2; 721 Efl_Ui_Focus_Object *root, *c1, *c2;
751 722
752 m = focus_test_manager_new(&root); 723 m = focus_test_manager_new(&root, EINA_TRUE);
753 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 724 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
754 c2 = focus_test_object_new("child2", 0, 0, 20, 20); 725 c2 = focus_test_object_new("child2", 0, 0, 20, 20);
755 efl_ui_focus_manager_calc_register_logical(m, c1, root, NULL); 726 efl_ui_focus_manager_calc_register_logical(m, c1, root, NULL);
@@ -768,7 +739,7 @@ EFL_START_TEST(test_request_subchild_child_regular_regular)
768 Efl_Ui_Focus_Manager *m; 739 Efl_Ui_Focus_Manager *m;
769 Efl_Ui_Focus_Object *root, *c1, *c2; 740 Efl_Ui_Focus_Object *root, *c1, *c2;
770 741
771 m = focus_test_manager_new(&root); 742 m = focus_test_manager_new(&root, EINA_TRUE);
772 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 743 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
773 c2 = focus_test_object_new("child2", 0, 0, 20, 20); 744 c2 = focus_test_object_new("child2", 0, 0, 20, 20);
774 efl_ui_focus_manager_calc_register(m, c1, root, NULL); 745 efl_ui_focus_manager_calc_register(m, c1, root, NULL);
@@ -787,7 +758,7 @@ EFL_START_TEST(test_unregister_last_focused_no_history)
787 Efl_Ui_Focus_Manager *m; 758 Efl_Ui_Focus_Manager *m;
788 Efl_Ui_Focus_Object *root, *c1, *c2, *c3; 759 Efl_Ui_Focus_Object *root, *c1, *c2, *c3;
789 760
790 m = focus_test_manager_new(&root); 761 m = focus_test_manager_new(&root, EINA_TRUE);
791 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 762 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
792 c2 = focus_test_object_new("child2", 0, 0, 20, 20); 763 c2 = focus_test_object_new("child2", 0, 0, 20, 20);
793 c3 = focus_test_object_new("child3", 0, 0, 20, 20); 764 c3 = focus_test_object_new("child3", 0, 0, 20, 20);
@@ -810,7 +781,7 @@ EFL_START_TEST(test_unregister_last_focused)
810 Efl_Ui_Focus_Manager *m; 781 Efl_Ui_Focus_Manager *m;
811 Efl_Ui_Focus_Object *root, *c1, *c2, *c3; 782 Efl_Ui_Focus_Object *root, *c1, *c2, *c3;
812 783
813 m = focus_test_manager_new(&root); 784 m = focus_test_manager_new(&root, EINA_TRUE);
814 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 785 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
815 c2 = focus_test_object_new("child2", 0, 0, 20, 20); 786 c2 = focus_test_object_new("child2", 0, 0, 20, 20);
816 c3 = focus_test_object_new("child3", 0, 0, 20, 20); 787 c3 = focus_test_object_new("child3", 0, 0, 20, 20);
@@ -835,7 +806,7 @@ EFL_START_TEST(test_unregister_last_focused_no_child)
835 Efl_Ui_Focus_Manager *m; 806 Efl_Ui_Focus_Manager *m;
836 Efl_Ui_Focus_Object *root, *c1; 807 Efl_Ui_Focus_Object *root, *c1;
837 808
838 m = focus_test_manager_new(&root); 809 m = focus_test_manager_new(&root, EINA_TRUE);
839 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 810 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
840 efl_ui_focus_manager_calc_register(m, c1, root, NULL); 811 efl_ui_focus_manager_calc_register(m, c1, root, NULL);
841 812
@@ -853,7 +824,7 @@ EFL_START_TEST(test_pop_history_element)
853 Efl_Ui_Focus_Manager *m; 824 Efl_Ui_Focus_Manager *m;
854 Efl_Ui_Focus_Object *root, *c1, *c2, *c3; 825 Efl_Ui_Focus_Object *root, *c1, *c2, *c3;
855 826
856 m = focus_test_manager_new(&root); 827 m = focus_test_manager_new(&root, EINA_TRUE);
857 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 828 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
858 c2 = focus_test_object_new("child2", 0, 0, 20, 20); 829 c2 = focus_test_object_new("child2", 0, 0, 20, 20);
859 c3 = focus_test_object_new("child3", 0, 0, 20, 20); 830 c3 = focus_test_object_new("child3", 0, 0, 20, 20);
@@ -902,7 +873,7 @@ EFL_START_TEST(test_request_move)
902 Efl_Ui_Focus_Manager *m; 873 Efl_Ui_Focus_Manager *m;
903 Efl_Ui_Focus_Object *root, *c1, *c2, *c3, *c4, *c5, *c6; 874 Efl_Ui_Focus_Object *root, *c1, *c2, *c3, *c4, *c5, *c6;
904 875
905 m = focus_test_manager_new(&root); 876 m = focus_test_manager_new(&root, EINA_TRUE);
906 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 877 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
907 c2 = focus_test_object_new("child2", 0, 0, 20, 20); 878 c2 = focus_test_object_new("child2", 0, 0, 20, 20);
908 c3 = focus_test_object_new("child3", 0, 0, 20, 20); 879 c3 = focus_test_object_new("child3", 0, 0, 20, 20);
@@ -936,21 +907,14 @@ EFL_END_TEST
936EFL_START_TEST(redirect_unregister_entrypoint) 907EFL_START_TEST(redirect_unregister_entrypoint)
937{ 908{
938 Efl_Ui_Focus_Manager *m, *m2; 909 Efl_Ui_Focus_Manager *m, *m2;
910 Efl_Ui_Focus_Object *root, *root2;
939 911
940 TEST_OBJ_NEW(root, 0, 20, 20, 20);
941 TEST_OBJ_NEW(root2, 0, 20, 20, 20);
942 TEST_OBJ_NEW(child, 0, 20, 20, 20); 912 TEST_OBJ_NEW(child, 0, 20, 20, 20);
943 TEST_OBJ_NEW(child2, 0, 20, 20, 20); 913 TEST_OBJ_NEW(child2, 0, 20, 20, 20);
944 TEST_OBJ_NEW(child3, 0, 20, 20, 20); 914 TEST_OBJ_NEW(child3, 0, 20, 20, 20);
945 915
946 m = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, efl_main_loop_get(), 916 m = focus_test_manager_new(&root, EINA_TRUE);
947 efl_ui_focus_manager_root_set(efl_added, root) 917 m2 = focus_test_manager_new(&root2, EINA_TRUE);
948 );
949
950 m2 = efl_add(EFL_UI_FOCUS_MANAGER_CALC_CLASS, efl_main_loop_get(),
951 efl_ui_focus_manager_root_set(efl_added, root2)
952 );
953
954 918
955 efl_ui_focus_manager_calc_register(m2, child3, root2, m2); 919 efl_ui_focus_manager_calc_register(m2, child3, root2, m2);
956 920
@@ -963,19 +927,17 @@ EFL_START_TEST(redirect_unregister_entrypoint)
963 ck_assert_ptr_eq(efl_ui_focus_manager_redirect_get(m), m2); 927 ck_assert_ptr_eq(efl_ui_focus_manager_redirect_get(m), m2);
964 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(m), NULL); 928 ck_assert_ptr_eq(efl_ui_focus_manager_focus_get(m), NULL);
965 929
966 efl_del(m); 930 efl_unref(m);
967 efl_del(m2); 931 efl_unref(m2);
968} 932}
969EFL_END_TEST 933EFL_END_TEST
970 934
971static void 935static void
972_child_focus_changed(void *data, const Efl_Event *ev) 936_child_focus_changed(void *data, const Efl_Event *ev EINA_UNUSED)
973{ 937{
974 Eina_Bool *flag = data; 938 Eina_Bool *flag = data;
975 939
976 *flag = EINA_TRUE; 940 *flag = EINA_TRUE;
977
978 printf("%s\n", efl_class_name_get(ev->object));
979} 941}
980 942
981EFL_START_TEST(test_events_child_focus) 943EFL_START_TEST(test_events_child_focus)
@@ -985,7 +947,7 @@ EFL_START_TEST(test_events_child_focus)
985 Eina_Bool froot = EINA_FALSE, fc1 = EINA_FALSE, fc2 = EINA_FALSE, 947 Eina_Bool froot = EINA_FALSE, fc1 = EINA_FALSE, fc2 = EINA_FALSE,
986 fc3 = EINA_FALSE, fc4 = EINA_FALSE, fc5 = EINA_FALSE, fc6 = EINA_FALSE; 948 fc3 = EINA_FALSE, fc4 = EINA_FALSE, fc5 = EINA_FALSE, fc6 = EINA_FALSE;
987 949
988 m = focus_test_manager_new(&root); 950 m = focus_test_manager_new(&root, EINA_TRUE);
989 c1 = focus_test_object_new("child1", 0, 0, 20, 20); 951 c1 = focus_test_object_new("child1", 0, 0, 20, 20);
990 efl_parent_set(c1, root); 952 efl_parent_set(c1, root);
991 c2 = focus_test_object_new("child2", 0, 0, 20, 20); 953 c2 = focus_test_object_new("child2", 0, 0, 20, 20);
@@ -1087,7 +1049,7 @@ EFL_START_TEST(viewport_check)
1087 1049
1088 focus_test_setup_cross(&middle, &south, &north, &east, &west); 1050 focus_test_setup_cross(&middle, &south, &north, &east, &west);
1089 1051
1090 m = focus_test_manager_new(&root); 1052 m = focus_test_manager_new(&root, EINA_TRUE);
1091 efl_ui_focus_manager_calc_register(m, middle, root, NULL); 1053 efl_ui_focus_manager_calc_register(m, middle, root, NULL);
1092 efl_ui_focus_manager_calc_register(m, south, root, NULL); 1054 efl_ui_focus_manager_calc_register(m, south, root, NULL);
1093 efl_ui_focus_manager_calc_register(m, north, root, NULL); 1055 efl_ui_focus_manager_calc_register(m, north, root, NULL);
diff --git a/src/tests/elementary/efl_ui_test_focus_common.c b/src/tests/elementary/efl_ui_test_focus_common.c
index c025d2833f..375031861a 100644
--- a/src/tests/elementary/efl_ui_test_focus_common.c
+++ b/src/tests/elementary/efl_ui_test_focus_common.c
@@ -2,6 +2,8 @@
2 2
3#include "efl_ui_test_focus_common.h" 3#include "efl_ui_test_focus_common.h"
4 4
5//#define DEBUG
6
5#define Q(o,_x,_y,_w,_h) \ 7#define Q(o,_x,_y,_w,_h) \
6 do {\ 8 do {\
7 Eina_Rect rect; \ 9 Eina_Rect rect; \
@@ -42,15 +44,28 @@ focus_test_setup_cross(Efl_Ui_Focus_Object **middle,
42 44
43 45
44Efl_Ui_Focus_Manager* 46Efl_Ui_Focus_Manager*
45focus_test_manager_new(Efl_Ui_Focus_Object **middle) 47focus_test_manager_new(Efl_Ui_Focus_Object **middle, Eina_Bool is_root)
46{ 48{
47 Efl_Ui_Focus_Object *root; 49 Efl_Ui_Focus_Object *root;
48 Efl_Ui_Focus_Manager *m; 50 Efl_Ui_Focus_Manager *m;
49 51
50 root = focus_test_object_new("middle", 40, 40, 20, 20); 52
53 if (!is_root)
54 {
55 root = focus_test_object_new("middle", 40, 40, 20, 20);
56 }
57 else
58 {
59
60 root = efl_add_ref(FOCUS_MANAGER_TEST_CLASS, NULL,
61 efl_name_set(efl_added, "middle")
62 );
63 Q(root, 40,40,20,20);
64 }
51 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL, 65 m = efl_add_ref(EFL_UI_FOCUS_MANAGER_CALC_CLASS, NULL,
52 efl_ui_focus_manager_root_set(efl_added, root) 66 efl_ui_focus_manager_root_set(efl_added, root)
53 ); 67 );
68
54 if (middle) 69 if (middle)
55 *middle = root; 70 *middle = root;
56 71
@@ -79,7 +94,9 @@ EOLIAN static void
79_focus_test_efl_ui_focus_object_focus_set(Eo *obj, Focus_Test_Data *pd, Eina_Bool focus) 94_focus_test_efl_ui_focus_object_focus_set(Eo *obj, Focus_Test_Data *pd, Eina_Bool focus)
80{ 95{
81 pd->focus = focus; 96 pd->focus = focus;
97#ifdef DEBUG
82 printf("Object %p now focused\n", obj); 98 printf("Object %p now focused\n", obj);
99#endif
83 efl_ui_focus_object_focus_set(efl_super(obj, FOCUS_TEST_CLASS), focus); 100 efl_ui_focus_object_focus_set(efl_super(obj, FOCUS_TEST_CLASS), focus);
84} 101}
85 102
@@ -121,3 +138,9 @@ _focus_test_manager_set(Eo *obj EINA_UNUSED, Focus_Test_Data *pd, Efl_Ui_Focus_M
121 138
122 139
123#include "focus_test.eo.c" 140#include "focus_test.eo.c"
141
142typedef struct {
143
144} Focus_Manager_Test_Data;
145
146#include "focus_manager_test.eo.c"
diff --git a/src/tests/elementary/efl_ui_test_focus_common.h b/src/tests/elementary/efl_ui_test_focus_common.h
index fc17edbb94..ceda6a0074 100644
--- a/src/tests/elementary/efl_ui_test_focus_common.h
+++ b/src/tests/elementary/efl_ui_test_focus_common.h
@@ -10,6 +10,7 @@
10#include <Efl_Ui.h> 10#include <Efl_Ui.h>
11#include "efl_ui_suite.h" 11#include "efl_ui_suite.h"
12#include "focus_test.eo.h" 12#include "focus_test.eo.h"
13#include "focus_manager_test.eo.h"
13 14
14#define TEST_OBJ_NEW(name, x, y, w, h) \ 15#define TEST_OBJ_NEW(name, x, y, w, h) \
15 Efl_Ui_Focus_Object* name; \ 16 Efl_Ui_Focus_Object* name; \
@@ -24,5 +25,5 @@ void focus_test_setup_cross(Efl_Ui_Focus_Object **middle,
24 Efl_Ui_Focus_Object **east, 25 Efl_Ui_Focus_Object **east,
25 Efl_Ui_Focus_Object **west); 26 Efl_Ui_Focus_Object **west);
26 27
27Efl_Ui_Focus_Manager *focus_test_manager_new(Efl_Ui_Focus_Object **middle); 28Efl_Ui_Focus_Manager *focus_test_manager_new(Efl_Ui_Focus_Object **middle, Eina_Bool);
28#endif 29#endif
diff --git a/src/tests/elementary/focus_manager_test.eo b/src/tests/elementary/focus_manager_test.eo
new file mode 100644
index 0000000000..5d334b1777
--- /dev/null
+++ b/src/tests/elementary/focus_manager_test.eo
@@ -0,0 +1,4 @@
1class @beta Focus_Manager_Test extends Focus.Test implements Efl.Ui.Focus.Manager_Window_Root
2{
3
4}
diff --git a/src/tests/elementary/meson.build b/src/tests/elementary/meson.build
index edea9537dc..9eb1b50fdb 100644
--- a/src/tests/elementary/meson.build
+++ b/src/tests/elementary/meson.build
@@ -1,6 +1,7 @@
1priv_eo_files = [ 1priv_eo_files = [
2 'focus_test.eo', 2 'focus_test.eo',
3 'focus_test_sub_main.eo' 3 'focus_test_sub_main.eo',
4 'focus_manager_test.eo'
4] 5]
5 6
6priv_eo_file_target = [] 7priv_eo_file_target = []