elementary: restore quick exit from wait loop in fileselector test.
authorCedric BAIL <cedric.bail@free.fr>
Wed, 27 Mar 2019 21:24:57 +0000 (14:24 -0700)
committerJunsuChoi <jsuya.choi@samsung.com>
Tue, 2 Apr 2019 04:14:38 +0000 (13:14 +0900)
The test was not expecting both callback to be set when the wait loop
was started. By moving them around, it fixes the test case to only have
one relevant callback set at a time.

Reviewed-by: Marcel Hollerbach <mail@marcel-hollerbach.de>
Differential Revision: https://phab.enlightenment.org/D8490

src/tests/elementary/elm_test_fileselector.c

index be8b53d..a2df980 100644 (file)
@@ -86,6 +86,8 @@ _ready_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED
 {
     Eina_Bool *ret = data;
     *ret = EINA_TRUE;
+
+    ecore_main_loop_quit();
 }
 
 EFL_START_TEST(elm_fileselector_selected)
@@ -116,7 +118,6 @@ EFL_START_TEST(elm_fileselector_selected)
 
    fileselector = elm_fileselector_add(win);
    evas_object_smart_callback_add(fileselector, "directory,open", _ready_cb, &open);
-   evas_object_smart_callback_add(fileselector, "selected", _ready_cb, &selected);
 
    ck_assert(!elm_fileselector_selected_set(fileselector, no_exist));
 
@@ -126,10 +127,13 @@ EFL_START_TEST(elm_fileselector_selected)
 
    ck_assert_str_eq(elm_fileselector_selected_get(fileselector), path);
 
-   selected = EINA_FALSE;
+   evas_object_smart_callback_del(fileselector, "directory,open", _ready_cb);
+   evas_object_smart_callback_add(fileselector, "selected", _ready_cb, &selected);
+
    ck_assert(elm_fileselector_selected_set(fileselector, exist));
    ck_assert(fileselector_test_helper_wait_flag(10, &selected));
    ck_assert(selected == EINA_TRUE);
+
    ck_assert_str_eq(elm_fileselector_selected_get(fileselector), exist);
 
    eina_stringshare_del(exist);