elm: Update elm_conformant_add test
authorse.osadchy <se.osadchy@samsung.com>
Wed, 26 Apr 2017 12:25:57 +0000 (15:25 +0300)
committerse.osadchy <se.osadchy@samsung.com>
Wed, 26 Apr 2017 12:26:13 +0000 (15:26 +0300)
Change-Id: I84b6fc47190337049028d41341ffdcacc8ea49bd
Signed-off-by: Sergey Osadchy <se.osadchy@samsung.com>
TC/elementary/conformant/utc_elm_conformant_add.c

index 055eb491862c62938fba372432f2a77a2ada164b..a42c4219d9f820c450cc1284267fe8c7a820246d 100644 (file)
@@ -18,11 +18,11 @@ 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__);
-        return;
      }
 }
 
@@ -41,7 +41,7 @@ teardown(void)
 /**
  * @addtogroup elm_conformant_add
  * @{
- * @objective Positive Test case checks if function call with valid value to add a new conformant widget
+ * @objective Positive Test case 01 checks if function call with valid value to add a new conformant widget
  * to the given parent Elementary (container) object works properly and without segmentation fault
  * @n Input Data:
  * @li the window object
@@ -53,11 +53,11 @@ teardown(void)
  * @li Test passes if returned value is not NULL and there is no segmentation fault
  * @}
  */
-START_TEST(utc_elm_conformant_add_p)
+START_TEST(utc_elm_conformant_add_p1)
 {
    if (main_win == NULL)
      {
-        return;
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__);
      }
 
    Evas_Object *conformant = NULL;
@@ -66,10 +66,69 @@ START_TEST(utc_elm_conformant_add_p)
    if (conformant == 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(conformant);
+}
+END_TEST
+
+/**
+ * @addtogroup elm_conformant_add
+ * @{
+ * @objective Positive Test case 02 checks if function call with valid value to add a new conformant widget
+ * with precreated object to the given parent Elementary (container) 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 conformant object
+ * @step 3 Call elm_conformant_add with valid value
+ *
+ * @passcondition
+ * @li Test passes if returned value is not NULL and there is no segmentation fault
+ * @}
+ */
+START_TEST(utc_elm_conformant_add_p2)
+{
+   Evas_Object *conformant = NULL;
+   Evas_Object *box = NULL;
+   Evas_Object *ret = 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)
+     {
+        evas_object_del(box);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__,__LINE__);
+     }
+
+   elm_conformant_precreated_object_set(box);
+   ret = elm_conformant_precreated_object_get();
+   if ((ret == NULL) || (ret != box))
+     {
+        evas_object_del(ret);
+        evas_object_del(box);
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   conformant = elm_conformant_add(main_win);
+   if (conformant == NULL)
+     {
+        evas_object_del(ret);
+        evas_object_del(box);
+        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(conformant);
+   evas_object_del(ret);
+   evas_object_del(box);
 }
 END_TEST
 
@@ -93,7 +152,6 @@ START_TEST(utc_elm_conformant_add_n)
    if (TEST_FAIL == UNITEST_FUNC_NEG_RET(NULL, elm_conformant_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__);
 }
@@ -110,7 +168,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_conformant_add_p);
+   tcase_add_test(tcase, utc_elm_conformant_add_p1);
+   tcase_add_test(tcase, utc_elm_conformant_add_p2);
    tcase_add_test(tcase, utc_elm_conformant_add_n);
    suite_add_tcase(suite, tcase);