QThread: check various ways users may use start(Priority)
Some of these would break if we changed the start(Priority) to say start(QThread::Priority) instead. Pick-to: 6.5 6.2 Task-number: QTBUG-124723 Change-Id: Id3ebe73718c8acbc54a2c88158f4062fd0dd5be1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> (cherry picked from commit cf19105e018314d1fb05bc91959f233d3d6747ba) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
1fc95e5214
commit
a4c2710077
@ -53,6 +53,7 @@ private slots:
|
||||
void setStackSize();
|
||||
void exit();
|
||||
void start();
|
||||
void startSlotUsedInStringBasedLookups();
|
||||
void terminate();
|
||||
void quit();
|
||||
void started();
|
||||
@ -466,6 +467,56 @@ void tst_QThread::start()
|
||||
}
|
||||
}
|
||||
|
||||
class QThreadStarter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QObject::QObject;
|
||||
Q_SIGNALS:
|
||||
void start(QThread::Priority);
|
||||
};
|
||||
|
||||
class QThreadSelfStarter : public QThread
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QThread::QThread;
|
||||
|
||||
void check()
|
||||
{
|
||||
QVERIFY(connect(this, SIGNAL(starting(Priority)),
|
||||
this, SLOT(start(Priority))));
|
||||
QVERIFY(QMetaObject::invokeMethod(this, "start", Q_ARG(Priority, IdlePriority)));
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
void starting(Priority);
|
||||
};
|
||||
|
||||
void tst_QThread::startSlotUsedInStringBasedLookups()
|
||||
{
|
||||
// QTBUG-124723
|
||||
|
||||
QThread thread;
|
||||
{
|
||||
QThreadStarter starter;
|
||||
QVERIFY(QObject::connect(&starter, SIGNAL(start(QThread::Priority)),
|
||||
&thread, SLOT(start(QThread::Priority))));
|
||||
}
|
||||
{
|
||||
QThreadSelfStarter selfStarter;
|
||||
selfStarter.check();
|
||||
if (QTest::currentTestFailed())
|
||||
return;
|
||||
selfStarter.exit();
|
||||
selfStarter.wait(30s);
|
||||
}
|
||||
QVERIFY(QMetaObject::invokeMethod(&thread, "start",
|
||||
Q_ARG(QThread::Priority, QThread::IdlePriority)));
|
||||
thread.exit();
|
||||
thread.wait(30s);
|
||||
}
|
||||
|
||||
void tst_QThread::terminate()
|
||||
{
|
||||
#if defined(Q_OS_ANDROID)
|
||||
|
Loading…
x
Reference in New Issue
Block a user