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") {
|
2020-08-30 17:00:41 +00:00
|
|
|
struct ncdirect* nc_ = ncdirect_init(NULL, stdout, 0);
|
2020-05-17 12:07:25 +00:00
|
|
|
if(!nc_){
|
2020-02-05 09:08:42 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("SetItalic") {
|
2020-12-28 07:21:37 +00:00
|
|
|
CHECK(0 == ncdirect_set_styles(nc_, NCSTYLE_ITALIC));
|
2020-05-17 12:07:25 +00:00
|
|
|
printf("DirectMode *italic*!\n");
|
|
|
|
fflush(stdout);
|
2020-12-28 07:21:37 +00:00
|
|
|
CHECK(0 == ncdirect_off_styles(nc_, NCSTYLE_ITALIC));
|
2020-02-05 09:08:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("SetBold") {
|
2020-12-28 07:21:37 +00:00
|
|
|
CHECK(0 == ncdirect_set_styles(nc_, NCSTYLE_BOLD));
|
2020-05-17 12:07:25 +00:00
|
|
|
printf("DirectMode *bold*!\n");
|
|
|
|
fflush(stdout);
|
2020-12-28 07:21:37 +00:00
|
|
|
CHECK(0 == ncdirect_off_styles(nc_, NCSTYLE_BOLD));
|
2020-02-05 09:08:42 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SUBCASE("SetUnderline") {
|
2020-12-28 07:21:37 +00:00
|
|
|
CHECK(0 == ncdirect_set_styles(nc_, NCSTYLE_UNDERLINE));
|
2020-05-17 12:07:25 +00:00
|
|
|
printf("DirectMode *underline*!\n");
|
|
|
|
fflush(stdout);
|
2020-12-28 07:21:37 +00:00
|
|
|
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") {
|
2020-12-28 07:21:37 +00:00
|
|
|
CHECK(0 == ncdirect_set_styles(nc_, NCSTYLE_STRUCK));
|
2020-12-16 11:46:54 +00:00
|
|
|
printf("DirectMode *struck*!\n");
|
|
|
|
fflush(stdout);
|
2020-12-28 07:21:37 +00:00
|
|
|
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_));
|
2020-08-30 17:00:41 +00:00
|
|
|
|
|
|
|
// 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
|
|
|
}
|