Add run opengl tests feature

On Woa cross compile we want to compile with opengl feature,
however tests windows arm nodes do not have opengl installed
add a feature to skip the tests preventing the crash otherwise.

Note this is just temporary workaround and should be reverted
as soon as opengl libs land on windows arm vm nodes.

Task-number: COIN-1211
Change-Id: Iaae205b9cc10bd17e82152a44b2e976e4321d00d
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Michal Klocek 2025-05-26 12:27:31 +02:00
parent 7c0a96785f
commit fb4c1257d8
8 changed files with 28 additions and 1 deletions

View File

@ -1570,6 +1570,11 @@ qt_feature("egl-extension-platform-wayland" PRIVATE
CONDITION QT_FEATURE_wayland_client AND QT_FEATURE_opengl AND QT_FEATURE_egl
AND TEST_egl_1_5_wayland
)
qt_feature("run-opengl-tests" PRIVATE
LABEL "Run opengl tests"
PURPOSE "Provides the ability to skip tests which require opengl to run"
CONDITION QT_FEATURE_opengl
)
qt_configure_add_summary_section(NAME "Qt Gui")

View File

@ -26,6 +26,9 @@ private slots:
void tst_QOpenGLWindow::initTestCase()
{
#if !QT_CONFIG(run_opengl_tests)
QSKIP("Skip test as run-opengl-tests feature is off.");
#endif
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
QSKIP("OpenGL is not supported on this platform.");
}

View File

@ -185,6 +185,9 @@ static QSurface *createSurface(int surfaceClass)
void tst_QOpenGL::initTestCase()
{
#if !QT_CONFIG(run_opengl_tests)
QSKIP("Skip test as run-opengl-tests feature is off.");
#endif
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
QSKIP("OpenGL is not supported on this platform.");
}

View File

@ -139,6 +139,9 @@ static void dumpConfiguration(QTextStream &str)
void tst_QOpenGlConfig::initTestCase()
{
#if !QT_CONFIG(run_opengl_tests)
QSKIP("Skip test as run-opengl-tests feature is off.");
#endif
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
QSKIP("OpenGL is not supported on this platform.");
}

View File

@ -657,6 +657,9 @@ void tst_QGraphicsView::viewport()
#if QT_CONFIG(opengl)
void tst_QGraphicsView::openGLViewport()
{
#if !QT_CONFIG(run_opengl_tests)
QSKIP("Skip test as run-opengl-tests feature is off.");
#endif
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
QSKIP("QOpenGL is not supported on this platform.");
if (isPlatformEGLFS())

View File

@ -654,6 +654,8 @@ void tst_QWidgetRepaintManager::evaluateRhi()
}
#if QT_CONFIG(opengl)
#if QT_CONFIG(run_opengl_tests)
{
// Non-native child RHI widget enables RHI for top level regular widget
QWidget topLevel;
@ -767,6 +769,7 @@ void tst_QWidgetRepaintManager::evaluateRhi()
QVERIFY(!QWidgetPrivate::get(&rhiChild)->usesRhiFlush);
QVERIFY(QWidgetPrivate::get(&rhiChild)->rhi());
}
#endif // QT_CONFIG(run_opengl_tests)
#if QT_CONFIG(metal)
QRhiMetalInitParams metalParams;
@ -802,6 +805,10 @@ void tst_QWidgetRepaintManager::evaluateRhi()
void tst_QWidgetRepaintManager::rhiRecreateMaintainsWindowProperties()
{
#if !QT_CONFIG(run_opengl_tests)
QSKIP("Skip test as run-opengl-tests feature is off.");
#endif
const auto *integration = QGuiApplicationPrivate::platformIntegration();
if (!integration->hasCapability(QPlatformIntegration::RhiBasedRendering))
QSKIP("Platform does not support RHI based rendering");

View File

@ -63,6 +63,9 @@ private slots:
void tst_QOpenGLWidget::initTestCase()
{
#if !QT_CONFIG(run_opengl_tests)
QSKIP("Skip test as run-opengl-tests feature is off.");
#endif
// See QOpenGLWidget constructor
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::RasterGLSurface))
QSKIP("QOpenGLWidget is not supported on this platform.");

View File

@ -64,7 +64,7 @@ void tst_QRhiWidget::testData()
QTest::newRow("Null") << QRhiWidget::Api::Null;
#endif
#if QT_CONFIG(opengl)
#if QT_CONFIG(opengl) && QT_CONFIG(run_opengl_tests)
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
QTest::newRow("OpenGL") << QRhiWidget::Api::OpenGL;
#endif