summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordavemds <dave@gurumeditation.it>2014-02-09 14:46:27 +0100
committerdavemds <dave@gurumeditation.it>2014-02-09 14:53:14 +0100
commit1ca7576c66f86d9a5599a16f1b3abd65060d72a9 (patch)
tree0a5192a0b2db75d2db505948b35e9a8d4d8770f9
parentee1a43a45137aee9a674b204a22debbce8420b2e (diff)
Add more tests to "Entry user style", to spot out lots of bug.
This test is full of TextBlock bugs, just to name a few: - The window height is wrong, it seems to take the max height as the win was less large, try resizing to min width to understand what I mean. - the backing on the em tag is not working. - the underline colors are wrong. - popping the style should remove the double underline. - push/pop on the stack seems not to work as expected: If you push twice you should need 2 pop to return to the normal state.
-rw-r--r--src/bin/test_entry.c50
1 files changed, 43 insertions, 7 deletions
diff --git a/src/bin/test_entry.c b/src/bin/test_entry.c
index 7aa04f06d..0e6129ad5 100644
--- a/src/bin/test_entry.c
+++ b/src/bin/test_entry.c
@@ -785,6 +785,12 @@ my_ent_bt_pas(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UN
785 elm_entry_selection_paste(en); 785 elm_entry_selection_paste(en);
786} 786}
787 787
788static char *user_style =
789 "DEFAULT='font_size=16 color=#F00'"
790 "em='+ backing=on backing_color=#FFF'"
791 "grn='+ color=#0F0'"
792 "ul='+ underline=on underline_color=#AAA'";
793
788static void 794static void
789ent_bt_style_user_peek(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 795ent_bt_style_user_peek(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
790{ 796{
@@ -804,12 +810,20 @@ ent_bt_style_user_pop(void *data, Evas_Object *obj EINA_UNUSED, void *event_info
804 printf("Style user popped\n"); 810 printf("Style user popped\n");
805} 811}
806 812
813static void
814ent_bt_style_user_push(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
815{
816 Evas_Object *en = data;
817 elm_entry_text_style_user_push(en, user_style);
818 printf("Style user pushed\n");
819}
820
807void 821void
808test_entry_style_user(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED) 822test_entry_style_user(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
809{ 823{
810 Evas_Object *win, *bx, *en, *bt, *bt2; 824 Evas_Object *win, *bx, *vbx, *en, *bt, *bt2;
811 825
812 win = elm_win_util_standard_add("entry-style", "Entry Style"); 826 win = elm_win_util_standard_add("entry-style", "Entry User Style");
813 elm_win_autodel_set(win, EINA_TRUE); 827 elm_win_autodel_set(win, EINA_TRUE);
814 evas_object_resize(win, 300, 300); 828 evas_object_resize(win, 300, 300);
815 829
@@ -820,22 +834,33 @@ test_entry_style_user(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
820 834
821 en = elm_entry_add(win); 835 en = elm_entry_add(win);
822 elm_entry_line_wrap_set(en, ELM_WRAP_MIXED); 836 elm_entry_line_wrap_set(en, ELM_WRAP_MIXED);
823 elm_entry_text_style_user_push(en, "DEFAULT='font_size=40 color=#FF0000'"); 837 elm_entry_text_style_user_push(en, user_style);
824 elm_object_text_set(en, "Testing Text"); 838 elm_object_text_set(en,
839 "Default style<br>"
840 "<em>Change a standard tag (backing)</em><br>"
841 "<grn>Create a custom tag (green)</grn><br>"
842 "<ul>Create a custom tag (underline)</ul><br>"
843 "<underline=double underline_color=#0F0 underline2_color=#00F>Unnamed tag (underline double)</><br>"
844 );
825 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 845 evas_object_size_hint_weight_set(en, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
826 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL); 846 evas_object_size_hint_align_set(en, EVAS_HINT_FILL, EVAS_HINT_FILL);
827 elm_box_pack_end(bx, en); 847 elm_box_pack_end(bx, en);
828 evas_object_resize(en, 200, 200); 848 evas_object_resize(en, 300, 300);
829 evas_object_show(en); 849 evas_object_show(en);
830 elm_object_focus_set(en, EINA_TRUE); 850 elm_object_focus_set(en, EINA_TRUE);
831 851
852 vbx = elm_box_add(win);
853 elm_box_horizontal_set(vbx, EINA_TRUE);
854 elm_box_pack_end(bx, vbx);
855 evas_object_show(vbx);
856
832 bt = elm_button_add(win); 857 bt = elm_button_add(win);
833 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); 858 evas_object_size_hint_weight_set(bt, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
834 elm_object_text_set(bt, "Peek"); 859 elm_object_text_set(bt, "Peek");
835 evas_object_smart_callback_add(bt, "clicked", ent_bt_style_user_peek, en); 860 evas_object_smart_callback_add(bt, "clicked", ent_bt_style_user_peek, en);
836 evas_object_size_hint_weight_set(bt, 0.0, 0.0); 861 evas_object_size_hint_weight_set(bt, 0.0, 0.0);
837 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5); 862 evas_object_size_hint_align_set(bt, EVAS_HINT_FILL, 0.5);
838 elm_box_pack_end(bx, bt); 863 elm_box_pack_end(vbx, bt);
839 evas_object_propagate_events_set(bt, EINA_FALSE); 864 evas_object_propagate_events_set(bt, EINA_FALSE);
840 elm_object_focus_allow_set(bt, EINA_FALSE); 865 elm_object_focus_allow_set(bt, EINA_FALSE);
841 evas_object_show(bt); 866 evas_object_show(bt);
@@ -846,7 +871,18 @@ test_entry_style_user(void *data EINA_UNUSED, Evas_Object *obj EINA_UNUSED, void
846 evas_object_smart_callback_add(bt2, "clicked", ent_bt_style_user_pop, en); 871 evas_object_smart_callback_add(bt2, "clicked", ent_bt_style_user_pop, en);
847 evas_object_size_hint_weight_set(bt2, 0.0, 0.0); 872 evas_object_size_hint_weight_set(bt2, 0.0, 0.0);
848 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, 0.5); 873 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, 0.5);
849 elm_box_pack_end(bx, bt2); 874 elm_box_pack_end(vbx, bt2);
875 evas_object_propagate_events_set(bt2, EINA_FALSE);
876 elm_object_focus_allow_set(bt2, EINA_FALSE);
877 evas_object_show(bt2);
878
879 bt2 = elm_button_add(win);
880 evas_object_size_hint_weight_set(bt2, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
881 elm_object_text_set(bt2, "Push");
882 evas_object_smart_callback_add(bt2, "clicked", ent_bt_style_user_push, en);
883 evas_object_size_hint_weight_set(bt2, 0.0, 0.0);
884 evas_object_size_hint_align_set(bt2, EVAS_HINT_FILL, 0.5);
885 elm_box_pack_end(vbx, bt2);
850 evas_object_propagate_events_set(bt2, EINA_FALSE); 886 evas_object_propagate_events_set(bt2, EINA_FALSE);
851 elm_object_focus_allow_set(bt2, EINA_FALSE); 887 elm_object_focus_allow_set(bt2, EINA_FALSE);
852 evas_object_show(bt2); 888 evas_object_show(bt2);