popup: place and bound the input panel
This commit is contained in:
@@ -178,8 +178,8 @@ font_render(struct ct *t)
|
||||
{
|
||||
static char *plain[] = { "A", "가", "あ", "漢", "☆", "𠀋" };
|
||||
u32int *buf, *mem;
|
||||
Str a, heart, missing;
|
||||
int i, w;
|
||||
Str a, heart, longrow, missing;
|
||||
int i, natural, w, x, y;
|
||||
|
||||
mem = emalloc((Testn + 2 * Guard) * sizeof mem[0]);
|
||||
fillpixels(mem, Testn + 2 * Guard, guardcolor);
|
||||
@@ -216,6 +216,21 @@ font_render(struct ct *t)
|
||||
checkclip(t, mem, Fontsz, -Fontsz / 2, &a);
|
||||
checkclip(t, mem, Fontsz, Testh - Fontsz / 2, &a);
|
||||
|
||||
longrow = mkstr("abcdefghijklmnopqrstuvwxyz");
|
||||
natural = textwidth(&longrow);
|
||||
CT_CHECK(t, natural > 2*Fontsz);
|
||||
fillpixels(buf, Testn, Colbg);
|
||||
textdrawfit(buf, Testw, Testh, 2*Fontsz, Fontsz,
|
||||
2*Fontsz, &longrow);
|
||||
CT_CHECK(t, hasink(buf, Testn, Colbg));
|
||||
for(y = Fontsz; y < 2*Fontsz; y++){
|
||||
for(x = 0; x < 2*Fontsz; x++)
|
||||
CT_EQ_UINT(t, Colbg, buf[y * Testw + x] & Rgbmask);
|
||||
for(x = 4*Fontsz; x < Testw; x++)
|
||||
CT_EQ_UINT(t, Colbg, buf[y * Testw + x] & Rgbmask);
|
||||
}
|
||||
CT_EQ_INT(t, natural, textwidth(&longrow));
|
||||
|
||||
missing = mkstr("\xF4\x8F\xBF\xBF");
|
||||
for(i = 0; i < 32; i++){
|
||||
textdraw(buf, Testw, Testh, Fontsz, Fontsz, &heart);
|
||||
|
||||
Reference in New Issue
Block a user