2019-11-24 17:36:46 +00:00
|
|
|
#include <notcurses.h>
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
class CellTest : public :: testing::Test {
|
|
|
|
protected:
|
|
|
|
void SetUp() override {
|
2019-11-25 18:36:16 +00:00
|
|
|
setlocale(LC_ALL, nullptr);
|
2019-11-24 17:36:46 +00:00
|
|
|
if(getenv("TERM") == nullptr){
|
|
|
|
GTEST_SKIP();
|
|
|
|
}
|
|
|
|
notcurses_options nopts{};
|
|
|
|
nopts.outfd = STDIN_FILENO;
|
|
|
|
nc_ = notcurses_init(&nopts);
|
|
|
|
ASSERT_NE(nullptr, nc_);
|
|
|
|
n_ = notcurses_stdplane(nc_);
|
|
|
|
ASSERT_NE(nullptr, n_);
|
|
|
|
}
|
|
|
|
|
|
|
|
void TearDown() override {
|
|
|
|
if(nc_){
|
|
|
|
EXPECT_EQ(0, notcurses_render(nc_));
|
|
|
|
EXPECT_EQ(0, notcurses_stop(nc_));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct notcurses* nc_{};
|
|
|
|
struct ncplane* n_{};
|
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(CellTest, SetStyles) {
|
|
|
|
cell c;
|
|
|
|
memset(&c, 0, sizeof(c));
|
|
|
|
cell_set_style(&c, WA_ITALIC);
|
2019-11-24 20:32:38 +00:00
|
|
|
ASSERT_EQ(1, cell_load(n_, &c, "s"));
|
|
|
|
EXPECT_EQ(0, ncplane_fg_rgb8(n_, 255, 255, 255));
|
|
|
|
EXPECT_EQ(1, ncplane_putc(n_, &c));
|
2019-11-24 17:36:46 +00:00
|
|
|
int x, y;
|
|
|
|
ncplane_cursor_yx(n_, &y, &x);
|
|
|
|
EXPECT_EQ(1, x);
|
|
|
|
EXPECT_EQ(0, y);
|
2019-11-24 20:32:38 +00:00
|
|
|
EXPECT_EQ(0, notcurses_render(nc_));
|
2019-11-24 17:36:46 +00:00
|
|
|
}
|