canvas evas_event: revise tc code. 38/210838/5
authorHermet Park <hermetpark@gmail.com>
Thu, 25 Jul 2019 07:21:43 +0000 (16:21 +0900)
committerHermet Park <hermetpark@gmail.com>
Fri, 26 Jul 2019 05:17:03 +0000 (14:17 +0900)
Use timer to quit mainloop successfully.

Change-Id: I3c091cfbda081d99fb9ebefd85e9872ef9c424a7

TC/evas/canvas/evas_events/utc_evas_post_event_callback_push.c
TC/evas/canvas/evas_events/utc_evas_post_event_callback_remove.c
TC/evas/canvas/evas_events/utc_evas_post_event_callback_remove_full.c

index c8c1c3aaaa0293bedb9869386028755dbbe7a34f..416928d70b78ef1880ac72bcf003284e623b4ad7 100644 (file)
@@ -14,7 +14,6 @@ static struct
    Eina_Bool post_event_callback_01_call_status;
    Eina_Bool post_event_callback_02_call_status;
    Eina_Bool evas_event_resize_callback_call_status;
-   Eina_Bool force_quit_timer_callback_status;
 } callBackCallsStatus;
 
 static void initCallBackCallsStatus()
@@ -22,7 +21,6 @@ static void initCallBackCallsStatus()
    callBackCallsStatus.post_event_callback_01_call_status = EINA_FALSE;
    callBackCallsStatus.post_event_callback_02_call_status = EINA_FALSE;
    callBackCallsStatus.evas_event_resize_callback_call_status = EINA_FALSE;
-   callBackCallsStatus.force_quit_timer_callback_status = EINA_FALSE;
 }
 static const char *data_passed_to_callback_1 = "The data pointer to be passed to the evas_post_event_callback 1";
 static const char *data_passed_to_callback_2 = "The data pointer to be passed to the evas_post_event_callback 2";
@@ -80,8 +78,6 @@ static Eina_Bool evas_object_event_post_cb_1(void *data, Evas *e EINA_UNUSED)
         return EINA_FALSE;
      }
 
-   ecore_main_loop_quit();
-
    callBackCallsStatus.post_event_callback_01_call_status = EINA_TRUE;
 
    return EINA_TRUE;
@@ -98,15 +94,11 @@ static void evas_event_resize_cb(void *data,
    evas_post_event_callback_push(canvas, evas_object_event_post_cb_2, data_passed_to_callback_2);
 }
 
