2019-04-28 03:28:55 -07:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
# include "elementary_config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <Efl_Ui.h>
|
|
|
|
#include "efl_ui_suite.h"
|
|
|
|
#include "eo_internal.h"
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_CLASS_SIMPLE_CLASS(efl_ui_spotlight_manager, "efl_ui_spotlight_manager", EFL_UI_SPOTLIGHT_MANAGER_CLASS);
|
|
|
|
EFL_CLASS_SIMPLE_CLASS(efl_ui_spotlight_indicator, "efl_ui_spotlight_indicator", EFL_UI_SPOTLIGHT_INDICATOR_CLASS);
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
static Efl_Ui_Win *win;
|
2019-07-04 16:02:43 -07:00
|
|
|
static Efl_Ui_Spotlight_Container *container;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
struct {
|
|
|
|
int called;
|
|
|
|
double position;
|
|
|
|
} position_update;
|
|
|
|
struct {
|
|
|
|
int called;
|
|
|
|
Efl_Gfx_Entity *subobj;
|
|
|
|
int index;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
Efl_Ui_Widget *current_page_at_call;
|
2019-04-28 03:28:55 -07:00
|
|
|
} content_del;
|
|
|
|
struct {
|
|
|
|
int called;
|
|
|
|
Efl_Gfx_Entity *subobj;
|
|
|
|
int index;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
Efl_Ui_Widget *current_page_at_call;
|
2019-04-28 03:28:55 -07:00
|
|
|
} content_add;
|
|
|
|
struct {
|
|
|
|
int called;
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Container *spotlight;
|
|
|
|
} spotlight;
|
2019-04-28 03:28:55 -07:00
|
|
|
} Indicator_Calls;
|
|
|
|
|
|
|
|
Indicator_Calls indicator_calls = { 0 };
|
|
|
|
|
|
|
|
static void
|
|
|
|
_indicator_content_del(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
|
|
|
|
{
|
|
|
|
indicator_calls.content_del.called ++;
|
|
|
|
indicator_calls.content_del.subobj = subobj;
|
|
|
|
indicator_calls.content_del.index = index;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
indicator_calls.content_del.current_page_at_call = efl_ui_spotlight_active_element_get(container);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_indicator_content_add(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
|
|
|
|
{
|
|
|
|
indicator_calls.content_add.called ++;
|
|
|
|
indicator_calls.content_add.subobj = subobj;
|
|
|
|
indicator_calls.content_add.index = index;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
indicator_calls.content_add.current_page_at_call = efl_ui_spotlight_active_element_get(container);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_indicator_position_update(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, double position)
|
|
|
|
{
|
|
|
|
indicator_calls.position_update.called ++;
|
|
|
|
indicator_calls.position_update.position = position;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_indicator_bind(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Spotlight_Container *spotlight)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
indicator_calls.spotlight.called++;
|
|
|
|
indicator_calls.spotlight.spotlight = spotlight;
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
EFL_OPS_DEFINE(indicator_tracker,
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_indicator_content_add, _indicator_content_add),
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_indicator_content_del, _indicator_content_del),
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_indicator_position_update, _indicator_position_update),
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_indicator_bind, _indicator_bind),
|
2019-04-28 03:28:55 -07:00
|
|
|
);
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
static Efl_Ui_Spotlight_Manager*
|
2019-04-28 03:28:55 -07:00
|
|
|
_create_indicator(void)
|
|
|
|
{
|
|
|
|
Eo *obj;
|
|
|
|
|
2019-07-12 10:33:31 -07:00
|
|
|
obj = efl_new(efl_ui_spotlight_indicator_realized_class_get());
|
2019-04-28 03:28:55 -07:00
|
|
|
efl_object_override(obj, &indicator_tracker);
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
struct {
|
|
|
|
int called;
|
|
|
|
Efl_Gfx_Entity *subobj;
|
|
|
|
int index;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
Efl_Ui_Widget *current_page_at_call;
|
2019-04-28 03:28:55 -07:00
|
|
|
} content_del;
|
|
|
|
struct {
|
|
|
|
int called;
|
|
|
|
Efl_Gfx_Entity *subobj;
|
|
|
|
int index;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
Efl_Ui_Widget *current_page_at_call;
|
2019-04-28 03:28:55 -07:00
|
|
|
} content_add;
|
|
|
|
struct {
|
|
|
|
int called;
|
|
|
|
int from;
|
|
|
|
int to;
|
|
|
|
} request_switch;
|
|
|
|
struct {
|
|
|
|
int called;
|
|
|
|
Eina_Size2D size;
|
|
|
|
} page_size;
|
|
|
|
struct {
|
|
|
|
int called;
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Container *spotlight;
|
2019-04-28 03:28:55 -07:00
|
|
|
Efl_Canvas_Group *group;
|
2019-07-04 16:02:43 -07:00
|
|
|
} spotlight;
|
2019-04-28 03:28:55 -07:00
|
|
|
struct {
|
|
|
|
int called;
|
2019-11-20 07:16:22 -08:00
|
|
|
Eina_Bool value;
|
2019-04-28 03:28:55 -07:00
|
|
|
} animation;
|
|
|
|
double last_position;
|
|
|
|
} Transition_Calls;
|
|
|
|
|
|
|
|
Transition_Calls transition_calls = { 0 };
|
|
|
|
|
|
|
|
static void
|
|
|
|
_emit_pos(Eo *obj, double d)
|
|
|
|
{
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
printf("EMITTING %f %f\n", d, transition_calls.last_position);
|
2019-04-28 03:28:55 -07:00
|
|
|
if (d == transition_calls.last_position) return;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_event_callback_call(obj, EFL_UI_SPOTLIGHT_MANAGER_EVENT_POS_UPDATE, &d);
|
2019-04-28 03:28:55 -07:00
|
|
|
transition_calls.last_position = d;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_transition_content_add(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
|
|
|
|
{
|
|
|
|
transition_calls.content_add.called ++;
|
|
|
|
transition_calls.content_add.subobj = subobj;
|
|
|
|
transition_calls.content_add.index = index;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
transition_calls.content_add.current_page_at_call = efl_ui_spotlight_active_element_get(container);
|
2019-04-28 03:28:55 -07:00
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
int i = efl_pack_index_get(container, efl_ui_spotlight_active_element_get(container));
|
2019-04-28 03:28:55 -07:00
|
|
|
if (i != -1)
|
|
|
|
_emit_pos(obj, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_transition_content_del(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Gfx_Entity *subobj, int index EINA_UNUSED)
|
|
|
|
{
|
|
|
|
transition_calls.content_del.called ++;
|
|
|
|
transition_calls.content_del.subobj = subobj;
|
|
|
|
transition_calls.content_del.index = index;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
transition_calls.content_del.current_page_at_call = efl_ui_spotlight_active_element_get(container);
|
2019-04-28 03:28:55 -07:00
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
int i = efl_pack_index_get(container, efl_ui_spotlight_active_element_get(container));
|
2019-04-28 03:28:55 -07:00
|
|
|
if (i != -1)
|
|
|
|
_emit_pos(obj, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_transition_request_switch(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, int from, int to)
|
|
|
|
{
|
|
|
|
transition_calls.request_switch.called++;
|
|
|
|
transition_calls.request_switch.from = from;
|
|
|
|
transition_calls.request_switch.to = to;
|
|
|
|
|
|
|
|
_emit_pos(obj, to);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_transition_page_size_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Eina_Size2D size)
|
|
|
|
{
|
|
|
|
transition_calls.page_size.called++;
|
|
|
|
transition_calls.page_size.size = size;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-04 16:02:43 -07:00
|
|
|
_transition_bind(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Efl_Ui_Spotlight_Container *spotlight, Efl_Canvas_Group *group)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
transition_calls.spotlight.called++;
|
|
|
|
transition_calls.spotlight.spotlight = spotlight;
|
|
|
|
transition_calls.spotlight.group = group;
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_transition_animation_set(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED, Eina_Bool animation)
|
|
|
|
{
|
|
|
|
transition_calls.animation.called++;
|
2019-11-20 07:16:22 -08:00
|
|
|
transition_calls.animation.value = animation;
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static Eina_Bool
|
|
|
|
_transition_animation_get(Eo *obj EINA_UNUSED, void *pd EINA_UNUSED)
|
|
|
|
{
|
|
|
|
return EINA_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
EFL_OPS_DEFINE(transition_tracker,
|
2019-11-11 08:38:08 -08:00
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animated_transition_set, _transition_animation_set),
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_animated_transition_get, _transition_animation_get),
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_add, _transition_content_add),
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_content_del, _transition_content_del),
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_switch_to, _transition_request_switch),
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_size_set, _transition_page_size_set),
|
|
|
|
EFL_OBJECT_OP_FUNC(efl_ui_spotlight_manager_bind, _transition_bind),
|
2019-04-28 03:28:55 -07:00
|
|
|
);
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
static Efl_Ui_Spotlight_Manager*
|
2019-04-28 03:28:55 -07:00
|
|
|
_create_transition(void)
|
|
|
|
{
|
|
|
|
Eo *obj;
|
|
|
|
|
2019-07-12 09:39:07 -07:00
|
|
|
obj = efl_new(efl_ui_spotlight_manager_realized_class_get());
|
2019-04-28 03:28:55 -07:00
|
|
|
efl_object_override(obj, &transition_tracker);
|
|
|
|
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_init)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
ck_assert_ptr_ne(container, NULL);
|
|
|
|
ck_assert_ptr_ne(win, NULL);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_indicator_get(container), NULL);
|
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_manager_get(container), NULL);
|
|
|
|
Eina_Size2D s = efl_ui_spotlight_size_get(container);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(s.w, 0); //FIXME
|
|
|
|
ck_assert_int_eq(s.h, 0); //FIXME
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), NULL);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_active_index)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
|
|
|
efl_pack(container, w);
|
|
|
|
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
|
|
|
|
EXPECT_ERROR_START;
|
|
|
|
efl_ui_spotlight_active_element_set(container, 0x0);
|
|
|
|
EXPECT_ERROR_END;
|
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
|
|
|
|
EXPECT_ERROR_START;
|
|
|
|
efl_ui_spotlight_active_element_set(container, (void*)0xAFFE);
|
|
|
|
EXPECT_ERROR_END;
|
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
|
|
|
|
EXPECT_ERROR_START;
|
|
|
|
efl_ui_spotlight_active_element_set(container, efl_main_loop_get());
|
|
|
|
EXPECT_ERROR_END;
|
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
|
|
|
|
|
2019-04-28 03:28:55 -07:00
|
|
|
efl_del(w);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), NULL);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-11-28 10:31:04 -08:00
|
|
|
static void
|
|
|
|
_verify_transition_calls(int number_of_animation_calls, Eina_Bool animation_value)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
Efl_Ui_Widget *w, *w1, *w2;
|
|
|
|
|
|
|
|
w = efl_add(WIDGET_CLASS, win);
|
|
|
|
w1 = efl_add(WIDGET_CLASS, win);
|
|
|
|
w2 = efl_add(WIDGET_CLASS, win);
|
|
|
|
|
|
|
|
transition_calls.last_position = -2.0;
|
2019-11-28 10:31:04 -08:00
|
|
|
ck_assert_int_eq(transition_calls.animation.called, number_of_animation_calls);
|
|
|
|
ck_assert_int_eq(transition_calls.animation.value, animation_value);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(transition_calls.spotlight.called, 1);
|
|
|
|
ck_assert_ptr_eq(transition_calls.spotlight.spotlight, container);
|
2019-04-28 03:28:55 -07:00
|
|
|
//We cannot verify group
|
|
|
|
ck_assert_int_eq(transition_calls.page_size.called, 1);
|
|
|
|
ck_assert_int_eq(transition_calls.page_size.size.w, 0); //FIXME
|
|
|
|
ck_assert_int_eq(transition_calls.page_size.size.h, 0); //FIXME
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.content_add.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.content_del.called, 0);
|
2019-07-04 16:02:43 -07:00
|
|
|
transition_calls.spotlight.called = 0;
|
2019-04-28 03:28:55 -07:00
|
|
|
transition_calls.page_size.called = 0;
|
|
|
|
|
|
|
|
//must update content, and request a switch from -1 to 1
|
|
|
|
efl_pack(container, w);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(transition_calls.spotlight.called, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(transition_calls.page_size.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.called, 1);
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.from, -1);
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.to, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.content_add.called, 1);
|
|
|
|
ck_assert_int_eq(transition_calls.content_add.index, 0);
|
|
|
|
ck_assert_ptr_eq(transition_calls.content_add.subobj, w);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(transition_calls.content_add.current_page_at_call, NULL);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(transition_calls.content_del.called, 0);
|
|
|
|
transition_calls.content_add.called = 0;
|
|
|
|
transition_calls.request_switch.called = 0;
|
|
|
|
|
|
|
|
//this must update content and a updated current page, but no other call
|
|
|
|
efl_pack_begin(container, w1);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(transition_calls.spotlight.called, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(transition_calls.page_size.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.content_add.called, 1);
|
|
|
|
ck_assert_int_eq(transition_calls.content_add.index, 0);
|
|
|
|
ck_assert_ptr_eq(transition_calls.content_add.subobj, w1);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(transition_calls.content_add.current_page_at_call, w);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(transition_calls.content_del.called, 0);
|
|
|
|
transition_calls.content_add.called = 0;
|
|
|
|
transition_calls.request_switch.called = 0;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
//new object, must update the content and a not update current page
|
|
|
|
efl_pack_end(container, w2);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(transition_calls.spotlight.called, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(transition_calls.page_size.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.content_add.called, 1);
|
|
|
|
ck_assert_int_eq(transition_calls.content_add.index, 2);
|
|
|
|
ck_assert_ptr_eq(transition_calls.content_add.subobj, w2);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(transition_calls.content_add.current_page_at_call, w);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(transition_calls.content_del.called, 0);
|
|
|
|
transition_calls.content_add.called = 0;
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
//page change must result in a call to request a switch
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
efl_ui_spotlight_active_element_set(container, w2);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(transition_calls.spotlight.called, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(transition_calls.page_size.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.called, 1);
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.from, 1);
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.to, 2);
|
|
|
|
ck_assert_int_eq(transition_calls.content_add.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.content_del.called, 0);
|
|
|
|
transition_calls.request_switch.called = 0;
|
|
|
|
|
|
|
|
//deletion of object must result in a content update
|
|
|
|
efl_del(w);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(transition_calls.spotlight.called, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(transition_calls.page_size.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.request_switch.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.content_add.called, 0);
|
|
|
|
ck_assert_int_eq(transition_calls.content_del.called, 1);
|
|
|
|
ck_assert_int_eq(transition_calls.content_del.index, 1);
|
|
|
|
ck_assert_ptr_eq(transition_calls.content_del.subobj, w);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(transition_calls.content_del.current_page_at_call, w2);
|
2019-04-28 03:28:55 -07:00
|
|
|
transition_calls.content_del.called = 0;
|
|
|
|
}
|
2019-11-28 10:31:04 -08:00
|
|
|
|
|
|
|
EFL_START_TEST (efl_ui_smart_transition_calls)
|
|
|
|
{
|
|
|
|
Efl_Ui_Spotlight_Manager*t = _create_transition();
|
|
|
|
efl_ui_spotlight_manager_set(container, t);
|
|
|
|
|
|
|
|
_verify_transition_calls(2, EINA_TRUE);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
EFL_START_TEST (efl_ui_smart_transition_calls_no_animation)
|
|
|
|
{
|
|
|
|
Efl_Ui_Spotlight_Manager*t = _create_transition();
|
|
|
|
efl_ui_spotlight_manager_set(container, t);
|
|
|
|
efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
|
|
|
|
|
|
|
|
_verify_transition_calls(3, EINA_FALSE);
|
|
|
|
}
|
2019-04-28 03:28:55 -07:00
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
|
|
|
|
EFL_START_TEST (efl_ui_smart_transition_lifetime)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Manager*t, *t1;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
t = _create_transition();
|
|
|
|
efl_wref_add(t, &t);
|
|
|
|
t1 = _create_transition();
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_manager_set(container, t);
|
|
|
|
efl_ui_spotlight_manager_set(container, t1);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_ptr_eq(t, NULL);
|
2019-09-27 08:07:37 -07:00
|
|
|
ck_assert_ptr_ne(t1, NULL);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
static void
|
|
|
|
_verify_indicator_calls(void)
|
|
|
|
{
|
|
|
|
Efl_Ui_Widget *w, *w1, *w2;
|
|
|
|
|
|
|
|
w = efl_add(WIDGET_CLASS, win);
|
|
|
|
w1 = efl_add(WIDGET_CLASS, win);
|
|
|
|
w2 = efl_add(WIDGET_CLASS, win);
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.spotlight.called, 1);
|
|
|
|
ck_assert_ptr_eq(indicator_calls.spotlight.spotlight, container);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.content_add.called, 0);
|
|
|
|
ck_assert_int_eq(indicator_calls.content_del.called, 0);
|
|
|
|
ck_assert_int_eq(indicator_calls.position_update.called, 0);
|
2019-07-04 16:02:43 -07:00
|
|
|
indicator_calls.spotlight.called = 0;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
efl_pack(container, w);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.spotlight.called, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.content_add.called, 1);
|
|
|
|
ck_assert_int_eq(indicator_calls.content_add.index, 0);
|
|
|
|
ck_assert_ptr_eq(indicator_calls.content_add.subobj, w);
|
|
|
|
ck_assert_int_eq(indicator_calls.content_del.called, 0);
|
|
|
|
ck_assert_int_eq(indicator_calls.position_update.called, 1);
|
|
|
|
ck_assert(indicator_calls.position_update.position == 0.0);
|
|
|
|
indicator_calls.content_add.called = 0;
|
|
|
|
indicator_calls.position_update.called = 0;
|
|
|
|
|
|
|
|
efl_pack_begin(container, w1);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.spotlight.called, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.content_add.called, 1);
|
|
|
|
ck_assert_int_eq(indicator_calls.content_add.index, 0);
|
|
|
|
ck_assert_ptr_eq(indicator_calls.content_add.subobj, w1);
|
|
|
|
ck_assert_int_eq(indicator_calls.content_del.called, 0);
|
|
|
|
ck_assert_int_eq(indicator_calls.position_update.called, 1);
|
|
|
|
ck_assert(indicator_calls.position_update.position == 1.0);
|
|
|
|
indicator_calls.content_add.called = 0;
|
|
|
|
indicator_calls.position_update.called = 0;
|
|
|
|
|
|
|
|
efl_pack_end(container, w2);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.spotlight.called, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.content_add.called, 1);
|
|
|
|
ck_assert_int_eq(indicator_calls.content_add.index, 2);
|
|
|
|
ck_assert_ptr_eq(indicator_calls.content_add.subobj, w2);
|
|
|
|
ck_assert_int_eq(indicator_calls.content_del.called, 0);
|
|
|
|
ck_assert_int_eq(indicator_calls.position_update.called, 0);
|
|
|
|
indicator_calls.content_add.called = 0;
|
|
|
|
indicator_calls.position_update.called = 0;
|
|
|
|
|
|
|
|
efl_del(w1);
|
2019-07-04 16:02:43 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.spotlight.called, 0);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(indicator_calls.content_add.called, 0);
|
|
|
|
ck_assert_int_eq(indicator_calls.content_del.called, 1);
|
|
|
|
ck_assert_int_eq(indicator_calls.content_del.index, 0);
|
|
|
|
ck_assert_ptr_eq(indicator_calls.content_del.subobj, w1);
|
|
|
|
ck_assert_int_eq(indicator_calls.position_update.called, 1);
|
|
|
|
ck_assert(indicator_calls.position_update.position == 0.0);
|
|
|
|
indicator_calls.content_del.called = 0;
|
|
|
|
indicator_calls.position_update.called = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
EFL_START_TEST (efl_ui_smart_indicator_calls)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Manager*i = _create_indicator();
|
|
|
|
efl_ui_spotlight_indicator_set(container, i);
|
2019-04-28 03:28:55 -07:00
|
|
|
_verify_indicator_calls();
|
2019-09-27 08:07:37 -07:00
|
|
|
ck_assert_ptr_ne(i, NULL);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
EFL_START_TEST (efl_ui_smart_indicator_transition_calls)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Manager *i = _create_indicator();
|
|
|
|
Efl_Ui_Spotlight_Manager *t = _create_transition();
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
transition_calls.last_position = -2.0;
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_indicator_set(container, i);
|
|
|
|
efl_ui_spotlight_manager_set(container, t);
|
2019-04-28 03:28:55 -07:00
|
|
|
_verify_indicator_calls();
|
2019-09-27 08:07:37 -07:00
|
|
|
ck_assert_ptr_ne(i, NULL);
|
|
|
|
ck_assert_ptr_ne(t, NULL);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Transition_Event start;
|
|
|
|
Efl_Ui_Spotlight_Transition_Event end;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_start(void *data EINA_UNUSED, const Efl_Event *ev)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Transition_Event *e = ev->info;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
memcpy(&start, e, sizeof(Efl_Ui_Spotlight_Transition_Event));
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_end(void *data EINA_UNUSED, const Efl_Event *ev)
|
|
|
|
{
|
2019-07-04 16:02:43 -07:00
|
|
|
Efl_Ui_Spotlight_Transition_Event *e = ev->info;
|
2019-04-28 03:28:55 -07:00
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
memcpy(&end, e, sizeof(Efl_Ui_Spotlight_Transition_Event));
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
#define EV_RESET \
|
|
|
|
start.from = -8; \
|
|
|
|
start.to = -8; \
|
|
|
|
end.from = -8; \
|
|
|
|
end.to = -8;
|
|
|
|
|
|
|
|
static void
|
|
|
|
_verify_transition_start_end_events(void)
|
|
|
|
{
|
|
|
|
Efl_Ui_Widget *w, *w1, *w2;
|
|
|
|
|
|
|
|
w = efl_add(WIDGET_CLASS, win);
|
|
|
|
w1 = efl_add(WIDGET_CLASS, win);
|
|
|
|
w2 = efl_add(WIDGET_CLASS, win);
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_event_callback_add(container, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_START, _start, NULL);
|
|
|
|
efl_event_callback_add(container, EFL_UI_SPOTLIGHT_EVENT_TRANSITION_END, _end, NULL);
|
2019-04-28 03:28:55 -07:00
|
|
|
|
|
|
|
EV_RESET
|
|
|
|
efl_pack_end(container, w);
|
|
|
|
ck_assert_int_eq(start.to, 0);
|
|
|
|
ck_assert_int_eq(end.to, 0);
|
|
|
|
ck_assert_int_eq(start.from, -1);
|
|
|
|
ck_assert_int_eq(end.from, -1);
|
|
|
|
|
|
|
|
EV_RESET
|
|
|
|
efl_pack_begin(container, w1);
|
|
|
|
efl_pack_end(container, w2);
|
|
|
|
ck_assert_int_eq(start.to, -8);
|
|
|
|
ck_assert_int_eq(end.to, -8);
|
|
|
|
ck_assert_int_eq(start.from, -8);
|
|
|
|
ck_assert_int_eq(end.from, -8);
|
|
|
|
|
|
|
|
EV_RESET
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
efl_ui_spotlight_active_element_set(container, w2);
|
2019-04-28 03:28:55 -07:00
|
|
|
ck_assert_int_eq(start.to, 2);
|
|
|
|
ck_assert_int_eq(end.to, 2);
|
|
|
|
ck_assert_int_eq(start.from, 1);
|
|
|
|
ck_assert_int_eq(end.from, 1);
|
|
|
|
}
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_manager_start_end)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
|
|
|
transition_calls.last_position = -2.0;
|
|
|
|
|
|
|
|
_verify_transition_start_end_events();
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_test_push1)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
2019-05-18 09:45:50 -07:00
|
|
|
for (int i = 0; i < 5; ++i)
|
|
|
|
{
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
|
|
|
efl_pack_end(container, w);
|
|
|
|
}
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_push(container, w);
|
2019-12-03 02:48:56 -08:00
|
|
|
ck_assert_int_eq(efl_pack_index_get(container, w), 1);
|
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 1));
|
2019-05-18 09:45:50 -07:00
|
|
|
}
|
|
|
|
EFL_END_TEST
|
2019-04-28 03:28:55 -07:00
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_test_push2)
|
2019-05-18 09:45:50 -07:00
|
|
|
{
|
2019-04-28 03:28:55 -07:00
|
|
|
for (int i = 0; i < 5; ++i)
|
|
|
|
{
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
2019-05-18 09:45:50 -07:00
|
|
|
efl_pack_end(container, w);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
if (i == 3)
|
|
|
|
efl_ui_spotlight_active_element_set(container, w);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
2019-05-18 09:45:50 -07:00
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_push(container, w);
|
2019-12-03 02:48:56 -08:00
|
|
|
ck_assert_int_eq(efl_pack_index_get(container, w), 4);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), w);
|
2019-05-18 09:45:50 -07:00
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
|
|
|
static Eina_Value
|
|
|
|
_then_cb(void *data, const Eina_Value v, const Eina_Future *dead_future EINA_UNUSED)
|
|
|
|
{
|
|
|
|
Eo **value = data;
|
|
|
|
|
|
|
|
*value = eina_value_object_get(&v);
|
|
|
|
|
|
|
|
return EINA_VALUE_EMPTY;
|
|
|
|
}
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_test_pop1)
|
2019-05-18 09:45:50 -07:00
|
|
|
{
|
|
|
|
Eo *called;
|
|
|
|
for (int i = 0; i < 5; ++i)
|
|
|
|
{
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
|
|
|
efl_pack_end(container, w);
|
|
|
|
}
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_push(container, w);
|
|
|
|
Eina_Future *f = efl_ui_spotlight_pop(container, EINA_FALSE);
|
2019-05-18 09:45:50 -07:00
|
|
|
eina_future_then(f, _then_cb, &called);
|
|
|
|
for (int i = 0; i < 10; ++i)
|
|
|
|
{
|
|
|
|
efl_loop_iterate(efl_provider_find(container, EFL_LOOP_CLASS));
|
|
|
|
}
|
|
|
|
ck_assert_ptr_eq(efl_ui_widget_parent_get(w), win);
|
|
|
|
ck_assert_int_eq(efl_content_count(container), 5);
|
|
|
|
ck_assert_ptr_eq(called, w);
|
|
|
|
ck_assert_ptr_ne(f, NULL);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_test_pop2)
|
2019-05-18 09:45:50 -07:00
|
|
|
{
|
|
|
|
for (int i = 0; i < 5; ++i)
|
|
|
|
{
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
|
|
|
efl_pack_end(container, w);
|
|
|
|
}
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_push(container, w);
|
|
|
|
Eina_Future *f = efl_ui_spotlight_pop(container, EINA_TRUE);
|
2019-05-18 09:45:50 -07:00
|
|
|
for (int i = 0; i < 10; ++i)
|
|
|
|
{
|
|
|
|
efl_loop_iterate(efl_provider_find(container, EFL_LOOP_CLASS));
|
|
|
|
}
|
|
|
|
ck_assert_int_eq(efl_ref_count(w), 0);
|
|
|
|
ck_assert_int_eq(efl_content_count(container), 5);
|
|
|
|
ck_assert_ptr_ne(f, NULL);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_test_pop3)
|
2019-05-18 09:45:50 -07:00
|
|
|
{
|
|
|
|
for (int i = 0; i < 5; ++i)
|
|
|
|
{
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
|
|
|
efl_pack_end(container, w);
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
if (i == 3)
|
|
|
|
efl_ui_spotlight_active_element_set(container, w);
|
2019-05-18 09:45:50 -07:00
|
|
|
}
|
|
|
|
Efl_Ui_Widget *w = efl_add(WIDGET_CLASS, win);
|
2019-07-04 16:02:43 -07:00
|
|
|
efl_ui_spotlight_push(container, w);
|
|
|
|
Eina_Future *f = efl_ui_spotlight_pop(container, EINA_TRUE);
|
2019-05-18 09:45:50 -07:00
|
|
|
for (int i = 0; i < 10; ++i)
|
|
|
|
{
|
|
|
|
efl_loop_iterate(efl_provider_find(container, EFL_LOOP_CLASS));
|
|
|
|
}
|
efl_ui_spotlight: migrate from active_index to active_element
after playing arround with the widget, we found out that it feels quite
weird to have a index, where most of the time you work with widgets.
We might want to add syntax suger in the future to make it easier to
just jump to the next element, or to the previous, but that still is to
be decided.
The event and the communication to the spotlight manager are still left
to be used with the index, reason for this is, that we might need to
fill there an invalid pointer, if a deletion is triggering an animation,
which seems quite weird. That needs further discussing.
Docx have been updated, the sitemarks about the shifting of the
active_index can be removed, as the element is not subject of change
during content adds/deletes.
ref T7991
Reviewed-by: Jaehyun Cho <jae_hyun.cho@samsung.com>
Differential Revision: https://phab.enlightenment.org/D9813
2019-09-02 01:26:40 -07:00
|
|
|
ck_assert_ptr_eq(efl_ui_spotlight_active_element_get(container), efl_pack_content_get(container, 3));
|
2019-05-18 09:45:50 -07:00
|
|
|
ck_assert_int_eq(efl_ref_count(w), 0);
|
|
|
|
ck_assert_int_eq(efl_content_count(container), 5);
|
|
|
|
ck_assert_ptr_ne(f, NULL);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-11-20 07:16:22 -08:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_animated_transition)
|
|
|
|
{
|
|
|
|
//this checks animation handing with the plain manager, there is no animation that will be played, but the flag should be preserved
|
|
|
|
ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_TRUE);
|
|
|
|
efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
|
|
|
|
ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_FALSE);
|
|
|
|
|
|
|
|
//now check with a real spotlight manager
|
|
|
|
efl_ui_spotlight_manager_set(container, efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS));
|
|
|
|
efl_ui_spotlight_animated_transition_set(container, EINA_TRUE);
|
|
|
|
ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_TRUE);
|
|
|
|
ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_TRUE);
|
|
|
|
|
|
|
|
efl_ui_spotlight_animated_transition_set(container, EINA_FALSE);
|
|
|
|
ck_assert_int_eq(efl_ui_spotlight_animated_transition_get(container), EINA_FALSE);
|
|
|
|
ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(efl_ui_spotlight_manager_get(container)), EINA_FALSE);
|
|
|
|
|
|
|
|
Eo *manager2 = efl_new(EFL_UI_SPOTLIGHT_MANAGER_STACK_CLASS);
|
|
|
|
Eina_Bool animated_transition_manager;
|
|
|
|
efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
|
|
|
|
efl_ui_spotlight_manager_set(efl_added, manager2),
|
|
|
|
efl_ui_spotlight_animated_transition_set(efl_added, EINA_TRUE),
|
|
|
|
animated_transition_manager = efl_ui_spotlight_manager_animated_transition_get(manager2));
|
|
|
|
ck_assert_int_eq(animated_transition_manager, EINA_FALSE);
|
|
|
|
ck_assert_int_eq(efl_ui_spotlight_manager_animated_transition_get(manager2), EINA_TRUE);
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-11-28 08:13:07 -08:00
|
|
|
EFL_START_TEST (efl_ui_spotlight_min_max_sizing)
|
|
|
|
{
|
|
|
|
Efl_Ui_Button *btn0, *btn1;
|
|
|
|
Eina_Size2D min, size;
|
|
|
|
|
|
|
|
btn0 = efl_add(WIDGET_CLASS, container);
|
|
|
|
efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 200));
|
|
|
|
|
|
|
|
btn1 = efl_add(WIDGET_CLASS, container);
|
|
|
|
efl_gfx_hint_size_min_set(btn1, EINA_SIZE2D(200, 20));
|
|
|
|
|
|
|
|
efl_pack_end(container, btn0);
|
|
|
|
efl_pack_end(container, btn1);
|
|
|
|
min = efl_gfx_hint_size_restricted_min_get(container);
|
|
|
|
ck_assert_int_eq(min.w, 200);
|
|
|
|
ck_assert_int_eq(min.h, 200);
|
|
|
|
|
|
|
|
efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 300));
|
|
|
|
efl_canvas_group_calculate(container);
|
|
|
|
|
|
|
|
min = efl_gfx_hint_size_restricted_min_get(container);
|
|
|
|
ck_assert_int_eq(min.w, 200);
|
|
|
|
ck_assert_int_eq(min.h, 300);
|
|
|
|
|
|
|
|
efl_gfx_hint_size_min_set(btn0, EINA_SIZE2D(20, 20));
|
|
|
|
efl_canvas_group_calculate(container);
|
|
|
|
|
|
|
|
min = efl_gfx_hint_size_restricted_min_get(container);
|
|
|
|
ck_assert_int_eq(min.w, 200);
|
|
|
|
ck_assert_int_eq(min.h, 20);
|
|
|
|
|
|
|
|
efl_ui_spotlight_size_set(container, EINA_SIZE2D(2000, 2000));
|
|
|
|
|
|
|
|
efl_gfx_entity_size_set(container, EINA_SIZE2D(200, 200));
|
|
|
|
size = efl_gfx_entity_size_get(btn0);
|
|
|
|
ck_assert_int_eq(size.w, 200);
|
|
|
|
ck_assert_int_eq(size.h, 200);
|
|
|
|
|
|
|
|
}
|
|
|
|
EFL_END_TEST
|
|
|
|
|
2019-06-10 06:54:22 -07:00
|
|
|
static void
|
2019-07-04 16:02:43 -07:00
|
|
|
spotlight_setup()
|
2019-06-10 06:54:22 -07:00
|
|
|
{
|
|
|
|
win = efl_add(EFL_UI_WIN_CLASS, efl_main_loop_get(),
|
|
|
|
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC));
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
container = efl_add(EFL_UI_SPOTLIGHT_CONTAINER_CLASS, win,
|
2019-06-10 06:54:22 -07:00
|
|
|
efl_content_set(win, efl_added));
|
|
|
|
|
|
|
|
efl_gfx_entity_size_set(win, EINA_SIZE2D(200, 200));
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2019-07-04 16:02:43 -07:00
|
|
|
spotlight_teardown()
|
2019-06-10 06:54:22 -07:00
|
|
|
{
|
|
|
|
memset(&transition_calls, 0, sizeof(transition_calls));
|
|
|
|
memset(&indicator_calls, 0, sizeof(indicator_calls));
|
|
|
|
}
|
|
|
|
|
2019-07-04 16:02:43 -07:00
|
|
|
void efl_ui_test_spotlight(TCase *tc)
|
2019-04-28 03:28:55 -07:00
|
|
|
{
|
2019-06-26 06:54:45 -07:00
|
|
|
tcase_add_checked_fixture(tc, fail_on_errors_setup, fail_on_errors_teardown);
|
2019-07-04 16:02:43 -07:00
|
|
|
tcase_add_checked_fixture(tc, spotlight_setup, spotlight_teardown);
|
|
|
|
tcase_add_test(tc, efl_ui_spotlight_init);
|
|
|
|
tcase_add_test(tc, efl_ui_spotlight_active_index);
|
2019-04-28 03:28:55 -07:00
|
|
|
tcase_add_test(tc, efl_ui_smart_transition_calls);
|
2019-11-28 10:31:04 -08:00
|
|
|
tcase_add_test(tc, efl_ui_smart_transition_calls_no_animation);
|
2019-04-28 03:28:55 -07:00
|
|
|
tcase_add_test(tc, efl_ui_smart_transition_lifetime);
|
|
|
|
tcase_add_test(tc, efl_ui_smart_indicator_calls);
|
|
|
|
tcase_add_test(tc, efl_ui_smart_indicator_transition_calls);
|
2019-07-04 16:02:43 -07:00
|
|
|
tcase_add_test(tc, efl_ui_spotlight_manager_start_end);
|
|
|
|
tcase_add_test(tc, efl_ui_spotlight_test_push1);
|
|
|
|
tcase_add_test(tc, efl_ui_spotlight_test_push2);
|
|
|
|
tcase_add_test(tc, efl_ui_spotlight_test_pop1);
|
|
|
|
tcase_add_test(tc, efl_ui_spotlight_test_pop2);
|
|
|
|
tcase_add_test(tc, efl_ui_spotlight_test_pop3);
|
2019-11-20 07:16:22 -08:00
|
|
|
tcase_add_test(tc, efl_ui_spotlight_animated_transition);
|
2019-11-28 08:13:07 -08:00
|
|
|
tcase_add_test(tc, efl_ui_spotlight_min_max_sizing);
|
2019-04-28 03:28:55 -07:00
|
|
|
}
|