notcurses/tests/direct.cpp

48 lines
1.2 KiB
C++
Raw Normal View History

2020-02-05 09:08:42 +00:00
#include "main.h"
2020-07-10 19:51:28 +00:00
#include <notcurses/direct.h>
2020-02-05 09:08:42 +00:00
TEST_CASE("DirectMode") {
struct ncdirect* nc_ = ncdirect_init(NULL, stdout, 0);
if(!nc_){
2020-02-05 09:08:42 +00:00
return;
}
SUBCASE("SetItalic") {
CHECK(0 == ncdirect_set_styles(nc_, NCSTYLE_ITALIC));
printf("DirectMode *italic*!\n");
fflush(stdout);
CHECK(0 == ncdirect_off_styles(nc_, NCSTYLE_ITALIC));
2020-02-05 09:08:42 +00:00
}
SUBCASE("SetBold") {
CHECK(0 == ncdirect_set_styles(nc_, NCSTYLE_BOLD));
printf("DirectMode *bold*!\n");
fflush(stdout);
CHECK(0 == ncdirect_off_styles(nc_, NCSTYLE_BOLD));
2020-02-05 09:08:42 +00:00
}
SUBCASE("SetUnderline") {
CHECK(0 == ncdirect_set_styles(nc_, NCSTYLE_UNDERLINE));
printf("DirectMode *underline*!\n");
fflush(stdout);
CHECK(0 == ncdirect_off_styles(nc_, NCSTYLE_UNDERLINE));
2020-02-05 09:08:42 +00:00
}
2020-12-16 11:46:54 +00:00
SUBCASE("SetStruck") {
CHECK(0 == ncdirect_set_styles(nc_, NCSTYLE_STRUCK));
2020-12-16 11:46:54 +00:00
printf("DirectMode *struck*!\n");
fflush(stdout);
CHECK(0 == ncdirect_off_styles(nc_, NCSTYLE_STRUCK));
2020-12-16 11:46:54 +00:00
}
2020-02-05 09:08:42 +00:00
CHECK(0 == ncdirect_stop(nc_));
// make sure that we can pass undefined flags and still create the ncdirect
SUBCASE("FutureFlags") {
nc_ = ncdirect_init(NULL, stdout, ~0ULL);
REQUIRE(nullptr != nc_);
CHECK(0 == ncdirect_stop(nc_));
}
2020-02-05 09:08:42 +00:00
}