Video backend
This commit is contained in:
41
tests/VideoIOBackendFactoryTests.cpp
Normal file
41
tests/VideoIOBackendFactoryTests.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
#include "VideoIOBackendFactory.h"
|
||||
#include "VideoIOTypes.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace
|
||||
{
|
||||
int gFailures = 0;
|
||||
|
||||
void Expect(bool condition, const char* message)
|
||||
{
|
||||
if (condition)
|
||||
return;
|
||||
|
||||
std::cerr << "FAIL: " << message << "\n";
|
||||
++gFailures;
|
||||
}
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
std::string error;
|
||||
std::unique_ptr<VideoIODevice> device = CreateVideoIODevice(VideoIOBackendId::DeckLink, error);
|
||||
Expect(device != nullptr, "decklink backend factory returns a device");
|
||||
Expect(!device || device->BackendId() == VideoIOBackendId::DeckLink, "decklink backend reports decklink id");
|
||||
Expect(error.empty(), "supported backend does not produce an error");
|
||||
|
||||
error.clear();
|
||||
device = CreateVideoIODevice(static_cast<VideoIOBackendId>(999), error);
|
||||
Expect(device == nullptr, "unknown backend id is rejected");
|
||||
Expect(!error.empty(), "unknown backend reports an error");
|
||||
|
||||
if (gFailures != 0)
|
||||
{
|
||||
std::cerr << gFailures << " VideoIO backend factory test failure(s).\n";
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::cout << "VideoIO backend factory tests passed.\n";
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user