summaryrefslogtreecommitdiff
path: root/src/tests/evas
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-27 08:13:04 +0200
committerMarcel Hollerbach <mail@marcel-hollerbach.de>2019-06-28 09:03:14 +0200
commitd3dbd5a5cdf24359d214bd487ebab6f202ff1a38 (patch)
treea149a094fb00da1156bbf875793e9ff7c0f96010 /src/tests/evas
parent7b8766698ad363665264db8f5ed188e06381223b (diff)
downloadefl-d3dbd5a5cdf24359d214bd487ebab6f202ff1a38.tar.gz
evas_events: fix wrong event listening
EFL_EVENT_FOCUS_IN is wrong here, EFL_EVENT_FOCUS_IN is called on object that received object focus. Not canvas focus, however, the code in the callback there seems to be mainly for canvas focus handling. Additionally, in evas_events, the event handler that was listening for the canvas focus in / out events expected a event type, which is also not correct, because the canvas focus in / out does not have one. In order to catch such errors later more easily, there is now a safety check, so we really fetched the correct seat. Reviewed-by: YeongJong Lee <yj34.lee@samsung.com> Differential Revision: https://phab.enlightenment.org/D9191
Diffstat (limited to 'src/tests/evas')
-rw-r--r--src/tests/evas/evas_suite.c1
-rw-r--r--src/tests/evas/evas_suite.h1
-rw-r--r--src/tests/evas/evas_test_focus.c28
-rw-r--r--src/tests/evas/meson.build1
4 files changed, 31 insertions, 0 deletions
diff --git a/src/tests/evas/evas_suite.c b/src/tests/evas/evas_suite.c
index e84d23f5dc..d1946cdeb0 100644
--- a/src/tests/evas/evas_suite.c
+++ b/src/tests/evas/evas_suite.c
@@ -10,6 +10,7 @@
static const Efl_Test_Case etc[] = {
{ "Evas", evas_test_init },
+ { "Evas Focus", evas_test_focus },
{ "Evas New", evas_test_new },
{ "Object", evas_test_object },
{ "Object Textblock", evas_test_textblock },
diff --git a/src/tests/evas/evas_suite.h b/src/tests/evas/evas_suite.h
index 0da47fe13f..3b6b7bf8f9 100644
--- a/src/tests/evas/evas_suite.h
+++ b/src/tests/evas/evas_suite.h
@@ -4,6 +4,7 @@
#include <check.h>
#include "../efl_check.h"
void evas_test_init(TCase *tc);
+void evas_test_focus(TCase *tc);
void evas_test_new(TCase *tc);
void evas_test_object(TCase *tc);
void evas_test_textblock(TCase *tc);
diff --git a/src/tests/evas/evas_test_focus.c b/src/tests/evas/evas_test_focus.c
new file mode 100644
index 0000000000..5c33bf2d41
--- /dev/null
+++ b/src/tests/evas/evas_test_focus.c
@@ -0,0 +1,28 @@
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <stdio.h>
+
+#include <Evas.h>
+
+#include "evas_suite.h"
+
+EFL_START_TEST(evas_focus)
+{
+ Evas *evas = evas_new();
+
+ evas_output_method_set(evas, evas_render_method_lookup("buffer"));
+ evas_focus_in(evas);
+ ck_assert_int_eq(evas_focus_state_get(evas), EINA_TRUE);
+ evas_focus_out(evas);
+ ck_assert_int_eq(evas_focus_state_get(evas), EINA_FALSE);
+ evas_focus_out(evas);
+ ck_assert_int_eq(evas_focus_state_get(evas), EINA_FALSE);
+}
+EFL_END_TEST
+
+void evas_test_focus(TCase *tc)
+{
+ tcase_add_test(tc, evas_focus);
+}
diff --git a/src/tests/evas/meson.build b/src/tests/evas/meson.build
index 5c06ff79ff..627351b2ae 100644
--- a/src/tests/evas/meson.build
+++ b/src/tests/evas/meson.build
@@ -14,6 +14,7 @@ evas_suite_src = [
'evas_test_mask.c',
'evas_test_evasgl.c',
'evas_test_matrix.c',
+ 'evas_test_focus.c',
'evas_tests_helpers.h',
'evas_suite.h'
]