popup: place and bound the input panel
This commit is contained in:
@@ -22,11 +22,38 @@ popup_layout(struct ct *t)
|
||||
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);
|
||||
CT_EQ_INT(t, 530, y);
|
||||
|
||||
/* Neither side fits: choose above, then clamp to the screen. */
|
||||
caret.x = 20;
|
||||
caret.y = 30;
|
||||
caret.h = 20;
|
||||
popupposition(&caret, 0, 0, 80, 80, 100, 100, &x, &y);
|
||||
CT_EQ_INT(t, 0, x);
|
||||
CT_EQ_INT(t, 0, y);
|
||||
|
||||
caret.x = 70;
|
||||
caret.y = 80;
|
||||
caret.h = 0;
|
||||
popupposition(&caret, 0, 0, 800, 600, 100, 60, &x, &y);
|
||||
CT_EQ_INT(t, 70, x);
|
||||
CT_EQ_INT(t, 80, y);
|
||||
caret.h = -20;
|
||||
popupposition(&caret, 0, 0, 800, 600, 100, 60, &x, &y);
|
||||
CT_EQ_INT(t, 70, x);
|
||||
CT_EQ_INT(t, 80, 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);
|
||||
caret.x = INT_MAX;
|
||||
caret.y = INT_MIN;
|
||||
caret.h = INT_MIN;
|
||||
popupposition(&caret, 0, 0, INT_MAX, INT_MAX,
|
||||
INT_MAX, INT_MAX, &x, &y);
|
||||
CT_EQ_INT(t, 0, x);
|
||||
CT_EQ_INT(t, 0, y);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user