aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/elementary/test_ui_slider.c
diff options
context:
space:
mode:
authorMarcel Hollerbach <mail@marcel-hollerbach.de>2019-07-16 13:58:42 +0200
committerXavi Artigas <xavierartigas@yahoo.es>2019-07-16 16:37:29 +0200
commit1bae8ec521f9e49453f51b921dbab1fe9c95fd6c (patch)
treead1a98fc2becdb53930131fd217a0471c229c4b0 /src/bin/elementary/test_ui_slider.c
parenttests/actionslider: add more actionslider unit tests (diff)
downloadefl-1bae8ec521f9e49453f51b921dbab1fe9c95fd6c.tar.gz
efl_ui_slider: change the semantical meaning of step property
Summary: before the step property was used as a relative value. The value that was added in the end was (max-min)*step. Which is quite confusing given the fact that the other APIs in in efl_ui_range_display are also taking values absolut. Other implementations also do so. fix https://phab.enlightenment.org/T4834 Subscribers: cedric, #reviewers, #committers Tags: #efl Maniphest Tasks: https://phab.enlightenment.org/T4834 Differential Revision: https://phab.enlightenment.org/D9327
Diffstat (limited to 'src/bin/elementary/test_ui_slider.c')
-rw-r--r--src/bin/elementary/test_ui_slider.c25
1 files changed, 6 insertions, 19 deletions
diff --git a/src/bin/elementary/test_ui_slider.c b/src/bin/elementary/test_ui_slider.c
index 38447efbc4..75df5f9d98 100644
--- a/src/bin/elementary/test_ui_slider.c
+++ b/src/bin/elementary/test_ui_slider.c
@@ -4,17 +4,6 @@
#include <Efl_Ui.h>
#include <Elementary.h>
-static double
-_step_size_calculate(double min, double max)
-{
- double step = 0.0;
- int steps = 0;
-
- steps = max - min;
- if (steps) step = (1.0 / steps);
- return step;
-}
-
static void
_slider_changed_cb(void *data EINA_UNUSED, const Efl_Event *ev)
{
@@ -31,7 +20,6 @@ void
test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
{
Eo *win, *bx, *hbx;
- double step;
win = efl_add_ref(EFL_UI_WIN_CLASS, NULL,
efl_ui_win_type_set(efl_added, EFL_UI_WIN_TYPE_BASIC),
@@ -67,11 +55,10 @@ test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
efl_text_interactive_editable_set(efl_added, EINA_FALSE),
efl_pack(bx, efl_added));
- step = _step_size_calculate(0, 9);
efl_add(EFL_UI_SLIDER_CLASS, bx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(120, 0)),
efl_gfx_hint_align_set(efl_added, 0.5, 0.5),
- efl_ui_range_step_set(efl_added, step),
+ efl_ui_range_step_set(efl_added, 0.1),
efl_pack(bx, efl_added));
efl_add(EFL_UI_TEXT_CLASS, bx,
@@ -82,7 +69,7 @@ test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
efl_add(EFL_UI_SLIDER_CLASS, bx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(120, 0)),
efl_ui_range_limits_set(efl_added, 10, 145),
- efl_ui_range_step_set(efl_added, step),
+ efl_ui_range_step_set(efl_added, 9),
elm_object_disabled_set(efl_added, EINA_TRUE),
efl_pack(bx, efl_added));
@@ -98,7 +85,7 @@ test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
efl_add(EFL_UI_SLIDER_CLASS, hbx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 160)),
efl_ui_range_limits_set(efl_added, 10, 145),
- efl_ui_range_step_set(efl_added, step),
+ efl_ui_range_step_set(efl_added, 9),
efl_ui_range_value_set(efl_added, 70),
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL),
efl_pack(hbx, efl_added));
@@ -106,7 +93,7 @@ test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
efl_add(EFL_UI_SLIDER_CLASS, hbx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 160)),
efl_ui_range_limits_set(efl_added, 10, 145),
- efl_ui_range_step_set(efl_added, step),
+ efl_ui_range_step_set(efl_added, 9),
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL),
elm_object_disabled_set(efl_added, EINA_TRUE),
efl_pack(hbx, efl_added));
@@ -115,7 +102,7 @@ test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(0, 160)),
efl_ui_range_limits_set(efl_added, 10, 145),
efl_ui_range_value_set(efl_added, 35),
- efl_ui_range_step_set(efl_added, step),
+ efl_ui_range_step_set(efl_added, 9),
efl_ui_layout_orientation_set(efl_added, EFL_UI_LAYOUT_ORIENTATION_VERTICAL | EFL_UI_LAYOUT_ORIENTATION_INVERTED),
efl_pack(hbx, efl_added));
@@ -127,7 +114,7 @@ test_ui_slider(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event
efl_add(EFL_UI_SLIDER_CLASS, bx,
efl_gfx_hint_size_min_set(efl_added, EINA_SIZE2D(260, 0)),
efl_ui_range_limits_set(efl_added, 0, 150),
- efl_ui_range_step_set(efl_added, step),
+ efl_ui_range_step_set(efl_added, 9),
efl_event_callback_add(efl_added, EFL_UI_SLIDER_EVENT_CHANGED, _slider_changed_cb, NULL),
efl_pack(bx, efl_added));
}