Evas textblock: Fixed coord (int) overflow.

X advance coords can be bigger than the limits of short.
This commit is contained in:
Tom Hacohen 2013-03-11 15:18:21 +00:00
parent 973d0b475b
commit 23264ae09c
2 changed files with 36 additions and 1 deletions

View File

@ -123,7 +123,8 @@ struct _Evas_Font_Glyph_Info
#if 1
// done with shorts to save space... if we need 32k or bigger glyphs and
// relative layout info... worry then.
short x_bear, y_bear, width, pen_after; // 8
Evas_Coord pen_after; // 4
short x_bear, y_bear, width; // 6
#else
Evas_Coord x_bear; // 4
/* This one is rarely used, only in draw, in which we already get the glyph

View File

@ -1353,6 +1353,40 @@ START_TEST(evas_textblock_various)
evas_textblock_cursor_pos_set(cur, 0);
evas_textblock_cursor_char_delete(cur);
/* Super big one line item. */
{
#define CNT 10000
char str[(CNT * 6) + 128], *d;
const char substr[] = "x";
Evas_Textblock_Style *stt;
int i, l;
l = strlen(substr);
d = str;
for (i = 0; i < CNT; i++)
{
memcpy(d, substr, l);
d += l;
}
*d = 0;
stt = evas_textblock_style_new();
evas_textblock_style_set(stt,
"DEFAULT='font=" TEST_FONT " font_size=10 align=left color=#000000 wrap=char'");
evas_object_textblock_style_set(tb, stt);
evas_textblock_style_free(stt);
evas_object_textblock_text_markup_set(tb, substr);
Evas_Textblock_Cursor *cr;
cr = evas_object_textblock_cursor_get(tb);
evas_textblock_cursor_text_append(cr, str);
evas_object_resize(tb, 480, 800);
evas_object_textblock_size_formatted_get(tb, &w, &h);
fail_if(w == 0);
}
END_TB_TEST();
}
END_TEST