2020-02-05 09:08:42 +00:00
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
TEST_CASE("DirectMode") {
|
|
|
|
// common initialization
|
|
|
|
if(getenv("TERM") == nullptr){
|
|
|
|
return;
|
|
|
|
}
|
2020-04-18 05:39:34 +00:00
|
|
|
FILE* outfp_ = fopen("/dev/tty", "wb");
|
2020-02-05 09:08:42 +00:00
|
|
|
REQUIRE(nullptr != outfp_);
|
2020-03-03 01:19:16 +00:00
|
|
|
struct ncdirect* nc_ = ncdirect_init(NULL, outfp_);
|
2020-02-05 09:08:42 +00:00
|
|
|
REQUIRE(nullptr != nc_);
|
|
|
|
|
|
|
|
SUBCASE("SetItalic") {
|
|
|
|
CHECK(0 == ncdirect_styles_set(nc_, NCSTYLE_ITALIC));
|
|
|
|
CHECK(0 == ncdirect_styles_off(nc_, NCSTYLE_ITALIC));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("SetBold") {
|
|
|
|
CHECK(0 == ncdirect_styles_set(nc_, NCSTYLE_BOLD));
|
|
|
|
CHECK(0 == ncdirect_styles_off(nc_, NCSTYLE_BOLD));
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("SetUnderline") {
|
|
|
|
CHECK(0 == ncdirect_styles_set(nc_, NCSTYLE_UNDERLINE));
|
|
|
|
CHECK(0 == ncdirect_styles_off(nc_, NCSTYLE_UNDERLINE));
|
|
|
|
}
|
|
|
|
|
|
|
|
// common teardown
|
|
|
|
CHECK(0 == ncdirect_stop(nc_));
|
|
|
|
CHECK(0 == fclose(outfp_));
|
|
|
|
}
|