summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-04-21 23:09:07 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-04-21 23:09:07 (GMT)
commit84a0a0c949d877dfc9a0eb05996a2b73d61b64f8 (patch)
treed35c4f722ac0e683918e585fb292416a4a44f140 /tests
parent2ca4e77f0a29bc6d7571ca614a6101d9e1bd83e0 (diff)
parent68dd1d40e4385914a14bf4c0d55b28378942dd8c (diff)
downloadQt-84a0a0c949d877dfc9a0eb05996a2b73d61b64f8.zip
Qt-84a0a0c949d877dfc9a0eb05996a2b73d61b64f8.tar.gz
Qt-84a0a0c949d877dfc9a0eb05996a2b73d61b64f8.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1: (34 commits) Cocoa: fix namespace build breakage Trivial doc fix qdoc: Updated the extra images variable for each manual.qdocconf. Cocoa: cocoa sometimes show a hidden window Default (Parentless) QMenuBar actions do not work (without autotest) Reorganised double stream out operator in QDataStream to avoid causing unnecessary floating point exceptions. Revert "Report the error as being AlreadyExists if this is why it fails" Revert "Default (Parentless) QMenuBar actions do not work" fix memory bug fix nativeFilePath character width issue fix typos Just use the path as the url can have an anchor attached etc... Doc: Cleaning HTML generator and updating index.qdoc Default (Parentless) QMenuBar actions do not work Fix Mac OS Tiger-vs-Leopard crash due to memory tagging by JavaScriptCore qdoc: Avoided putting bad chars in links Improve itemview appearance on Mac Backport a few fixes to the Designer filteredit from Creator Doc: Correcting qdocconf files for assistant ScrollBar width not updated dynamically on Windows. ...
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/qdiriterator/tst_qdiriterator.cpp10
-rw-r--r--tests/auto/qhostinfo/tst_qhostinfo.cpp45
-rw-r--r--tests/auto/qitemmodel/tst_qitemmodel.cpp2
-rw-r--r--tests/auto/qthread/tst_qthread.cpp4
4 files changed, 37 insertions, 24 deletions
diff --git a/tests/auto/qdiriterator/tst_qdiriterator.cpp b/tests/auto/qdiriterator/tst_qdiriterator.cpp
index c1db8f2..1a873b8 100644
--- a/tests/auto/qdiriterator/tst_qdiriterator.cpp
+++ b/tests/auto/qdiriterator/tst_qdiriterator.cpp
@@ -85,11 +85,13 @@ private: // convenience functions
return false;
}
- bool createFile(const QString &fileName)
+ enum Cleanup { DoDelete, DontDelete };
+ bool createFile(const QString &fileName, Cleanup cleanup = DoDelete)
{
QFile file(fileName);
if (file.open(QIODevice::WriteOnly)) {
- createdFiles << fileName;
+ if (cleanup == DoDelete)
+ createdFiles << fileName;
return true;
}
return false;
@@ -131,9 +133,9 @@ tst_QDirIterator::tst_QDirIterator()
createDirectory("entrylist");
createDirectory("entrylist/directory");
- createFile("entrylist/file");
+ createFile("entrylist/file", DontDelete);
createFile("entrylist/writable");
- createFile("entrylist/directory/dummy");
+ createFile("entrylist/directory/dummy", DontDelete);
createDirectory("recursiveDirs");
createDirectory("recursiveDirs/dir1");
diff --git a/tests/auto/qhostinfo/tst_qhostinfo.cpp b/tests/auto/qhostinfo/tst_qhostinfo.cpp
index 4282062..c336746 100644
--- a/tests/auto/qhostinfo/tst_qhostinfo.cpp
+++ b/tests/auto/qhostinfo/tst_qhostinfo.cpp
@@ -128,6 +128,7 @@ private slots:
void threadSafety();
void multipleSameLookups();
+ void multipleDifferentLookups_data();
void multipleDifferentLookups();
void cache();
@@ -441,36 +442,46 @@ void tst_QHostInfo::multipleSameLookups()
for (int i = 0; i < COUNT; i++)
QHostInfo::lookupHost("localhost", this, SLOT(resultsReady(const QHostInfo)));
- QTRY_VERIFY(lookupsDoneCounter == COUNT);
-
- // spin two seconds more to see if it is not more :)
- QTestEventLoop::instance().enterLoop(2);
- QTRY_VERIFY(lookupsDoneCounter == COUNT);
+ QElapsedTimer timer;
+ timer.start();
+ while (timer.elapsed() < 10000 && lookupsDoneCounter < COUNT) {
+ QTestEventLoop::instance().enterLoop(2);
+ }
+ QCOMPARE(lookupsDoneCounter, COUNT);
}
// this test is for the multi-threaded QHostInfo rewrite. It is about getting results at all,
// not about getting correct IPs
+void tst_QHostInfo::multipleDifferentLookups_data()
+{
+ QTest::addColumn<int>("repeats");
+ QTest::newRow("1") << 1;
+ QTest::newRow("2") << 2;
+ QTest::newRow("5") << 5;
+ QTest::newRow("10") << 10;
+}
+
void tst_QHostInfo::multipleDifferentLookups()
{
QStringList hostnameList;
hostnameList << "www.ovi.com" << "www.nokia.com" << "qt.nokia.com" << "www.trolltech.com" << "troll.no"
- << "www.qtcentre.org" << "forum.nokia.com" << "www.forum.nokia.com" << "wiki.forum.nokia.com"
- << "www.nokia.no" << "nokia.de" << "127.0.0.1" << "----";
+ << "www.qtcentre.org" << "forum.nokia.com" << "www.nokia.com" << "wiki.forum.nokia.com"
+ << "www.nokia.com" << "nokia.de" << "127.0.0.1" << "----";
+ QFETCH(int, repeats);
const int COUNT = hostnameList.size();
lookupsDoneCounter = 0;
for (int i = 0; i < hostnameList.size(); i++)
- QHostInfo::lookupHost(hostnameList.at(i), this, SLOT(resultsReady(const QHostInfo)));
-
- // give some time
- QTestEventLoop::instance().enterLoop(5);
- // try_verify gives some more time
- QTRY_VERIFY(lookupsDoneCounter == COUNT);
+ for (int j = 0; j < repeats; ++j)
+ QHostInfo::lookupHost(hostnameList.at(i), this, SLOT(resultsReady(const QHostInfo)));
- // spin two seconds more to see if it is not more than expected
- QTestEventLoop::instance().enterLoop(2);
- QTRY_VERIFY(lookupsDoneCounter == COUNT);
+ QElapsedTimer timer;
+ timer.start();
+ while (timer.elapsed() < 10000 && lookupsDoneCounter < repeats*COUNT) {
+ QTestEventLoop::instance().enterLoop(2);
+ }
+ QCOMPARE(lookupsDoneCounter, repeats*COUNT);
}
void tst_QHostInfo::cache()
@@ -517,7 +528,7 @@ void tst_QHostInfo::resultsReady(const QHostInfo &hi)
lookupDone = true;
lookupResults = hi;
lookupsDoneCounter++;
- QTestEventLoop::instance().exitLoop();
+ QMetaObject::invokeMethod(&QTestEventLoop::instance(), "exitLoop", Qt::QueuedConnection);
}
QTEST_MAIN(tst_QHostInfo)
diff --git a/tests/auto/qitemmodel/tst_qitemmodel.cpp b/tests/auto/qitemmodel/tst_qitemmodel.cpp
index f466045..d36df9c 100644
--- a/tests/auto/qitemmodel/tst_qitemmodel.cpp
+++ b/tests/auto/qitemmodel/tst_qitemmodel.cpp
@@ -452,7 +452,7 @@ void checkChildren(QAbstractItemModel *currentModel, const QModelIndex &parent,
QCOMPARE(index.column(), c);
QCOMPARE(currentModel->data(index, Qt::DisplayRole).isValid(), true);
- // If the next test fails here is some somewhat usefull debug you play with.
+ // If the next test fails here is some somewhat useful debug you play with.
/*
if (currentModel->parent(index) != parent) {
qDebug() << r << c << currentDepth << currentModel->data(index).toString()
diff --git a/tests/auto/qthread/tst_qthread.cpp b/tests/auto/qthread/tst_qthread.cpp
index 9a4397e..7a5b053 100644
--- a/tests/auto/qthread/tst_qthread.cpp
+++ b/tests/auto/qthread/tst_qthread.cpp
@@ -442,9 +442,9 @@ void tst_QThread::exit()
thread2.object = 0;
thread2.code = 53;
thread2.result = 0;
+ QMutexLocker locker2(&thread2.mutex);
thread2.start();
thread2.exit(thread2.code);
- QMutexLocker locker2(&thread2.mutex);
thread2.cond.wait(locker2.mutex());
QVERIFY(thread2.wait(five_minutes));
QCOMPARE(thread2.result, thread2.code);
@@ -514,9 +514,9 @@ void tst_QThread::quit()
Quit_Thread thread2;
thread2.object = 0;
thread2.result = -1;
+ QMutexLocker locker2(&thread2.mutex);
thread2.start();
thread2.quit();
- QMutexLocker locker2(&thread2.mutex);
thread2.cond.wait(locker2.mutex());
QVERIFY(thread2.wait(five_minutes));
QCOMPARE(thread2.result, 0);