Evas tests: Added a test to verify last textblock bugfix.
authorTom Hacohen <tom@stosb.com>
Tue, 19 Jul 2011 15:14:40 +0000 (15:14 +0000)
committerTom Hacohen <tom@stosb.com>
Tue, 19 Jul 2011 15:14:40 +0000 (15:14 +0000)
SVN revision: 61505

legacy/evas/src/lib/canvas/evas_object_textblock.c
legacy/evas/src/tests/evas_test_textblock.c

index 34ec794..a5b3fe3 100644 (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 */
index b4619ed..0458245 100644 (file)
 
 #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