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.7 6.5 6.2 Task-number: QTBUG-124723 Change-Id: Id3ebe73718c8acbc54a2c88158f4062fd0dd5be1 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
This commit is contained in:
parent
7d7d843a3e
commit
cf19105e01
@ -53,6 +53,7 @@ private slots:
|
|||||||
void setStackSize();
|
void setStackSize();
|
||||||
void exit();
|
void exit();
|
||||||
void start();
|
void start();
|
||||||
|
void startSlotUsedInStringBasedLookups();
|
||||||
void terminate();
|
void terminate();
|
||||||
void quit();
|
void quit();
|
||||||
void started();
|
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()
|
void tst_QThread::terminate()
|
||||||
{
|
{
|
||||||
#if defined(Q_OS_ANDROID)
|
#if defined(Q_OS_ANDROID)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user