tst_Q*Application: centralize the mainAppInAThread skipping
By adding a way for the apphelper to let the caller know that it must skip this test. Pick-to: 6.9 6.8 Change-Id: I750e7188b8f54cea7278fffd584f8fbf433f496b Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
a72077a889
commit
00a30f4312
@ -74,6 +74,13 @@ static int exitFromThreadedEventLoop(int argc, char **argv)
|
||||
// see QTBUG-130895
|
||||
static int mainAppInAThread(int argc, char **argv)
|
||||
{
|
||||
#if defined(Q_OS_APPLE) && defined(QT_GUI_LIB)
|
||||
// *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:777
|
||||
// *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.'
|
||||
puts("QGuiApplication in a thread fails inside Apple libs");
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
// note: when using std::thread in MinGW, we exercise different code paths
|
||||
// from QThread (winpthreads vs native)
|
||||
auto callable = [](int argc, char **argv) {
|
||||
|
@ -1226,6 +1226,10 @@ void tst_QCoreApplication::runHelperTest()
|
||||
QProcess process;
|
||||
process.start(QFINDTESTDATA("apphelper" EXE), { QTest::currentTestFunction() });
|
||||
QVERIFY2(process.waitForFinished(5000), qPrintable(process.errorString()));
|
||||
if (qint8(process.exitCode()) == -1)
|
||||
QSKIP("Process requested skip: " + process.readAllStandardOutput().trimmed());
|
||||
|
||||
|
||||
QCOMPARE(process.readAllStandardError(), QString());
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
|
@ -52,13 +52,7 @@ private slots:
|
||||
void exitFromEventLoop() { runHelperTest(); }
|
||||
void exitFromThread() { runHelperTest(); }
|
||||
void exitFromThreadedEventLoop() { runHelperTest(); }
|
||||
# if defined(Q_OS_APPLE) && defined(QT_GUI_LIB)
|
||||
// QGuiApplication in a thread fails inside Apple libs:
|
||||
// *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:777
|
||||
// *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.'
|
||||
# else
|
||||
void mainAppInAThread() { runHelperTest(); }
|
||||
# endif
|
||||
#endif
|
||||
void testTrWithPercantegeAtTheEnd();
|
||||
#if QT_CONFIG(library)
|
||||
|
@ -97,13 +97,7 @@ private slots:
|
||||
void exitFromEventLoop() { runHelperTest(); }
|
||||
void exitFromThread() { runHelperTest(); }
|
||||
void exitFromThreadedEventLoop() { runHelperTest(); }
|
||||
# if defined(Q_OS_APPLE)
|
||||
// QGuiApplication in a thread fails inside Apple libs:
|
||||
// *** Assertion failure in -[NSMenu _setMenuName:], NSMenu.m:777
|
||||
// *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'API misuse: setting the main menu on a non-main thread. Main menu contents should only be modified from the main thread.'
|
||||
# else
|
||||
void mainAppInAThread() { runHelperTest(); }
|
||||
# endif
|
||||
#endif
|
||||
void thread();
|
||||
void desktopSettingsAware();
|
||||
@ -1016,6 +1010,9 @@ void tst_QApplication::runHelperTest()
|
||||
QProcess process;
|
||||
process.start(QFINDTESTDATA("apphelper" EXE), { QTest::currentTestFunction() });
|
||||
QVERIFY2(process.waitForFinished(5000), qPrintable(process.errorString()));
|
||||
if (qint8(process.exitCode()) == -1)
|
||||
QSKIP("Process requested skip: " + process.readAllStandardOutput().trimmed());
|
||||
|
||||
QCOMPARE(process.readAllStandardError(), QString());
|
||||
QCOMPARE(process.exitStatus(), QProcess::NormalExit);
|
||||
QCOMPARE(process.exitCode(), 0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user