From 5501f844d31b9ac192f045f643f9e622c3c966e2 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Sun, 17 Jul 2011 10:48:01 +0000 Subject: [PATCH] Evas tests: Added a textblock test that emulates edje's min size calc. Currently mixed wrapping is disabled, because something is wrong there, but word and char work. This also tests the bugs fixed in previous commits. SVN revision: 61437 --- legacy/evas/src/tests/evas_test_textblock.c | 62 ++++++++++++++++++++- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/legacy/evas/src/tests/evas_test_textblock.c b/legacy/evas/src/tests/evas_test_textblock.c index c0b88776b8..d8551c10bc 100644 --- a/legacy/evas/src/tests/evas_test_textblock.c +++ b/legacy/evas/src/tests/evas_test_textblock.c @@ -657,6 +657,7 @@ END_TEST START_TEST(evas_textblock_wrapping) { Evas_Coord bw, bh, w, h, nw, nh; + int i; START_TB_TEST(); evas_object_textblock_text_markup_set(tb, "a"); evas_object_textblock_size_formatted_get(tb, &bw, &bh); @@ -731,7 +732,7 @@ START_TEST(evas_textblock_wrapping) { evas_object_resize(tb, iw, 1000); evas_object_textblock_size_formatted_get(tb, &w, &h); - fail_if((w < bw) || (h < bh)); + fail_if(w < bw); fail_if(w > iw); } fail_if(w != bw); @@ -752,7 +753,7 @@ START_TEST(evas_textblock_wrapping) { evas_object_resize(tb, iw, 1000); evas_object_textblock_size_formatted_get(tb, &w, &h); - fail_if((w < bw) || (h < bh)); + fail_if(w < bw); fail_if(w > iw); } fail_if(w != bw); @@ -774,12 +775,67 @@ START_TEST(evas_textblock_wrapping) { evas_object_resize(tb, iw, 1000); evas_object_textblock_size_formatted_get(tb, &w, &h); - fail_if((w < bw) || (h < bh)); + fail_if(w < bw); fail_if(w > iw); } fail_if(w != bw); #endif + /* Resize, making sure we keep going down in the minimum size. */ + char *wrap_style[] = { "+ wrap=word", "+ wrap=char"/*, "+ wrap=mixed"*/ }; + int wrap_items = sizeof(wrap_style) / sizeof(*wrap_style); + + evas_object_textblock_text_markup_set(tb, + "This is an entry widget in this window that
" + "uses markup like this for styling and
" + "formatting like this, as well as
" + "links in the text, so enter text
" + "in here to edit it. By the way, links are
" + "called Anchors so you will need
" + "to refer to them this way.
" + "
" + + "Also you can stick in items with (relsize + ascent): " + "" + " (full) " + "" + " (to the left)
" + + "Also (size + ascent): " + "" + " (full) " + "" + " (before this)
" + + "And as well (absize + ascent): " + "" + " (full) " + "" + " or even paths to image files on disk too like: " + "" + " ... end." + ); + + /* Get minimum size */ + evas_object_textblock_size_native_get(tb, &nw, &nh); + + for (i = 0 ; i < wrap_items ; i++) + { + evas_textblock_cursor_format_prepend(cur, wrap_style[i]); + evas_object_resize(tb, 0, 0); + evas_object_textblock_size_formatted_get(tb, &bw, &bh); + + for (iw = nw ; iw >= bw ; iw--) + { + evas_object_resize(tb, iw, 1000); + evas_object_textblock_size_formatted_get(tb, &w, &h); + fail_if(w < bw); + fail_if(w > iw); + } + fail_if(w != bw); + } + + /* Ellipsis */ evas_object_textblock_text_markup_set(tb, "aaaaaaaaaa"); evas_textblock_cursor_format_prepend(cur, "+ ellipsis=1.0");