Evas tests: Added a test to verify last textblock bugfix.

SVN revision: 61505
This commit is contained in:
Tom Hacohen 2011-07-19 15:14:40 +00:00
parent 6eb5cdc681
commit 9f7d3f8af8
2 changed files with 50 additions and 0 deletions

View File

@ -8986,6 +8986,35 @@ _evas_object_textblock_rehint(Evas_Object *obj)
* @}
*/
#ifdef HAVE_TESTS
/* return EINA_FALSE on error, used in unit_testing */
EAPI Eina_Bool
_evas_textblock_check_item_node_link(Evas_Object *obj)
{
Evas_Object_Textblock *o;
Evas_Object_Textblock_Paragraph *par;
Evas_Object_Textblock_Line *ln;
Evas_Object_Textblock_Item *it;
o = (Evas_Object_Textblock *)(obj->object_data);
if (!o) return EINA_FALSE;
if (!o->formatted.valid) _relayout(obj);
EINA_INLIST_FOREACH(o->paragraphs, par)
{
EINA_INLIST_FOREACH(par->lines, ln)
{
EINA_INLIST_FOREACH(ln->items, it)
{
if (it->text_node != par->text_node)
return EINA_FALSE;
}
}
}
return EINA_TRUE;
}
#endif
#if 0
/* Good for debugging */

View File

@ -11,6 +11,12 @@
#include "evas_tests_helpers.h"
/* Functions defined in evas_object_textblock.c */
EAPI Eina_Bool
_evas_textblock_check_item_node_link(Evas_Object *obj);
/* end of functions defined in evas_object_textblock.c */
static const char *style_buf =
"DEFAULT='font=Sans font_size=10 color=#000 text_class=entry'"
"br='\n'"
@ -1042,6 +1048,21 @@ START_TEST(evas_textblock_various)
evas_object_textblock_text_markup_set(tb, "|");
evas_object_textblock_size_formatted_get(tb, &w, &h);
fail_if((w != bw) || (h != bh));
/* Items have correct text node information */
evas_object_textblock_text_markup_set(tb, "");
fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "<ps>");
fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "a<ps>");
fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "a<ps>a");
fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "a<ps>a<ps>");
fail_if(!_evas_textblock_check_item_node_link(tb));
evas_object_textblock_text_markup_set(tb, "a<ps>a<ps>a");
fail_if(!_evas_textblock_check_item_node_link(tb));
END_TB_TEST();
}
END_TEST