Make qGlobalPostedEventsCount() auto-test-exported-only

The only in-tree user outside QtCore is tst_QCoreApplication, guard
the (single) test function there with QT_BUILD_INTERNAL.

Change-Id: Ibc87ba76f2135cd8283acd75318f80a95e4b5c45
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
Marc Mutz 2022-05-17 09:40:48 +02:00
parent f2fea2325d
commit 7b736e1faf
4 changed files with 6 additions and 2 deletions

View File

@ -20,7 +20,7 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
Q_CORE_EXPORT uint qGlobalPostedEventsCount(); Q_AUTOTEST_EXPORT uint qGlobalPostedEventsCount();
class Q_CORE_EXPORT QAbstractEventDispatcherPrivate : public QObjectPrivate class Q_CORE_EXPORT QAbstractEventDispatcherPrivate : public QObjectPrivate
{ {

View File

@ -321,7 +321,7 @@ Q_CONSTINIT bool QCoreApplicationPrivate::is_app_running = false;
// app closing down if true // app closing down if true
Q_CONSTINIT bool QCoreApplicationPrivate::is_app_closing = false; Q_CONSTINIT bool QCoreApplicationPrivate::is_app_closing = false;
Q_CORE_EXPORT uint qGlobalPostedEventsCount() uint qGlobalPostedEventsCount()
{ {
QThreadData *currentThreadData = QThreadData::current(); QThreadData *currentThreadData = QThreadData::current();
return currentThreadData->postEventList.size() - currentThreadData->postEventList.startOffset; return currentThreadData->postEventList.size() - currentThreadData->postEventList.startOffset;

View File

@ -514,6 +514,7 @@ void tst_QCoreApplication::applicationPid()
QVERIFY(QCoreApplication::applicationPid() > 0); QVERIFY(QCoreApplication::applicationPid() > 0);
} }
#ifdef QT_BUILD_INTERNAL
class GlobalPostedEventsCountObject : public QObject class GlobalPostedEventsCountObject : public QObject
{ {
Q_OBJECT Q_OBJECT
@ -557,6 +558,7 @@ void tst_QCoreApplication::globalPostedEventsCount()
<< 0; << 0;
QCOMPARE(x.globalPostedEventsCount, expected); QCOMPARE(x.globalPostedEventsCount, expected);
} }
#endif // QT_BUILD_INTERNAL
class ProcessEventsAlwaysSendsPostedEventsObject : public QObject class ProcessEventsAlwaysSendsPostedEventsObject : public QObject
{ {

View File

@ -22,7 +22,9 @@ private slots:
void deliverInDefinedOrder(); void deliverInDefinedOrder();
#endif #endif
void applicationPid(); void applicationPid();
#ifdef QT_BUILD_INTERNAL
void globalPostedEventsCount(); void globalPostedEventsCount();
#endif
void processEventsAlwaysSendsPostedEvents(); void processEventsAlwaysSendsPostedEvents();
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
void sendPostedEventsInNativeLoop(); void sendPostedEventsInNativeLoop();