-static Eina_Bool quit_cb(void *data EINA_UNUSED)
+static Eina_Bool timer_cb(void *data)
 {
    ecore_main_loop_quit();
 
-   callBackCallsStatus.force_quit_timer_callback_status = EINA_TRUE;
-
-   ck_abort_msg("[TEST_FAIL]:: %s[%d] : Force quit timer expired. Test has failed..", __FILE__, __LINE__);
-
-   return EINA_FALSE;
+   return ECORE_CALLBACK_CANCEL;
 }
 
 /**
@@ -120,18 +112,17 @@ static Eina_Bool quit_cb(void *data EINA_UNUSED)
  * @li data The data pointer to be passed to the callback
  *
  * @procedure
- * @step 1 Add timer for forced quit if couldn't quit from main loop
- * @step 2 Create a new Ecore_Evas based on engine name and common parameters
- * @step 3 Get an Ecore_Evas's Evas(Canvas)
- * @step 4 Add and set background.
- * @step 5 Register callback for Evas resize events.
- * @step 6 Push two callbacks on the post-event callback stack.
+ * @step 1 Create a new Ecore_Evas based on engine name and common parameters
+ * @step 2 Get an Ecore_Evas's Evas(Canvas)
+ * @step 3 Add and set background.
+ * @step 4 Register callback for Evas resize events.
+ * @step 5 Push two callbacks on the post-event callback stack.
  * First post-event callback call ecore_main_loop_quit.
  * It must be called after second post-event callback, because
  * of FIFO structure of post-event callback calls.
- * @step 7 Resize Ecore_Evas and background.
- * @step 8 Run main loop.
- * @step 9 Check whether the all callbacks were called in declared in
+ * @step 6 Resize Ecore_Evas and background.
+ * @step 7 Run main loop.
+ * @step 8 Check whether the all callbacks were called in declared in
  * EFL description order and force quit timer was not expired
  * @step 10 Free Ecore_Evas.
  *
@@ -141,10 +132,6 @@ static Eina_Bool quit_cb(void *data EINA_UNUSED)
  */
 START_TEST(utc_evas_post_event_callback_push_p_01)
 {
-
-   const double quit_time = 1.0;
-   ecore_timer_add(quit_time, quit_cb, NULL);
-
    const int x = 10;
    const int y = 10;
    Ecore_Evas* ee = ecore_evas_new(NULL, x, y, WIDTH, HEIGHT, NULL);
@@ -174,9 +161,11 @@ START_TEST(utc_evas_post_event_callback_push_p_01)
    ecore_evas_resize(ee, NEW_WIDTH, NEW_HEIGHT);
    evas_object_resize(bg, NEW_WIDTH, NEW_HEIGHT);
 
+   ecore_timer_add(1, timer_cb, NULL);
+
    ecore_main_loop_begin();
 
-   if (callBackCallsStatus.post_event_callback_01_call_status != EINA_TRUE || callBackCallsStatus.force_quit_timer_callback_status == EINA_TRUE)
+   if (callBackCallsStatus.post_event_callback_01_call_status != EINA_TRUE)
      {
         ecore_evas_free(ee);
         ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
index 29616f190ff152fd81dbcf5465bcc23957b2f6a7..2ceead0889979d6230d4e890e2612917e054271d 100644 (file)
@@ -13,14 +13,12 @@ static struct
 {
    Eina_Bool post_event_callback_01_call_status;
    Eina_Bool post_event_callback_02_call_status;
-   Eina_Bool force_quit_timer_callback_status;
 } callBackCallsStatus;
 
 static void initCallBackCallsStatus()
 {
    callBackCallsStatus.post_event_callback_01_call_status = EINA_FALSE;
    callBackCallsStatus.post_event_callback_02_call_status = EINA_FALSE;
-   callBackCallsStatus.force_quit_timer_callback_status = EINA_FALSE;
 }
 
 /**
@@ -52,8 +50,6 @@ static Eina_Bool evas_object_event_post_cb_1(void *data EINA_UNUSED, Evas *e EIN
 {
    callBackCallsStatus.post_event_callback_01_call_status = EINA_TRUE;
 
-   ecore_main_loop_quit();
-
    return EINA_FALSE;
 }
 
@@ -78,15 +74,11 @@ static void evas_event_resize_cb(void *data,
    evas_post_event_callback_remove(canvas, evas_object_event_post_cb_2);
 }
 
-static Eina_Bool quit_cb(void *data EINA_UNUSED)
+static Eina_Bool timer_cb(void *data)
 {
    ecore_main_loop_quit();
 
-   callBackCallsStatus.force_quit_timer_callback_status = EINA_TRUE;
-
-   ck_abort_msg("[TEST_FAIL]:: %s[%d] : Force quit timer expired. Test has failed..", __FILE__, __LINE__);
-
-   return EINA_FALSE;
+   return ECORE_CALLBACK_CANCEL;
 }
 
 /**
@@ -99,21 +91,20 @@ static Eina_Bool quit_cb(void *data EINA_UNUSED)
  * @li func The function that to be called when the stack is unwound
  *
  * @procedure
- * @step 1 Add timer for forced quit if couldn't quit from main loop
- * @step 2 Create a new Ecore_Evas based on engine name and common parameters
- * @step 3 Get an Ecore_Evas's Evas(Canvas)
- * @step 4 Set a callback for Ecore_Evas resize events.
- * @step 5 Register a callback function to a given canvas
+ * @step 1 Create a new Ecore_Evas based on engine name and common parameters
+ * @step 2 Get an Ecore_Evas's Evas(Canvas)
+ * @step 3 Set a callback for Ecore_Evas resize events.
+ * @step 4 Register a callback function to a given canvas
  * event(EVAS_CALLBACK_RENDER_FLUSH_POST). Called just after rendering
  * is updated on the canvas target
- * @step 6 Push callback evas_object_event_post_cb_1 and evas_object_event_post_cb_2
+ * @step 5 Push callback evas_object_event_post_cb_1 and evas_object_event_post_cb_2
  * on the post-event callback stack
- * @step 7 Remove callback evas_object_event_post_cb_2 from the post-event callback stack
- * @step 8 Resize an Ecore_Evas
- * @step 9 Run main loop
- * @step 10 Check whether the all callback evas_object_event_post_cb_2 was not called
+ * @step 6 Remove callback evas_object_event_post_cb_2 from the post-event callback stack
+ * @step 7 Resize an Ecore_Evas
+ * @step 8 Run main loop
+ * @step 9 Check whether the all callback evas_object_event_post_cb_2 was not called
  * and force quit timer was not expired
- * @step 11 Free Ecore_Evas.
+ * @step 10 Free Ecore_Evas.
  *
  * @passcondition Function Post event callback evas_object_event_post_cb_2 was
  * succesfully removed from post-event callback stack and there is no segmentation fault
@@ -121,10 +112,6 @@ static Eina_Bool quit_cb(void *data EINA_UNUSED)
  */
 START_TEST(utc_evas_post_event_callback_remove_p_01)
 {
-
-   const double quit_time = 1.0;
-   ecore_timer_add(quit_time, quit_cb, NULL);
-
    const int x = 10;
    const int y = 10;
    Ecore_Evas* ee = ecore_evas_new(NULL, x, y, WIDTH, HEIGHT, NULL);
@@ -155,13 +142,9 @@ START_TEST(utc_evas_post_event_callback_remove_p_01)
    ecore_evas_resize(ee, NEW_WIDTH, NEW_HEIGHT);
    evas_object_resize(bg, NEW_WIDTH, NEW_HEIGHT);
 
-   ecore_main_loop_begin();
+   ecore_timer_add(1, timer_cb, NULL);
 
-   if (callBackCallsStatus.force_quit_timer_callback_status == EINA_TRUE)
-     {
-        ecore_evas_free(ee);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
+   ecore_main_loop_begin();
 
    if (callBackCallsStatus.post_event_callback_01_call_status != EINA_TRUE || callBackCallsStatus.post_event_callback_02_call_status != EINA_FALSE)
      {
index 85146011e037acb149042356fecef28e2c35ee83..52cb2250fa7ae2e8a1c9acbd16cb1288bdf16571 100644 (file)
@@ -13,14 +13,12 @@ static struct
 {
    Eina_Bool post_event_callback_01_call_status;
    Eina_Bool post_event_callback_02_call_status;
-   Eina_Bool force_quit_timer_callback_status;
 } callBackCallsStatus;
 
 static void initCallBackCallsStatus()
 {
    callBackCallsStatus.post_event_callback_01_call_status = EINA_FALSE;
    callBackCallsStatus.post_event_callback_02_call_status = EINA_FALSE;
-   callBackCallsStatus.force_quit_timer_callback_status = EINA_FALSE;
 }
 static const char *data_passed_to_callback_2 = "The data pointer to be passed to the evas_post_event_callback 2";
 
@@ -63,8 +61,6 @@ static Eina_Bool evas_object_event_post_cb_1(void *data EINA_UNUSED, Evas *e EIN
 {
    callBackCallsStatus.post_event_callback_01_call_status = EINA_TRUE;
 
-   ecore_main_loop_quit();
-
    return EINA_FALSE;
 }
 
@@ -89,15 +85,11 @@ static void evas_event_resize_cb(void *data,
    evas_post_event_callback_remove_full(canvas, evas_object_event_post_cb_2, data_passed_to_callback_2);
 }
 
-static Eina_Bool quit_cb(void *data EINA_UNUSED)
+static Eina_Bool timer_cb(void *data)
 {
-   ck_abort_msg("[TEST_FAIL]:: %s[%d] : Force quit timer expired. Test has failed..", __FILE__, __LINE__);
-
-   callBackCallsStatus.force_quit_timer_callback_status = EINA_TRUE;
-
    ecore_main_loop_quit();
 
-   return EINA_FALSE;
+   return ECORE_CALLBACK_CANCEL;
 }
 
 /**
@@ -112,21 +104,20 @@ static Eina_Bool quit_cb(void *data EINA_UNUSED)
  * @li the data pointer to be passed to the callback
  *
  * @procedure
- * @step 1 Add timer for forced quit if couldn't quit from main loop
- * @step 2 Create a new Ecore_Evas based on engine name and common parameters
- * @step 3 Get an Ecore_Evas's Evas(Canvas)
- * @step 4 Set a callback for Ecore_Evas resize events.
- * @step 5 Register a callback function to a given canvas
+ * @step 1 Create a new Ecore_Evas based on engine name and common parameters
+ * @step 2 Get an Ecore_Evas's Evas(Canvas)
+ * @step 3 Set a callback for Ecore_Evas resize events.
+ * @step 4 Register a callback function to a given canvas
  * event(EVAS_CALLBACK_RENDER_FLUSH_POST). Called just after rendering
  * is updated on the canvas target
- * @step 6 Push callback evas_object_event_post_cb_1 and evas_object_event_post_cb_2
+ * @step 5 Push callback evas_object_event_post_cb_1 and evas_object_event_post_cb_2
  * on the post-event callback stack
- * @step 7 Remove callback evas_object_event_post_cb_2 from the post-event callback stack
- * @step 8 Resize an Ecore_Evas
- * @step 9 Run main loop
- * @step 10 Check whether the all callback evas_object_event_post_cb_2 was not called
+ * @step 6 Remove callback evas_object_event_post_cb_2 from the post-event callback stack
+ * @step 7 Resize an Ecore_Evas
+ * @step 8 Run main loop
+ * @step 9 Check whether the all callback evas_object_event_post_cb_2 was not called
  * and force quit timer was not expired
- * @step 11 Free Ecore_Evas.
+ * @step 10 Free Ecore_Evas.
  *
  * @passcondition Function Post event callback evas_object_event_post_cb_2 was
  * succesfully removed from post-event callback stack and there is no segmentation fault
@@ -134,10 +125,6 @@ static Eina_Bool quit_cb(void *data EINA_UNUSED)
  */
 START_TEST(utc_evas_post_event_callback_remove_full_p_01)
 {
-
-   const double quit_time = 1.0;
-   ecore_timer_add(quit_time, quit_cb, NULL);
-
    const int x = 10;
    const int y = 10;
    Ecore_Evas* ee = ecore_evas_new(NULL, x, y, WIDTH, HEIGHT, NULL);
@@ -168,13 +155,9 @@ START_TEST(utc_evas_post_event_callback_remove_full_p_01)
    ecore_evas_resize(ee, NEW_WIDTH, NEW_HEIGHT);
    evas_object_resize(bg, NEW_WIDTH, NEW_HEIGHT);
 
-   ecore_main_loop_begin();
+   ecore_timer_add(1, timer_cb, NULL);
 
-   if (callBackCallsStatus.force_quit_timer_callback_status == EINA_TRUE)
-     {
-        ecore_evas_free(ee);
-        ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
-     }
+   ecore_main_loop_begin();
 
    if (callBackCallsStatus.post_event_callback_01_call_status != EINA_TRUE || callBackCallsStatus.post_event_callback_02_call_status != EINA_FALSE)
      {