Evas tests: Added a test to verify last textblock bugfix.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 19 Jul 2011 15:14:40 +0000 (15:14 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 19 Jul 2011 15:14:40 +0000 (15:14 +0000)
git-svn-id: svn+ssh://svn.enlightenment.org/var/svn/e/trunk/evas@61505 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/lib/canvas/evas_object_textblock.c
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