summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorShilpa Singh <shilpa.singh@samsung.com>2019-03-20 14:16:11 +0000
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-03-20 15:29:04 +0100
commite80169a844aaf9cf2f75a814c7561abd9a7bdd25 (patch)
tree7041b319730a8e6d063161c7aafb1b2688777e73 /src/tests
parent89d80ffc52086610f188df345f90e04a5539f5c1 (diff)
efl_access: Add attribute_del API, Add test cases for all access_object_attribute* APIs
Add attribute_del API, currently there is no provision to delete a particular attribute(key-value pair) from the attribute list of a widget. Add test cases for efl_access_attribute_append, efl_access_attributes_get, efl_access_attribute_del and efl_access_attributes_clear API Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de> Reviewed-by: Shinwoo Kim <cinoo.kim@samsung.com> Differential Revision: https://phab.enlightenment.org/D8386
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/efl_ui_test_atspi.c118
1 files changed, 118 insertions, 0 deletions
diff --git a/src/tests/elementary/efl_ui_test_atspi.c b/src/tests/elementary/efl_ui_test_atspi.c
index 9aa046351c..4b9a68172f 100644
--- a/src/tests/elementary/efl_ui_test_atspi.c
+++ b/src/tests/elementary/efl_ui_test_atspi.c
@@ -451,6 +451,120 @@ EFL_START_TEST(test_efl_access_object_relationships_clear)
451} 451}
452EFL_END_TEST 452EFL_END_TEST
453 453
454EFL_START_TEST(test_efl_access_object_attribute_append)
455{
456 Eina_List *attr_list = NULL, *l = NULL;
457 Efl_Access_Attribute *attr = NULL;
458 generate_app();
459 efl_access_object_attribute_append(g_btn, "color1", "red");
460 efl_access_object_attribute_append(g_btn, "color2", "blue");
461 efl_access_object_attribute_append(g_btn, "color3", "green");
462 attr_list = efl_access_object_attributes_get(g_btn);
463
464 ck_assert(attr_list != NULL);
465 EINA_LIST_FOREACH(attr_list, l, attr)
466 {
467 if (!strcmp(attr->key, "color1"))
468 ck_assert_str_eq(attr->value, "red");
469 else if (!strcmp(attr->key, "color2"))
470 ck_assert_str_eq(attr->value, "blue");
471 else if (!strcmp(attr->key, "color3"))
472 ck_assert_str_eq(attr->value, "green");
473 }
474 EINA_LIST_FREE(attr_list, attr)
475 {
476 eina_stringshare_del(attr->key);
477 eina_stringshare_del(attr->value);
478 free(attr);
479 }
480}
481EFL_END_TEST
482
483EFL_START_TEST(test_efl_access_object_attributes_get)
484{
485 Eina_List *attr_list = NULL, *l = NULL;
486 Efl_Access_Attribute *attr = NULL;
487 generate_app();
488 efl_access_object_attribute_append(g_btn, "color1", "red");
489 efl_access_object_attribute_append(g_btn, "color2", "blue");
490 efl_access_object_attribute_append(g_btn, "color3", "green");
491 attr_list = efl_access_object_attributes_get(g_btn);
492
493 ck_assert(attr_list != NULL);
494 EINA_LIST_FOREACH(attr_list, l, attr)
495 {
496 if (!strcmp(attr->key, "color1"))
497 ck_assert_str_eq(attr->value, "red");
498 else if (!strcmp(attr->key, "color2"))
499 ck_assert_str_eq(attr->value, "blue");
500 else if (!strcmp(attr->key, "color3"))
501 ck_assert_str_eq(attr->value, "green");
502 }
503 EINA_LIST_FREE(attr_list, attr)
504 {
505 eina_stringshare_del(attr->key);
506 eina_stringshare_del(attr->value);
507 free(attr);
508 }
509}
510EFL_END_TEST
511
512EFL_START_TEST(test_efl_access_object_attribute_del)
513{
514 Eina_List *attr_list = NULL;
515 Efl_Access_Attribute *attr = NULL;
516 int count1 = 0;
517 int count2 = 0;
518 generate_app();
519 efl_access_object_attribute_append(g_btn, "color1", "red");
520 efl_access_object_attribute_append(g_btn, "color2", "blue");
521 efl_access_object_attribute_append(g_btn, "color3", "green");
522 attr_list = efl_access_object_attributes_get(g_btn);//default attributes are added again
523 ck_assert(attr_list != NULL);
524 count1 = eina_list_count(attr_list);
525 EINA_LIST_FREE(attr_list, attr)
526 {
527 eina_stringshare_del(attr->key);
528 eina_stringshare_del(attr->value);
529 free(attr);
530 }
531 attr_list = NULL;
532 efl_access_object_attribute_del(g_btn, "color4");//non existent key deletion
533 efl_access_object_attribute_del(g_btn, "color3");//existing key deletion
534 attr_list = efl_access_object_attributes_get(g_btn);
535 ck_assert(attr_list != NULL);
536 count2 = eina_list_count(attr_list);
537 ck_assert(count1 == (count2+1));
538 EINA_LIST_FREE(attr_list, attr)
539 {
540 eina_stringshare_del(attr->key);
541 eina_stringshare_del(attr->value);
542 free(attr);
543 }
544}
545EFL_END_TEST
546
547EFL_START_TEST(test_efl_access_object_attributes_clear)
548{
549 Eina_List *attr_list = NULL;
550 Efl_Access_Attribute *attr = NULL;
551 generate_app();
552 efl_access_object_attribute_append(g_btn, "color1", "red");
553 efl_access_object_attribute_append(g_btn, "color2", "blue");
554 efl_access_object_attribute_append(g_btn, "color3", "green");
555 efl_access_object_attributes_clear(g_btn);
556 attr_list = efl_access_object_attributes_get(g_btn);//default attributes are added again
557 ck_assert(attr_list != NULL);
558 ck_assert(eina_list_count(attr_list) <= 2);
559 EINA_LIST_FREE(attr_list, attr)
560 {
561 eina_stringshare_del(attr->key);
562 eina_stringshare_del(attr->value);
563 free(attr);
564 }
565}
566EFL_END_TEST
567
454void efl_ui_test_atspi(TCase *tc) 568void efl_ui_test_atspi(TCase *tc)
455{ 569{
456 tcase_add_test(tc, test_efl_access_app_obj_name_get); 570 tcase_add_test(tc, test_efl_access_app_obj_name_get);
@@ -469,4 +583,8 @@ void efl_ui_test_atspi(TCase *tc)
469 tcase_add_test(tc, test_efl_access_object_relationship_append); 583 tcase_add_test(tc, test_efl_access_object_relationship_append);
470 tcase_add_test(tc, test_efl_access_object_relationship_remove); 584 tcase_add_test(tc, test_efl_access_object_relationship_remove);
471 tcase_add_test(tc, test_efl_access_object_relationships_clear); 585 tcase_add_test(tc, test_efl_access_object_relationships_clear);
586 tcase_add_test(tc, test_efl_access_object_attribute_append);
587 tcase_add_test(tc, test_efl_access_object_attributes_get);
588 tcase_add_test(tc, test_efl_access_object_attribute_del);
589 tcase_add_test(tc, test_efl_access_object_attributes_clear);
472} 590}