summaryrefslogtreecommitdiff
path: root/src/bin/elementary
diff options
context:
space:
mode:
authorCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-11-07 10:23:58 +0000
committerCarsten Haitzler (Rasterman) <raster@rasterman.com>2019-11-07 10:23:58 +0000
commit39240fa3e723c8b0f2dc1792cc5b938502297655 (patch)
treeecdcbf997154f0981ca4e97eff91653800bcf4fd /src/bin/elementary
parente4e7ff3905090a75eb900672be7208f1f62fcf65 (diff)
Revert "evas_textblock: content fit feature"
This reverts commit 2f676a6591c117e15d65f263ebd267866963b627. This causes segv's in edje_cc - i suspect the eet changes (or in combo to how they are used in edje): AddressSanitizer:DEADLYSIGNAL ================================================================= ==8991==ERROR: AddressSanitizer: SEGV on unknown address 0x000001010000 (pc 0xffff9f002604 bp 0xfffffa747700 sp 0xfffffa747700 T0) ==8991==The signal is caused by a READ memory access. #0 0xffff9f002600 in _eet_hash_gen ../src/lib/eet/eet_utils.c:25 #1 0xffff9efdd024 in eet_dictionary_string_add ../src/lib/eet/eet_dictionary.c:103 #2 0xffff9efbe324 in eet_data_put_string ../src/lib/eet/eet_data.c:849 #3 0xffff9efc1c4c in eet_data_put_type ../src/lib/eet/eet_data.c:1427 #4 0xffff9efd9128 in eet_data_put_unknown ../src/lib/eet/eet_data.c:4730 #5 0xffff9efdb320 in _eet_data_descriptor_encode ../src/lib/eet/eet_data.c:5108 #6 0xffff9efd5958 in eet_data_put_variant ../src/lib/eet/eet_data.c:4309 #7 0xffff9efdb320 in _eet_data_descriptor_encode ../src/lib/eet/eet_data.c:5108 #8 0xffff9efd9270 in eet_data_put_unknown ../src/lib/eet/eet_data.c:4739 #9 0xffff9efdb320 in _eet_data_descriptor_encode ../src/lib/eet/eet_data.c:5108 #10 0xffff9efd8ca0 in eet_data_put_array ../src/lib/eet/eet_data.c:4692 #11 0xffff9efdb320 in _eet_data_descriptor_encode ../src/lib/eet/eet_data.c:5108 #12 0xffff9efc7768 in eet_data_write_cipher ../src/lib/eet/eet_data.c:2403 #13 0xffff9efc78a4 in eet_data_write ../src/lib/eet/eet_data.c:2420 #14 0xaaaabb151dcc in data_thread_group ../src/bin/edje/edje_cc_out.c:2045 #15 0xaaaabb152130 in data_write_groups ../src/bin/edje/edje_cc_out.c:2086 #16 0xaaaabb157734 in data_write ../src/bin/edje/edje_cc_out.c:2866 #17 0xaaaabb14122c in main ../src/bin/edje/edje_cc.c:456 #18 0xffff9dbd92a0 in __libc_start_main (/usr/lib/aarch64-linux-gnu/libc.so.6+0x242a0) #19 0xaaaabb13ea00 (/home/raster/C/git/efl/build/src/bin/edje/edje_cc+0x38a00) AddressSanitizer can not provide additional info. SUMMARY: AddressSanitizer: SEGV ../src/lib/eet/eet_utils.c:25 in _eet_hash_gen ==8991==ABORTING Aborted (core dumped) When compiling breaks... it's certainly time to revert ASAP :(
Diffstat (limited to 'src/bin/elementary')
-rw-r--r--src/bin/elementary/test.c2
-rw-r--r--src/bin/elementary/test_label.c232
2 files changed, 0 insertions, 234 deletions
diff --git a/src/bin/elementary/test.c b/src/bin/elementary/test.c
index 257cdc1..8259ed8 100644
--- a/src/bin/elementary/test.c
+++ b/src/bin/elementary/test.c
@@ -240,7 +240,6 @@ void test_flip_page_eo(void *data, Evas_Object *obj, void *event_info);
240void test_label(void *data, Evas_Object *obj, void *event_info); 240void test_label(void *data, Evas_Object *obj, void *event_info);
241void test_label_slide(void *data, Evas_Object *obj, void *event_info); 241void test_label_slide(void *data, Evas_Object *obj, void *event_info);
242void test_label_wrap(void *data, Evas_Object *obj, void *event_info); 242void test_label_wrap(void *data, Evas_Object *obj, void *event_info);
243void test_textblock_fit(void *data, Evas_Object *obj, void *event_info);
244void test_label_ellipsis(void *data, Evas_Object *obj, void *event_info); 243void test_label_ellipsis(void *data, Evas_Object *obj, void *event_info);
245void test_label_colors(void *data, Evas_Object *obj, void *event_info); 244void test_label_colors(void *data, Evas_Object *obj, void *event_info);
246void test_label_emoji(void *data, Evas_Object *obj, void *event_info); 245void test_label_emoji(void *data, Evas_Object *obj, void *event_info);
@@ -1208,7 +1207,6 @@ add_tests:
1208 ADD_TEST(NULL, "Text", "Label", test_label); 1207 ADD_TEST(NULL, "Text", "Label", test_label);
1209 ADD_TEST(NULL, "Text", "Label Slide", test_label_slide); 1208 ADD_TEST(NULL, "Text", "Label Slide", test_label_slide);
1210 ADD_TEST(NULL, "Text", "Label Wrap", test_label_wrap); 1209 ADD_TEST(NULL, "Text", "Label Wrap", test_label_wrap);
1211 ADD_TEST(NULL, "Text", "Textblock Fit", test_textblock_fit);
1212 ADD_TEST(NULL, "Text", "Label Ellipsis", test_label_ellipsis); 1210 ADD_TEST(NULL, "Text", "Label Ellipsis", test_label_ellipsis);
1213 ADD_TEST(NULL, "Text", "Label Colors", test_label_colors); 1211 ADD_TEST(NULL, "Text", "Label Colors", test_label_colors);
1214 ADD_TEST(NULL, "Text", "Label Emoji", test_label_emoji); 1212 ADD_TEST(NULL, "Text", "Label Emoji", test_label_emoji);
diff --git a/src/bin/elementary/test_label.c b/src/bin/elementary/test_label.c
index 929d06b..233ce01 100644
--- a/src/bin/elementary/test_label.c
+++ b/src/bin/elementary/test_label.c
@@ -309,238 +309,6 @@ test_label_slide(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *eve
309 evas_object_show(win); 309 evas_object_show(win);
310} 310}
311 311
312
313
314/*** FIT TEXT **************************************************************/
315enum BUTTON{
316 BUTTON_MODE = 0,
317 BUTTON_MAX = 1,
318 BUTTON_MIN = 2,
319 BUTTON_STEP = 3,
320 BUTTON_ARRAY = 4,
321 BUTTON_CONTENT = 5,
322 BUTTON_STYLE = 6,
323 BUTTON_ALL = BUTTON_STYLE+1,
324};
325
326char* BUTTON_STR[BUTTON_ALL] ={
327 "MODE",
328 "MAX",
329 "MIN",
330 "STEP",
331 "ARRAY",
332 "CONTENT",
333 "STYLE",
334};
335
336char *contents[] = {
337 "Hello World",
338 "This is Line<br>THis is other Line",
339 "This text contains <font_size=20 color=#F00>SPECIFIC SIZE</font_size>that does not effected by fit mode"
340 };
341
342char *styles[] = {
343 "DEFAULT='font=sans font_size=30 color=#000 wrap=mixed ellipsis=1.0'",
344 "DEFAULT='font=sans font_size=30 color=#000 wrap=mixed'",
345 "DEFAULT='font=sans font_size=30 color=#000 ellipsis=1.0'",
346 "DEFAULT='font=sans font_size=30 color=#000'",
347 };
348
349char *styles_names[] = {
350 "wrap=<color=#F00>mixed</color> ellipsis=<color=#F00>1.0</color>",
351 "wrap=<color=#F00>mixed</color> ellipsis=<color=#F00>NONE</color>",
352 "wrap=<color=#F00>NONE</color> ellipsis=<color=#F00>1.0</color>",
353 "wrap=<color=#F00>NONE</color> ellipsis=<color=#F00>NONE</color>",
354 };
355
356typedef struct _APP
357{
358 Evas_Object *win, *box, *txtblock,*bg, *boxHor, *boxHor2;
359 Eo *btn[BUTTON_ALL];
360 Eo *lbl_status;
361 char * str;
362 unsigned int i_contnet, i_style;
363} APP;
364APP *app;
365
366char * get_fit_status(Eo * textblock);
367
368static void _btn_clicked(void *data EINA_UNUSED, Eo *obj, void *eventInfo EINA_UNUSED){
369 if (obj == app->btn[BUTTON_MODE])
370 {
371 unsigned int options;
372 evas_textblock_fit_options_get(app->txtblock, &options);
373 if (options == TEXTBLOCK_FIT_MODE_NONE)
374 evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_HEIGHT);
375 else if (options == TEXTBLOCK_FIT_MODE_HEIGHT)
376 evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_WIDTH);
377 else if (options == TEXTBLOCK_FIT_MODE_WIDTH)
378 evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_ALL);
379 else if (options == TEXTBLOCK_FIT_MODE_ALL)
380 evas_textblock_fit_options_set(app->txtblock, TEXTBLOCK_FIT_MODE_NONE);
381 }
382 else if (obj == app->btn[BUTTON_MAX])
383 {
384 unsigned int min, max;
385 evas_textblock_fit_size_range_get(app->txtblock, &min, &max);
386 max -= 5;
387 evas_textblock_fit_size_range_set(app->txtblock, min, max);
388 }
389 else if (obj == app->btn[BUTTON_MIN])
390 {
391 unsigned int min, max;
392 evas_textblock_fit_size_range_get(app->txtblock, &min, &max);
393 min += 5;
394 evas_textblock_fit_size_range_set(app->txtblock, min, max);
395 }
396 else if (obj == app->btn[BUTTON_STEP])
397 {
398 unsigned int step;
399 evas_textblock_fit_step_size_get(app->txtblock, &step);
400 step++;
401 evas_textblock_fit_step_size_set(app->txtblock, step);
402 }
403 else if (obj == app->btn[BUTTON_ARRAY])
404 {
405 unsigned int font_size[] = {10, 50, 100 ,150};
406 evas_textblock_fit_size_array_set(app->txtblock,font_size,4);
407 }
408 else if (obj == app->btn[BUTTON_CONTENT])
409 {
410 app->i_contnet++;
411 if(app->i_contnet>=sizeof(contents)/sizeof(char*))
412 app->i_contnet=0;
413 evas_object_textblock_text_markup_set(app->txtblock,contents[app->i_contnet]);
414 }
415 else if (obj == app->btn[BUTTON_STYLE])
416 {
417 app->i_style++;
418 if(app->i_style>=sizeof(styles)/sizeof(char*))
419 app->i_style=0;
420
421 Evas_Textblock_Style *style = evas_object_textblock_style_get(app->txtblock);
422 evas_textblock_style_set(style,styles[app->i_style]);
423 }
424
425 elm_object_text_set(app->lbl_status, get_fit_status(app->txtblock));
426}
427
428char * get_fit_status(Eo * textblock)
429{
430 static char status[0xFFF];
431 unsigned int options,min,max,step,size_array[256];
432 size_t size_array_len;
433 evas_textblock_fit_options_get(textblock,&options);
434 evas_textblock_fit_size_range_get(textblock,&min,&max);
435 evas_textblock_fit_step_size_get(textblock,&step);
436 evas_textblock_fit_size_array_get(textblock,NULL,&size_array_len,0);
437 if (size_array_len>255)
438 size_array_len = 255;
439 evas_textblock_fit_size_array_get(textblock,size_array,NULL,size_array_len);
440
441 strcpy(status,"Mode : ");
442 if (options == TEXTBLOCK_FIT_MODE_NONE)
443 strcat(status,"MODE_NONE");
444 else if (options == TEXTBLOCK_FIT_MODE_HEIGHT)
445 strcat(status,"MODE_HEIGHT");
446 else if (options == TEXTBLOCK_FIT_MODE_WIDTH)
447 strcat(status,"MODE_WIDTH");
448 else if (options == TEXTBLOCK_FIT_MODE_ALL)
449 strcat(status,"MODE_ALL");
450
451 strcat(status,"<br>");
452 sprintf(status + strlen(status),"Max : %d<br>",max);
453 sprintf(status + strlen(status),"Min : %d<br>",min);
454 sprintf(status + strlen(status),"Step : %d<br>",step);
455 sprintf(status + strlen(status),"Array : [ ");
456 for (size_t i = 0 ; i < 10 ; i++)
457 {
458 if(i<size_array_len)
459 sprintf(status + strlen(status)," %d,",size_array[i]);
460 }
461
462 if(10<size_array_len)
463 sprintf(status + strlen(status)," ... ");
464 sprintf(status + strlen(status)," ]");
465
466 sprintf(status + strlen(status),"<br>");
467 sprintf(status + strlen(status),"%s",styles_names[app->i_style]);
468
469
470
471 return status;
472}
473
474void
475test_textblock_fit(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
476{
477 app = calloc(sizeof(APP), 1);
478
479 elm_policy_set(ELM_POLICY_QUIT, ELM_POLICY_QUIT_LAST_WINDOW_CLOSED);
480
481 app->win = elm_win_util_standard_add("Main", "App");
482 elm_win_autodel_set(app->win, EINA_TRUE);
483
484 app->box = elm_box_add(app->win);
485 app->boxHor = elm_box_add(app->box);
486 app->boxHor2 = elm_box_add(app->box);
487 app->txtblock = evas_object_textblock_add(app->box);
488 app->bg = elm_bg_add(app->box);
489 elm_bg_color_set(app->bg,255,255,255);
490
491 Evas_Textblock_Style *style = evas_textblock_style_new();
492 evas_textblock_style_set(style,styles[0]);
493 evas_object_textblock_style_set(app->txtblock,style);
494 evas_object_textblock_text_markup_set(app->txtblock,contents[0]);
495
496 elm_box_horizontal_set(app->boxHor, EINA_TRUE);
497 elm_box_horizontal_set(app->boxHor2, EINA_TRUE);
498
499 evas_object_size_hint_weight_set(app->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
500 evas_object_size_hint_align_set(app->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
501
502
503 evas_object_size_hint_weight_set(app->box, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
504 evas_object_size_hint_align_set(app->box, EVAS_HINT_FILL, EVAS_HINT_FILL);
505
506 evas_object_show(app->txtblock);
507 evas_object_show(app->bg);
508 evas_object_show(app->box);
509 evas_object_show(app->boxHor);
510 evas_object_show(app->boxHor2);
511
512 elm_box_pack_end(app->box, app->bg);
513 elm_box_pack_end(app->box, app->boxHor);
514 elm_box_pack_end(app->box, app->boxHor2);
515
516 elm_object_content_set(app->bg,app->txtblock);
517
518 elm_win_resize_object_add(app->win, app->box);
519 evas_object_resize(app->win, 320, 480);
520
521 for(int i = 0 ; i < BUTTON_ALL ; i++)
522 {
523 app->btn[i] = elm_button_add(app->boxHor);
524 evas_object_smart_callback_add(app->btn[i], "clicked", _btn_clicked, NULL);
525 elm_object_text_set(app->btn[i], BUTTON_STR[i]);
526 elm_box_pack_end(app->boxHor, app->btn[i]);
527 evas_object_show(app->btn[i]);
528 }
529
530 app->lbl_status = elm_label_add(app->boxHor2);
531 elm_object_text_set(app->lbl_status, get_fit_status(app->txtblock));
532 elm_box_pack_end(app->boxHor2, app->lbl_status);
533 evas_object_show(app->lbl_status);
534
535 evas_object_size_hint_weight_set(app->txtblock, EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
536 evas_object_size_hint_align_set(app->txtblock, EVAS_HINT_FILL, EVAS_HINT_FILL);
537
538 evas_object_size_hint_weight_set(app->bg, EVAS_HINT_EXPAND,EVAS_HINT_EXPAND);
539 evas_object_size_hint_align_set(app->bg, EVAS_HINT_FILL, EVAS_HINT_FILL);
540
541 evas_object_show(app->win);
542}
543
544/*** Label Wrap **************************************************************/ 312/*** Label Wrap **************************************************************/
545void 313void
546test_label_wrap(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 314test_label_wrap(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)