You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
905 B
C++
42 lines
905 B
C++
5 years ago
|
#include <notcurses.h>
|
||
|
#include "main.h"
|
||
|
|
||
|
class CellTest : public :: testing::Test {
|
||
|
protected:
|
||
|
void SetUp() override {
|
||
|
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, ncplane_fg_rgb8(n_, 255, 255, 255));
|
||
|
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);
|
||
|
cell_load(n_, &c, "s");
|
||
|
EXPECT_EQ(1, ncplane_putc(n_, &c, "s"));
|
||
|
int x, y;
|
||
|
ncplane_cursor_yx(n_, &y, &x);
|
||
|
EXPECT_EQ(1, x);
|
||
|
EXPECT_EQ(0, y);
|
||
|
notcurses_render(nc_);
|
||
|
}
|