complete SingleCellDown/SingleCellUp tests #1258

pull/1270/head
nick black 4 years ago committed by Nick Black
parent cd8dd4232c
commit f729d855f9

@ -26,20 +26,22 @@ ncplane* ncprogbar_plane(ncprogbar* n){
return n->ncp;
}
// we never explicitly draw full blocks, as any such cell is already
// handled (and at higher resolution) by the high-res gradient.
static const char right_egcs[8][5] = {
"🮇", "🮇", "🮈", "", "🮉", "🮊", "🮋", "",
" ", "🮇", "🮇", "🮈", "", "🮉", "🮊", "🮋",
};
static const char left_egcs[8][5] = {
"", "", "", "", "", "", "", "",
" ", "", "", "", "", "", "", "",
};
static const char down_egcs[8][5] = {
"", "🮂", "🮃", "", "🮄", "🮅", "🮆", "",
" ", "", "🮂", "🮃", "", "🮄", "🮅", "🮆",
};
static const char up_egcs[8][5] = {
"", "", "", "", "", "", "", "",
" ", "", "", "", "", "", "", "",
};
static int

@ -23,10 +23,10 @@ TEST_CASE("ProgressBar") {
.resizecb = nullptr,
.flags = 0,
};
const char* egcs[] = { " ", "", "", "", "", "", "", "", "" };
const char* egcs[] = { " ", "", "", "", "", "", "", "", "" };
auto n = ncplane_create(n_, &nopts);
REQUIRE(nullptr != n);
auto pbar = ncprogbar_create(n, NULL);
auto pbar = ncprogbar_create(n, nullptr);
for(int i = 0 ; i < 9 ; ++i){
double p = i / 8.0;
CHECK(0 == ncprogbar_set_progress(pbar, p));
@ -41,5 +41,40 @@ TEST_CASE("ProgressBar") {
ncprogbar_destroy(pbar);
}
SUBCASE("SingleCellDown") {
struct ncplane_options nopts = {
.y = 0,
.x = 0,
.rows = 1,
.cols = 1,
.userptr = nullptr,
.name = "pbar",
.resizecb = nullptr,
.flags = 0,
};
const char* egcs[] = { " ", "", "🮂", "🮃", "", "🮄", "🮅", "🮆", ""};
auto n = ncplane_create(n_, &nopts);
REQUIRE(nullptr != n);
struct ncprogbar_options popts = {
.ulchannel = 0,
.urchannel = 0,
.blchannel = 0,
.brchannel = 0,
.flags = NCPROGBAR_OPTION_RETROGRADE,
};
auto pbar = ncprogbar_create(n, &popts);
for(int i = 0 ; i < 9 ; ++i){
double p = i / 8.0;
CHECK(0 == ncprogbar_set_progress(pbar, p));
CHECK(0 == notcurses_render(nc_));
uint16_t smask;
uint64_t channels;
char* egc = notcurses_at_yx(nc_, 0, 0, &smask, &channels);
REQUIRE(nullptr != egc);
CHECK(0 == strcmp(egc, egcs[i]));
free(egc);
}
ncprogbar_destroy(pbar);
}
CHECK(0 == notcurses_stop(nc_));
}

Loading…
Cancel
Save