68 lines
2.4 KiB
C++
68 lines
2.4 KiB
C++
#include "RuntimeHost.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()
|
|
{
|
|
RuntimeHost runtimeHost;
|
|
std::string error;
|
|
Expect(runtimeHost.Initialize(error), "runtime host initializes");
|
|
Expect(error.empty(), "runtime host initialization does not report an error");
|
|
|
|
VideoIOState state;
|
|
state.backendId = VideoIOBackendId::DeckLink;
|
|
state.deviceName = "Test Device";
|
|
state.hasInputDevice = true;
|
|
state.hasInputSource = true;
|
|
state.inputDisplayModeName = "fake input";
|
|
state.outputDisplayModeName = "fake output";
|
|
state.capabilities.supportsInternalKeying = true;
|
|
state.capabilities.supportsExternalKeying = true;
|
|
state.capabilities.keyerInterfaceAvailable = true;
|
|
state.externalKeyingRequested = true;
|
|
state.externalKeyingActive = true;
|
|
state.statusMessage = "ready";
|
|
state.formatStatusMessage = "using fake formats";
|
|
runtimeHost.SetVideoIOStatus(state);
|
|
|
|
JsonValue root;
|
|
Expect(ParseJson(runtimeHost.BuildStateJson(), root, error), "runtime state json parses");
|
|
Expect(root.find("videoIO") != nullptr, "runtime state exposes videoIO");
|
|
Expect(root.find("decklink") == nullptr, "runtime state no longer exposes a decklink top-level block");
|
|
|
|
const JsonValue* app = root.find("app");
|
|
Expect(app != nullptr, "runtime state exposes app settings");
|
|
Expect(app != nullptr && app->find("videoBackend") != nullptr, "app settings expose videoBackend");
|
|
Expect(app != nullptr && app->find("videoBackend")->asString() == "decklink", "videoBackend serializes as decklink");
|
|
|
|
const JsonValue* videoIO = root.find("videoIO");
|
|
Expect(videoIO != nullptr && videoIO->find("backend") != nullptr, "videoIO exposes backend");
|
|
Expect(videoIO != nullptr && videoIO->find("backend")->asString() == "decklink", "videoIO backend serializes as decklink");
|
|
Expect(videoIO != nullptr && videoIO->find("deviceName") != nullptr, "videoIO exposes device name");
|
|
Expect(videoIO != nullptr && videoIO->find("deviceName")->asString() == "Test Device", "videoIO device name matches");
|
|
Expect(videoIO != nullptr && videoIO->find("capabilities") != nullptr, "videoIO exposes capabilities");
|
|
|
|
if (gFailures != 0)
|
|
{
|
|
std::cerr << gFailures << " RuntimeHost video I/O state test failure(s).\n";
|
|
return 1;
|
|
}
|
|
|
|
std::cout << "RuntimeHost video I/O state tests passed.\n";
|
|
return 0;
|
|
}
|