2013-09-12 23:41:49 -05:00
|
|
|
##################### tests/CMakeLists.txt (libopenshot) ######################
|
2014-04-10 22:38:01 -05:00
|
|
|
# @brief CMake build file for libopenshot (used to generate makefiles)
|
2013-09-12 23:41:49 -05:00
|
|
|
# @author Jonathan Thomas <jonathan@openshot.org>
|
|
|
|
|
#
|
|
|
|
|
# @section LICENSE
|
|
|
|
|
#
|
2019-06-11 06:48:32 -04:00
|
|
|
# Copyright (c) 2008-2019 OpenShot Studios, LLC
|
2013-09-12 23:41:49 -05:00
|
|
|
#
|
2021-10-16 01:26:26 -04:00
|
|
|
# SPDX-License-Identifier: LGPL-3.0-or-later
|
2013-09-12 23:41:49 -05:00
|
|
|
|
2021-05-14 21:56:18 -04:00
|
|
|
# Allow spaces in test names
|
|
|
|
|
if(POLICY CMP0110)
|
|
|
|
|
cmake_policy(SET CMP0110 NEW)
|
|
|
|
|
endif()
|
|
|
|
|
|
2020-01-12 12:33:58 -05:00
|
|
|
# Test media path, used by unit tests for input data
|
2020-10-18 05:15:35 -04:00
|
|
|
file(TO_NATIVE_PATH "${PROJECT_SOURCE_DIR}/examples/" TEST_MEDIA_PATH)
|
2013-08-27 13:37:00 -05:00
|
|
|
|
Adding Benchmark executable to assist with performance testing and comparisons with different versions of OpenShot.
Initial results:
FFmpegWriter,7800
FrameMapper,3508
Clip,4958
Timeline,30817
Timeline (with transforms),53951
Effect_Mask,9283
Effect_Brightness,12486
Effect_Crop,5153
Effect_Saturation,15545
Overall,147136
2025-09-12 17:27:43 -05:00
|
|
|
# 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
|
2022-10-30 22:04:19 -05:00
|
|
|
AudioWaveformer
|
2021-04-09 05:27:18 -04:00
|
|
|
CacheDisk
|
|
|
|
|
CacheMemory
|
2023-02-10 15:14:10 -06:00
|
|
|
Caption
|
2021-04-09 04:09:36 -04:00
|
|
|
Clip
|
|
|
|
|
Color
|
|
|
|
|
Coordinate
|
|
|
|
|
DummyReader
|
|
|
|
|
FFmpegReader
|
|
|
|
|
FFmpegWriter
|
|
|
|
|
Fraction
|
|
|
|
|
Frame
|
|
|
|
|
FrameMapper
|
|
|
|
|
KeyFrame
|
|
|
|
|
Point
|
Improved Profile Class (Helper methods, Sortable, Unit tests) (#895)
* Removing legacy profile property. Add new operators for Profile classes (for comparison). Also added new functions to generate different variations of the Profile data (key, short name, long name, long name w/description).
* Add empty constructor for Profile class, and new Profile unit tets
* Adding zero padding to profile Key function, for easier sorting: 01920x1080i2997_16:09
* Clear setfill flag after creating Key() output
* Updating example exe to load an *.osp project file via C++, which makes debugging complex broken projects much easier.
* - Add new unit test to FFmpegWriter to create an animated GIF and verify it can be wrapped with a FrameMapper (with no audio track)
- Improve FrameMapper to ignore missing audio data (i.e. when no audio samples present, don't try and find them or resample them)
* Fix some whitespace issues
* Fix inline documentation mistype
* Fixed missing reuse licensing on new example profile files
* Changing Profile::Key() format to exclude the : character, since Windows file names cannot contain that
* - Large memory leak fixed in FFmpegWriter when closing the video & audio contexts
- Reducing # of cached frames and rescalers to 1, since we no longer use OMP and this is unneeded - we need to refactor much of this code out eventually
* - Fixing whitespace issues
- Code clean-up / line wrapping / etc...
2023-02-02 16:29:38 -06:00
|
|
|
Profiles
|
2021-04-09 04:09:36 -04:00
|
|
|
QtImageReader
|
2021-06-06 22:42:27 -04:00
|
|
|
ReaderBase
|
2021-04-09 04:09:36 -04:00
|
|
|
Settings
|
2025-05-20 20:21:32 -05:00
|
|
|
SphericalMetadata
|
2021-04-09 04:44:48 -04:00
|
|
|
Timeline
|
2025-06-03 22:24:34 -05:00
|
|
|
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
|
2025-05-28 17:40:47 -05:00
|
|
|
LensFlare
|
2025-09-10 22:44:30 -05:00
|
|
|
AnalogTape
|
2025-05-23 15:09:02 -05:00
|
|
|
Sharpen
|
2025-05-21 18:25:22 -05:00
|
|
|
SphericalEffect
|
2025-09-12 15:07:51 -05:00
|
|
|
WaveEffect
|
2021-04-09 04:44:48 -04:00
|
|
|
)
|
|
|
|
|
|
2021-06-06 22:42:27 -04:00
|
|
|
# ImageMagick related test files
|
|
|
|
|
if($CACHE{HAVE_IMAGEMAGICK})
|
|
|
|
|
list(APPEND OPENSHOT_TESTS
|
2026-02-23 16:55:49 -06:00
|
|
|
ImageReader
|
2021-06-06 22:42:27 -04:00
|
|
|
ImageWriter
|
|
|
|
|
)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
# OPENCV RELATED TEST FILES
|
|
|
|
|
if($CACHE{HAVE_OPENCV})
|
2021-04-09 04:09:36 -04:00
|
|
|
list(APPEND OPENSHOT_TESTS
|
|
|
|
|
CVTracker
|
|
|
|
|
CVStabilizer
|
2025-03-12 16:52:15 -05:00
|
|
|
CVOutline
|
2021-04-09 04:09:36 -04:00
|
|
|
# CVObjectDetection
|
2020-07-28 21:01:57 -03:00
|
|
|
)
|
2020-11-05 12:23:08 -03:00
|
|
|
endif()
|
2014-06-26 23:12:54 -05:00
|
|
|
|
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
|
|
|
###
|
2021-04-19 15:59:52 -04:00
|
|
|
include(CTest)
|
|
|
|
|
include(Catch)
|
|
|
|
|
|
2021-04-19 17:56:19 -04:00
|
|
|
if(NOT BUILD_TESTING)
|
|
|
|
|
return()
|
|
|
|
|
endif()
|
|
|
|
|
|
2022-06-17 15:09:16 -04:00
|
|
|
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()
|
2021-04-19 15:59:52 -04:00
|
|
|
|
|
|
|
|
foreach(tname ${OPENSHOT_TESTS})
|
2021-10-20 06:49:08 -04:00
|
|
|
add_executable(openshot-${tname}-test
|
|
|
|
|
${tname}.cpp
|
|
|
|
|
)
|
2022-06-17 15:09:16 -04:00
|
|
|
target_link_libraries(openshot-${tname}-test
|
|
|
|
|
openshot_catch2
|
|
|
|
|
openshot
|
2021-04-19 15:59:52 -04:00
|
|
|
)
|
2021-10-20 06:49:08 -04:00
|
|
|
|
2021-04-19 16:49:42 -04:00
|
|
|
# Automatically configure CTest targets from Catch2 test cases
|
|
|
|
|
catch_discover_tests(
|
2021-04-19 15:59:52 -04:00
|
|
|
openshot-${tname}-test
|
|
|
|
|
TEST_PREFIX ${tname}:
|
2021-04-19 16:49:42 -04:00
|
|
|
PROPERTIES
|
|
|
|
|
LABELS ${tname}
|
2021-04-19 15:59:52 -04:00
|
|
|
)
|
|
|
|
|
list(APPEND CATCH2_TEST_TARGETS openshot-${tname}-test)
|
2021-04-19 16:49:42 -04:00
|
|
|
list(APPEND CATCH2_TEST_NAMES ${tname})
|
2021-04-19 15:59:52 -04:00
|
|
|
endforeach()
|
2021-10-20 06:49:08 -04:00
|
|
|
|
2021-05-14 21:56:18 -04:00
|
|
|
# Add an additional special-case test, for an envvar-dependent setting
|
2021-10-20 06:49:08 -04:00
|
|
|
catch_discover_tests(
|
|
|
|
|
openshot-Settings-test
|
|
|
|
|
TEST_LIST Settings_EXTRA_TESTS
|
2021-10-24 01:07:03 -04:00
|
|
|
TEST_SPEC "[environment]"
|
2021-10-20 06:49:08 -04:00
|
|
|
TEST_PREFIX Settings:
|
|
|
|
|
TEST_SUFFIX "(enabled)"
|
|
|
|
|
TEST_WORKING_DIR "${_test_dir}"
|
2021-05-14 21:56:18 -04:00
|
|
|
PROPERTIES
|
|
|
|
|
LABELS Settings
|
|
|
|
|
ENVIRONMENT "LIBOPENSHOT_DEBUG=1"
|
|
|
|
|
)
|
|
|
|
|
|
2021-04-19 15:59:52 -04:00
|
|
|
# Export target list for coverage use
|
|
|
|
|
set(UNIT_TEST_TARGETS ${CATCH2_TEST_TARGETS} PARENT_SCOPE)
|
2021-04-19 16:49:42 -04:00
|
|
|
set(UNIT_TEST_NAMES ${CATCH2_TEST_NAMES} PARENT_SCOPE)
|