notcurses/tests/input.cpp

39 lines
792 B
C++
Raw Normal View History

2019-12-23 07:47:34 +00:00
#include "main.h"
class InputTest : public :: testing::Test {
protected:
void SetUp() override {
setlocale(LC_ALL, "");
if(getenv("TERM") == nullptr){
GTEST_SKIP();
}
notcurses_options nopts{};
nopts.inhibit_alternate_screen = true;
nopts.suppress_bannner = true;
outfp_ = fopen("/dev/tty", "wb");
ASSERT_NE(nullptr, outfp_);
nc_ = notcurses_init(&nopts, outfp_);
ASSERT_NE(nullptr, nc_);
}
void TearDown() override {
if(nc_){
EXPECT_EQ(0, notcurses_stop(nc_));
}
if(outfp_){
fclose(outfp_);
}
}
struct notcurses* nc_{};
FILE* outfp_{};
};
TEST_F(InputTest, TestMouseOn){
ASSERT_EQ(0, notcurses_mouse_enable(nc_));
}
TEST_F(InputTest, TestMouseOff){
ASSERT_EQ(0, notcurses_mouse_disable(nc_));
}