#include <check.h>
#include <Eina.h>
#include <Ecore.h>
+#include <pthread.h>
+
static int result = -1;
+static Eina_Bool function_called = EINA_FALSE;
/**
* @addtogroup ecore
return EINA_FALSE;
}
+static Eina_Bool _timer_thread_cb(void *data)
+{
+ ecore_main_loop_quit();
+
+ return EINA_FALSE;
+}
+
+static void *_new_thread_run(void *arg)
+{
+ function_called = EINA_TRUE;
+ result = ecore_thread_main_loop_begin();
+ ecore_thread_main_loop_end();
+
+ return NULL;
+}
+
/**
* @addtogroup ecore_thread_main_loop_begin
* @{
*/
START_TEST(utc_ecore_thread_main_loop_begin_p)
{
-
ecore_timer_add(0.1, _timer_cb, NULL);
ecore_main_loop_begin();
printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
}
END_TEST
+
+/**
+ * @addtogroup ecore_thread_main_loop_begin
+ * @{
+ * @objective Positive test case 3 checks if ecore_thread_main_loop_begin succeeds.
+ * @n Input Data: none.
+ *
+ * @procedure
+ * @step 1 Add a new pthread
+ * @step 2 Invoke begin and end of ecore_thread_main_loop in new_thread_run
+ * @step 3 Add a timer with _timer_cb callback
+ * @step 4 Start main loop
+ * @step 5 Quit main loop
+ * @step 6 Check status of call functions after callbacks
+ *
+ * @passcondition
+ * Variable named result must be equal to 1, and there is no segmentation fault.
+ * @}
+ */
+START_TEST(utc_ecore_thread_main_loop_begin_p3)
+{
+ pthread_attr_t attr;
+ pthread_t thread_id;
+
+ pthread_attr_init(&attr);
+ pthread_create(&thread_id, &attr, _new_thread_run, NULL);
+
+ ecore_timer_add(0.1, _timer_thread_cb, NULL);
+ ecore_main_loop_begin();
+
+ if (function_called != EINA_TRUE || result != 1)
+ {
+ ck_abort_msg("[TEST_FAIL]:: %s[%d] : Test has failed..", __FILE__, __LINE__);
+ }
+ printf("[TEST_PASS]:: %s[%d] : Test has passed..\n", __FILE__, __LINE__);
+}
+END_TEST
+
/**
*@}
*/
tcase_add_checked_fixture(tcase, setup, teardown);
tcase_add_test(tcase, utc_ecore_thread_main_loop_begin_p);
tcase_add_test(tcase, utc_ecore_thread_main_loop_begin_p2);
+ tcase_add_test(tcase, utc_ecore_thread_main_loop_begin_p3);
suite_add_tcase(suite, tcase);
return suite;