tests: Run tst_view on offscreen by default

Moved the QPA offscreen defaulting to Platform_qt
This commit is contained in:
Sergio Martins
2022-05-08 19:38:52 +01:00
parent 97f26743e5
commit 985224f24b
6 changed files with 15 additions and 42 deletions

View File

@@ -196,8 +196,20 @@ bool Platform_qt::isGammaray()
Platform_qt::Platform_qt(int argc, char *argv[])
{
Q_UNUSED(argc)
Q_UNUSED(argv)
// This CTOR is called before we have a QApplication
bool qpaPassed = false;
for (int i = 1; i < argc; ++i) {
if (qstrcmp(argv[i], "-platform") == 0) {
qpaPassed = true;
break;
}
}
if (!qpaPassed) {
// Use offscreen by default as it's less annoying, doesn't create visible windows
qputenv("QT_QPA_PLATFORM", "offscreen");
}
}
void Platform_qt::tests_wait(int ms)

View File

@@ -28,11 +28,6 @@ using namespace KDDockWidgets::Testing;
int main(int argc, char **argv)
{
if (!qpaPassedAsArgument(argc, argv)) {
// Use offscreen by default as it's less annoying, doesn't create visible windows
qputenv("QT_QPA_PLATFORM", "offscreen");
}
QApplication app(argc, argv);
QCommandLineParser parser;
@@ -88,7 +83,7 @@ int main(int argc, char **argv)
if (filesToLoad.isEmpty()) {
do {
fuzzer.fuzz({ 1, 10, true });
} while(loops);
} while (loops);
} else {
fuzzer.fuzz(filesToLoad);
}

View File

@@ -1406,11 +1406,6 @@ void TestQtWidgets::tst_complex()
int main(int argc, char *argv[])
{
if (!qpaPassedAsArgument(argc, argv)) {
// Use offscreen by default as it's less annoying, doesn't create visible windows
qputenv("QT_QPA_PLATFORM", "offscreen");
}
KDDockWidgets::Platform::tests_initPlatform(argc, argv, KDDockWidgets::FrontendType::QtWidgets);
if (shouldSkipTests())

View File

@@ -6344,11 +6344,6 @@ void TestDocks::tst_persistentCentralWidget()
int main(int argc, char *argv[])
{
if (!qpaPassedAsArgument(argc, argv)) {
// Use offscreen by default as it's less annoying, doesn't create visible windows
qputenv("QT_QPA_PLATFORM", "offscreen");
}
KDDockWidgets::Platform::tests_initPlatform(argc, argv, KDDockWidgets::FrontendType::QtWidgets);
if (shouldSkipTests())
return 0;

View File

@@ -1808,19 +1808,6 @@ void TestMultiSplitter::tst_adjacentLayoutBorders()
int main(int argc, char *argv[])
{
bool qpaPassed = false;
for (int i = 1; i < argc; ++i) {
if (qstrcmp(argv[i], "-platform") == 0) {
qpaPassed = true;
break;
}
}
if (!qpaPassed) {
// Use offscreen by default as it's less annoying, doesn't create visible windows
qputenv("QT_QPA_PLATFORM", "offscreen");
}
KDDockWidgets::Platform::tests_initPlatform(argc, argv, KDDockWidgets::FrontendType::QtWidgets);
TestMultiSplitter test;

View File

@@ -439,17 +439,6 @@ inline void dragFloatingWindowTo(Controllers::FloatingWindow *fw, Controllers::D
}
inline bool qpaPassedAsArgument(int argc, char *argv[])
{
for (int i = 1; i < argc; ++i) {
if (qstrcmp(argv[i], "-platform") == 0) {
return true;
}
}
return false;
}
}
Q_DECLARE_METATYPE(KDDockWidgets::Tests::DockDescriptor)