summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/thread
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/thread')
-rw-r--r--tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
index 3c50c6315b..0fb4bfbe56 100644
--- a/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
+++ b/tests/auto/corelib/thread/qthreadpool/tst_qthreadpool.cpp
@@ -75,6 +75,7 @@ private slots:
void singleton();
void destruction();
void threadRecycling();
+ void threadPriority();
void expiryTimeout();
void expiryTimeoutRace();
#ifndef QT_NO_EXCEPTIONS
@@ -323,6 +324,25 @@ void tst_QThreadPool::threadRecycling()
QCOMPARE(thread2, thread3);
}
+/*
+ Test that the thread priority from the thread created by the pool matches
+ the one configured on the pool.
+*/
+void tst_QThreadPool::threadPriority()
+{
+ QThread::Priority priority = QThread::HighPriority;
+ QThreadPool threadPool;
+ threadPool.setThreadPriority(priority);
+
+ threadPool.start(new ThreadRecorderTask());
+ threadRecyclingSemaphore.acquire();
+ QThread *thread = recycledThread;
+
+ QTest::qSleep(100);
+
+ QCOMPARE(thread->priority(), priority);
+}
+
class ExpiryTimeoutTask : public QRunnable
{
public: