diff options
author | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2022-03-06 14:31:49 +0100 |
---|---|---|
committer | Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> | 2022-03-15 03:32:14 +0100 |
commit | 9b8015ed8d4dcfc3ac3dd15fb5a2edf16ff639db (patch) | |
tree | 1b301b286ff19e6605860ab4744e49dbe4c8ccf1 /tests/auto/corelib/thread | |
parent | 07b176ce70009f62fbce603c0495fa36c23b10d7 (diff) |
QMutexLocker: add isLocked()
It's basically for free.
[ChangeLog][QtCore][QMutexLocker] Added the isLocked() function.
Change-Id: Idad5fa249ba8f135dcf81c7b7596caa3a888e99c
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'tests/auto/corelib/thread')
-rw-r--r-- | tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp b/tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp index d873291fd6..29c8b92222 100644 --- a/tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp +++ b/tests/auto/corelib/thread/qmutexlocker/tst_qmutexlocker.cpp @@ -80,6 +80,7 @@ void tst_QMutexLocker::scopeTest() { QMutexLocker locker(&mutex); + QVERIFY(locker.isLocked()); waitForTest(); } @@ -122,16 +123,23 @@ void tst_QMutexLocker::unlockAndRelockTest() void run() override { QMutexLocker locker(&mutex); + QVERIFY(locker.isLocked()); waitForTest(); + QVERIFY(locker.isLocked()); locker.unlock(); + QVERIFY(!locker.isLocked()); waitForTest(); + QVERIFY(!locker.isLocked()); locker.relock(); + QVERIFY(locker.isLocked()); waitForTest(); + + QVERIFY(locker.isLocked()); } }; @@ -169,10 +177,16 @@ void tst_QMutexLocker::lockerStateTest() { { QMutexLocker locker(&mutex); + QVERIFY(locker.isLocked()); + locker.relock(); + QVERIFY(locker.isLocked()); + locker.unlock(); + QVERIFY(!locker.isLocked()); waitForTest(); + QVERIFY(!locker.isLocked()); } waitForTest(); |