Skip to content

Commit 619795b

Browse files
committed
fix: stabilize driver page CI test
1 parent 3d55a4b commit 619795b

2 files changed

Lines changed: 14 additions & 5 deletions

File tree

tests/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,3 +128,6 @@ target_link_libraries(test_driver_page PRIVATE
128128
)
129129

130130
add_test(NAME test_driver_page COMMAND test_driver_page)
131+
set_tests_properties(test_driver_page PROPERTIES
132+
ENVIRONMENT "QT_QPA_PLATFORM=offscreen;QT_QUICK_CONTROLS_STYLE=Basic"
133+
)

tests/test_driver_page.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include <QStringList>
99
#include <QTemporaryDir>
1010
#include <QTest>
11+
#include <QtQuickControls2/QQuickStyle>
1112

1213
class DetectorMock : public QObject {
1314
Q_OBJECT
@@ -285,10 +286,6 @@ class TestDriverPage : public QObject {
285286
Q_OBJECT
286287

287288
private slots:
288-
void initTestCase() {
289-
qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("offscreen"));
290-
}
291-
292289
void testDriverInstalledLocallyUsesDetectorVersion();
293290
void testOperationRunningStillTracksBackendBusyAfterManualStateChanges();
294291

@@ -450,5 +447,14 @@ void TestDriverPage::
450447
QTRY_VERIFY(!page->property("operationRunning").toBool());
451448
}
452449

453-
QTEST_MAIN(TestDriverPage)
450+
int main(int argc, char **argv) {
451+
qputenv("QT_QPA_PLATFORM", QByteArrayLiteral("offscreen"));
452+
qputenv("QT_QUICK_CONTROLS_STYLE", QByteArrayLiteral("Basic"));
453+
454+
QQuickStyle::setStyle(QStringLiteral("Basic"));
455+
456+
QGuiApplication app(argc, argv);
457+
TestDriverPage testCase;
458+
return QTest::qExec(&testCase, argc, argv);
459+
}
454460
#include "test_driver_page.moc"

0 commit comments

Comments
 (0)