2019-11-25 03:22:18 +00:00
|
|
|
#include <notcurses.h>
|
|
|
|
#include "main.h"
|
|
|
|
|
|
|
|
class LibavTest : public :: testing::Test {
|
|
|
|
protected:
|
|
|
|
void SetUp() override {
|
2019-11-27 22:22:13 +00:00
|
|
|
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 {
|
2019-11-27 22:22:13 +00:00
|
|
|
if(nc_){
|
|
|
|
EXPECT_EQ(0, notcurses_stop(nc_));
|
|
|
|
}
|
2019-11-25 03:22:18 +00:00
|
|
|
}
|
2019-11-27 22:22:13 +00:00
|
|
|
|
|
|
|
notcurses* nc_{};
|
|
|
|
ncplane* ncp_{};
|
2019-11-25 03:22:18 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
TEST_F(LibavTest, LoadImage) {
|
2019-11-27 22:22:13 +00:00
|
|
|
auto ncv = ncplane_visual_open(ncp_, "../tools/dsscaw-purp.png");
|
2019-11-27 20:22:54 +00:00
|
|
|
ASSERT_NE(nullptr, ncv);
|
2019-11-27 20:48:18 +00:00
|
|
|
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) {
|
2019-11-27 22:22:13 +00:00
|
|
|
auto ncv = ncplane_visual_open(ncp_, "../tools/atliens.mkv");
|
2019-11-27 20:22:54 +00:00
|
|
|
ASSERT_NE(nullptr, ncv);
|
2019-11-27 20:48:18 +00:00
|
|
|
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
|
|
|
}
|