summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDave Andreoli <dave@gurumeditation.it>2015-09-02 21:51:46 +0200
committerDave Andreoli <dave@gurumeditation.it>2015-09-02 21:51:46 +0200
commitd7a2f549b8a830c2eefd539191c4eceb696c12df (patch)
treee344b88decd6f38d11794ebfc12ab8ce025b7329
parentbc357d8015c2f80b5f45427f9aa454691a058d0b (diff)
Label test: split Slide and Ellipsis in two separate tests
this reveal the ellipsis + markup bug as explained in T2709
-rw-r--r--src/bin/test.c2
-rw-r--r--src/bin/test_label.c99
2 files changed, 66 insertions, 35 deletions
diff --git a/src/bin/test.c b/src/bin/test.c
index a1bb386fd..e6479ff5f 100644
--- a/src/bin/test.c
+++ b/src/bin/test.c
@@ -185,6 +185,7 @@ void test_flip_page(void *data, Evas_Object *obj, void *event_info);
185void test_label(void *data, Evas_Object *obj, void *event_info); 185void test_label(void *data, Evas_Object *obj, void *event_info);
186void test_label_slide(void *data, Evas_Object *obj, void *event_info); 186void test_label_slide(void *data, Evas_Object *obj, void *event_info);
187void test_label_wrap(void *data, Evas_Object *obj, void *event_info); 187void test_label_wrap(void *data, Evas_Object *obj, void *event_info);
188void test_label_ellipsis(void *data, Evas_Object *obj, void *event_info);
188void test_conformant(void *data, Evas_Object *obj, void *event_info); 189void test_conformant(void *data, Evas_Object *obj, void *event_info);
189void test_conformant2(void *data, Evas_Object *obj, void *event_info); 190void test_conformant2(void *data, Evas_Object *obj, void *event_info);
190void test_conformant_indicator(void *data, Evas_Object *obj, void *event_info); 191void test_conformant_indicator(void *data, Evas_Object *obj, void *event_info);
@@ -799,6 +800,7 @@ add_tests:
799 ADD_TEST(NULL, "Text", "Label", test_label); 800 ADD_TEST(NULL, "Text", "Label", test_label);
800 ADD_TEST(NULL, "Text", "Label Slide", test_label_slide); 801 ADD_TEST(NULL, "Text", "Label Slide", test_label_slide);
801 ADD_TEST(NULL, "Text", "Label Wrap", test_label_wrap); 802 ADD_TEST(NULL, "Text", "Label Wrap", test_label_wrap);
803 ADD_TEST(NULL, "Text", "Label Ellipsis", test_label_ellipsis);
802 804
803 //------------------------------// 805 //------------------------------//
804 ADD_TEST(NULL, "Stored Surface Buffer", "Launcher", test_launcher); 806 ADD_TEST(NULL, "Stored Surface Buffer", "Launcher", test_launcher);
diff --git a/src/bin/test_label.c b/src/bin/test_label.c
index 14707b2d8..537360a07 100644
--- a/src/bin/test_label.c
+++ b/src/bin/test_label.c
@@ -11,6 +11,7 @@ enum _slide_style
11 SLIDE_STYLE_LAST 11 SLIDE_STYLE_LAST
12}; 12};
13 13
14/*** Label *******************************************************************/
14void 15void
15test_label(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 16test_label(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
16{ 17{
@@ -87,6 +88,7 @@ test_label(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_inf
87 elm_win_resize_object_add(win, bx); 88 elm_win_resize_object_add(win, bx);
88} 89}
89 90
91/*** Label Slide *************************************************************/
90static void 92static void
91_cb_size_radio_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED) 93_cb_size_radio_changed(void *data, Evas_Object *obj, void *event EINA_UNUSED)
92{ 94{
@@ -162,9 +164,9 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
162 elm_win_resize_object_add(win, gd); 164 elm_win_resize_object_add(win, gd);
163 evas_object_show(gd); 165 evas_object_show(gd);
164 166
165 /* Test Label Ellipsis */ 167 /* Test Label Slide */
166 lb = elm_label_add(win); 168 lb = elm_label_add(win);
167 elm_object_text_set(lb, "Test Label Ellipsis:"); 169 elm_object_text_set(lb, "<b>Test Label Slide:</b>");
168 elm_grid_pack(gd, lb, 5, 0, 90, 10); 170 elm_grid_pack(gd, lb, 5, 0, 90, 10);
169 evas_object_show(lb); 171 evas_object_show(lb);
170 172
@@ -174,28 +176,6 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
174 evas_object_show(rect); 176 evas_object_show(rect);
175 177
176 lb = elm_label_add(win); 178 lb = elm_label_add(win);
177 elm_object_text_set(lb,
178 "This is a label set to ellipsis. "
179 "If set ellipsis to true and the text doesn't fit "
180 "in the label an ellipsis(\"...\") will be shown "
181 "at the end of the widget."
182 );
183 elm_label_ellipsis_set(lb, EINA_TRUE);
184 elm_grid_pack(gd, lb, 5, 10, 90, 10);
185 evas_object_show(lb);
186
187 /* Test Label Slide */
188 lb = elm_label_add(win);
189 elm_object_text_set(lb, "Test Label Slide:");
190 elm_grid_pack(gd, lb, 5, 20, 90, 10);
191 evas_object_show(lb);
192
193 rect = evas_object_rectangle_add(evas_object_evas_get(win));
194 elm_grid_pack(gd, rect, 5, 30, 90, 10);
195 evas_object_color_set(rect, 255, 125, 125, 255);
196 evas_object_show(rect);
197
198 lb = elm_label_add(win);
199 elm_object_style_set(lb, "slide_short"); 179 elm_object_style_set(lb, "slide_short");
200 elm_object_text_set(lb, 180 elm_object_text_set(lb,
201 "This is a label set to slide. " 181 "This is a label set to slide. "
@@ -207,7 +187,7 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
207 elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_AUTO); 187 elm_label_slide_mode_set(lb, ELM_LABEL_SLIDE_MODE_AUTO);
208 elm_label_slide_speed_set(lb, 40.0); 188 elm_label_slide_speed_set(lb, 40.0);
209 elm_label_slide_go(lb); 189 elm_label_slide_go(lb);
210 elm_grid_pack(gd, lb, 5, 30, 90, 10); 190 elm_grid_pack(gd, lb, 5, 10, 90, 10);
211 evas_object_show(lb); 191 evas_object_show(lb);
212 192
213 /* The speed or the duration of the slide animation will change when the 193 /* The speed or the duration of the slide animation will change when the
@@ -219,7 +199,7 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
219 elm_object_text_set(rd, "slide_short"); 199 elm_object_text_set(rd, "slide_short");
220 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 200 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
221 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb); 201 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb);
222 elm_grid_pack(gd, rd, 5, 40, 30, 10); 202 elm_grid_pack(gd, rd, 5, 20, 30, 10);
223 evas_object_show(rd); 203 evas_object_show(rd);
224 rdg = rd; 204 rdg = rd;
225 205
@@ -229,7 +209,7 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
229 elm_object_text_set(rd, "slide_long"); 209 elm_object_text_set(rd, "slide_long");
230 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 210 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
231 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb); 211 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb);
232 elm_grid_pack(gd, rd, 35, 40, 30, 10); 212 elm_grid_pack(gd, rd, 35, 20, 30, 10);
233 evas_object_show(rd); 213 evas_object_show(rd);
234 214
235 rd = elm_radio_add(win); 215 rd = elm_radio_add(win);
@@ -238,7 +218,7 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
238 elm_object_text_set(rd, "slide_bounce"); 218 elm_object_text_set(rd, "slide_bounce");
239 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL); 219 evas_object_size_hint_weight_set(rd, EVAS_HINT_EXPAND, EVAS_HINT_FILL);
240 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb); 220 evas_object_smart_callback_add(rd, "changed", _cb_size_radio_changed, lb);
241 elm_grid_pack(gd, rd, 65, 40, 30, 10); 221 elm_grid_pack(gd, rd, 65, 20, 30, 10);
242 evas_object_show(rd); 222 evas_object_show(rd);
243 223
244 sl = elm_slider_add(win); 224 sl = elm_slider_add(win);
@@ -250,7 +230,7 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
250 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 230 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
251 evas_object_smart_callback_add(sl, "changed", _duration_change_cb, lb); 231 evas_object_smart_callback_add(sl, "changed", _duration_change_cb, lb);
252 evas_object_data_set(lb, "duration_slider", sl); 232 evas_object_data_set(lb, "duration_slider", sl);
253 elm_grid_pack(gd, sl, 5, 50, 90, 10); 233 elm_grid_pack(gd, sl, 5, 30, 90, 10);
254 evas_object_show(sl); 234 evas_object_show(sl);
255 235
256 sl = elm_slider_add(win); 236 sl = elm_slider_add(win);
@@ -262,17 +242,17 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
262 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 242 evas_object_size_hint_weight_set(sl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
263 evas_object_smart_callback_add(sl, "changed", _speed_change_cb, lb); 243 evas_object_smart_callback_add(sl, "changed", _speed_change_cb, lb);
264 evas_object_data_set(lb, "speed_slider", sl); 244 evas_object_data_set(lb, "speed_slider", sl);
265 elm_grid_pack(gd, sl, 5, 60, 90, 10); 245 elm_grid_pack(gd, sl, 5, 40, 90, 10);
266 evas_object_show(sl); 246 evas_object_show(sl);
267 247
268 /* Test 2 label at the same speed */ 248 /* Test 2 label at the same speed */
269 lb = elm_label_add(win); 249 lb = elm_label_add(win);
270 elm_object_text_set(lb, "Test 2 label with the same speed:"); 250 elm_object_text_set(lb, "<b>Test 2 label with the same speed:</b>");
271 elm_grid_pack(gd, lb, 5, 70, 90, 10); 251 elm_grid_pack(gd, lb, 5, 60, 90, 10);
272 evas_object_show(lb); 252 evas_object_show(lb);
273 253
274 rect = evas_object_rectangle_add(evas_object_evas_get(win)); 254 rect = evas_object_rectangle_add(evas_object_evas_get(win));
275 elm_grid_pack(gd, rect, 5, 80, 90, 20); 255 elm_grid_pack(gd, rect, 5, 70, 90, 20);
276 evas_object_color_set(rect, 255, 125, 125, 255); 256 evas_object_color_set(rect, 255, 125, 125, 255);
277 evas_object_show(rect); 257 evas_object_show(rect);
278 258
@@ -284,7 +264,7 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
284 elm_label_slide_mode_set(lb1, ELM_LABEL_SLIDE_MODE_ALWAYS); 264 elm_label_slide_mode_set(lb1, ELM_LABEL_SLIDE_MODE_ALWAYS);
285 elm_label_slide_speed_set(lb1, 40.0); 265 elm_label_slide_speed_set(lb1, 40.0);
286 elm_label_slide_go(lb1); 266 elm_label_slide_go(lb1);
287 elm_grid_pack(gd, lb1, 5, 80, 90, 10); 267 elm_grid_pack(gd, lb1, 5, 70, 90, 10);
288 evas_object_show(lb1); 268 evas_object_show(lb1);
289 269
290 lb2 = elm_label_add(win); 270 lb2 = elm_label_add(win);
@@ -294,13 +274,14 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
294 elm_label_slide_mode_set(lb2, ELM_LABEL_SLIDE_MODE_ALWAYS); 274 elm_label_slide_mode_set(lb2, ELM_LABEL_SLIDE_MODE_ALWAYS);
295 elm_label_slide_speed_set(lb2, 40.0); 275 elm_label_slide_speed_set(lb2, 40.0);
296 elm_label_slide_go(lb2); 276 elm_label_slide_go(lb2);
297 elm_grid_pack(gd, lb2, 5, 90, 90, 10); 277 elm_grid_pack(gd, lb2, 5, 80, 90, 10);
298 evas_object_show(lb2); 278 evas_object_show(lb2);
299 279
300 evas_object_resize(win, 320, 320); 280 evas_object_resize(win, 320, 320);
301 evas_object_show(win); 281 evas_object_show(win);
302} 282}
303 283
284/*** Label Wrap **************************************************************/
304void 285void
305test_label_wrap(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 286test_label_wrap(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
306{ 287{
@@ -322,3 +303,51 @@ test_label_wrap(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *even
322 303
323 evas_object_show(win); 304 evas_object_show(win);
324} 305}
306
307
308/*** Label Ellipsis **********************************************************/
309void
310test_label_ellipsis(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
311{
312 Evas_Object *win, *bx, *lb;
313
314 win = elm_win_util_standard_add("label-ellipsis", "Label Ellipsis");
315 elm_win_autodel_set(win, EINA_TRUE);
316
317 bx = elm_box_add(win);
318 elm_box_padding_set(bx, 0, ELM_SCALE_SIZE(10));
319 evas_object_size_hint_weight_set(bx, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
320 elm_win_resize_object_add(win, bx);
321 evas_object_show(bx);
322
323 lb = elm_label_add(win);
324 elm_object_text_set(lb,
325 "This is a label set to ellipsis. "
326 "If set ellipsis to true and the text doesn't fit "
327 "in the label an ellipsis(\"...\") will be shown "
328 "at the end of the widget."
329 );
330 elm_label_ellipsis_set(lb, EINA_TRUE);
331 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
332 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.0);
333 elm_box_pack_end(bx, lb);
334 evas_object_show(lb);
335
336 lb = elm_label_add(win);
337 elm_object_text_set(lb,
338 "<big>"
339 "This label also have <b>markups</b>, "
340 "<hilight>hilight</hilight>, "
341 "<success>success</success>, "
342 "<failure>failure</failure>."
343 "</big>"
344 );
345 elm_label_ellipsis_set(lb, EINA_TRUE);
346 evas_object_size_hint_weight_set(lb, EVAS_HINT_EXPAND, 0.0);
347 evas_object_size_hint_align_set(lb, EVAS_HINT_FILL, 0.0);
348 elm_box_pack_end(bx, lb);
349 evas_object_show(lb);
350
351 evas_object_resize(win, 300, 100);
352 evas_object_show(win);
353}