Files
strans/tests/popup_test.c

35 lines
788 B
C

#include "test.h"
#include <limits.h>
void
popup_layout(struct ct *t)
{
Rune heart[] = { 0x2764, 0xfe0f };
Caret caret;
int x, y;
CT_EQ_INT(t, 1, popupcells(heart, nelem(heart)));
memset(&caret, 0, sizeof caret);
popupposition(&caret, 40, 50, 800, 600, 100, 60, &x, &y);
CT_EQ_INT(t, 50, x);
CT_EQ_INT(t, 60, y);
caret.valid = 1;
caret.x = 70;
caret.y = 80;
caret.h = 20;
popupposition(&caret, 40, 50, 800, 600, 100, 60, &x, &y);
CT_EQ_INT(t, 70, x);
CT_EQ_INT(t, 100, y);
caret.x = 790;
caret.y = 590;
popupposition(&caret, 0, 0, 800, 600, 100, 60, &x, &y);
CT_EQ_INT(t, 700, x);
CT_EQ_INT(t, 540, y);
caret.x = INT_MIN;
caret.y = INT_MAX;
caret.h = INT_MAX;
popupposition(&caret, 0, 0, 800, 600, 100, 60, &x, &y);
CT_EQ_INT(t, 0, x);
CT_EQ_INT(t, 540, y);
}