Evas tests: Added textblock line_coord_set tests.
authortasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 13 Jul 2011 15:16:41 +0000 (15:16 +0000)
committertasn <tasn@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Wed, 13 Jul 2011 15:16:41 +0000 (15:16 +0000)
These also verifies the bug fix from my previous commit.

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/evas@61345 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

src/tests/evas_test_textblock.c

index 1136d0c..7513261 100644 (file)
@@ -455,8 +455,28 @@ START_TEST(evas_textblock_cursor)
              plh = lh;
              evas_textblock_cursor_char_next(cur);
           }
+
+        evas_textblock_cursor_paragraph_last(cur);
+        evas_textblock_cursor_line_set(cur, 0);
+        evas_textblock_cursor_line_geometry_get(cur, &plx, &ply, &plw, &plh);
+        evas_object_textblock_line_number_geometry_get(tb, 0,
+              &lx, &ly, &lw, &lh);
+        fail_if((lx != plx) || (ly != ply) || (lw != plw) || (lh != plh));
+        fail_if(0 != evas_textblock_cursor_line_coord_set(cur, ly + (lh / 2)));
+
+        evas_textblock_cursor_line_set(cur, 1);
+        evas_textblock_cursor_line_geometry_get(cur, &plx, &ply, &plw, &plh);
+        evas_object_textblock_line_number_geometry_get(tb, 1,
+              &lx, &ly, &lw, &lh);
+        fail_if((lx != plx) || (ly != ply) || (lw != plw) || (lh != plh));
+        fail_if(1 != evas_textblock_cursor_line_coord_set(cur, ly + (lh / 2)));
+
+        /* Before the start of the textblock */
+        fail_if(0 != evas_textblock_cursor_line_coord_set(cur, -50));
+        fail_if(3 != evas_textblock_cursor_line_coord_set(cur, 100000));
      }
 
+
    /* FIXME: Add tests that check positions left of/right of rtl lines. */
 
    END_TB_TEST();