ncurses-view #61

This commit is contained in:
nick black 2019-11-27 15:22:54 -05:00 committed by Nick Black
parent 4b2bf26ee2
commit cf557ff500
10 changed files with 39 additions and 6 deletions

View File

@ -47,8 +47,8 @@ target_compile_definitions(notcurses
_DEFAULT_SOURCE _XOPEN_SOURCE=700
)
file(GLOB BINSRCS CONFIGURE_DEPENDS src/bin/*.c)
add_executable(notcurses-demo ${BINSRCS})
file(GLOB DEMOSRCS CONFIGURE_DEPENDS src/demo/*.c)
add_executable(notcurses-demo ${DEMOSRCS})
target_include_directories(notcurses-demo PRIVATE include)
target_link_libraries(notcurses-demo
PRIVATE
@ -59,6 +59,18 @@ target_compile_options(notcurses-demo
-Wall -Wextra -W -Wshadow
)
file(GLOB VIEWSRCS CONFIGURE_DEPENDS src/view/*.cpp)
add_executable(notcurses-view ${VIEWSRCS})
target_include_directories(notcurses-view PRIVATE include)
target_link_libraries(notcurses-view
PRIVATE
notcurses
)
target_compile_options(notcurses-view
PRIVATE
-Wall -Wextra -W -Wshadow
)
file(GLOB TESTSRCS CONFIGURE_DEPENDS tests/*.cpp)
add_executable(notcurses-tester ${TESTSRCS})
find_package(GTest 1.9 REQUIRED)
@ -107,6 +119,7 @@ install(FILES
)
install(TARGETS notcurses-demo DESTINATION bin)
install(TARGETS notcurses-view DESTINATION bin)
install(TARGETS notcurses
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}

18
src/view/main.cpp Normal file
View File

@ -0,0 +1,18 @@
#include <cstdlib>
#include <libgen.h>
#include <iostream>
void usage(std::ostream& o, char* argv0, int exitcode){
o << "usage: " << basename(argv0) << " files" << '\n';
exit(exitcode);
}
int main(int argc, char** argv){
if(argc == 1){
usage(std::cerr, argv[0], EXIT_FAILURE);
}
for(int i = 1 ; i < argc ; ++i){
std::cout << "file: " << argv[i] << std::endl;
}
return EXIT_SUCCESS;
}

View File

@ -11,11 +11,13 @@ class LibavTest : public :: testing::Test {
};
TEST_F(LibavTest, LoadImage) {
int ret = notcurses_visual_open(nullptr, "../tools/dsscaw-purp.png");
ASSERT_EQ(0, ret);
auto ncv = notcurses_visual_open(nullptr, "../tools/dsscaw-purp.png");
ASSERT_NE(nullptr, ncv);
ncvisual_destroy(ncv);
}
TEST_F(LibavTest, LoadVideo) {
int ret = notcurses_visual_open(nullptr, "../tools/atliens.mkv");
ASSERT_EQ(0, ret);
auto ncv = notcurses_visual_open(nullptr, "../tools/atliens.mkv");
ASSERT_NE(nullptr, ncv);
ncvisual_destroy(ncv);
}