notcurses_term_dimensions() + unit test
parent
1fcae27627
commit
c1f4219dc1
@ -1,7 +1,28 @@
|
||||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <notcurses.h>
|
||||
#include "main.h"
|
||||
|
||||
TEST(Notcurses, BasicLifetime) {
|
||||
ASSERT_EQ(0, notcurses_init());
|
||||
EXPECT_EQ(0, notcurses_stop());
|
||||
struct notcurses* nc = notcurses_init();
|
||||
ASSERT_NE(nullptr, nc);
|
||||
EXPECT_EQ(0, notcurses_stop(nc));
|
||||
}
|
||||
|
||||
TEST(Notcurses, TermDimensions) {
|
||||
struct notcurses* nc = notcurses_init();
|
||||
int x, y;
|
||||
ASSERT_NE(nullptr, nc);
|
||||
EXPECT_EQ(0, notcurses_term_dimensions(nc, &y, &x));
|
||||
auto stry = getenv("LINES");
|
||||
if(stry){
|
||||
auto envy = std::stoi(stry, nullptr);
|
||||
EXPECT_EQ(envy, y);
|
||||
}
|
||||
auto strx = getenv("COLUMNS");
|
||||
if(stry){
|
||||
auto envx = std::stoi(strx, nullptr);
|
||||
EXPECT_EQ(envx, x);
|
||||
}
|
||||
EXPECT_EQ(0, notcurses_stop(nc));
|
||||
}
|
||||
|
Loading…
Reference in New Issue