|
|
|
@ -65,7 +65,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
ncplane_dim_yx(ncsp, &dimy, &dimx);
|
|
|
|
|
CHECK(4 == dimy);
|
|
|
|
|
CHECK(5 == dimx);
|
|
|
|
|
ncselector_destroy(ncs);
|
|
|
|
|
ncselector_destroy(ncs, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SUBCASE("TitledSelector") {
|
|
|
|
@ -86,7 +86,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
ncplane_dim_yx(ncsp, &dimy, &dimx);
|
|
|
|
|
CHECK(6 == dimy);
|
|
|
|
|
CHECK(strlen(opts.title) + 4 == dimx);
|
|
|
|
|
ncselector_destroy(ncs);
|
|
|
|
|
ncselector_destroy(ncs, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SUBCASE("SecondarySelector") {
|
|
|
|
@ -107,7 +107,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
ncplane_dim_yx(ncsp, &dimy, &dimx);
|
|
|
|
|
CHECK(4 == dimy);
|
|
|
|
|
CHECK(strlen(opts.secondary) + 2 == dimx);
|
|
|
|
|
ncselector_destroy(ncs);
|
|
|
|
|
ncselector_destroy(ncs, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SUBCASE("FooterSelector") {
|
|
|
|
@ -128,7 +128,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
ncplane_dim_yx(ncsp, &dimy, &dimx);
|
|
|
|
|
CHECK(4 == dimy);
|
|
|
|
|
CHECK(strlen(opts.footer) + 2 == dimx);
|
|
|
|
|
ncselector_destroy(ncs);
|
|
|
|
|
ncselector_destroy(ncs, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SUBCASE("PopulatedSelector") {
|
|
|
|
@ -136,7 +136,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
{ "op1", "this is option 1", },
|
|
|
|
|
{ "2ndop", "this is option #2", },
|
|
|
|
|
{ "tres", "option the third", },
|
|
|
|
|
{ NULL, NULL, },
|
|
|
|
|
{ nullptr, nullptr, },
|
|
|
|
|
};
|
|
|
|
|
struct ncselector_options opts{};
|
|
|
|
|
opts.items = items;
|
|
|
|
@ -154,7 +154,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
ncplane_dim_yx(ncsp, &dimy, &dimx);
|
|
|
|
|
CHECK(7 == dimy);
|
|
|
|
|
CHECK(15 < dimx);
|
|
|
|
|
ncselector_destroy(ncs);
|
|
|
|
|
ncselector_destroy(ncs, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SUBCASE("EmptySelectorMovement") {
|
|
|
|
@ -175,7 +175,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
sel = ncselector_previtem(ncs);
|
|
|
|
|
REQUIRE(nullptr == sel);
|
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
|
ncselector_destroy(ncs);
|
|
|
|
|
ncselector_destroy(ncs, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
SUBCASE("SelectorMovement") {
|
|
|
|
@ -183,7 +183,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
{ "op1", "this is option 1", },
|
|
|
|
|
{ "2ndop", "this is option #2", },
|
|
|
|
|
{ "tres", "option the third", },
|
|
|
|
|
{ NULL, NULL, },
|
|
|
|
|
{ nullptr, nullptr, },
|
|
|
|
|
};
|
|
|
|
|
struct ncselector_options opts{};
|
|
|
|
|
opts.items = items;
|
|
|
|
@ -216,7 +216,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
REQUIRE(nullptr != sel);
|
|
|
|
|
CHECK(0 == strcmp(sel, items[0].option));
|
|
|
|
|
CHECK(0 == notcurses_render(nc_));
|
|
|
|
|
ncselector_destroy(ncs);
|
|
|
|
|
ncselector_destroy(ncs, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Provide three items, limited to 1 shown at a time
|
|
|
|
@ -225,7 +225,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
{ "op1", "this is option 1", },
|
|
|
|
|
{ "2ndop", "this is option #2", },
|
|
|
|
|
{ "tres", "option the third", },
|
|
|
|
|
{ NULL, NULL, },
|
|
|
|
|
{ nullptr, nullptr, },
|
|
|
|
|
};
|
|
|
|
|
struct ncselector_options opts{};
|
|
|
|
|
opts.maxdisplay = 1;
|
|
|
|
@ -264,7 +264,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
unsigned dimy, dimx;
|
|
|
|
|
ncplane_dim_yx(ncsp, &dimy, &dimx);
|
|
|
|
|
CHECK(5 == dimy);
|
|
|
|
|
ncselector_destroy(ncs);
|
|
|
|
|
ncselector_destroy(ncs, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Provide three items, limited to 2 shown at a time
|
|
|
|
@ -273,7 +273,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
{ "op1", "this is option 1", },
|
|
|
|
|
{ "2ndop", "this is option #2", },
|
|
|
|
|
{ "tres", "option the third", },
|
|
|
|
|
{ NULL, NULL, },
|
|
|
|
|
{ nullptr, nullptr, },
|
|
|
|
|
};
|
|
|
|
|
struct ncselector_options opts{};
|
|
|
|
|
opts.maxdisplay = 2;
|
|
|
|
@ -311,7 +311,7 @@ TEST_CASE("Selectors") {
|
|
|
|
|
unsigned dimy, dimx;
|
|
|
|
|
ncplane_dim_yx(ncsp, &dimy, &dimx);
|
|
|
|
|
CHECK(6 == dimy);
|
|
|
|
|
ncselector_destroy(ncs);
|
|
|
|
|
ncselector_destroy(ncs, nullptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
CHECK(0 == notcurses_stop(nc_));
|
|
|
|
|