Files
libopenshot/tests/CMakeLists.txt

149 lines
3.4 KiB
CMake
Raw Permalink Normal View History

##################### tests/CMakeLists.txt (libopenshot) ######################
# @brief CMake build file for libopenshot (used to generate makefiles)
# @author Jonathan Thomas <jonathan@openshot.org>
#
# @section LICENSE
#
2019-06-11 06:48:32 -04:00
# Copyright (c) 2008-2019 OpenShot Studios, LLC
#
# SPDX-License-Identifier: LGPL-3.0-or-later
# Allow spaces in test names
if(POLICY CMP0110)
cmake_policy(SET CMP0110 NEW)
endif()
# Test media path, used by unit tests for input data
file(TO_NATIVE_PATH "${PROJECT_SOURCE_DIR}/examples/" TEST_MEDIA_PATH)
# Benchmark executable
add_executable(openshot-benchmark Benchmark.cpp)
target_compile_definitions(openshot-benchmark PRIVATE -DTEST_MEDIA_PATH="${TEST_MEDIA_PATH}")
target_link_libraries(openshot-benchmark openshot)
2021-04-09 04:09:36 -04:00
###
### TEST SOURCE FILES
###
set(OPENSHOT_TESTS
Refactoring Audio Device detection (don't crash on Windows, find actual sample rate and device details) (#883) * Close down ZMQ context to stop the zmq threads (related to sentry bug: OPENSHOT-3X) * Add Support for Windows 7/8.1 (#881) Adding protection around getting current sample rate for win 7, if audio device not found. Also added mutex for Singleton method. Also, making whitespace consistent on AudioPlaybackThread.cpp * Big refactor of audio device opening - with multiple sample rates attempted, for better recovery from a missing or unsupported sample rate. Debug logs added for testing. * Additional failure logging for windows audio device init * Refactor of Audio Device Initialization (#882) * Huge refactor of audio device initialization: - Attempt requested audio device first, and then iterate through all known audio types and devices, and common sample rates. The idea is to ignore an invalid default or invalid requested device, and keep looking until we find a valid one - New public method to return active, open audio device - Added methods for AudioDeviceInfo struct, to make it callable from Python - Some code clean-up and whitespace fixes - New unit tests for AudioDeviceManagerSingleton * Ignore audio device unit tests on systems with "No Driver" returned in the audio error message * Ignore audio device unit tests if any error is found during initialization (i.e. build servers don't have audio cards) * Trying to update GitHub libomp errors during build checks * Remove zmq context shutdown call, due to the method missing on newer versions of zmq.hpp * Downgrading GitHub Ubuntu latest image to Ubuntu 20.04, for compatibility with Catchv2 * Initialize all audio device manager variables correctly, and ignore unit test on low or missing sample rate systems (i.e. GitHub build servers)
2022-12-19 13:15:43 -06:00
AudioDeviceManager
AudioWaveformer
2021-04-09 05:27:18 -04:00
CacheDisk
CacheMemory
Caption
2021-04-09 04:09:36 -04:00
Clip
Color
Coordinate
DummyReader
FFmpegReader
FFmpegWriter
Fraction
Frame
FrameMapper
KeyFrame
Point
Profiles
2021-04-09 04:09:36 -04:00
QtImageReader
ReaderBase
2021-04-09 04:09:36 -04:00
Settings
SphericalMetadata
2021-04-09 04:44:48 -04:00
Timeline
VideoCacheThread
2021-09-11 22:42:59 -04:00
# Effects
2025-05-25 18:22:41 -05:00
ColorMap
2021-09-11 22:42:59 -04:00
ChromaKey
2021-09-18 04:14:17 -04:00
Crop
LensFlare
AnalogTape
Sharpen
SphericalEffect
WaveEffect
2021-04-09 04:44:48 -04:00
)
# ImageMagick related test files
if($CACHE{HAVE_IMAGEMAGICK})
list(APPEND OPENSHOT_TESTS
ImageReader
ImageWriter
)
endif()
# OPENCV RELATED TEST FILES
if($CACHE{HAVE_OPENCV})
2021-04-09 04:09:36 -04:00
list(APPEND OPENSHOT_TESTS
CVTracker
CVStabilizer
CVOutline
2021-04-09 04:09:36 -04:00
# CVObjectDetection
)
2020-11-05 12:23:08 -03:00
endif()
2021-04-09 04:09:36 -04:00
###
2021-04-09 05:27:18 -04:00
### Catch2 unit tests
2021-04-09 04:09:36 -04:00
###
include(CTest)
include(Catch)
if(NOT BUILD_TESTING)
return()
endif()
add_library(openshot_catch2 INTERFACE)
target_include_directories(openshot_catch2 INTERFACE
"${CMAKE_CURRENT_BINARY_DIR}"
)
target_compile_definitions(openshot_catch2 INTERFACE
TEST_MEDIA_PATH="${TEST_MEDIA_PATH}")
if(TARGET Catch2::Catch2WithMain)
# Catch2 v3 works a bit differently
configure_file(catch2v3.h.in openshot_catch.h)
target_link_libraries(openshot_catch2 INTERFACE Catch2::Catch2WithMain)
else()
configure_file(catch2v2.h.in openshot_catch.h)
# Create object library for test executable main(),
# to avoid recompiling for every test
add_library(catch-main OBJECT catch_main.cpp)
target_link_libraries(catch-main PUBLIC Catch2::Catch2)
target_include_directories(catch-main PUBLIC
"${CMAKE_CURRENT_BINARY_DIR}")
target_link_libraries(openshot_catch2 INTERFACE Catch2::Catch2)
target_sources(openshot_catch2 INTERFACE $<TARGET_OBJECTS:catch-main>)
endif()
foreach(tname ${OPENSHOT_TESTS})
add_executable(openshot-${tname}-test
${tname}.cpp
)
target_link_libraries(openshot-${tname}-test
openshot_catch2
openshot
)
# Automatically configure CTest targets from Catch2 test cases
catch_discover_tests(
openshot-${tname}-test
TEST_PREFIX ${tname}:
PROPERTIES
LABELS ${tname}
)
list(APPEND CATCH2_TEST_TARGETS openshot-${tname}-test)
list(APPEND CATCH2_TEST_NAMES ${tname})
endforeach()
# Add an additional special-case test, for an envvar-dependent setting
catch_discover_tests(
openshot-Settings-test
TEST_LIST Settings_EXTRA_TESTS
TEST_SPEC "[environment]"
TEST_PREFIX Settings:
TEST_SUFFIX "(enabled)"
TEST_WORKING_DIR "${_test_dir}"
PROPERTIES
LABELS Settings
ENVIRONMENT "LIBOPENSHOT_DEBUG=1"
)
# Export target list for coverage use
set(UNIT_TEST_TARGETS ${CATCH2_TEST_TARGETS} PARENT_SCOPE)
set(UNIT_TEST_NAMES ${CATCH2_TEST_NAMES} PARENT_SCOPE)