add test case for qAddPostRoutine() and qRemovePostRoutine()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-06-14 08:53:18 +03:00
parent 41320de644
commit c23499cb2a

View file

@ -22,6 +22,8 @@
#include <QtCore/QtCore>
#include <QtTest/QtTest>
#include <unistd.h>
class tst_QCoreApplication: public QObject
{
Q_OBJECT
@ -41,6 +43,7 @@ private slots:
void reexec();
void execAfterExit();
void eventLoopExecAfterExit();
void postRoutine();
};
class EventSpy : public QObject
@ -556,6 +559,18 @@ void tst_QCoreApplication::eventLoopExecAfterExit()
QCOMPARE(loop.exec(), 0);
}
void TestPostRoutine()
{
::usleep(1000);
// deadlock test
qRemovePostRoutine(TestPostRoutine);
}
void tst_QCoreApplication::postRoutine()
{
qAddPostRoutine(TestPostRoutine);
}
static void createQObjectOnDestruction()
{
// Make sure that we can create a QObject after the last QObject has been