popup: show the candidate page
This commit is contained in:
@@ -694,7 +694,9 @@ checkcandidatepage(struct ct *t, char *where, int first, int n, int sel)
|
||||
show();
|
||||
if(!CT_CHECK(t, draindraw(&dc) > 0))
|
||||
return 0;
|
||||
if(!CT_EQ_INT(t, n, dc.nkouho) || !CT_EQ_INT(t, sel, dc.sel))
|
||||
if(!CT_EQ_INT(t, n, dc.nkouho) || !CT_EQ_INT(t, sel, dc.sel) ||
|
||||
!CT_EQ_INT(t, first, dc.first) ||
|
||||
!CT_EQ_INT(t, im.nkouho, dc.total))
|
||||
return 0;
|
||||
if(n == 0)
|
||||
return 1;
|
||||
@@ -705,6 +707,50 @@ checkcandidatepage(struct ct *t, char *where, int first, int n, int sel)
|
||||
return checkstr(t, where, want, &dc.kouho[n-1]);
|
||||
}
|
||||
|
||||
void
|
||||
engine_candidate_page_metadata(struct ct *t)
|
||||
{
|
||||
static const struct {
|
||||
int total;
|
||||
int sel;
|
||||
int first;
|
||||
int shown;
|
||||
int local;
|
||||
} cases[] = {
|
||||
{ 9, 8, 0, 9, 8 },
|
||||
{ 10, 8, 0, 9, 8 },
|
||||
{ 10, 9, 9, 1, 0 },
|
||||
{ 18, 8, 0, 9, 8 },
|
||||
{ 18, 17, 9, 9, 8 },
|
||||
{ 32, 8, 0, 9, 8 },
|
||||
{ 32, 17, 9, 9, 8 },
|
||||
{ 32, 26, 18, 9, 8 },
|
||||
{ 32, 31, 27, 5, 4 },
|
||||
};
|
||||
Drawcmd dc;
|
||||
int i;
|
||||
|
||||
/* A clearing draw is the observable zero-candidate snapshot. */
|
||||
candidatebegin(1);
|
||||
show();
|
||||
draindraw(nil);
|
||||
setcandidates(0);
|
||||
show();
|
||||
if(CT_CHECK(t, draindraw(&dc) > 0)){
|
||||
CT_EQ_INT(t, 0, dc.nkouho);
|
||||
CT_EQ_INT(t, -1, dc.sel);
|
||||
CT_EQ_INT(t, 0, dc.first);
|
||||
CT_EQ_INT(t, 0, dc.total);
|
||||
}
|
||||
|
||||
for(i = 0; i < nelem(cases); i++){
|
||||
candidatebegin(cases[i].total);
|
||||
im.sel = cases[i].sel;
|
||||
checkcandidatepage(t, "candidate page metadata",
|
||||
cases[i].first, cases[i].shown, cases[i].local);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
engine_candidate_page_snapshots(struct ct *t)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user