diff options
Diffstat (limited to 'tests/auto/corelib')
18 files changed, 168 insertions, 151 deletions
diff --git a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp index 890c315bfb..95524830e8 100644 --- a/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp +++ b/tests/auto/corelib/animation/qparallelanimationgroup/tst_qparallelanimationgroup.cpp @@ -72,7 +72,7 @@ private slots: void autoAdd(); void pauseResume(); - void QTBUG8910_crashWhenRemovingUncontrolledAnimation(); + void crashWhenRemovingUncontrolledAnimation(); }; void tst_QParallelAnimationGroup::initTestCase() @@ -991,8 +991,9 @@ void tst_QParallelAnimationGroup::pauseResume() QCOMPARE(spy.count(), 2); //this shouldn't have changed } - -void tst_QParallelAnimationGroup::QTBUG8910_crashWhenRemovingUncontrolledAnimation() +// This is a regression test for QTBUG-8910, where a crash occurred when the +// last animation was removed from a group. +void tst_QParallelAnimationGroup::crashWhenRemovingUncontrolledAnimation() { QParallelAnimationGroup group; TestAnimation *anim = new TestAnimation; diff --git a/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp b/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp index 0b3eb90819..c318a7391b 100644 --- a/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp +++ b/tests/auto/corelib/concurrent/qfuture/tst_qfuture.cpp @@ -83,7 +83,7 @@ private slots: void voidConversions(); #ifndef QT_NO_EXCEPTIONS void exceptions(); - void exceptions_QTBUG18149(); + void nestedExceptions(); #endif }; @@ -1421,7 +1421,10 @@ public: bool MyClass::caught = false; -void tst_QFuture::exceptions_QTBUG18149() +// This is a regression test for QTBUG-18149. where QFuture did not throw +// exceptions if called from destructors when the stack was already unwinding +// due to an exception having been thrown. +void tst_QFuture::nestedExceptions() { try { MyClass m; diff --git a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp index 771e79e79e..01fb35c74c 100644 --- a/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp +++ b/tests/auto/corelib/io/qdiriterator/tst_qdiriterator.cpp @@ -121,7 +121,7 @@ private slots: void uncPaths_data(); void uncPaths(); #endif - void qtbug15421_hiddenDirs_hiddenFiles(); + void hiddenDirs_hiddenFiles(); }; tst_QDirIterator::tst_QDirIterator() @@ -171,19 +171,19 @@ tst_QDirIterator::tst_QDirIterator() #endif #if !defined(Q_OS_WIN) && !defined(Q_OS_WINCE) - createDirectory("qtbug15421_hiddenDirs_hiddenFiles"); - createFile("qtbug15421_hiddenDirs_hiddenFiles/normalFile"); - createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenFile"); - createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory"); - createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory"); - createFile("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/normalFile"); - createFile("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/.hiddenFile"); - createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/normalFile"); - createFile("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenFile"); - createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/normalDirectory"); - createDirectory("qtbug15421_hiddenDirs_hiddenFiles/normalDirectory/.hiddenDirectory"); - createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/normalDirectory"); - createDirectory("qtbug15421_hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenDirectory"); + createDirectory("hiddenDirs_hiddenFiles"); + createFile("hiddenDirs_hiddenFiles/normalFile"); + createFile("hiddenDirs_hiddenFiles/.hiddenFile"); + createDirectory("hiddenDirs_hiddenFiles/normalDirectory"); + createDirectory("hiddenDirs_hiddenFiles/.hiddenDirectory"); + createFile("hiddenDirs_hiddenFiles/normalDirectory/normalFile"); + createFile("hiddenDirs_hiddenFiles/normalDirectory/.hiddenFile"); + createFile("hiddenDirs_hiddenFiles/.hiddenDirectory/normalFile"); + createFile("hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenFile"); + createDirectory("hiddenDirs_hiddenFiles/normalDirectory/normalDirectory"); + createDirectory("hiddenDirs_hiddenFiles/normalDirectory/.hiddenDirectory"); + createDirectory("hiddenDirs_hiddenFiles/.hiddenDirectory/normalDirectory"); + createDirectory("hiddenDirs_hiddenFiles/.hiddenDirectory/.hiddenDirectory"); #endif } @@ -590,7 +590,7 @@ void tst_QDirIterator::uncPaths() } #endif -void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles() +void tst_QDirIterator::hiddenDirs_hiddenFiles() { // In Unix it is easy to create hidden files, but in Windows it requires // a special call since hidden files need to be "marked" while in Unix @@ -603,7 +603,7 @@ void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles() { int matches = 0; int failures = 0; - QDirIterator di("qtbug15421_hiddenDirs_hiddenFiles", QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + QDirIterator di("hiddenDirs_hiddenFiles", QDir::Files | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); while (di.hasNext()) { ++matches; QString filename = di.next(); @@ -617,7 +617,7 @@ void tst_QDirIterator::qtbug15421_hiddenDirs_hiddenFiles() { int matches = 0; int failures = 0; - QDirIterator di("qtbug15421_hiddenDirs_hiddenFiles", QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); + QDirIterator di("hiddenDirs_hiddenFiles", QDir::Dirs | QDir::Hidden | QDir::NoDotAndDotDot, QDirIterator::Subdirectories); while (di.hasNext()) { ++matches; QString filename = di.next(); diff --git a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp index 08a5e3ae3d..58198f85fa 100644 --- a/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp +++ b/tests/auto/corelib/io/qfilesystemwatcher/tst_qfilesystemwatcher.cpp @@ -83,7 +83,7 @@ private slots: void cleanup(); - void QTBUG15255_deadlock(); + void destroyAfterQCoreApplication(); private: QStringList do_force_engines; bool do_force_native; @@ -543,13 +543,15 @@ public: Q_GLOBAL_STATIC(SomeSingleton, someSingleton) -void tst_QFileSystemWatcher::QTBUG15255_deadlock() +// This is a regression test for QTBUG-15255, where a deadlock occurred if a +// QFileSystemWatcher was destroyed after the QCoreApplication instance had +// been destroyed. There are no explicit verification steps in this test -- +// it is sufficient that the test terminates. +void tst_QFileSystemWatcher::destroyAfterQCoreApplication() { someSingleton()->bla(); - //the test must still finish QTest::qWait(30); } - QTEST_MAIN(tst_QFileSystemWatcher) #include "tst_qfilesystemwatcher.moc" diff --git a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp index 293d30d487..03366aabff 100644 --- a/tests/auto/corelib/io/qsettings/tst_qsettings.cpp +++ b/tests/auto/corelib/io/qsettings/tst_qsettings.cpp @@ -129,7 +129,7 @@ private slots: void dontReorderIniKeysNeedlessly(); #endif #if defined(Q_OS_WIN) - void qtbug_13249(); + void consistentRegistryStorage(); #endif void testVariantTypes_data(); @@ -3114,19 +3114,21 @@ static DWORD readKeyType(HKEY handle, const QString &rSubKey) return 0; } -void tst_QSettings::qtbug_13249() +// This is a regression test for QTBUG-13249, where QSettings was storing +// signed integers as numeric values and unsigned integers as strings. +void tst_QSettings::consistentRegistryStorage() { QSettings settings1(QSettings::UserScope, "software.org", "KillerAPP"); qint32 x = 1024; - settings1.setValue("qtbug_13249_a", (qint32)x); - QCOMPARE(settings1.value("qtbug_13249_a").toInt(), (qint32)1024); - settings1.setValue("qtbug_13249_b", (quint32)x); - QCOMPARE(settings1.value("qtbug_13249_b").toUInt(), (quint32)1024); - settings1.setValue("qtbug_13249_c", (qint64)x); - QCOMPARE(settings1.value("qtbug_13249_c").toLongLong(), (qint64)1024); - settings1.setValue("qtbug_13249_d", (quint64)x); - QCOMPARE(settings1.value("qtbug_13249_d").toULongLong(), (quint64)1024); + settings1.setValue("qint32_value", (qint32)x); + QCOMPARE(settings1.value("qint32_value").toInt(), (qint32)1024); + settings1.setValue("quint32_value", (quint32)x); + QCOMPARE(settings1.value("quint32_value").toUInt(), (quint32)1024); + settings1.setValue("qint64_value", (qint64)x); + QCOMPARE(settings1.value("qint64_value").toLongLong(), (qint64)1024); + settings1.setValue("quint64_value", (quint64)x); + QCOMPARE(settings1.value("quint64_value").toULongLong(), (quint64)1024); settings1.sync(); HKEY handle; @@ -3136,19 +3138,19 @@ void tst_QSettings::qtbug_13249() if (res == ERROR_SUCCESS) { DWORD dataType; - dataType = readKeyType(handle, QString("qtbug_13249_a")); + dataType = readKeyType(handle, QString("qint32_value")); if (dataType != 0) { QCOMPARE((int)REG_DWORD, (int)dataType); } - dataType = readKeyType(handle, QString("qtbug_13249_b")); + dataType = readKeyType(handle, QString("quint32_value")); if (dataType != 0) { QCOMPARE((int)REG_DWORD, (int)dataType); } - dataType = readKeyType(handle, QString("qtbug_13249_c")); + dataType = readKeyType(handle, QString("qint64_value")); if (dataType != 0) { QCOMPARE((int)REG_QWORD, (int)dataType); } - dataType = readKeyType(handle, QString("qtbug_13249_d")); + dataType = readKeyType(handle, QString("quint64_value")); if (dataType != 0) { QCOMPARE((int)REG_QWORD, (int)dataType); } diff --git a/tests/auto/corelib/io/qurl/tst_qurl.cpp b/tests/auto/corelib/io/qurl/tst_qurl.cpp index c5e4d87908..f565989394 100644 --- a/tests/auto/corelib/io/qurl/tst_qurl.cpp +++ b/tests/auto/corelib/io/qurl/tst_qurl.cpp @@ -188,10 +188,10 @@ private slots: void binaryData(); void fromUserInput_data(); void fromUserInput(); - void task_199967(); - void task_240612(); - void taskQTBUG_6962(); - void taskQTBUG_8701(); + void isEmptyForEncodedUrl(); + void toEncodedNotUsingUninitializedPath(); + void emptyAuthorityRemovesExistingAuthority(); + void acceptEmptyAuthoritySegments(); void removeAllEncodedQueryItems_data(); void removeAllEncodedQueryItems(); }; @@ -3131,7 +3131,10 @@ void tst_QUrl::fromUserInput() QCOMPARE(url, guessUrlFromString); } -void tst_QUrl::task_199967() +// This is a regression test for a previously fixed bug where isEmpty didn't +// work for an encoded URL that was yet to be decoded. The test checks that +// isEmpty works for an encoded URL both after and before decoding. +void tst_QUrl::isEmptyForEncodedUrl() { { QUrl url; @@ -3149,7 +3152,9 @@ void tst_QUrl::task_199967() } } -void tst_QUrl::task_240612() +// This test verifies that the QUrl::toEncoded() does not rely on the +// potentially uninitialized unencoded path. +void tst_QUrl::toEncodedNotUsingUninitializedPath() { QUrl url; url.setEncodedPath("test.txt"); @@ -3210,23 +3215,22 @@ void tst_QUrl::resolvedWithAbsoluteSchemes_data() const << QUrl::fromEncoded("http://andreas:hemmelig@www.vg.no/?my=query&your=query#yougotfragged"); } -void tst_QUrl::taskQTBUG_6962() +void tst_QUrl::emptyAuthorityRemovesExistingAuthority() { - //bug 6962: empty authority ignored by setAuthority QUrl url("http://example.com/something"); url.setAuthority(QString()); QCOMPARE(url.authority(), QString()); } -void tst_QUrl::taskQTBUG_8701() +void tst_QUrl::acceptEmptyAuthoritySegments() { - //bug 8701: foo:///bar mangled to foo:/bar + // Verify that foo:///bar is not mangled to foo:/bar QString foo_triple_bar("foo:///bar"), foo_uni_bar("foo:/bar"); QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar).toString()); QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar).toString()); - QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar, QUrl::StrictMode).toString()); // fails + QCOMPARE(foo_triple_bar, QUrl(foo_triple_bar, QUrl::StrictMode).toString()); QCOMPARE(foo_uni_bar, QUrl(foo_uni_bar, QUrl::StrictMode).toString()); } diff --git a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp index f53803ef0f..076ecc31fc 100644 --- a/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp +++ b/tests/auto/corelib/kernel/qeventloop/tst_qeventloop.cpp @@ -192,7 +192,7 @@ private slots: void quit(); void processEventsExcludeSocket(); void processEventsExcludeTimers(); - void deliverInDefinedOrder_QTBUG19637(); + void deliverInDefinedOrder(); // keep this test last: void nestedLoops(); @@ -566,7 +566,7 @@ void tst_QEventLoop::processEventsExcludeTimers() Q_DECLARE_METATYPE(QThread*) -namespace DeliverInDefinedOrder_QTBUG19637 { +namespace DeliverInDefinedOrder { enum { NbThread = 3, NbObject = 500, NbEventQueue = 5, NbEvent = 50 }; struct CustomEvent : public QEvent { @@ -601,9 +601,9 @@ namespace DeliverInDefinedOrder_QTBUG19637 { } -void tst_QEventLoop::deliverInDefinedOrder_QTBUG19637() +void tst_QEventLoop::deliverInDefinedOrder() { - using namespace DeliverInDefinedOrder_QTBUG19637; + using namespace DeliverInDefinedOrder; qMetaTypeId<QThread*>(); QThread threads[NbThread]; Object objects[NbObject]; diff --git a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp index 32d5b0bb3c..e0433ea4b0 100644 --- a/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp +++ b/tests/auto/corelib/kernel/qmetatype/tst_qmetatype.cpp @@ -86,8 +86,7 @@ private slots: void isRegistered_data(); void isRegistered(); void unregisterType(); - void QTBUG11316_registerStreamBuiltin(); - + void registerStreamBuiltin(); }; struct Foo { int i; }; @@ -805,7 +804,7 @@ void tst_QMetaType::unregisterType() QCOMPARE(QMetaType::isRegistered(typeId), false); } -void tst_QMetaType::QTBUG11316_registerStreamBuiltin() +void tst_QMetaType::registerStreamBuiltin() { //should not crash; qRegisterMetaTypeStreamOperators<QString>("QString"); diff --git a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp index f70c380c4a..c66e5ff80b 100644 --- a/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp +++ b/tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp @@ -74,7 +74,7 @@ private slots: void singleShotStaticFunctionZeroTimeout(); void recurseOnTimeoutAndStopTimer(); - void QTBUG13633_dontBlockEvents(); + void dontBlockEvents(); void postedEventsShouldNotStarveTimers(); }; @@ -634,7 +634,7 @@ DontBlockEvents::DontBlockEvents() count = 0; total = 0; - //QTBUG-13633 need few unrelated timer running to reproduce the bug. + // need a few unrelated timers running to reproduce the bug. (new QTimer(this))->start(2000); (new QTimer(this))->start(2500); (new QTimer(this))->start(3000); @@ -662,8 +662,9 @@ void DontBlockEvents::paintEvent() QCOMPARE(count, 0); } - -void tst_QTimer::QTBUG13633_dontBlockEvents() +// This is a regression test for QTBUG-13633, where a timer with a zero +// timeout that was restarted by the event handler could starve other timers. +void tst_QTimer::dontBlockEvents() { DontBlockEvents t; QTest::qWait(60); diff --git a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp index 82b0c98522..d70dea5e57 100644 --- a/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp +++ b/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp @@ -59,7 +59,7 @@ private slots: void lock_unlock_locked_tryLock(); void stressTest(); void tryLockRace(); - void qtbug16115_trylock(); + void tryLockDeadlock(); void moreStress(); }; @@ -510,14 +510,17 @@ void tst_QMutex::tryLockRace() TryLockRaceThread::mutex.unlock(); } +// The following is a regression test for QTBUG-16115, where QMutex could +// deadlock after calling tryLock repeatedly. + // Variable that will be protected by the mutex. Volatile so that the // the optimiser doesn't mess with it based on the increment-then-decrement // usage pattern. -static volatile int qtbug16115_trylock_counter; +static volatile int tryLockDeadlockCounter; // Counter for how many times the protected variable has an incorrect value. -static int qtbug16115_failure_count = 0; +static int tryLockDeadlockFailureCount = 0; -void tst_QMutex::qtbug16115_trylock() +void tst_QMutex::tryLockDeadlock() { //Used to deadlock on unix struct TrylockThread : QThread { @@ -526,10 +529,10 @@ void tst_QMutex::qtbug16115_trylock() void run() { for (int i = 0; i < 100000; ++i) { if (mut.tryLock(0)) { - if ((++qtbug16115_trylock_counter) != 1) - ++qtbug16115_failure_count; - if ((--qtbug16115_trylock_counter) != 0) - ++qtbug16115_failure_count; + if ((++tryLockDeadlockCounter) != 1) + ++tryLockDeadlockFailureCount; + if ((--tryLockDeadlockCounter) != 0) + ++tryLockDeadlockFailureCount; mut.unlock(); } } @@ -545,16 +548,16 @@ void tst_QMutex::qtbug16115_trylock() for (int i = 0; i < 100000; ++i) { mut.lock(); - if ((++qtbug16115_trylock_counter) != 1) - ++qtbug16115_failure_count; - if ((--qtbug16115_trylock_counter) != 0) - ++qtbug16115_failure_count; + if ((++tryLockDeadlockCounter) != 1) + ++tryLockDeadlockFailureCount; + if ((--tryLockDeadlockCounter) != 0) + ++tryLockDeadlockFailureCount; mut.unlock(); } t1.wait(); t2.wait(); t3.wait(); - QCOMPARE(qtbug16115_failure_count, 0); + QCOMPARE(tryLockDeadlockFailureCount, 0); } diff --git a/tests/auto/corelib/thread/qthread/tst_qthread.cpp b/tests/auto/corelib/thread/qthread/tst_qthread.cpp index 540f4b3d1e..42a64ef427 100644 --- a/tests/auto/corelib/thread/qthread/tst_qthread.cpp +++ b/tests/auto/corelib/thread/qthread/tst_qthread.cpp @@ -96,8 +96,8 @@ private slots: void adoptMultipleThreads(); void adoptMultipleThreadsOverlap(); - void QTBUG13810_exitAndStart(); - void QTBUG15378_exitAndExec(); + void exitAndStart(); + void exitAndExec(); void connectThreadFinishedSignalToObjectDeleteLaterSlot(); void wait2(); @@ -980,7 +980,7 @@ public: int m_prop; }; -void tst_QThread::QTBUG13810_exitAndStart() +void tst_QThread::exitAndStart() { QThread thread; thread.exit(555); //should do nothing @@ -1002,7 +1002,7 @@ void tst_QThread::QTBUG13810_exitAndStart() QCOMPARE(sync1.m_prop, 89); } -void tst_QThread::QTBUG15378_exitAndExec() +void tst_QThread::exitAndExec() { class Thread : public QThread { public: diff --git a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp index 5858cd98bb..ceb74b3849 100644 --- a/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp +++ b/tests/auto/corelib/thread/qthreadstorage/tst_qthreadstorage.cpp @@ -71,9 +71,9 @@ private slots: void autoDelete(); void adoptedThreads(); void ensureCleanupOrder(); - void QTBUG13877_crashOnExit(); - void QTBUG14579_leakInDestructor(); - void QTBUG14579_resetInDestructor(); + void crashOnExit(); + void leakInDestructor(); + void resetInDestructor(); void valueBased(); }; @@ -288,7 +288,7 @@ void tst_QThreadStorage::ensureCleanupOrder() QVERIFY(First::order < Second::order); } -void tst_QThreadStorage::QTBUG13877_crashOnExit() +void tst_QThreadStorage::crashOnExit() { QProcess process; #ifdef Q_OS_WIN @@ -315,45 +315,45 @@ public: }; QBasicAtomicInt SPointer::count = Q_BASIC_ATOMIC_INITIALIZER(0); -Q_GLOBAL_STATIC(QThreadStorage<SPointer *>, QTBUG14579_pointers1) -Q_GLOBAL_STATIC(QThreadStorage<SPointer *>, QTBUG14579_pointers2) +Q_GLOBAL_STATIC(QThreadStorage<SPointer *>, threadStoragePointers1) +Q_GLOBAL_STATIC(QThreadStorage<SPointer *>, threadStoragePointers2) -class QTBUG14579_class +class ThreadStorageLocalDataTester { public: SPointer member; - inline ~QTBUG14579_class() { - QVERIFY(!QTBUG14579_pointers1()->hasLocalData()); - QVERIFY(!QTBUG14579_pointers2()->hasLocalData()); - QTBUG14579_pointers2()->setLocalData(new SPointer); - QTBUG14579_pointers1()->setLocalData(new SPointer); - QVERIFY(QTBUG14579_pointers1()->hasLocalData()); - QVERIFY(QTBUG14579_pointers2()->hasLocalData()); + inline ~ThreadStorageLocalDataTester() { + QVERIFY(!threadStoragePointers1()->hasLocalData()); + QVERIFY(!threadStoragePointers2()->hasLocalData()); + threadStoragePointers2()->setLocalData(new SPointer); + threadStoragePointers1()->setLocalData(new SPointer); + QVERIFY(threadStoragePointers1()->hasLocalData()); + QVERIFY(threadStoragePointers2()->hasLocalData()); } }; -void tst_QThreadStorage::QTBUG14579_leakInDestructor() +void tst_QThreadStorage::leakInDestructor() { class Thread : public QThread { public: - QThreadStorage<QTBUG14579_class *> &tls; + QThreadStorage<ThreadStorageLocalDataTester *> &tls; - Thread(QThreadStorage<QTBUG14579_class *> &t) : tls(t) { } + Thread(QThreadStorage<ThreadStorageLocalDataTester *> &t) : tls(t) { } void run() { QVERIFY(!tls.hasLocalData()); - tls.setLocalData(new QTBUG14579_class); + tls.setLocalData(new ThreadStorageLocalDataTester); QVERIFY(tls.hasLocalData()); } }; int c = SPointer::count.load(); - QThreadStorage<QTBUG14579_class *> tls; + QThreadStorage<ThreadStorageLocalDataTester *> tls; - QVERIFY(!QTBUG14579_pointers1()->hasLocalData()); + QVERIFY(!threadStoragePointers1()->hasLocalData()); QThreadStorage<int *> tls2; //add some more tls to make sure ids are not following each other too much QThreadStorage<int *> tls3; QVERIFY(!tls2.hasLocalData()); @@ -376,29 +376,29 @@ void tst_QThreadStorage::QTBUG14579_leakInDestructor() QCOMPARE(int(SPointer::count.load()), c); } -class QTBUG14579_reset { +class ThreadStorageResetLocalDataTester { public: SPointer member; - ~QTBUG14579_reset(); + ~ThreadStorageResetLocalDataTester(); }; -Q_GLOBAL_STATIC(QThreadStorage<QTBUG14579_reset *>, QTBUG14579_resetTls) +Q_GLOBAL_STATIC(QThreadStorage<ThreadStorageResetLocalDataTester *>, ThreadStorageResetLocalDataTesterTls) -QTBUG14579_reset::~QTBUG14579_reset() { +ThreadStorageResetLocalDataTester::~ThreadStorageResetLocalDataTester() { //Quite stupid, but WTF::ThreadSpecific<T>::destroy does it. - QTBUG14579_resetTls()->setLocalData(this); + ThreadStorageResetLocalDataTesterTls()->setLocalData(this); } -void tst_QThreadStorage::QTBUG14579_resetInDestructor() +void tst_QThreadStorage::resetInDestructor() { class Thread : public QThread { public: void run() { - QVERIFY(!QTBUG14579_resetTls()->hasLocalData()); - QTBUG14579_resetTls()->setLocalData(new QTBUG14579_reset); - QVERIFY(QTBUG14579_resetTls()->hasLocalData()); + QVERIFY(!ThreadStorageResetLocalDataTesterTls()->hasLocalData()); + ThreadStorageResetLocalDataTesterTls()->setLocalData(new ThreadStorageResetLocalDataTester); + QVERIFY(ThreadStorageResetLocalDataTesterTls()->hasLocalData()); } }; int c = SPointer::count.load(); diff --git a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp index 2f1ac10694..21bf9d1539 100644 --- a/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp +++ b/tests/auto/corelib/tools/qregexp/tst_qregexp.cpp @@ -79,8 +79,8 @@ private slots: void reentrancy(); void threadsafeEngineCache(); - void QTBUG_7049_data(); - void QTBUG_7049(); + void posAndCapConsistency_data(); + void posAndCapConsistency(); void interval(); }; @@ -1237,7 +1237,9 @@ void tst_QRegExp::operator_eq() } } -void tst_QRegExp::QTBUG_7049_data() +// This test aims to ensure that the values returned by pos() and cap() +// are consistent. +void tst_QRegExp::posAndCapConsistency_data() { QTest::addColumn<QString>("reStr"); QTest::addColumn<QString>("text"); @@ -1297,7 +1299,7 @@ void tst_QRegExp::QTBUG_7049_data() } -void tst_QRegExp::QTBUG_7049() +void tst_QRegExp::posAndCapConsistency() { QFETCH( QString, reStr ); QFETCH( QString, text ); diff --git a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp index 94f6fc1c12..c4acf5be76 100644 --- a/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp +++ b/tests/auto/corelib/tools/qsharedpointer/tst_qsharedpointer.cpp @@ -1838,7 +1838,7 @@ void tst_QSharedPointer::invalidConstructs() } } -namespace QTBUG11730 { +namespace ReentrancyWhileDestructing { struct IB { virtual ~IB() {} @@ -1881,17 +1881,14 @@ namespace QTBUG11730 { }; } +// This is a regression test for QTBUG-11730, where there would be a crash if +// the destructor of a QSharedPointer object being deleted recursed back into +// the same QSharedPointer object. There are no explicit verification steps +// in this test -- it is sufficient that the code does not crash. void tst_QSharedPointer::reentrancyWhileDestructing() { - // this bug is about recursing back into QSharedPointer::clear() - // from inside it - // that is, the destructor of the object being deleted recurses - // into the same QSharedPointer object. - // First reported as QTBUG-11730 - QTBUG11730::A obj; + ReentrancyWhileDestructing::A obj; } - QTEST_MAIN(tst_QSharedPointer) - #include "tst_qsharedpointer.moc" diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 45df14b560..cb61dea924 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -214,8 +214,8 @@ private slots: void repeated() const; void repeated_data() const; void task262677remove(); - void QTBUG10404_compareRef(); - void QTBUG9281_arg_locale(); + void compareRef(); + void arg_locale(); void toUpperLower_icu(); void literals(); @@ -4962,7 +4962,7 @@ void tst_QString::task262677remove() QVERIFY(driveName == QLatin1String("V:")); } -void tst_QString::QTBUG10404_compareRef() +void tst_QString::compareRef() { QString a = "ABCDEFGH"; @@ -4993,7 +4993,7 @@ void tst_QString::QTBUG10404_compareRef() QVERIFY(QStringRef(&a2, 1, 2).compare(QStringRef(&a, 1, 3), Qt::CaseInsensitive) < 0); } -void tst_QString::QTBUG9281_arg_locale() +void tst_QString::arg_locale() { QLocale l(QLocale::English, QLocale::UnitedKingdom); l.setNumberOptions(QLocale::OmitGroupSeparator); diff --git a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp index b6bdd9d1cf..c36f293745 100644 --- a/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp +++ b/tests/auto/corelib/tools/qvarlengtharray/tst_qvarlengtharray.cpp @@ -56,8 +56,8 @@ private slots: void removeLast(); void oldTests(); void task214223(); - void QTBUG6718_resize(); - void QTBUG10978_realloc(); + void resize(); + void realloc(); }; int fooCtor = 0; @@ -258,7 +258,7 @@ void tst_QVarLengthArray::task214223() d.append(i); } -void tst_QVarLengthArray::QTBUG6718_resize() +void tst_QVarLengthArray::resize() { //MOVABLE { @@ -400,7 +400,7 @@ Q_DECLARE_TYPEINFO(MyComplex, Q_COMPLEX_TYPE); QT_END_NAMESPACE -bool QTBUG10978_proceed = true; +bool reallocTestProceed = true; template <class T, int PreAlloc> int countMoved(QVarLengthArray<T, PreAlloc> const &c) @@ -414,9 +414,9 @@ int countMoved(QVarLengthArray<T, PreAlloc> const &c) } template <class T> -void QTBUG10978_test() +void reallocTest() { - QTBUG10978_proceed = false; + reallocTestProceed = false; typedef QVarLengthArray<T, 16> Container; enum { @@ -578,22 +578,22 @@ void QTBUG10978_test() QCOMPARE(MyBase::liveCount, 0); // All done - QTBUG10978_proceed = true; + reallocTestProceed = true; } -void tst_QVarLengthArray::QTBUG10978_realloc() +void tst_QVarLengthArray::realloc() { - QTBUG10978_test<MyBase>(); - QVERIFY(QTBUG10978_proceed); + reallocTest<MyBase>(); + QVERIFY(reallocTestProceed); - QTBUG10978_test<MyPrimitive>(); - QVERIFY(QTBUG10978_proceed); + reallocTest<MyPrimitive>(); + QVERIFY(reallocTestProceed); - QTBUG10978_test<MyMovable>(); - QVERIFY(QTBUG10978_proceed); + reallocTest<MyMovable>(); + QVERIFY(reallocTestProceed); - QTBUG10978_test<MyComplex>(); - QVERIFY(QTBUG10978_proceed); + reallocTest<MyComplex>(); + QVERIFY(reallocTestProceed); } QTEST_APPLESS_MAIN(tst_QVarLengthArray) diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp index 2c1a17108b..77e70bd1fd 100644 --- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp +++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp @@ -82,9 +82,9 @@ private slots: void testOperators() const; void outOfMemory(); - void QTBUG6416_reserve(); - void QTBUG11763_data(); - void QTBUG11763(); + void reserve(); + void reallocAfterCopy_data(); + void reallocAfterCopy(); void initializeList(); void const_shared_null(); @@ -832,7 +832,7 @@ void tst_QVector::outOfMemory() } } -void tst_QVector::QTBUG6416_reserve() +void tst_QVector::reserve() { fooCtor = 0; fooDtor = 0; @@ -845,7 +845,9 @@ void tst_QVector::QTBUG6416_reserve() QCOMPARE(fooCtor, fooDtor); } -void tst_QVector::QTBUG11763_data() +// This is a regression test for QTBUG-11763, where memory would be reallocated +// soon after copying a QVector. +void tst_QVector::reallocAfterCopy_data() { QTest::addColumn<int>("capacity"); QTest::addColumn<int>("fill_size"); @@ -881,12 +883,12 @@ void tst_QVector::QTBUG11763_data() result3 = i - 10; result4 = i - 20; } - QTest::newRow(qPrintable(QString("QTBUG11763:%1,%2").arg(i).arg(j))) << i << fill_size << j << result1 << result2 << result3 << result4; + QTest::newRow(qPrintable(QString("reallocAfterCopy:%1,%2").arg(i).arg(j))) << i << fill_size << j << result1 << result2 << result3 << result4; } } } -void tst_QVector::QTBUG11763() +void tst_QVector::reallocAfterCopy() { QFETCH(int, capacity); QFETCH(int, fill_size); diff --git a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp index cba7979605..2320483fca 100644 --- a/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp +++ b/tests/auto/corelib/xml/qxmlstream/tst_qxmlstream.cpp @@ -570,7 +570,7 @@ private slots: void clear() const; void checkCommentIndentation() const; void checkCommentIndentation_data() const; - void qtbug9196_crash() const; + void crashInXmlStreamReader() const; void hasError() const; private: @@ -1479,9 +1479,10 @@ void tst_QXmlStream::checkCommentIndentation() const // task 256468 QCOMPARE(output, expectedOutput); } -void tst_QXmlStream::qtbug9196_crash() const +// This is a regression test for QTBUG-9196, where the series of tags used +// in the test caused a crash in the XML stream reader. +void tst_QXmlStream::crashInXmlStreamReader() const { - // the following input used to produce a crash in the stream reader QByteArray ba("<a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a>" "<a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a><a></a>"); QXmlStreamReader xml(ba); |