Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,9 @@
else
libpng
)
(
catch2
)

]
++ pkgsForHost.lib.optionals isWindows [
Expand Down
19 changes: 16 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
find_package(Catch2 CONFIG REQUIRED)

include(CTest)
include(Catch)

add_executable(ffmpegthumbnailertest
testrunner.cpp
histogramtest.cpp
Expand All @@ -23,12 +28,20 @@ target_compile_definitions(ffmpegthumbnailertest PRIVATE TEST_DATADIR="${CMAKE_C
target_compile_definitions(ffmpegthumbnailerctest PRIVATE TEST_DATADIR="${CMAKE_CURRENT_SOURCE_DIR}")

if (ENABLE_SHARED)
target_link_libraries(ffmpegthumbnailertest libffmpegthumbnailer)
if (TARGET Catch2::Catch2WithMain)
target_link_libraries(ffmpegthumbnailertest libffmpegthumbnailer Catch2::Catch2WithMain)
else ()
target_link_libraries(ffmpegthumbnailertest libffmpegthumbnailer Catch2::Catch2)
endif ()
target_link_libraries(ffmpegthumbnailerctest libffmpegthumbnailer)
else ()
target_link_libraries(ffmpegthumbnailertest libffmpegthumbnailerstatic)
if (TARGET Catch2::Catch2WithMain)
target_link_libraries(ffmpegthumbnailertest libffmpegthumbnailerstatic Catch2::Catch2WithMain)
else ()
target_link_libraries(ffmpegthumbnailertest libffmpegthumbnailerstatic Catch2::Catch2)
endif ()
target_link_libraries(ffmpegthumbnailerctest libffmpegthumbnailerstatic)
endif ()

add_test(NAME ffmpegthumbnailertest COMMAND ffmpegthumbnailertest)
catch_discover_tests(ffmpegthumbnailertest)
add_test(NAME ffmpegthumbnailerctest COMMAND ffmpegthumbnailerctest)
7 changes: 6 additions & 1 deletion test/histogramtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@
#include <vector>

#include "libffmpegthumbnailer/histogram.h"
#include <catch.hpp>

#if __has_include(<catch2/catch_test_macros.hpp>)
#include <catch2/catch_test_macros.hpp>
#else
#include <catch2/catch.hpp>
#endif

namespace ffmpegthumbnailer {

Expand Down
Loading