ecore_wl2: add TC for ecore_wl2_subsurface_window_get 97/262297/1
authorShinwoo Kim <cinoo.kim@samsung.com>
Fri, 6 Aug 2021 05:48:05 +0000 (14:48 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Fri, 6 Aug 2021 05:48:05 +0000 (14:48 +0900)
This patch is related to ACR-1642.
We are providing ecore_wl2_subsurface_window_get as a managed API.

Change-Id: Iebb36c5e0495ffa0d3c7856bc0e56e14e2aacec7

TC/ecore/ecore_wl2/tslist
TC/ecore/ecore_wl2/tslist_fhub
TC/ecore/ecore_wl2/tslist_mobile
TC/ecore/ecore_wl2/tslist_tv
TC/ecore/ecore_wl2/tslist_wear
TC/ecore/ecore_wl2/utc_ecore_wl2_subsurface_window_get.c [new file with mode: 0644]

index 3f8e27149f1ef8d8077126c6ee0a6a888298b468..53937e6d3845e838daf3fae2bb9856acfb3478dd 100644 (file)
@@ -61,3 +61,4 @@ utc_ecore_wl2_subsurface_exported_surface_resize.c
 utc_ecore_wl2_subsurface_exported_surface_transform_set.c
 utc_ecore_wl2_subsurface_exported_surface_sync_set.c
 utc_ecore_wl2_subsurface_exported_surface_commit.c
+utc_ecore_wl2_subsurface_window_get.c
index ce2d3ff8b860203b225d7ab15aa79ad3b2cefa8c..2e56ccd55b9bda716c8203c288b28ed46786cc13 100644 (file)
@@ -61,3 +61,4 @@ utc_ecore_wl2_subsurface_exported_surface_resize.c
 utc_ecore_wl2_subsurface_exported_surface_transform_set.c
 utc_ecore_wl2_subsurface_exported_surface_sync_set.c
 utc_ecore_wl2_subsurface_exported_surface_commit.c
+utc_ecore_wl2_subsurface_window_get.c
index 3f8e27149f1ef8d8077126c6ee0a6a888298b468..53937e6d3845e838daf3fae2bb9856acfb3478dd 100644 (file)
@@ -61,3 +61,4 @@ utc_ecore_wl2_subsurface_exported_surface_resize.c
 utc_ecore_wl2_subsurface_exported_surface_transform_set.c
 utc_ecore_wl2_subsurface_exported_surface_sync_set.c
 utc_ecore_wl2_subsurface_exported_surface_commit.c
+utc_ecore_wl2_subsurface_window_get.c
index 3f8e27149f1ef8d8077126c6ee0a6a888298b468..53937e6d3845e838daf3fae2bb9856acfb3478dd 100644 (file)
@@ -61,3 +61,4 @@ utc_ecore_wl2_subsurface_exported_surface_resize.c
 utc_ecore_wl2_subsurface_exported_surface_transform_set.c
 utc_ecore_wl2_subsurface_exported_surface_sync_set.c
 utc_ecore_wl2_subsurface_exported_surface_commit.c
+utc_ecore_wl2_subsurface_window_get.c
index 3f8e27149f1ef8d8077126c6ee0a6a888298b468..53937e6d3845e838daf3fae2bb9856acfb3478dd 100644 (file)
@@ -61,3 +61,4 @@ utc_ecore_wl2_subsurface_exported_surface_resize.c
 utc_ecore_wl2_subsurface_exported_surface_transform_set.c
 utc_ecore_wl2_subsurface_exported_surface_sync_set.c
 utc_ecore_wl2_subsurface_exported_surface_commit.c
+utc_ecore_wl2_subsurface_window_get.c
diff --git a/TC/ecore/ecore_wl2/utc_ecore_wl2_subsurface_window_get.c b/TC/ecore/ecore_wl2/utc_ecore_wl2_subsurface_window_get.c
new file mode 100644 (file)
index 0000000..20e0a6d
--- /dev/null
@@ -0,0 +1,163 @@
+#include <check.h>
+#include <Eina.h>
+#include <Ecore.h>
+#include <Ecore_Wayland2.h> // use managed header instead of Ecore_Wl2.h
+#include "utc_ecore_wl2_common.h"
+
+static Eina_Bool startup_status = EINA_FALSE;
+static Ecore_Timer *timer_exit = NULL;
+
+/**
+ * @addtogroup ecore_wl2
+ * @{
+ * @defgroup ecore_wl2_subsurface_window_get ecore_wl2_subsurface_window_get()
+ *
+ * @precondition
+ * @step 1 Initialize Ecore_Wl2 with ecore_wl2_init()
+ */
+static void
+setup(void)
+{
+   printf(" ============ Startup ============ \n");
+   if (ecore_wl2_init())
+     {
+        startup_status = EINA_TRUE;
+     }
+}
+
+static void
+teardown(void)
+{
+   ecore_wl2_shutdown();
+   printf(" ============ Cleanup ============ \n");
+}
+
+static Eina_Bool _timer_cb(void *data)
+{
+   Ecore_Wl2_Subsurface *ss;
+   Ecore_Wl2_Display *ewd = NULL;
+   //Connect the display.
+   ewd  = ecore_wl2_display_connect(NULL);
+   if (!ewd)
+     {
+        ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (The returned value is wrong)", __FILE__, __LINE__);
+        goto quit_main_loop;
+     }
+
+   if (CHECK_TV_PROFILE()) ecore_wl2_display_sync(ewd);
+
+   Ecore_Wl2_Window *win = NULL;
+   win = ecore_wl2_window_new(ewd, NULL, 0, 0, 1, 1);
+   if (!win)
+     {
+        ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (The returned value is wrong)", __FILE__, __LINE__);
+        goto quit_main_loop;
+     }
+
+   ss = ecore_wl2_subsurface_new(win);
+   if (!ss)
+     {
+        ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (The returned value is wrong)", __FILE__, __LINE__);
+        goto quit_main_loop;
+     }
+
+   Ecore_Wl2_Window *win2 = NULL;
+   win2 = ecore_wl2_subsurface_window_get(ss);
+   if (!win2)
+     {
+        ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (The returned value is wrong)", __FILE__, __LINE__);
+        goto quit_main_loop;
+     }
+
+   if (win != win2)
+     {
+        ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (The returned value is wrong)", __FILE__, __LINE__);
+        goto quit_main_loop;
+     }
+
+quit_main_loop:
+   ecore_main_loop_quit();
+
+   return ECORE_CALLBACK_DONE;
+}
+
+/**
+ * @addtogroup ecore_wl2_subsurface_window_get
+ * @{
+ * @objective Positive test case checks that the tested function calling without any errors.
+ * @n Input Data: none.
+ *
+ * @procedure
+ * @step 1 Call tested function.
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_wl2_subsurface_window_get_p)
+{
+   if (startup_status != EINA_TRUE)
+     {
+        ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+        return;
+     }
+
+   timer_exit = ecore_timer_add(0.2, _timer_cb, NULL);
+   if (!timer_exit)
+     {
+        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+     }
+
+   ecore_main_loop_begin();
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ * @addtogroup ecore_wl2_subsurface_window_get
+ * @{
+ * @objective Negative test case checks if function call with invalid value works without segmentation fault
+ * @n Input Data: none.
+ *
+ * @procedure
+ * @step 1 Call ecore_wl2_subsurface_window_get with invalid value instead of the Ecore_Wl2_Subsurface object
+ *
+ * @passcondition
+ * There is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_wl2_subsurface_window_get_n)
+{
+   Ecore_Wl2_Window *win = NULL;
+   if (startup_status != EINA_TRUE)
+     {
+        ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (startup was been executed unsuccessfully)..", __FILE__, __LINE__);
+        return;
+     }
+
+   win = ecore_wl2_subsurface_window_get(NULL);
+
+   if (win)
+     {
+        ck_abort_msg("[TEST_FAIL:: %s[%d] : Test has failed (The returned value is wrong)", __FILE__, __LINE__);
+        return;
+     }
+
+   printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
+/**
+ *@}
+ */
+
+TCase * _utc_ecore_wl2_subsurface_window_get()
+{
+   TCase *tcase = tcase_create("utc_ecore_wl2_subsurface_window_get");
+   tcase_set_timeout(tcase, 30);
+   tcase_add_checked_fixture(tcase, setup, teardown);
+   tcase_add_test(tcase, utc_ecore_wl2_subsurface_window_get_p);
+   tcase_add_test(tcase, utc_ecore_wl2_subsurface_window_get_n);
+   return tcase;
+}