tests: skip viewer display repro tests when the render backend is unusable
The CI runner has no Vulkan runtime (liboakvulkan.so fails to load) and no display (offscreen QOpenGLWidget cannot create a context). The viewer display tests only checked that the parameter was "vulkan", so they ran on the OpenGL fallback and segfaulted with no usable GL context. Probe the backend the same way the other render test fixtures do (load, verify the backend kind actually matches the request, init) and skip when it is unavailable. Also replace the stale "temporary scratch test" file header now that this is a committed regression test.
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
/*
|
||||
* TEMPORARY scratch test for the direct-connection black screen
|
||||
* investigation. Not meant for commit. Drives the real ViewerWidget display
|
||||
* path offscreen and checks the pixels the display widget actually paints.
|
||||
* Regression test for the direct-connection black screen bug. Drives the real
|
||||
* ViewerWidget display path offscreen and checks the pixels the display
|
||||
* widget actually paints, for both the direct (footage -> output) and
|
||||
* indirect (footage -> effect -> output) wiring, plus runtime rewiring
|
||||
* between the two.
|
||||
*/
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
@@ -36,6 +38,11 @@
|
||||
#include "widget/viewer/viewer.h"
|
||||
#include "widget/viewer/viewerdisplay.h"
|
||||
|
||||
#ifdef OAK_ENABLE_DYNAMIC_RENDER_BACKEND
|
||||
#include "render/backend/dynamicrenderer.h"
|
||||
#include "render/backend/renderbackend_c.h"
|
||||
#endif
|
||||
|
||||
using namespace olive;
|
||||
|
||||
namespace
|
||||
@@ -60,6 +67,39 @@ QString WorkerBinaryPathT()
|
||||
#endif
|
||||
}
|
||||
|
||||
// Loads and initializes the requested render backend the same way the
|
||||
// application does, verifying that the loaded backend is actually of the
|
||||
// requested kind (a Vulkan request that fell back to OpenGL does not count).
|
||||
bool IsRenderBackendAvailable(const QString &backend)
|
||||
{
|
||||
#ifdef OAK_ENABLE_DYNAMIC_RENDER_BACKEND
|
||||
olive::DynamicRenderer renderer(backend);
|
||||
if (!renderer.Load()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
OakRenderBackendInfo info = {};
|
||||
if (!renderer.GetBackendInfo(&info)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (backend == QStringLiteral("vulkan") &&
|
||||
info.kind != OAK_RENDER_BACKEND_VULKAN) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (backend == QStringLiteral("opengl") &&
|
||||
info.kind != OAK_RENDER_BACKEND_OPENGL) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return renderer.Init();
|
||||
#else
|
||||
Q_UNUSED(backend)
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
double BrightnessOfWidget(QWidget *w)
|
||||
{
|
||||
QPixmap pm = w->grab();
|
||||
@@ -135,6 +175,10 @@ protected:
|
||||
if (backend_ != QStringLiteral("vulkan")) {
|
||||
GTEST_SKIP() << "offscreen QOpenGLWidget cannot paint; Vulkan only";
|
||||
}
|
||||
if (!IsRenderBackendAvailable(backend_)) {
|
||||
GTEST_SKIP() << "Render backend is not available: "
|
||||
<< backend_.toStdString();
|
||||
}
|
||||
Config::Current()[QStringLiteral("GraphicsBackend")] = backend_;
|
||||
|
||||
demo_path_ = DemoVideoPathT();
|
||||
|
||||
Reference in New Issue
Block a user