Simplify failure detection logic in QEventDispatcher test

The test always fails when either the Xcb or UNIX, one of the Windows
event dispatchers is used. So only test for the event dispatcher name,
which then covers all platforms, including QNX and INTEGRITY (which
use the UNIX event dispatcher).

Pick-to: 6.3 6.2
Change-Id: I2e315831b53f823c5496ad0319319df78f064cc1
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Pasi Petäjäjärvi <pasi.petajajarvi@qt.io>
bb10
Volker Hilsheimer 2022-02-16 10:08:19 +01:00
parent 5f338040f4
commit 72e1fc7c0b
1 changed files with 9 additions and 16 deletions

View File

@ -443,24 +443,17 @@ void tst_QEventDispatcher::postEventFromEventHandler()
QAbstractEventDispatcher::instance()->processEvents(QEventLoop::WaitForMoreEvents);
done = true;
bool coreFails = false;
bool guiFails = false;
const QByteArrayView eventDispatcherName(QAbstractEventDispatcher::instance()->metaObject()->className());
#if defined(Q_OS_DARWIN)
coreFails = true;
#elif defined(Q_OS_WINDOWS)
coreFails = true;
guiFails = true;
#elif defined(Q_OS_LINUX) || defined(Q_OS_INTEGRITY)
// QXcbUnixEventDispatcher and QEventDispatcherUNIX do not do this correctly
// QXcbGlibEventDispatcher and QEventDispatcherGlib do
coreFails = !eventDispatcherName.contains("Glib");
guiFails = !eventDispatcherName.contains("Glib");
#endif
qDebug() << eventDispatcherName;
// QXcbUnixEventDispatcher and QEventDispatcherUNIX do not do this correctly on any platform;
// both Windows event dispatchers fail as well.
const bool knownToFail = eventDispatcherName.contains("UNIX")
|| eventDispatcherName.contains("XcbUnix")
|| eventDispatcherName.contains("Win32")
|| eventDispatcherName.contains("WindowsGui")
|| eventDispatcherName.contains("Android");
if (coreFails && !isGuiEventDispatcher)
QEXPECT_FAIL("", eventDispatcherName.constData(), Continue);
if (guiFails && isGuiEventDispatcher)
if (knownToFail)
QEXPECT_FAIL("", eventDispatcherName.constData(), Continue);
QVERIFY(!hadToQuit);