Skip to content

Commit

Permalink
add test for pre C++20 includes
Browse files Browse the repository at this point in the history
  • Loading branch information
TinyTinni committed Aug 1, 2024
1 parent 7ebc4e0 commit 1281511
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/LegacyInclude.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#include <doctest.h>

#include <opencv2/core.hpp>
#include <opencv2/videoio.hpp>

#include <filesystem>

#include <FairyCam/AnyCamera.hpp>

using namespace FairyCam;

TEST_SUITE("AnyCamera")
{
TEST_CASE_TEMPLATE("create", T, cv::VideoCapture, DirectoryTriggerCamera,
FileCamera, DirectoryTriggerCamera, HttpCamera)
{
AnyCamera cam = AnyCamera::create<T>();
}

TEST_CASE("dynamicCast")
{
AnyCamera cam = AnyCamera::create<FileCamera>();
REQUIRE_FALSE(cam.dynamicCast<DirectoryCamera>());
auto fileCam = cam.dynamicCast<FileCamera>();
REQUIRE(fileCam);
FileCamera &cam_ref = *fileCam;
REQUIRE_FALSE(cam.isOpened());
REQUIRE_FALSE(cam_ref.isOpened());
cam_ref.open(0, 0, {});
REQUIRE(cam.isOpened());
REQUIRE(cam_ref.isOpened());
}
}

0 comments on commit 1281511

Please sign in to comment.