Merge pull request #828 from ferdnyc/catch-upgrade

Make unit tests work with Catch2v3 (for macOS CI)
This commit is contained in:
Frank Dana
2022-06-18 05:53:35 -04:00
committed by GitHub
27 changed files with 88 additions and 32 deletions

View File

@@ -68,20 +68,37 @@ if(NOT BUILD_TESTING)
return()
endif()
# 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)
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_OBJECTS:catch-main>
)
target_compile_definitions(openshot-${tname}-test PRIVATE
TEST_MEDIA_PATH="${TEST_MEDIA_PATH}"
target_link_libraries(openshot-${tname}-test
openshot_catch2
openshot
)
target_link_libraries(openshot-${tname}-test Catch2::Catch2 openshot)
# Automatically configure CTest targets from Catch2 test cases
catch_discover_tests(

View File

@@ -14,7 +14,7 @@
#include <sstream>
#include <memory>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "Clip.h"
#include "CVObjectDetection.h"

View File

@@ -14,7 +14,7 @@
#include <sstream>
#include <memory>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "Clip.h"
#include "CVStabilization.h" // for TransformParam, CamTrajectory, CVStabilization

View File

@@ -14,7 +14,7 @@
#include <sstream>
#include <memory>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "Clip.h"
#include "CVTracker.h" // for FrameData, CVTracker

View File

@@ -13,7 +13,7 @@
#include <memory>
#include <QDir>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "CacheDisk.h"
#include "Frame.h"

View File

@@ -13,7 +13,7 @@
#include <memory>
#include <QDir>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "CacheMemory.h"
#include "Frame.h"

View File

@@ -28,7 +28,7 @@ std::ostream& operator << ( std::ostream& os, QColor const& value ) {
return os;
}
#include <catch2/catch.hpp>
#include "openshot_catch.h"
using namespace openshot;

View File

@@ -13,7 +13,7 @@
#include <sstream>
#include <memory>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include <QColor>
#include <QImage>

View File

@@ -13,7 +13,7 @@
#include <string>
#include <vector>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include <QColor>

View File

@@ -10,7 +10,7 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "Coordinate.h"
#include "Exceptions.h"

View File

@@ -13,7 +13,7 @@
#include <memory>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "Frame.h"
#include "effects/Crop.h"

View File

@@ -12,7 +12,7 @@
#include <memory>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "DummyReader.h"
#include "Exceptions.h"

View File

@@ -13,7 +13,7 @@
#include <sstream>
#include <memory>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "FFmpegReader.h"
#include "Exceptions.h"

View File

@@ -13,7 +13,7 @@
#include <sstream>
#include <memory>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "FFmpegWriter.h"
#include "Exceptions.h"

View File

@@ -10,7 +10,7 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include <map>
#include <vector>

View File

@@ -24,7 +24,7 @@
#undef uint64
#endif
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "Clip.h"
#include "Fraction.h"

View File

@@ -10,7 +10,7 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "CacheMemory.h"
#include "Clip.h"

View File

@@ -15,7 +15,7 @@
#include <sstream>
#include <memory>
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include "ImageWriter.h"
#include "Exceptions.h"

View File

@@ -10,7 +10,7 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include <sstream>
#include <memory>

View File

@@ -10,7 +10,7 @@
//
// SPDX-License-Identifier: LGPL-3.0-or-later
#include <catch2/catch.hpp>
#include "openshot_catch.h"
#include <sstream>
#include "Point.h"

Some files were not shown because too many files have changed in this diff Show More