NDI discovery
This commit is contained in:
@@ -149,6 +149,46 @@ void TestConfigJsonRoundTrip()
|
||||
Expect(parsed.runtimeShaderId == "solid-color", "runtime shader id round trips");
|
||||
}
|
||||
|
||||
void TestOutputAlphaNormalizesLegacyKeying()
|
||||
{
|
||||
using namespace RenderCadenceCompositor;
|
||||
|
||||
const std::string deckLinkJson =
|
||||
"{"
|
||||
"\"output\":{"
|
||||
"\"backend\":\"decklink\","
|
||||
"\"keying\":{\"external\":true,\"alphaRequired\":false}"
|
||||
"}"
|
||||
"}";
|
||||
|
||||
AppConfig parsed;
|
||||
std::string error;
|
||||
Expect(ParseAppConfigJson(deckLinkJson, parsed, error), "legacy DeckLink keying config parses");
|
||||
Expect(parsed.output.externalKeyingEnabled, "DeckLink external keying remains enabled");
|
||||
Expect(parsed.output.outputAlphaRequired, "DeckLink external keying implies output alpha");
|
||||
|
||||
const std::filesystem::path path = std::filesystem::temp_directory_path() / "render-cadence-compositor-config-alpha-test.json";
|
||||
std::ofstream output(path, std::ios::binary);
|
||||
output
|
||||
<< "{\n"
|
||||
<< " \"output\": {\n"
|
||||
<< " \"backend\": \"ndi\",\n"
|
||||
<< " \"keying\": {\n"
|
||||
<< " \"external\": true,\n"
|
||||
<< " \"alphaRequired\": false\n"
|
||||
<< " }\n"
|
||||
<< " }\n"
|
||||
<< "}\n";
|
||||
output.close();
|
||||
|
||||
AppConfigProvider provider;
|
||||
Expect(provider.Load(path, error), "legacy NDI keying config loads");
|
||||
Expect(provider.Config().output.outputAlphaRequired, "legacy external keying implies NDI output alpha");
|
||||
Expect(!provider.Config().output.externalKeyingEnabled, "NDI ignores external keying backing field");
|
||||
|
||||
std::filesystem::remove(path);
|
||||
}
|
||||
|
||||
void TestHelpers()
|
||||
{
|
||||
using namespace RenderCadenceCompositor;
|
||||
@@ -178,6 +218,7 @@ int main()
|
||||
TestCommandLineOverrides();
|
||||
TestPreviewDefaultsAreOptIn();
|
||||
TestConfigJsonRoundTrip();
|
||||
TestOutputAlphaNormalizesLegacyKeying();
|
||||
TestHelpers();
|
||||
|
||||
if (gFailures != 0)
|
||||
|
||||
@@ -83,6 +83,25 @@ void TestConfigEndpointUsesCallback()
|
||||
ExpectEquals(response.body, "{\"diskLoaded\":true}", "config endpoint returns callback JSON");
|
||||
}
|
||||
|
||||
void TestNdiSourcesEndpointUsesCallback()
|
||||
{
|
||||
using namespace RenderCadenceCompositor;
|
||||
|
||||
HttpControlServer server;
|
||||
HttpControlServerCallbacks callbacks;
|
||||
callbacks.getNdiSourcesJson = []() { return std::string("{\"ok\":true,\"sources\":[{\"name\":\"DESKTOP (Camera)\"}]}"); };
|
||||
server.SetCallbacksForTest(callbacks);
|
||||
|
||||
HttpControlServer::HttpRequest request;
|
||||
request.method = "GET";
|
||||
request.path = "/api/ndi/sources";
|
||||
|
||||
const HttpControlServer::HttpResponse response = server.RouteRequestForTest(request);
|
||||
ExpectEquals(response.status, "200 OK", "NDI sources endpoint succeeds");
|
||||
ExpectEquals(response.contentType, "application/json", "NDI sources endpoint is JSON");
|
||||
Expect(response.body.find("DESKTOP (Camera)") != std::string::npos, "NDI sources endpoint returns callback JSON");
|
||||
}
|
||||
|
||||
void TestWebSocketAcceptKey()
|
||||
{
|
||||
using namespace RenderCadenceCompositor;
|
||||
@@ -242,6 +261,7 @@ int main()
|
||||
TestParsesHttpRequest();
|
||||
TestStateEndpointUsesCallback();
|
||||
TestConfigEndpointUsesCallback();
|
||||
TestNdiSourcesEndpointUsesCallback();
|
||||
TestWebSocketAcceptKey();
|
||||
TestRootServesUiIndex();
|
||||
TestKnownPostEndpointReturnsActionError();
|
||||
|
||||
Reference in New Issue
Block a user