summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_suite.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2018-11-20 18:18:04 +0100
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2018-11-20 20:50:42 +0100
commitd79db7c8bf7d925db9f2e1a78ad8082674b9b71d (patch)
tree5f22e56ab6f6b9079c3ed3ff6902162b36c75ac1 /src/tests/elementary/elm_suite.c
parent1524c94180f562ff827859688c931eae97e55581 (diff)
elm-test: simulate focus on the window
we cannot rely on the compositor to actaully get focus. However, a few widgets are only doing focus operations if they can get focus, if not they do nothing. Which effectifility turns off every focus operation if you don't have compositor focus. In order to work arround this, we are getting the ee, NULL out the callbacks, so the window does not know about the the *real* compositor focus, after that we manully say that the root object has focus, so normal operations can be performed again. Differential Revision: https://phab.enlightenment.org/D7311
Diffstat (limited to 'src/tests/elementary/elm_suite.c')
-rw-r--r--src/tests/elementary/elm_suite.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_suite.c b/src/tests/elementary/elm_suite.c
index 627bb3a..a046e6c 100644
--- a/src/tests/elementary/elm_suite.c
+++ b/src/tests/elementary/elm_suite.c
@@ -5,6 +5,7 @@
5#include <Elementary.h> 5#include <Elementary.h>
6#include "elm_suite.h" 6#include "elm_suite.h"
7#include "../efl_check.h" 7#include "../efl_check.h"
8#include "elm_widget.h"
8 9
9static int main_pid = -1; 10static int main_pid = -1;
10static Eina_Bool did_shutdown; 11static Eina_Bool did_shutdown;
@@ -182,6 +183,34 @@ win_add()
182 return _elm_suite_win_create(); 183 return _elm_suite_win_create();
183} 184}
184 185
186static void
187force_focus_win(Evas_Object *win)
188{
189 Ecore_Evas *ee;
190
191 ee = ecore_evas_ecore_evas_get(evas_object_evas_get(win));
192 ecore_evas_focus_set(ee, EINA_TRUE);
193 ecore_evas_callback_focus_in_set(ee, NULL);
194 ecore_evas_callback_focus_out_set(ee, NULL);
195 Elm_Widget_Smart_Data *pd = efl_data_scope_safe_get(win, EFL_UI_WIDGET_CLASS);
196 pd->top_win_focused = EINA_TRUE;
197}
198
199Evas_Object *
200win_add_focused()
201{
202 Evas_Object *win;
203
204 if (getpid() != main_pid)
205 {
206 if (global_win) return global_win;
207 }
208
209 win = _elm_suite_win_create();
210 force_focus_win(win);
211 return win;
212}
213
185int 214int
186main(int argc, char **argv) 215main(int argc, char **argv)
187{ 216{
@@ -211,6 +240,7 @@ main(int argc, char **argv)
211 if (buffer) 240 if (buffer)
212 { 241 {
213 global_win = _elm_suite_win_create(); 242 global_win = _elm_suite_win_create();
243 force_focus_win(global_win);
214 } 244 }
215 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255); 245 EINA_SAFETY_ON_TRUE_RETURN_VAL(failed_count, 255);
216 /* preload default theme */ 246 /* preload default theme */