elm: Add test for elm_atspi_accessible_relationships_clear 97/153497/2
authorse.osadchy <se.osadchy@samsung.com>
Fri, 29 Sep 2017 15:51:36 +0000 (18:51 +0300)
committerse.osadchy <se.osadchy@samsung.com>
Fri, 29 Sep 2017 15:51:36 +0000 (18:51 +0300)
Change-Id: I0a8a72992ee7bc5992c71471a9ead514ce473403

TC/elementary/atspi/tslist
TC/elementary/atspi/tslist_mobile
TC/elementary/atspi/tslist_tv
TC/elementary/atspi/tslist_wear
TC/elementary/atspi/utc_elm_atspi_accessible_relationships_clear.c [new file with mode: 0644]

index 3f8e2d8de2d09fc2cf702f373013ffdf26a4f136..3e28a2719b57c3b3556ffa10bfd24baca60556e0 100644 (file)
@@ -7,6 +7,7 @@ utc_elm_atspi_accessible_role_set.c
 utc_elm_atspi_accessible_role_get.c
 utc_elm_atspi_accessible_relationship_append.c
 utc_elm_atspi_accessible_relationship_remove.c
+utc_elm_atspi_accessible_relationships_clear.c
 utc_elm_atspi_accessible_translation_domain_get.c
 utc_elm_atspi_accessible_translation_domain_set.c
 utc_elm_atspi_attributes.c
index 3f8e2d8de2d09fc2cf702f373013ffdf26a4f136..3e28a2719b57c3b3556ffa10bfd24baca60556e0 100644 (file)
@@ -7,6 +7,7 @@ utc_elm_atspi_accessible_role_set.c
 utc_elm_atspi_accessible_role_get.c
 utc_elm_atspi_accessible_relationship_append.c
 utc_elm_atspi_accessible_relationship_remove.c
+utc_elm_atspi_accessible_relationships_clear.c
 utc_elm_atspi_accessible_translation_domain_get.c
 utc_elm_atspi_accessible_translation_domain_set.c
 utc_elm_atspi_attributes.c
index 9c2722ebfa4ce2dbb3935e8b40949fb1dfa3ed87..c7865fd3045b700fd8c68efbb75cfc0b52d588be 100644 (file)
@@ -7,6 +7,7 @@ utc_elm_atspi_accessible_role_set.c
 utc_elm_atspi_accessible_role_get.c
 utc_elm_atspi_accessible_relationship_append.c
 utc_elm_atspi_accessible_relationship_remove.c
+utc_elm_atspi_accessible_relationships_clear.c
 utc_elm_atspi_accessible_translation_domain_get.c
 utc_elm_atspi_accessible_translation_domain_set.c
 #utc_elm_atspi_attributes.c
index 986fc382ae03c33765e53a3d5d4d5294ccfcf7e0..448cffb0469c667289278d2f0a8a9f089c3dc25a 100644 (file)
@@ -7,6 +7,7 @@ utc_elm_atspi_accessible_role_set.c
 utc_elm_atspi_accessible_role_get.c
 utc_elm_atspi_accessible_relationship_append.c
 utc_elm_atspi_accessible_relationship_remove.c
+utc_elm_atspi_accessible_relationships_clear.c
 utc_elm_atspi_accessible_translation_domain_get.c
 utc_elm_atspi_accessible_translation_domain_set.c
 #utc_elm_atspi_attributes.c
diff --git a/TC/elementary/atspi/utc_elm_atspi_accessible_relationships_clear.c b/TC/elementary/atspi/utc_elm_atspi_accessible_relationships_clear.c
new file mode 100644 (file)
index 0000000..bcecc4e
--- /dev/null
@@ -0,0 +1,130 @@
+#include <check.h>
+#define EFL_BETA_API_SUPPORT
+#include <Elementary.h>
+Evas_Object *main_win = NULL;
+Evas_Object *label = NULL;
+
+/**
+ * @addtogroup elm_atspi
+ * @{
+ * @defgroup elm_atspi_accessible_relationships_clear elm_atspi_accessible_relationships_clear()
+ *
+ * @precondition
+ * @step 1 Initialize Elementary
+ * @step 2 Create and show main window
+ */
+
+static void
+setup(void)
+{
+   printf(" ============ Startup ============ \n");
+   elm_init(0, NULL);
+   main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
+   if (main_win == NULL)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Unable to create a main window..", __FILE__, __LINE__);
+     }
+   label = elm_label_add(main_win);
+   evas_object_show(main_win);
+   evas_object_show(label);
+}
+
+static void
+teardown(void)
+{
+   if (main_win != NULL)
+     {
+        evas_object_del(main_win);
+        main_win = NULL;
+     }
+
+   elm_shutdown();
+   printf(" ============ Cleanup ============ \n");
+}
+
+/**
+ * @addtogroup elm_atspi_accessible_relationships_clear
+ * @{
+ * @objective Positive test case checks if relationships clear works properly
+ * @n Input Data:
+ * @li pointer to elm_button object.
+ *
+ * @procedure
+ * @step 1 Set text on elm_button with elm_object_text_set.
+ * @step 2 Append 2 new relations with elm_atspi_accessible_relationship_append.
+ * @step 3 Call elm_atspi_accessible_relation_set_get and check result.
+ * @step 4 Call elm_atspi_accessible_relationships_clear() for clear relation.
+ * @step 5 Call elm_atspi_accessible_relation_set_get for check NULL relation.
+ *
+ * @passcondition
+ * @li Test passes if all comprarisons pass and there is no segmentation fault
+ * @}
+ */
+START_TEST(utc_elm_atspi_accessible_relationships_clear_p)
+{
+   if (main_win == NULL)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__);
+     }
+
+   Evas_Object *btn = NULL;
+
+   btn = elm_button_add(main_win);
+   elm_object_text_set(btn, "Other text");
+
+   if (!elm_atspi_accessible_relationship_append(btn, ELM_ATSPI_RELATION_FLOWS_TO, label))
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__);
+     }
+   if (!elm_atspi_accessible_relationship_append(btn, ELM_ATSPI_RELATION_FLOWS_FROM, main_win))
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__);
+     }
+   if (!elm_atspi_accessible_relation_set_get(btn))
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__);
+     }
+
+   elm_atspi_accessible_relationships_clear(btn);
+
+   if (elm_atspi_accessible_relation_set_get(btn))
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__);
+     }
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ *@}
+ */
+Suite *
+test_suite(void)
+{
+   Suite *suite = suite_create("utc_elm_atspi_accessible_relationships_clear");
+
+   TCase *tcase = tcase_create("TCase");
+   tcase_set_timeout(tcase, 30);
+   tcase_add_checked_fixture(tcase, setup, teardown);
+   tcase_add_test(tcase, utc_elm_atspi_accessible_relationships_clear_p);
+   suite_add_tcase(suite, tcase);
+
+   return suite;
+}
+
+int
+main()
+{
+   int number_failed;
+
+   Suite *suite = test_suite();
+   SRunner *srunner = srunner_create(suite);
+   srunner_set_log(srunner, "utc_elm_atspi_accessible_relationships_clear.log");
+   srunner_set_xml(srunner, "utc_elm_atspi_accessible_relationships_clear.xml");
+   srunner_run_all(srunner, CK_NORMAL);
+   number_failed = srunner_ntests_failed(srunner);
+   srunner_free(srunner);
+
+   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}