elm_bg: Update elm_bg_add test
authorse.osadchy <se.osadchy@samsung.com>
Wed, 26 Apr 2017 12:11:54 +0000 (15:11 +0300)
committerse.osadchy <se.osadchy@samsung.com>
Wed, 26 Apr 2017 12:13:06 +0000 (15:13 +0300)
Change-Id: Id34aefad418a0e02bee4455b6a011fc0073fc2bb
Signed-off-by: Sergey Osadchy <se.osadchy@samsung.com>
TC/elementary/bg/utc_elm_bg_add.c

index 501cbbd20ecce73a58b188237e74d73a73f17397..afc9bc1cf05019039aa2be2872804319537a53d7 100644 (file)
@@ -42,7 +42,7 @@ teardown(void)
 /**
  * @addtogroup elm_bg_add
  * @{
- * @objective Positive Test case checks if function call with valid value to add a new background
+ * @objective Positive Test case 01 checks if function call with valid value to add a new background
  * to the parent works properly and without segmentation fault
  * @n Input Data:
  * @li the window object
@@ -54,11 +54,11 @@ teardown(void)
  * @li Test passes if returned value is not NULL and there is no segmentation fault
  * @}
  */
-START_TEST(utc_elm_bg_add_p)
+START_TEST(utc_elm_bg_add_p1)
 {
    if (main_win == NULL)
      {
-        return;
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__);
      }
 
    Evas_Object *bg = NULL;
@@ -67,13 +67,69 @@ START_TEST(utc_elm_bg_add_p)
    if (bg == NULL)
      {
         ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__);
-        return;
      }
+
    printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
    evas_object_del(bg);
 }
 END_TEST
 
+/**
+ * @addtogroup elm_bg_add
+ * @{
+ * @objective Positive Test case 02 checks if function call with valid value to add a new background
+ * to the parent with precreated object works properly and without segmentation fault
+ * @n Input Data:
+ * @li the window object
+ *
+ * @procedure
+ * @step 1 Create box object with main window parent
+ * @step 2 Set box object as precreated bg object
+ * @step 3 Call elm_bg_add with valid value
+ *
+ * @passcondition
+ * @li Test passes if returned value is not NULL and there is no segmentation fault
+ * @}
+ */
+START_TEST(utc_elm_bg_add_p2)
+{
+   Evas_Object *bg = NULL;
+   Evas_Object *box = NULL;
+   Evas_Object *res_bg = NULL;
+
+   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)
+     {
+        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))
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   bg = elm_bg_add(main_win);
+   if (bg == NULL)
+     {
+        evas_object_del(box);
+        evas_object_del(res_bg);
+        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(bg);
+   evas_object_del(box);
+   evas_object_del(res_bg);
+}
+END_TEST
+
 /**
  * @addtogroup elm_bg_add
  * @{
@@ -94,8 +150,8 @@ START_TEST(utc_elm_bg_add_n)
    if (TEST_FAIL == UNITEST_FUNC_NEG_RET(NULL, elm_bg_add, main_win))
      {
         ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-        return;
      }
+
    printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__,__LINE__);
 }
 END_TEST
@@ -111,7 +167,8 @@ 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_bg_add_p);
+   tcase_add_test(tcase, utc_elm_bg_add_p1);
+   tcase_add_test(tcase, utc_elm_bg_add_p2);
    tcase_add_test(tcase, utc_elm_bg_add_n);
    suite_add_tcase(suite, tcase);