basic autogrow tests #2440

pull/2447/head
nick black 3 years ago committed by nick black
parent c8e601e457
commit e57999d226

@ -15,6 +15,37 @@ TEST_CASE("Autogrow") {
CHECK(!ncplane_set_autogrow(n_, false)); // attempt to enable failed?
}
// by default, a new plane ought not have autogrow enabled--but we ought be
// able to enable(+disable) it, unlike the standard plane.
SUBCASE("AutogrowDisabledNewPlane") {
struct ncplane_options nopts{};
nopts.rows = 10;
nopts.cols = 10;
auto np = ncplane_create(n_, &nopts);
REQUIRE(np);
CHECK(!ncplane_set_autogrow(np, true)); // ought be false by default
CHECK(ncplane_set_autogrow(np, false)); // did we set it true?
CHECK(!ncplane_set_autogrow(np, false)); // did we set it false?
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(np));
}
// with the NCPLANE_OPTION_AUTOGROW flag, the plane ought have autogrow
// enabled upon creation. we ought be able to disable it.
SUBCASE("AutogrowDisabledNewPlane") {
struct ncplane_options nopts{};
nopts.rows = 10;
nopts.cols = 10;
nopts.flags = NCPLANE_OPTION_AUTOGROW;
auto np = ncplane_create(n_, &nopts);
REQUIRE(np);
CHECK(ncplane_set_autogrow(np, false)); // ought be true at creation
CHECK(!ncplane_set_autogrow(np, true)); // did we set it false?
CHECK(ncplane_set_autogrow(np, false)); // did we set it true?
CHECK(0 == notcurses_render(nc_));
CHECK(0 == ncplane_destroy(np));
}
CHECK(0 == notcurses_stop(nc_));
}

Loading…
Cancel
Save