2019-12-11 00:12:29 -08:00
|
|
|
#define EFL_NOLEGACY_API_SUPPORT
|
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
#define EFL_LAYOUT_CALC_PROTECTED
|
|
|
|
#include <Efl_Ui.h>
|
|
|
|
#include "efl_ui_suite.h"
|
2019-12-29 01:49:04 -08:00
|
|
|
#include "Evas_Legacy.h"
|
2019-12-11 00:12:29 -08:00
|
|
|
|
|
|
|
static void
|
|
|
|
increment_int_changed(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
|
|
|
|
{
|
|
|
|
int *value = data;
|
|
|
|
(*value)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
EFL_START_TEST(text_cnp)
|
|
|
|
{
|
|
|
|
Eo *txt;
|
|
|
|
Eo *win = win_add();
|
|
|
|
|
|
|
|
int i_copy = 0, i_paste = 0, i_cut = 0;
|
|
|
|
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
|
|
|
|
efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_SELECTION_COPY, increment_int_changed, &i_copy),
|
|
|
|
efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_SELECTION_PASTE, increment_int_changed, &i_paste),
|
|
|
|
efl_event_callback_add(efl_added, EFL_UI_TEXTBOX_EVENT_SELECTION_CUT, increment_int_changed, &i_cut)
|
|
|
|
);
|
|
|
|
|
2020-04-03 09:11:24 -07:00
|
|
|
efl_text_set(txt, "Hello");
|
|
|
|
efl_text_interactive_all_select(txt);
|
|
|
|
efl_ui_textbox_selection_copy(txt);
|
|
|
|
efl_text_interactive_all_unselect(txt);
|
2020-04-07 04:11:13 -07:00
|
|
|
efl_text_cursor_object_text_insert(efl_text_interactive_main_cursor_get(txt), "X");
|
2020-04-03 09:11:24 -07:00
|
|
|
efl_ui_textbox_selection_paste(txt);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
ck_assert_int_eq(i_copy, 1);
|
|
|
|
ck_assert_int_eq(i_paste, 1);
|
|
|
|
ck_assert_str_eq(efl_text_get(txt), "HelloXHello");
|
|
|
|
|
|
|
|
i_copy = i_cut = i_paste= 0;
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_text_set(txt, "Hello");
|
|
|
|
efl_text_interactive_all_select(txt);
|
|
|
|
efl_ui_textbox_selection_copy(txt);
|
|
|
|
efl_text_interactive_all_select(txt);
|
|
|
|
efl_ui_textbox_selection_cut(txt);
|
|
|
|
efl_ui_textbox_selection_paste(txt);
|
|
|
|
efl_ui_textbox_selection_paste(txt);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
ck_assert_int_eq(i_copy, 1);
|
|
|
|
ck_assert_int_eq(i_cut, 1);
|
|
|
|
ck_assert_int_eq(i_paste, 2);
|
|
|
|
//FIXME
|
|
|
|
//fail_if(strcmp(efl_text_get(txt),"HelloHello"));
|
|
|
|
efl_del(txt);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2020-01-19 04:58:26 -08:00
|
|
|
static void
|
|
|
|
_stop_event_soon(void *data EINA_UNUSED, const Efl_Event *ev)
|
|
|
|
{
|
|
|
|
efl_event_callback_stop(ev->object);
|
|
|
|
}
|
|
|
|
|
2019-12-11 00:12:29 -08:00
|
|
|
EFL_START_TEST(text_all_select_all_unselect)
|
|
|
|
{
|
2020-03-25 22:49:02 -07:00
|
|
|
Eo *txt, *txt2;
|
2019-12-11 00:12:29 -08:00
|
|
|
Eo *win = win_add();
|
|
|
|
|
|
|
|
int i_have_selection = 0, i_selection = 0;
|
|
|
|
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
|
|
|
|
efl_event_callback_add(efl_added, EFL_TEXT_INTERACTIVE_EVENT_HAVE_SELECTION_CHANGED,
|
|
|
|
increment_int_changed, &i_have_selection),
|
|
|
|
efl_event_callback_add(efl_added, EFL_TEXT_INTERACTIVE_EVENT_SELECTION_CHANGED,
|
|
|
|
increment_int_changed, &i_selection)
|
|
|
|
);
|
2020-01-19 04:58:26 -08:00
|
|
|
efl_event_callback_priority_add(txt, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, _stop_event_soon, NULL);
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_text_set(txt, "Hello");
|
|
|
|
efl_text_interactive_all_select(txt);
|
2020-04-07 04:11:13 -07:00
|
|
|
Efl_Text_Cursor_Object *c1=NULL, *c2 =NULL;
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_text_interactive_selection_cursors_get(txt, &c1, &c2);
|
|
|
|
ck_assert_ptr_ne(c1, NULL);
|
|
|
|
ck_assert_ptr_ne(c2, NULL);
|
|
|
|
fail_if(!efl_text_interactive_have_selection_get(txt));
|
2020-04-07 04:11:13 -07:00
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(c1), 0);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(c2), 5);
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_text_interactive_all_unselect(txt);
|
|
|
|
fail_if(efl_text_interactive_have_selection_get(txt));
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
ck_assert_int_eq(i_have_selection, 2);
|
|
|
|
ck_assert_int_eq(i_selection, 1);
|
2020-01-21 23:33:58 -08:00
|
|
|
|
|
|
|
/*Partial select, the select all*/
|
|
|
|
Eo *sel1, *sel2;
|
|
|
|
i_selection = 0;
|
|
|
|
efl_text_interactive_selection_cursors_get(txt, &sel1, &sel2);
|
2020-04-07 04:11:13 -07:00
|
|
|
efl_text_cursor_object_position_set(sel1, 1);
|
|
|
|
efl_text_cursor_object_position_set(sel2, 2);
|
2020-01-21 23:33:58 -08:00
|
|
|
ck_assert_int_eq(i_selection, 2);
|
|
|
|
efl_text_interactive_all_select(txt);
|
|
|
|
ck_assert_int_eq(i_selection, 3);
|
2020-04-07 04:11:13 -07:00
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(sel1), 0);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(sel2), 5);
|
2020-01-21 23:33:58 -08:00
|
|
|
|
|
|
|
Eo *cur1 = efl_ui_textbox_cursor_create(txt);
|
|
|
|
Eo *cur2 = efl_ui_textbox_cursor_create(txt);
|
2020-04-07 04:11:13 -07:00
|
|
|
efl_text_cursor_object_position_set(cur1, 1);
|
|
|
|
efl_text_cursor_object_position_set(cur2, 2);
|
2020-01-21 23:33:58 -08:00
|
|
|
efl_text_interactive_selection_cursors_set(txt, cur1, cur2);
|
|
|
|
ck_assert_int_eq(i_selection, 4);
|
|
|
|
efl_text_interactive_selection_cursors_get(txt, &sel1, &sel2);
|
2020-04-07 04:11:13 -07:00
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(sel1),1);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(sel2),2);
|
2020-01-21 23:33:58 -08:00
|
|
|
|
|
|
|
|
|
|
|
/*Select part then select all*/
|
|
|
|
efl_text_interactive_all_unselect(txt);
|
|
|
|
i_have_selection = 0, i_selection = 0;
|
2020-04-07 04:11:13 -07:00
|
|
|
efl_text_cursor_object_position_set(cur1, 1);
|
|
|
|
efl_text_cursor_object_position_set(cur2, 2);
|
2020-01-21 23:33:58 -08:00
|
|
|
efl_text_interactive_selection_cursors_set(txt, cur1, cur2);
|
|
|
|
ck_assert_int_eq(i_selection, 1);
|
|
|
|
ck_assert_int_eq(i_have_selection, 1);
|
|
|
|
efl_text_interactive_all_select(txt);
|
|
|
|
ck_assert_int_eq(i_selection, 2);
|
|
|
|
ck_assert_int_eq(i_have_selection, 1);
|
|
|
|
efl_text_interactive_all_unselect(txt);
|
|
|
|
ck_assert_int_eq(i_have_selection, 2);
|
|
|
|
|
2020-03-25 22:49:02 -07:00
|
|
|
//cursor selection change on efl_markup_set
|
|
|
|
txt2 = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
|
|
|
efl_text_markup_set(txt2, "<ps>");
|
2020-01-21 23:33:58 -08:00
|
|
|
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_del(txt);
|
2020-03-25 22:49:02 -07:00
|
|
|
efl_del(txt2);
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
EFL_START_TEST(text_selection)
|
|
|
|
{
|
|
|
|
Eo *txt;
|
|
|
|
Eo *win = win_add();
|
|
|
|
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
2020-01-19 04:58:26 -08:00
|
|
|
efl_event_callback_priority_add(txt, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, _stop_event_soon, NULL);
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
|
|
|
|
efl_text_set(txt, "Hello");
|
|
|
|
get_me_to_those_events(txt);
|
|
|
|
drag_object(txt, 2, 2, 295, 295, EINA_TRUE);
|
|
|
|
ecore_main_loop_iterate();
|
2020-04-07 04:11:13 -07:00
|
|
|
Efl_Text_Cursor_Object *c1=NULL, *c2 =NULL;
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_text_interactive_selection_cursors_get(txt, &c1, &c2);
|
|
|
|
ck_assert_ptr_ne(c1, NULL);
|
|
|
|
ck_assert_ptr_ne(c2, NULL);
|
|
|
|
fail_if(!efl_text_interactive_have_selection_get(txt));
|
2020-04-07 04:11:13 -07:00
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(c1), 0);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(c2), 5);
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_text_interactive_all_unselect(txt);
|
|
|
|
fail_if(efl_text_interactive_have_selection_get(txt));
|
|
|
|
efl_text_interactive_selection_allowed_set(txt, EINA_FALSE);
|
|
|
|
drag_object(txt, 2, 2, 295, 295, EINA_TRUE);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
fail_if(efl_text_interactive_have_selection_get(txt));
|
|
|
|
efl_del(txt);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
static void
|
|
|
|
user_changed(void *data, const Efl_Event *ev)
|
|
|
|
{
|
|
|
|
Efl_Text_Change_Info *info = (Efl_Text_Change_Info *)ev->info;
|
|
|
|
Efl_Text_Change_Info *stored = (Efl_Text_Change_Info *)data;
|
|
|
|
*stored = *info;
|
|
|
|
}
|
|
|
|
|
|
|
|
EFL_START_TEST(text_user_change)
|
|
|
|
{
|
|
|
|
Eo *txt;
|
|
|
|
Eo *win = win_add();
|
|
|
|
Efl_Text_Change_Info info = {0};
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
|
|
|
|
efl_event_callback_add(efl_added, EFL_TEXT_INTERACTIVE_EVENT_CHANGED_USER, user_changed, &info)
|
|
|
|
);
|
2020-01-19 04:58:26 -08:00
|
|
|
efl_event_callback_priority_add(txt, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, _stop_event_soon, NULL);
|
2019-12-11 00:12:29 -08:00
|
|
|
efl_text_set(txt, "Hello");
|
|
|
|
efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
|
|
|
|
efl_text_interactive_all_select(txt);
|
|
|
|
efl_ui_textbox_selection_cut(txt);
|
|
|
|
ck_assert_int_eq(info.position, 0);
|
|
|
|
ck_assert_int_eq(info.length, 5);
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-12-26 17:17:17 -08:00
|
|
|
EFL_START_TEST(text_scroll_mode)
|
|
|
|
{
|
|
|
|
Eo *txt, *win, *cur;
|
|
|
|
win = win_add();
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
2020-01-19 04:58:26 -08:00
|
|
|
efl_event_callback_priority_add(txt, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, _stop_event_soon, NULL);
|
2019-12-26 17:17:17 -08:00
|
|
|
cur = efl_text_interactive_main_cursor_get(txt);
|
|
|
|
efl_text_set(txt, "Hello");
|
|
|
|
/*scroll mode is false by default*/
|
|
|
|
fail_if(efl_ui_textbox_scrollable_get(txt));
|
|
|
|
efl_ui_textbox_scrollable_set(txt, !efl_ui_textbox_scrollable_get(txt));
|
2020-04-07 04:11:13 -07:00
|
|
|
efl_text_cursor_object_text_insert(cur, "World");
|
2019-12-26 17:17:17 -08:00
|
|
|
fail_if(!efl_ui_textbox_scrollable_get(txt));
|
|
|
|
efl_ui_textbox_scrollable_set(txt, !efl_ui_textbox_scrollable_get(txt));
|
2020-04-07 04:11:13 -07:00
|
|
|
efl_text_cursor_object_text_insert(cur, "!!!");
|
2019-12-26 17:17:17 -08:00
|
|
|
|
|
|
|
ck_assert_str_eq(efl_text_get(txt),"HelloWorld!!!");
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-12-29 01:49:04 -08:00
|
|
|
EFL_START_TEST(text_change_event)
|
|
|
|
{
|
|
|
|
Eo *txt;
|
|
|
|
Eo *win = win_add();
|
|
|
|
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
2020-01-19 04:58:26 -08:00
|
|
|
efl_event_callback_priority_add(txt, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, _stop_event_soon, NULL);
|
2019-12-29 01:49:04 -08:00
|
|
|
efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
|
|
|
|
efl_text_set(txt, "Hello");
|
|
|
|
int i_changed = 0;
|
|
|
|
efl_event_callback_add(txt, EFL_UI_TEXTBOX_EVENT_CHANGED, increment_int_changed, &i_changed);
|
|
|
|
efl_gfx_entity_visible_set(txt, EINA_TRUE);
|
|
|
|
Evas *e = evas_object_evas_get(txt);
|
|
|
|
efl_ui_focus_util_focus(txt);
|
|
|
|
evas_event_feed_key_down(e, "s", "s", "s", "s", time(NULL), NULL);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
ck_assert_str_eq(efl_text_get(txt),"Hellos");
|
|
|
|
ck_assert_int_eq(i_changed,1);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2020-01-16 00:53:36 -08:00
|
|
|
EFL_START_TEST(text_keys_handler)
|
|
|
|
{
|
|
|
|
Eo *txt;
|
|
|
|
Eo *win = win_add();
|
|
|
|
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
2020-01-19 04:58:26 -08:00
|
|
|
efl_event_callback_priority_add(txt, EFL_UI_SELECTION_EVENT_WM_SELECTION_CHANGED, EFL_CALLBACK_PRIORITY_BEFORE, _stop_event_soon, NULL);
|
2020-01-16 00:53:36 -08:00
|
|
|
efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
|
|
|
|
efl_text_set(txt, "Hello");
|
|
|
|
|
|
|
|
efl_gfx_entity_visible_set(txt, EINA_TRUE);
|
|
|
|
Evas *e = evas_object_evas_get(txt);
|
|
|
|
efl_ui_focus_util_focus(txt);
|
|
|
|
|
2020-04-07 04:11:13 -07:00
|
|
|
efl_text_cursor_object_move(efl_text_interactive_main_cursor_get(txt), EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
|
2020-01-16 00:53:36 -08:00
|
|
|
evas_key_modifier_on(e, "Control");
|
|
|
|
evas_event_feed_key_down(e, "BackSpace", "BackSpace", "\b", "\b", time(NULL), NULL);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
ck_assert_str_eq(efl_text_get(txt),"");
|
2020-04-07 04:11:13 -07:00
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(efl_text_interactive_main_cursor_get(txt)), 0);
|
2020-01-16 00:53:36 -08:00
|
|
|
evas_event_feed_key_up(e, "BackSpace", "BackSpace", "\b", "\b", time(NULL), NULL);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
|
|
|
|
efl_text_set(txt, "Hello");
|
2020-04-07 04:11:13 -07:00
|
|
|
efl_text_cursor_object_position_set(efl_text_interactive_main_cursor_get(txt), 0);
|
2020-01-16 00:53:36 -08:00
|
|
|
evas_key_modifier_on(e, "Control");
|
|
|
|
evas_event_feed_key_down(e, "Delete", "Delete", "\177", "\177", time(NULL), NULL);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
ck_assert_str_eq(efl_text_get(txt),"");
|
2020-04-07 04:11:13 -07:00
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(efl_text_interactive_main_cursor_get(txt)), 0);
|
2020-01-16 00:53:36 -08:00
|
|
|
evas_event_feed_key_up(e, "Delete", "Delete", "\177", "\177", time(NULL), NULL);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2020-02-25 03:30:23 -08:00
|
|
|
EFL_START_TEST(text_editable)
|
|
|
|
{
|
|
|
|
Eo *txt, *win;
|
|
|
|
win = win_add();
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
|
|
|
efl_text_font_size_set(txt, 100);
|
|
|
|
efl_text_font_family_set(txt, "Arial");
|
|
|
|
efl_text_interactive_editable_set(txt, !efl_text_interactive_editable_get(txt));
|
|
|
|
ck_assert_int_eq(efl_text_font_size_get(txt), 100);
|
|
|
|
ck_assert_str_eq(efl_text_font_family_get(txt), "Arial");
|
|
|
|
|
|
|
|
efl_ui_widget_disabled_set(txt, EINA_TRUE);
|
|
|
|
ck_assert_int_eq(efl_text_font_size_get(txt), 100);
|
|
|
|
ck_assert_str_eq(efl_text_font_family_get(txt), "Arial");
|
|
|
|
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
efl_ui_textbox: preserve changing user color set
Summary:
setting color inside the constructor call will be override in theme apply because it happen later.
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
efl_text_color_set(efl_added, 0, 255, 0, 255));
Now we will preserve user choice, to not change it during theme apply.
Test Plan: ninja test
Reviewers: woohyun, bu5hm4n, zmike, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D11942
2020-08-04 21:33:03 -07:00
|
|
|
EFL_START_TEST(text_on_startup)
|
|
|
|
{
|
|
|
|
Eo *txt, *win;
|
|
|
|
win = win_add();
|
|
|
|
unsigned char r,g,b,a;
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
|
|
|
|
efl_text_color_set(efl_added, 0, 255, 0, 255),
|
|
|
|
efl_text_font_size_set(efl_added, 50),
|
|
|
|
efl_text_font_family_set(efl_added, "Arial"));
|
|
|
|
|
|
|
|
ck_assert_int_eq(efl_text_font_size_get(txt), 50);
|
|
|
|
ck_assert_str_eq(efl_text_font_family_get(txt), "Arial");
|
|
|
|
efl_text_color_get(txt, &r, &g, &b, &a);
|
|
|
|
ck_assert_int_eq(r, 0);
|
|
|
|
ck_assert_int_eq(g, 255);
|
|
|
|
ck_assert_int_eq(b, 0);
|
|
|
|
ck_assert_int_eq(a, 255);
|
|
|
|
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
evas_textblock : fix text insertion & selection with ps in single line
Summary:
when we have text that contains <ps> (example "p1<ps>p2") in a single line mode
and the cursor position is after the ps tag
then we try to insert any character using the keyboard it will show segmentation fault.
also with the same text if we try to select the text we will notice that it is corrupted.
this should resolve https://phab.enlightenment.org/T8594
Test Plan:
#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1
#include <Eina.h>
#include <Elementary.h>
#include <Efl_Ui.h>
static void
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
efl_exit(0);
}
static void
_gui_setup()
{
Eo *win, *box;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Hello World"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
// when the user clicks "close" on a window there is a request to delete
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);
box = efl_add(EFL_UI_BOX_CLASS, win,
efl_content_set(win, efl_added),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(360, 240)));
Eo *text = efl_add(EFL_UI_TEXTBOX_CLASS, box,
efl_gfx_hint_weight_set(efl_added, 1.0, 1.0),
efl_gfx_hint_align_set(efl_added, 1.0, 1.0),
efl_pack(box, efl_added));
efl_text_interactive_selection_allowed_set(text, EINA_TRUE);
efl_text_multiline_set(text,EINA_FALSE);
efl_text_markup_set(text, "p1<ps>p2");
}
EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
_gui_setup();
}
EFL_MAIN()
Reviewers: ali.alzyod, woohyun, zmike, bu5hm4n, segfaultxavi, stefan_schmidt
Reviewed By: ali.alzyod, woohyun
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D11621
2020-04-16 04:03:31 -07:00
|
|
|
EFL_START_TEST(text_multiline_selection)
|
|
|
|
{
|
|
|
|
Eo *txt, *win;
|
|
|
|
Eo *cursor1, *cursor2;
|
|
|
|
Eina_Rect rc1, rc2;
|
|
|
|
win = win_add();
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
|
|
|
efl_text_markup_set(txt, "p1<ps/>p2<ps/>p3");
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
efl_text_interactive_all_select(txt);
|
|
|
|
efl_text_interactive_selection_cursors_get(txt, &cursor1, &cursor2);
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor1, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor2, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_ne(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
EFL_START_TEST(text_singleline_cursor_movement)
|
|
|
|
{
|
|
|
|
Eo *txt, *win;
|
|
|
|
Eo *cursor;
|
|
|
|
Eina_Rect rc1, rc2;
|
|
|
|
win = win_add();
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
|
|
|
efl_text_markup_set(txt, "p1<ps>p<b>2</b>2<ps>p3");
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
ecore_main_loop_iterate();
|
|
|
|
|
|
|
|
cursor = efl_text_interactive_main_cursor_get(txt);
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_FIRST);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(cursor), 0);
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_LAST);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(cursor), 9);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_ne(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_START);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(cursor), 0);
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_LINE_END);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(cursor), 9);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_ne(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_PARAGRAPH_NEXT);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(cursor), 9); //do not move
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_PARAGRAPH_PREVIOUS);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(cursor), 9); //do not move
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_eq(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_PARAGRAPH_START);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(cursor), 0);
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_PARAGRAPH_END);
|
|
|
|
ck_assert_int_eq(efl_text_cursor_object_position_get(cursor), 9);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_ne(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
EFL_START_TEST(text_multiline_singleline_cursor_pos)
|
|
|
|
{
|
|
|
|
Eo *txt, *win;
|
|
|
|
Eo *cursor, *cursor1, *cursor2;
|
|
|
|
Eina_Rect rc1, rc2;
|
|
|
|
win = win_add();
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
|
|
|
efl_text_markup_set(txt, "p1<ps>p<b>2</b>2<ps>p3<ps>");
|
|
|
|
cursor = efl_text_interactive_main_cursor_get(txt);
|
|
|
|
cursor1 = efl_ui_textbox_cursor_create(txt);
|
|
|
|
efl_text_cursor_object_position_set(cursor1, 4);
|
|
|
|
cursor2 = efl_ui_textbox_cursor_create(txt);
|
|
|
|
efl_text_cursor_object_position_set(cursor2, 8);
|
|
|
|
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
ck_assert_uint_eq(efl_text_cursor_object_content_get(cursor1), '2');
|
|
|
|
ck_assert_uint_eq(efl_text_cursor_object_content_get(cursor2), '3');
|
|
|
|
|
|
|
|
efl_text_cursor_object_position_set(cursor, 0);
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
efl_text_multiline_set(txt, EINA_TRUE);
|
|
|
|
ck_assert_uint_eq(efl_text_cursor_object_content_get(cursor1), '2');
|
|
|
|
ck_assert_uint_eq(efl_text_cursor_object_content_get(cursor2), '3');
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_eq(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
efl_text_cursor_object_position_set(cursor, 2);
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
efl_text_multiline_set(txt, EINA_TRUE);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_eq(rc1.x, rc2.x);
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_eq(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
efl_text_cursor_object_position_set(cursor, 3);
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
efl_text_multiline_set(txt, EINA_TRUE);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_ne(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_ne(rc1.x, rc2.x);
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_eq(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
efl_text_cursor_object_position_set(cursor, 4);
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
efl_text_multiline_set(txt, EINA_TRUE);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_ne(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_ne(rc1.x, rc2.x);
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_eq(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
efl_text_cursor_object_position_set(cursor, 10);
|
|
|
|
rc1 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
efl_text_multiline_set(txt, EINA_TRUE);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_ne(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_ne(rc1.x, rc2.x);
|
|
|
|
efl_text_multiline_set(txt, EINA_FALSE);
|
|
|
|
rc2 = efl_text_cursor_object_cursor_geometry_get(cursor, EFL_TEXT_CURSOR_TYPE_BEFORE);
|
|
|
|
ck_assert_int_eq(rc1.y, rc2.y);
|
|
|
|
ck_assert_int_eq(rc1.x, rc2.x);
|
|
|
|
|
|
|
|
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
efl.ui.text : Fixing cursor movement using keyboard arrows/mouse click
Summary:
if we have an emoji or a cluster combining multiple Unicode inside ui textbox, we can move the cursor inside the emoji/cluster using keyboard arrows/mouse click.
so we should use cluster movement instead of character movement (same as entry).
{F3868931}
this should resolve T8666
Test Plan:
#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1
#include <Efl_Ui.h>
static void
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
efl_exit(0);
}
static void
_gui_setup()
{
Eo *win, *box;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Hello World"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
// when the user clicks "close" on a window there is a request to delete
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);
box = efl_add(EFL_UI_BOX_CLASS, win,
efl_content_set(win, efl_added),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(360, 240)));
efl_add(EFL_UI_TEXTBOX_CLASS, box,
efl_gfx_hint_weight_set(efl_added, 1.0, 1.0),
efl_gfx_hint_align_set(efl_added, 1.0, 1.0),
efl_text_markup_set(efl_added, "A☪️"),
efl_pack(box, efl_added));
}
EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
_gui_setup();
}
EFL_MAIN()
Reviewers: ali.alzyod, zmike, woohyun, bu5hm4n
Reviewed By: ali.alzyod, woohyun
Subscribers: zmike, cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8666
Differential Revision: https://phab.enlightenment.org/D11745
2020-10-20 03:20:27 -07:00
|
|
|
EFL_START_TEST(text_keyboard_mouse_cluster_cursor_movement)
|
|
|
|
{
|
|
|
|
Eo *txt;
|
|
|
|
Eo *cursor;
|
|
|
|
Eo *win = win_add();
|
|
|
|
Evas *e;
|
|
|
|
Eina_Rect rc, rc2;
|
|
|
|
|
|
|
|
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win);
|
|
|
|
|
|
|
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(300, 300));
|
|
|
|
efl_gfx_entity_size_set(txt, EINA_SIZE2D(300, 300));
|
|
|
|
efl_ui_textbox_scrollable_set(txt, EINA_TRUE);
|
|
|
|
get_me_to_those_events(txt);
|
|
|
|
|
2020-12-28 12:56:52 -08:00
|
|
|
// efl_text_markup_set(txt, "A\u1100\u1161\u11AA");
|
|
|
|
efl_text_markup_set(txt, "AAAAAA");
|
efl.ui.text : Fixing cursor movement using keyboard arrows/mouse click
Summary:
if we have an emoji or a cluster combining multiple Unicode inside ui textbox, we can move the cursor inside the emoji/cluster using keyboard arrows/mouse click.
so we should use cluster movement instead of character movement (same as entry).
{F3868931}
this should resolve T8666
Test Plan:
#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1
#include <Efl_Ui.h>
static void
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
efl_exit(0);
}
static void
_gui_setup()
{
Eo *win, *box;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Hello World"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
// when the user clicks "close" on a window there is a request to delete
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);
box = efl_add(EFL_UI_BOX_CLASS, win,
efl_content_set(win, efl_added),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(360, 240)));
efl_add(EFL_UI_TEXTBOX_CLASS, box,
efl_gfx_hint_weight_set(efl_added, 1.0, 1.0),
efl_gfx_hint_align_set(efl_added, 1.0, 1.0),
efl_text_markup_set(efl_added, "A☪️"),
efl_pack(box, efl_added));
}
EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
_gui_setup();
}
EFL_MAIN()
Reviewers: ali.alzyod, zmike, woohyun, bu5hm4n
Reviewed By: ali.alzyod, woohyun
Subscribers: zmike, cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8666
Differential Revision: https://phab.enlightenment.org/D11745
2020-10-20 03:20:27 -07:00
|
|
|
cursor = efl_text_interactive_main_cursor_get(txt);
|
|
|
|
efl_text_cursor_object_position_set(cursor, 1);
|
|
|
|
|
|
|
|
e = evas_object_evas_get(txt);
|
|
|
|
efl_ui_focus_util_focus(txt);
|
|
|
|
evas_event_feed_key_down(e, "Right", "Right", "Right", "Right", time(NULL), NULL);
|
|
|
|
|
|
|
|
ck_assert_int_eq(4, efl_text_cursor_object_position_get(cursor));
|
|
|
|
|
|
|
|
efl_text_cursor_object_position_set(cursor, 1);
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT);
|
|
|
|
efl_text_cursor_object_move(cursor, EFL_TEXT_CURSOR_MOVE_TYPE_CHARACTER_NEXT);
|
|
|
|
rc = efl_text_cursor_object_content_geometry_get(cursor);
|
|
|
|
rc2 = efl_ui_scrollable_viewport_geometry_get(txt);
|
|
|
|
|
|
|
|
efl_text_cursor_object_position_set(cursor, 0);
|
|
|
|
click_object_at(win, rc2.x + rc.x + (rc.w/2), rc2.y + rc.y + (rc.h/2));
|
|
|
|
|
|
|
|
ck_assert_int_eq(4, efl_text_cursor_object_position_get(cursor));
|
|
|
|
|
|
|
|
efl_del(txt);
|
|
|
|
efl_del(win);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-12-11 00:12:29 -08:00
|
|
|
void efl_ui_test_text(TCase *tc)
|
|
|
|
{
|
|
|
|
tcase_add_test(tc, text_cnp);
|
|
|
|
tcase_add_test(tc, text_all_select_all_unselect);
|
|
|
|
tcase_add_test(tc, text_selection);
|
|
|
|
tcase_add_test(tc, text_user_change);
|
2019-12-26 17:17:17 -08:00
|
|
|
tcase_add_test(tc, text_scroll_mode);
|
2019-12-29 01:49:04 -08:00
|
|
|
tcase_add_test(tc, text_change_event);
|
2020-01-16 00:53:36 -08:00
|
|
|
tcase_add_test(tc, text_keys_handler);
|
2020-02-25 03:30:23 -08:00
|
|
|
tcase_add_test(tc, text_editable);
|
evas_textblock : fix text insertion & selection with ps in single line
Summary:
when we have text that contains <ps> (example "p1<ps>p2") in a single line mode
and the cursor position is after the ps tag
then we try to insert any character using the keyboard it will show segmentation fault.
also with the same text if we try to select the text we will notice that it is corrupted.
this should resolve https://phab.enlightenment.org/T8594
Test Plan:
#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1
#include <Eina.h>
#include <Elementary.h>
#include <Efl_Ui.h>
static void
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
efl_exit(0);
}
static void
_gui_setup()
{
Eo *win, *box;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Hello World"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
// when the user clicks "close" on a window there is a request to delete
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);
box = efl_add(EFL_UI_BOX_CLASS, win,
efl_content_set(win, efl_added),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(360, 240)));
Eo *text = efl_add(EFL_UI_TEXTBOX_CLASS, box,
efl_gfx_hint_weight_set(efl_added, 1.0, 1.0),
efl_gfx_hint_align_set(efl_added, 1.0, 1.0),
efl_pack(box, efl_added));
efl_text_interactive_selection_allowed_set(text, EINA_TRUE);
efl_text_multiline_set(text,EINA_FALSE);
efl_text_markup_set(text, "p1<ps>p2");
}
EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
_gui_setup();
}
EFL_MAIN()
Reviewers: ali.alzyod, woohyun, zmike, bu5hm4n, segfaultxavi, stefan_schmidt
Reviewed By: ali.alzyod, woohyun
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D11621
2020-04-16 04:03:31 -07:00
|
|
|
tcase_add_test(tc, text_multiline_selection);
|
|
|
|
tcase_add_test(tc, text_singleline_cursor_movement);
|
|
|
|
tcase_add_test(tc, text_multiline_singleline_cursor_pos);
|
efl_ui_textbox: preserve changing user color set
Summary:
setting color inside the constructor call will be override in theme apply because it happen later.
txt = efl_add(EFL_UI_TEXTBOX_CLASS, win,
efl_text_color_set(efl_added, 0, 255, 0, 255));
Now we will preserve user choice, to not change it during theme apply.
Test Plan: ninja test
Reviewers: woohyun, bu5hm4n, zmike, segfaultxavi
Subscribers: cedric, #reviewers, #committers
Tags: #efl
Differential Revision: https://phab.enlightenment.org/D11942
2020-08-04 21:33:03 -07:00
|
|
|
tcase_add_test(tc, text_on_startup);
|
efl.ui.text : Fixing cursor movement using keyboard arrows/mouse click
Summary:
if we have an emoji or a cluster combining multiple Unicode inside ui textbox, we can move the cursor inside the emoji/cluster using keyboard arrows/mouse click.
so we should use cluster movement instead of character movement (same as entry).
{F3868931}
this should resolve T8666
Test Plan:
#define EFL_EO_API_SUPPORT 1
#define EFL_BETA_API_SUPPORT 1
#include <Efl_Ui.h>
static void
_gui_quit_cb(void *data EINA_UNUSED, const Efl_Event *event EINA_UNUSED)
{
efl_exit(0);
}
static void
_gui_setup()
{
Eo *win, *box;
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
efl_text_set(efl_added, "Hello World"),
efl_ui_win_autodel_set(efl_added, EINA_TRUE));
// when the user clicks "close" on a window there is a request to delete
efl_event_callback_add(win, EFL_UI_WIN_EVENT_DELETE_REQUEST, _gui_quit_cb, NULL);
box = efl_add(EFL_UI_BOX_CLASS, win,
efl_content_set(win, efl_added),
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(360, 240)));
efl_add(EFL_UI_TEXTBOX_CLASS, box,
efl_gfx_hint_weight_set(efl_added, 1.0, 1.0),
efl_gfx_hint_align_set(efl_added, 1.0, 1.0),
efl_text_markup_set(efl_added, "A☪️"),
efl_pack(box, efl_added));
}
EAPI_MAIN void
efl_main(void *data EINA_UNUSED, const Efl_Event *ev EINA_UNUSED)
{
_gui_setup();
}
EFL_MAIN()
Reviewers: ali.alzyod, zmike, woohyun, bu5hm4n
Reviewed By: ali.alzyod, woohyun
Subscribers: zmike, cedric, #reviewers, #committers
Tags: #efl
Maniphest Tasks: T8666
Differential Revision: https://phab.enlightenment.org/D11745
2020-10-20 03:20:27 -07:00
|
|
|
tcase_add_test(tc, text_keyboard_mouse_cluster_cursor_movement);
|
2019-12-11 00:12:29 -08:00
|
|
|
}
|