Use timer to quit mainloop successfully.
Change-Id: I3c091cfbda081d99fb9ebefd85e9872ef9c424a7
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()
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";
return EINA_FALSE;
}
- ecore_main_loop_quit();
-
callBackCallsStatus.post_event_callback_01_call_status = EINA_TRUE;
return EINA_TRUE;
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;
}
/**
* @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.
*
*/
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);
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__);
{
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;
}
/**
{
callBackCallsStatus.post_event_callback_01_call_status = EINA_TRUE;
- ecore_main_loop_quit();
-
return EINA_FALSE;
}
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;
}
/**
* @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
*/
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);
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)
{
{
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";
{
callBackCallsStatus.post_event_callback_01_call_status = EINA_TRUE;
- ecore_main_loop_quit();
-
return EINA_FALSE;
}
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;
}
/**
* @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
*/
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);
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)
{