Ncpp tests: supply NCOPTION_SUPPRESS_BANNERS | NCOPTION_INHIBIT_SETLOCALE

pull/821/head
nick black 4 years ago committed by Nick Black
parent 2ecfb84fe8
commit bae1cedd6b

@ -6,17 +6,21 @@ using namespace ncpp;
TEST_CASE("Ncpp"
* doctest::description("Basic C++ wrapper tests")) {
notcurses_options nopts{};
nopts.flags = NCOPTION_SUPPRESS_BANNERS |
NCOPTION_INHIBIT_SETLOCALE;
// we ought be able to construct a NotCurses object with a nullptr FILE
// or even just no argument (decays to nullptr).
SUBCASE("ConstructNotCurses") {
NotCurses nc;
NotCurses nc{ nopts };
CHECK(!NotCurses::is_notcurses_stopped(&nc));
CHECK(nc.stop());
CHECK(NotCurses::is_notcurses_stopped(&nc));
}
SUBCASE("ConstructNotCursesNullFILE") {
NotCurses ncnull(nullptr);
NotCurses ncnull{ nopts, nullptr };
CHECK(!NotCurses::is_notcurses_stopped(&ncnull));
CHECK(ncnull.stop());
CHECK(NotCurses::is_notcurses_stopped(&ncnull));
@ -24,17 +28,17 @@ TEST_CASE("Ncpp"
// we ought be able to get a new NotCurses object after stop()ping one.
SUBCASE("ConstructNotCursesTwice") {
NotCurses nc;
NotCurses nc{ nopts };
CHECK(nc.stop());
CHECK(NotCurses::is_notcurses_stopped(&nc));
NotCurses ncnull(nullptr);
NotCurses ncnull{ nopts, nullptr };
CHECK(!NotCurses::is_notcurses_stopped(&ncnull));
CHECK(ncnull.stop());
CHECK(NotCurses::is_notcurses_stopped(&ncnull));
}
SUBCASE("StdPlane") {
NotCurses nc;
NotCurses nc{ nopts };
auto std1 = nc.get_stdplane();
CHECK(nullptr != std1);
int y, x;
@ -46,19 +50,19 @@ TEST_CASE("Ncpp"
}
SUBCASE("Debug") { // just test to ensure it doesn't coredump
NotCurses nc;
NotCurses nc{ nopts };
nc.debug(stderr);
CHECK(nc.stop());
}
SUBCASE("GetPaletteSize") {
NotCurses nc;
NotCurses nc{ nopts };
CHECK(0 < nc.get_palette_size());
CHECK(nc.stop());
}
SUBCASE("VisualFromFile") {
NotCurses nc;
NotCurses nc{ nopts };
if(nc.can_open_images()){
nc_err_e err;
{
@ -70,7 +74,7 @@ TEST_CASE("Ncpp"
}
SUBCASE("VisualFromRGBA") {
NotCurses nc;
NotCurses nc{ nopts };
uint32_t rgba[] = {
0x4080c0ff,
0x105090ff,
@ -83,7 +87,7 @@ TEST_CASE("Ncpp"
}
SUBCASE("VisualFromPlane") {
NotCurses nc;
NotCurses nc{ nopts };
{
auto n = nc.get_stdplane();
REQUIRE(n);

@ -203,16 +203,16 @@ fprintf(stderr, "LINE: [%s]\n", line);
// create a plane of two rows, and exactly fill both with wide chars
SUBCASE("LayoutFillsPlaneWide") {
auto sp = ncplane_new(nc_, 2, 8, 0, 0, nullptr);
auto sp = ncplane_new(nc_, 2, 7, 0, 0, nullptr);
REQUIRE(sp);
size_t bytes;
const char boundstr[] = "我能吞 下玻 ";
const char boundstr[] = "我能吞 下玻";
CHECK(0 < ncplane_puttext(sp, 0, NCALIGN_LEFT, boundstr, &bytes));
CHECK(0 == notcurses_render(nc_));
CHECK(bytes == strlen(boundstr));
char* line = ncplane_contents(sp, 0, 0, -1, -1);
REQUIRE(line);
CHECK(0 == strcmp(line, "我能吞下玻 "));
CHECK(0 == strcmp(line, "我能吞下玻"));
free(line);
ncplane_destroy(sp);
}

@ -17,7 +17,6 @@ auto testing_notcurses() -> struct notcurses* {
notcurses_options nopts{};
nopts.loglevel = NCLOGLEVEL_VERBOSE;
nopts.flags = NCOPTION_SUPPRESS_BANNERS
| NCOPTION_NO_ALTERNATE_SCREEN
| NCOPTION_INHIBIT_SETLOCALE;
auto nc = notcurses_init(&nopts, nullptr);
return nc;

Loading…
Cancel
Save