elm_win: Update elm_win_add test
authorse.osadchy <se.osadchy@samsung.com>
Tue, 25 Apr 2017 07:25:48 +0000 (10:25 +0300)
committerse.osadchy <se.osadchy@samsung.com>
Tue, 25 Apr 2017 07:26:25 +0000 (10:26 +0300)
Change-Id: I48adcd55f1e62ba9d4362a08712425d61b1942a9
Signed-off-by: Sergey Osadchy <se.osadchy@samsung.com>
TC/elementary/win/utc_elm_win_add.c

index c6b3a0de08c0786ce0fb09b34a79ba9ce8edfdeb..8ca34ac1b425da2cca833c9d5abdbbdff697e700 100644 (file)
@@ -27,7 +27,7 @@ teardown(void)
 /**
  * @addtogroup elm_win_add
  * @{
- * @objective Positive test case checks if function call with valid values to add the window
+ * @objective Positive test case 01 checks if function call with valid values to add the window
  * object works properly and without segmentation fault
  * @n Input Data:
  * @li NULL instead of the parent object to add the window to
@@ -44,7 +44,7 @@ teardown(void)
  * Note! elm_win_add returns NULL only if the 1st parameter equal to NULL and the 3rd parameter equal to ELM_WIN_INLINED_IMAGE
  * @}
  */
-START_TEST(utc_elm_win_add_p)
+START_TEST(utc_elm_win_add_p1)
 {
    Evas_Object *main_win = NULL;
 
@@ -58,6 +58,144 @@ START_TEST(utc_elm_win_add_p)
 }
 END_TEST
 
+/**
+ * @addtogroup elm_win_add
+ * @{
+ * @objective Positive test case 02 checks if function call with valid values to add the window
+ * object works properly with precreated window object and without segmentation fault
+ * @n Input Data:
+ * @li main_win instead of the parent object to add the basic window
+ * @li "basic" as the name of the window
+ * @li ELM_WIN_BASIC as the window type
+ *
+ * @procedure
+ * @step 1 Create main window object
+ * @step 2 Create box object with main window parent
+ * @step 3 Set box object as precreated window object
+ * @step 4 Call elm_win_add with valid values and main window parent
+ *
+ * @passcondition
+ * @li Test passes if returned value is not NULL and there is no segmentation fault
+ * Note! elm_win_add returns NULL only if the 1st parameter equal to NULL and the 3rd parameter equal to ELM_WIN_INLINED_IMAGE
+ * @}
+ */
+START_TEST(utc_elm_win_add_p2)
+{
+   Evas_Object *main_win = NULL;
+   Evas_Object *win = NULL;
+   Evas_Object *box = NULL;
+   Evas_Object *res = NULL;
+
+   main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
+   if (main_win == NULL)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   box = elm_box_add(main_win);
+   if (box == NULL)
+     {
+        evas_object_del(main_win);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   elm_win_precreated_object_set(box);
+   res = elm_win_precreated_object_get();
+   if ((res == NULL) || (res != box))
+     {
+        evas_object_del(main_win);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   win = elm_win_add(main_win, "basic", ELM_WIN_BASIC);
+   if (win == NULL)
+     {
+        evas_object_del(main_win);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+   evas_object_del(main_win);
+}
+END_TEST
+
+/**
+ * @addtogroup elm_win_add
+ * @{
+ * @objective Positive test case 03 checks if function call with valid values to add the inlined
+ * window object works properly with precreated window object and without segmentation fault
+ * @n Input Data:
+ * @li main_win instead of the parent object to add the inline window
+ * @li "inlined" as the name of the window
+ * @li ELM_WIN_INLINED_IMAGE as the window type
+ *
+ * @procedure
+ * @step 1 Create main window object
+ * @step 2 Create box object with main window parent
+ * @step 3 Set box object as precreated window object
+ * @step 4 Set box object as precreated bg object
+ * @step 5 Set box object as precreated conformat object
+ * @step 6 Create inlined window with main window parent
+ *
+ * @passcondition
+ * @li Test passes if returned value is not NULL and there is no segmentation fault
+ * Note! elm_win_add returns NULL only if the 1st parameter equal to NULL and the 3rd parameter equal to ELM_WIN_INLINED_IMAGE
+ * @}
+*/
+START_TEST(utc_elm_win_add_p3)
+{
+   Evas_Object *main_win = NULL;
+   Evas_Object *inl_win = NULL;
+   Evas_Object *box = NULL;
+   Evas_Object *res_box = NULL;
+   Evas_Object *res_bg = NULL;
+   Evas_Object *res_conf = NULL;
+
+   main_win = elm_win_add(NULL, "main", ELM_WIN_BASIC);
+   if (main_win == NULL)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   box = elm_box_add(main_win);
+   if (box == NULL)
+     {
+        evas_object_del(main_win);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   elm_win_precreated_object_set(box);
+   res_box = elm_win_precreated_object_get();
+   if ((res_box == NULL) || (res_box != box))
+     {
+        evas_object_del(main_win);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   elm_bg_precreated_object_set(box);
+   res_bg = elm_bg_precreated_object_get();
+   if ((res_bg == NULL) || (res_bg != box))
+     {
+        evas_object_del(main_win);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+   elm_conformant_precreated_object_set(box);
+   res_conf = elm_conformant_precreated_object_get();
+   if ((res_conf == NULL) || (res_conf != box))
+     {
+        evas_object_del(main_win);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   inl_win = elm_win_add(main_win, "inlined", ELM_WIN_INLINED_IMAGE);
+   if (inl_win == NULL)
+     {
+        evas_object_del(main_win);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+   evas_object_del(main_win);
+}
+END_TEST
+
 /**
  * @addtogroup elm_win_add
  * @{
@@ -122,7 +260,9 @@ test_suite(void)
    TCase *tcase = tcase_create("TCase");
    tcase_set_timeout(tcase, 30);
    tcase_add_checked_fixture(tcase, setup, teardown);
-   tcase_add_test(tcase, utc_elm_win_add_p);
+   tcase_add_test(tcase, utc_elm_win_add_p1);
+   tcase_add_test(tcase, utc_elm_win_add_p2);
+   tcase_add_test(tcase, utc_elm_win_add_p3);
 #ifdef NOT_APPROVED_FOR_BUILD
    tcase_add_test(tcase, utc_elm_win_add_n);
 #endif