notcurses/tests/libav.cpp

42 lines
935 B
C++
Raw Normal View History

2019-11-25 03:22:18 +00:00
#include <notcurses.h>
#include "main.h"
class LibavTest : public :: testing::Test {
protected:
void SetUp() override {
setlocale(LC_ALL, nullptr);
if(getenv("TERM") == nullptr){
GTEST_SKIP();
}
notcurses_options nopts{};
nopts.outfp = stdin;
nc_ = notcurses_init(&nopts);
ASSERT_NE(nullptr, nc_);
ncp_ = notcurses_stdplane(nc_);
ASSERT_NE(nullptr, ncp_);
2019-11-25 03:22:18 +00:00
}
void TearDown() override {
if(nc_){
EXPECT_EQ(0, notcurses_stop(nc_));
}
2019-11-25 03:22:18 +00:00
}
notcurses* nc_{};
ncplane* ncp_{};
2019-11-25 03:22:18 +00:00
};
TEST_F(LibavTest, LoadImage) {
auto ncv = ncplane_visual_open(ncp_, "../tools/dsscaw-purp.png");
2019-11-27 20:22:54 +00:00
ASSERT_NE(nullptr, ncv);
ASSERT_NE(nullptr, ncvisual_decode(ncv));
2019-11-27 20:22:54 +00:00
ncvisual_destroy(ncv);
2019-11-27 01:19:16 +00:00
}
TEST_F(LibavTest, LoadVideo) {
auto ncv = ncplane_visual_open(ncp_, "../tools/atliens.mkv");
2019-11-27 20:22:54 +00:00
ASSERT_NE(nullptr, ncv);
ASSERT_NE(nullptr, ncvisual_decode(ncv));
2019-11-27 20:22:54 +00:00
ncvisual_destroy(ncv);
2019-11-25 03:22:18 +00:00
}