ACR: Add elm_access_object tests pack(3)
authorse.osadchy <se.osadchy@samsung.com>
Wed, 3 May 2017 07:32:14 +0000 (10:32 +0300)
committerse.osadchy <se.osadchy@samsung.com>
Wed, 3 May 2017 07:33:02 +0000 (10:33 +0300)
Change-Id: Ice05427195fc13d7ddc08f06136b775a65430896
Signed-off-by: Sergey Osadchy <se.osadchy@samsung.com>
TC/elementary/elm_object/tslist
TC/elementary/elm_object/tslist_mobile
TC/elementary/elm_object/tslist_tv
TC/elementary/elm_object/tslist_wear
TC/elementary/elm_object/utc_elm_access_object.c [new file with mode: 0644]

index 146508ef63c9530e6aac13f9e2fa4ada1c8c724f..c0178bd654d872169046a285b20f13dc2361515b 100644 (file)
@@ -153,3 +153,4 @@ utc_elm_object_item_color_class_color3_set.c
 utc_elm_object_item_color_class_color3_get.c
 utc_elm_object_item_color_class_del.c
 utc_elm_object_item_color_class_clear.c
+utc_elm_access_object.c
index 146508ef63c9530e6aac13f9e2fa4ada1c8c724f..c0178bd654d872169046a285b20f13dc2361515b 100644 (file)
@@ -153,3 +153,4 @@ utc_elm_object_item_color_class_color3_set.c
 utc_elm_object_item_color_class_color3_get.c
 utc_elm_object_item_color_class_del.c
 utc_elm_object_item_color_class_clear.c
+utc_elm_access_object.c
index 22b564460f8d359848fc4b596a8228b9c43b9dc2..012361bac46a855a437756afc7e4a11982050331 100644 (file)
@@ -153,3 +153,4 @@ utc_elm_object_item_color_class_color3_set.c
 utc_elm_object_item_color_class_color3_get.c
 utc_elm_object_item_color_class_del.c
 utc_elm_object_item_color_class_clear.c
+utc_elm_access_object.c
index f98917ba79775915174e44fec29b586780bbcdcf..9349d27550bab9e1ef9a2da6777008ad8824b84b 100644 (file)
@@ -153,3 +153,4 @@ utc_elm_object_item_color_class_color3_set.c
 utc_elm_object_item_color_class_color3_get.c
 utc_elm_object_item_color_class_del.c
 utc_elm_object_item_color_class_clear.c
+utc_elm_access_object.c
diff --git a/TC/elementary/elm_object/utc_elm_access_object.c b/TC/elementary/elm_object/utc_elm_access_object.c
new file mode 100644 (file)
index 0000000..39b5dda
--- /dev/null
@@ -0,0 +1,151 @@
+#include <check.h>
+#include <Elementary.h>
+#include "../../utc_negative_unitest.h"
+
+Evas_Object *main_win = NULL, *lay = NULL;
+Eina_Bool file_set = EINA_TRUE;
+#define FILE "../layout/layout_example.edj"
+#define GROUP "example/mylayout"
+#define PART_NAME "example/title"
+
+/**
+ * @addtogroup elm_access
+ * @{
+ * @defgroup elm_access_object
+ * elm_access_object_register
+ * elm_access_object_unregister
+ * elm_access_object_get
+ *
+ * @precondition
+ * @step 1 Initialize Elementary
+ * @step 2 Create and show main window
+ * @step 3 Add a layout to the main window
+ * @step 4 Set edj file to layout
+ */
+
+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__);
+     }
+   evas_object_show(main_win);
+
+   lay = elm_layout_add(main_win);
+   if (lay == NULL)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Unable to add a layout to the main window..", __FILE__, __LINE__);
+     }
+   file_set = elm_layout_file_set(lay, FILE, GROUP);
+   if (file_set == EINA_FALSE)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Unable to set %s as the file that will be used as layout..", __FILE__, __LINE__, FILE);
+     }
+}
+
+static void
+teardown(void)
+{
+   if (main_win != NULL)
+     {
+        evas_object_del(main_win);
+        main_win = NULL;
+     }
+   elm_shutdown();
+   printf(" ============ Cleanup ============ \n");
+}
+
+/**
+ * @addtogroup elm_access_object
+ * @{
+ * @objective The positive Test case check work of functions without errors
+ *
+ * @procedure
+ * @step 1 Gets the evas object from a part of layout
+ * @step 2 Register evas object as an accessible object by call elm_access_object_register()
+ * @step 3 Get an accessible object of the evas object by call elm_access_object_get()
+ * @step 4 Check result
+ * @step 5 Unregister accessible object by call elm_access_object_unregister()
+ * @step 6 Try get an accessible object
+ * @step 7 Check result
+ *
+ * @passcondition : All operations with access object was successful.
+ * @}
+ */
+START_TEST(utc_elm_access_object_p)
+{
+   Evas_Object *obj = NULL;
+   Evas_Object *reg_obj = NULL;
+   Evas_Object *res = NULL;
+
+   obj = (Evas_Object *)edje_object_part_object_get(elm_layout_edje_get(lay), PART_NAME);
+   if (obj == NULL)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   reg_obj = elm_access_object_register(obj, lay);
+   if (reg_obj == NULL)
+     {
+        evas_object_del(obj);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   res = elm_access_object_get(obj);
+   if ((res == NULL) || (res != reg_obj))
+     {
+        evas_object_del(obj);
+        evas_object_del(reg_obj);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   elm_access_object_unregister(obj);
+   res = elm_access_object_get(obj);
+   if (res != NULL)
+     {
+        evas_object_del(obj);
+        evas_object_del(reg_obj);
+        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_access_object");
+
+   TCase *tcase = tcase_create("TCase");
+   tcase_set_timeout(tcase, 30);
+   tcase_add_checked_fixture(tcase, setup, teardown);
+   tcase_add_test(tcase, utc_elm_access_object_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_access_object.log");
+   srunner_set_xml(srunner, "utc_elm_access_object.xml");
+   srunner_run_all(srunner, CK_NORMAL);
+   number_failed = srunner_ntests_failed(srunner);
+   srunner_free(srunner);
+
+   return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
+}