summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2013-02-08 09:46:47 +0000
committerCarsten Haitzler <raster@rasterman.com>2013-02-08 09:46:47 +0000
commit9d72abefe28787ecc2de3aa3af894640abb09f7e (patch)
tree582bf63c2e4e4906f4899f5ffb37793158e2c987 /src/bin
parentd3d3c97d16f6b1fd494d6eb97988b03221f38fe2 (diff)
add test case to slider
SVN revision: 83775
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/test_slider.c93
1 files changed, 78 insertions, 15 deletions
diff --git a/src/bin/test_slider.c b/src/bin/test_slider.c
index 5e62efbb0..66a151cd3 100644
--- a/src/bin/test_slider.c
+++ b/src/bin/test_slider.c
@@ -12,9 +12,40 @@ _change_cb(void *data, Evas_Object *obj, void *event_info __UNUSED__)
12} 12}
13 13
14void 14void
15_change_print_cb(void *data __UNUSED__, Evas_Object *obj, void *event_info __UNUSED__)
16{
17 double val = elm_slider_value_get(obj);
18 printf("change to %3.3f\n", val);
19}
20
21void
22_bt_0(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
23{
24 elm_slider_value_set(data, 0.0);
25}
26
27void
28_bt_1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
29{
30 elm_slider_value_set(data, 1.0);
31}
32
33void
34_bt_p1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
35{
36 elm_slider_value_set(data, elm_slider_value_get(data) + 0.1);
37}
38
39void
40_bt_m1(void *data, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
41{
42 elm_slider_value_set(data, elm_slider_value_get(data) - 0.1);
43}
44
45void
15test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__) 46test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info __UNUSED__)
16{ 47{
17 Evas_Object *win, *bx, *sl, *ic, *sl1, *bx2; 48 Evas_Object *win, *bx, *sl, *ic, *sl1, *bx2, *bt;
18 char buf[PATH_MAX]; 49 char buf[PATH_MAX];
19 50
20 win = elm_win_util_standard_add("slider", "Slider"); 51 win = elm_win_util_standard_add("slider", "Slider");
@@ -37,7 +68,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
37 elm_slider_unit_format_set(sl, "%1.1f units"); 68 elm_slider_unit_format_set(sl, "%1.1f units");
38 elm_slider_span_size_set(sl, 120); 69 elm_slider_span_size_set(sl, 120);
39 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); 70 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
40 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 71 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
41 elm_box_pack_end(bx, sl); 72 elm_box_pack_end(bx, sl);
42 evas_object_show(ic); 73 evas_object_show(ic);
43 evas_object_show(sl); 74 evas_object_show(sl);
@@ -57,7 +88,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
57 elm_slider_value_set(sl, 80); 88 elm_slider_value_set(sl, 80);
58 elm_object_disabled_set(sl, EINA_TRUE); 89 elm_object_disabled_set(sl, EINA_TRUE);
59 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); 90 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
60 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 91 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
61 elm_box_pack_end(bx, sl); 92 elm_box_pack_end(bx, sl);
62 evas_object_show(ic); 93 evas_object_show(ic);
63 evas_object_show(sl); 94 evas_object_show(sl);
@@ -72,7 +103,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
72 elm_object_part_content_set(sl, "end", ic); 103 elm_object_part_content_set(sl, "end", ic);
73 elm_slider_span_size_set(sl, 80); 104 elm_slider_span_size_set(sl, 80);
74 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); 105 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
75 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 106 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
76 elm_slider_indicator_format_set(sl, "%3.0f"); 107 elm_slider_indicator_format_set(sl, "%3.0f");
77 elm_slider_min_max_set(sl, 50, 150); 108 elm_slider_min_max_set(sl, 50, 150);
78 elm_slider_value_set(sl, 80); 109 elm_slider_value_set(sl, 80);
@@ -94,7 +125,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
94 elm_object_part_content_set(sl, "end", ic); 125 elm_object_part_content_set(sl, "end", ic);
95 elm_slider_span_size_set(sl, 80); 126 elm_slider_span_size_set(sl, 80);
96 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); 127 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
97 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 128 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 0.0);
98 elm_slider_indicator_format_set(sl, "%3.0f"); 129 elm_slider_indicator_format_set(sl, "%3.0f");
99 elm_slider_min_max_set(sl, 50, 150); 130 elm_slider_min_max_set(sl, 50, 150);
100 elm_slider_value_set(sl, 80); 131 elm_slider_value_set(sl, 80);
@@ -112,7 +143,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
112 elm_slider_unit_format_set(sl, "%3.0f units"); 143 elm_slider_unit_format_set(sl, "%3.0f units");
113 elm_slider_span_size_set(sl, 40); 144 elm_slider_span_size_set(sl, 40);
114 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5); 145 evas_object_size_hint_align_set(sl, EVAS_HINT_FILL, 0.5);
115 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 146 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, 00);
116 elm_slider_indicator_format_set(sl, "%3.0f"); 147 elm_slider_indicator_format_set(sl, "%3.0f");
117 elm_slider_min_max_set(sl, 50, 150); 148 elm_slider_min_max_set(sl, 50, 150);
118 elm_slider_value_set(sl, 80); 149 elm_slider_value_set(sl, 80);
@@ -124,6 +155,7 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
124 155
125 bx2 = elm_box_add(win); 156 bx2 = elm_box_add(win);
126 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 157 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
158 evas_object_size_hint_align_set(bx2, 0.5, EVAS_HINT_FILL);
127 elm_box_horizontal_set(bx2, EINA_TRUE); 159 elm_box_horizontal_set(bx2, EINA_TRUE);
128 elm_box_pack_end(bx, bx2); 160 elm_box_pack_end(bx, bx2);
129 evas_object_show(bx2); 161 evas_object_show(bx2);
@@ -152,15 +184,18 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
152 evas_object_smart_callback_add(sl1, "changed", _change_cb, sl); 184 evas_object_smart_callback_add(sl1, "changed", _change_cb, sl);
153 185
154 sl = elm_slider_add(win); 186 sl = elm_slider_add(win);
155 elm_object_text_set(sl, "Vertical"); 187 elm_object_part_content_set(sl, "icon", ic);
188 elm_object_text_set(sl, "Disabled vertical");
189 elm_slider_inverted_set(sl, EINA_TRUE);
156 elm_slider_unit_format_set(sl, "%1.1f units"); 190 elm_slider_unit_format_set(sl, "%1.1f units");
157 elm_slider_span_size_set(sl, 60); 191 elm_slider_span_size_set(sl, 100);
158 evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); 192 evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
159 evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); 193 evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
160 elm_slider_indicator_format_set(sl, "%1.1f"); 194 elm_slider_indicator_format_set(sl, "%1.1f");
161 elm_slider_value_set(sl, 0.2); 195 elm_slider_value_set(sl, 0.2);
162 elm_object_scale_set(sl, 1.0); 196 elm_object_scale_set(sl, 1.0);
163 elm_slider_horizontal_set(sl, EINA_FALSE); 197 elm_slider_horizontal_set(sl, 0);
198 elm_object_disabled_set(sl, EINA_TRUE);
164 elm_box_pack_end(bx2, sl); 199 elm_box_pack_end(bx2, sl);
165 evas_object_show(ic); 200 evas_object_show(ic);
166 evas_object_show(sl); 201 evas_object_show(sl);
@@ -172,22 +207,50 @@ test_slider(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info
172 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1); 207 evas_object_size_hint_aspect_set(ic, EVAS_ASPECT_CONTROL_HORIZONTAL, 1, 1);
173 208
174 sl = elm_slider_add(win); 209 sl = elm_slider_add(win);
175 elm_object_part_content_set(sl, "icon", ic); 210 elm_object_text_set(sl, "Vertical");
176 elm_object_text_set(sl, "Disabled vertical");
177 elm_slider_inverted_set(sl, EINA_TRUE);
178 elm_slider_unit_format_set(sl, "%1.1f units"); 211 elm_slider_unit_format_set(sl, "%1.1f units");
179 elm_slider_span_size_set(sl, 100); 212 elm_slider_span_size_set(sl, 60);
180 evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL); 213 evas_object_size_hint_align_set(sl, 0.5, EVAS_HINT_FILL);
181 evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND); 214 evas_object_size_hint_weight_set(sl, 0.0, EVAS_HINT_EXPAND);
182 elm_slider_indicator_format_set(sl, "%1.1f"); 215 elm_slider_indicator_format_set(sl, "%1.1f");
183 elm_slider_value_set(sl, 0.2); 216 elm_slider_value_set(sl, 0.2);
184 elm_object_scale_set(sl, 1.0); 217 elm_object_scale_set(sl, 1.0);
185 elm_slider_horizontal_set(sl, 0); 218 elm_slider_horizontal_set(sl, EINA_FALSE);
186 elm_object_disabled_set(sl, EINA_TRUE); 219 evas_object_smart_callback_add(sl, "changed", _change_print_cb, sl);
187 elm_box_pack_end(bx2, sl); 220 elm_box_pack_end(bx2, sl);
188 evas_object_show(ic); 221 evas_object_show(ic);
189 evas_object_show(sl); 222 evas_object_show(sl);
190 223
224 bx2 = elm_box_add(win);
225 evas_object_size_hint_weight_set(bx2, EVAS_HINT_EXPAND, 0.0);
226 elm_box_horizontal_set(bx2, EINA_TRUE);
227 elm_box_pack_end(bx, bx2);
228 evas_object_show(bx2);
229
230 bt = elm_button_add(win);
231 elm_object_text_set(bt, "0");
232 evas_object_smart_callback_add(bt, "clicked", _bt_0, sl);
233 evas_object_show(bt);
234 elm_box_pack_end(bx2, bt);
235
236 bt = elm_button_add(win);
237 elm_object_text_set(bt, "1");
238 evas_object_smart_callback_add(bt, "clicked", _bt_1, sl);
239 evas_object_show(bt);
240 elm_box_pack_end(bx2, bt);
241
242 bt = elm_button_add(win);
243 elm_object_text_set(bt, "+.1");
244 evas_object_smart_callback_add(bt, "clicked", _bt_p1, sl);
245 evas_object_show(bt);
246 elm_box_pack_end(bx2, bt);
247
248 bt = elm_button_add(win);
249 elm_object_text_set(bt, "-.1");
250 evas_object_smart_callback_add(bt, "clicked", _bt_m1, sl);
251 evas_object_show(bt);
252 elm_box_pack_end(bx2, bt);
253
191 evas_object_show(win); 254 evas_object_show(win);
192} 255}
193#endif 256#endif