fix: make popup rendering deterministic
This commit is contained in:
28
tests/popup_test.c
Normal file
28
tests/popup_test.c
Normal file
@@ -0,0 +1,28 @@
|
||||
#include "test.h"
|
||||
#include "../popup_layout.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);
|
||||
}
|
||||
Reference in New Issue
Block a user