diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-19 13:49:33 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-19 13:49:33 (GMT) |
commit | 42567d2e4d85e001f77767cabea8acb06daeb94d (patch) | |
tree | 96c6e3241f322535834633b883808e3e44196495 /tests | |
parent | b91d336573c9bfb2e7c93286a8e0b36e742bd775 (diff) | |
parent | 0f01ad8c73e352a8368296820f4dd77f9da06114 (diff) | |
download | Qt-42567d2e4d85e001f77767cabea8acb06daeb94d.zip Qt-42567d2e4d85e001f77767cabea8acb06daeb94d.tar.gz Qt-42567d2e4d85e001f77767cabea8acb06daeb94d.tar.bz2 |
Merge remote branch 'origin/4.6' into qt-master-from-4.6
Conflicts:
tools/assistant/lib/qhelpsearchindexreader_clucene_p.h
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 66 | ||||
-rw-r--r-- | tests/benchmarks/corelib/io/qdir/10000/10000.pro | 10 | ||||
-rw-r--r-- | tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp (renamed from tests/benchmarks/corelib/io/qdir/tst_qdir.cpp) | 10 | ||||
-rw-r--r-- | tests/benchmarks/corelib/io/qdir/qdir.pro | 10 |
4 files changed, 83 insertions, 13 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 538333a..1f78a82 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -263,6 +263,8 @@ private Q_SLOTS: void httpConnectionCount(); + void httpRecursiveCreation(); + #ifndef QT_NO_OPENSSL void ioPostToHttpsUploadProgress(); void ignoreSslErrorsList_data(); @@ -3871,6 +3873,70 @@ void tst_QNetworkReply::httpConnectionCount() #endif } +class HttpRecursiveCreationHelper : public QObject { + Q_OBJECT +public: + + HttpRecursiveCreationHelper(): + QObject(0), + requestsStartedCount_finished(0), + requestsStartedCount_readyRead(0), + requestsFinishedCount(0) + { + } + QNetworkAccessManager manager; + int requestsStartedCount_finished; + int requestsStartedCount_readyRead; + int requestsFinishedCount; +public slots: + void finishedSlot() { + requestsFinishedCount++; + + QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender()); + QVERIFY(!reply->error()); + QVERIFY(reply->bytesAvailable() == 27906); + + if (requestsFinishedCount == 60) { + QTestEventLoop::instance().exitLoop(); + return; + } + + if (requestsStartedCount_finished < 30) { + startOne(); + requestsStartedCount_finished++; + } + + reply->deleteLater(); + } + void readyReadSlot() { + QNetworkReply *reply = qobject_cast<QNetworkReply*>(sender()); + QVERIFY(!reply->error()); + + if (requestsStartedCount_readyRead < 30 && reply->bytesAvailable() > 27906/2) { + startOne(); + requestsStartedCount_readyRead++; + } + } + void startOne() { + QUrl url = "http://" + QtNetworkSettings::serverName() + "/gif/fluke.gif"; + QNetworkRequest request(url); + QNetworkReply *reply = manager.get(request); + reply->setParent(this); + connect(reply, SIGNAL(finished()), this, SLOT(finishedSlot())); + connect(reply, SIGNAL(readyRead()), this, SLOT(readyReadSlot())); + } +}; + +void tst_QNetworkReply::httpRecursiveCreation() +{ + // this test checks if creation of new requests to the same host properly works + // from readyRead() and finished() signals + HttpRecursiveCreationHelper helper; + helper.startOne(); + QTestEventLoop::instance().enterLoop(30); + QVERIFY(!QTestEventLoop::instance().timeout()); +} + #ifndef QT_NO_OPENSSL void tst_QNetworkReply::ignoreSslErrorsList_data() { diff --git a/tests/benchmarks/corelib/io/qdir/10000/10000.pro b/tests/benchmarks/corelib/io/qdir/10000/10000.pro new file mode 100644 index 0000000..93b0992 --- /dev/null +++ b/tests/benchmarks/corelib/io/qdir/10000/10000.pro @@ -0,0 +1,10 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = bench_qdir_10000 +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += bench_qdir_10000.cpp + +QT -= gui diff --git a/tests/benchmarks/corelib/io/qdir/tst_qdir.cpp b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp index aea9fd0..b325250 100644 --- a/tests/benchmarks/corelib/io/qdir/tst_qdir.cpp +++ b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp @@ -50,7 +50,7 @@ # include <unistd.h> #endif -class Test : public QObject{ +class bench_QDir_10000 : public QObject{ Q_OBJECT public slots: void initTestCase() { @@ -95,9 +95,9 @@ private slots: QBENCHMARK { QDirIterator dit(testdir.path(), QDir::Files); while (dit.hasNext()) { + dit.next(); dit.fileInfo().isDir(); dit.fileInfo().size(); - dit.next(); } } } @@ -116,9 +116,9 @@ private slots: QBENCHMARK { QDirIterator dit(testdir.path()); while (dit.hasNext()) { + dit.next(); dit.fileInfo().isDir(); dit.fileInfo().size(); - dit.next(); } } } @@ -194,5 +194,5 @@ private slots: } }; -QTEST_MAIN(Test) -#include "tst_qdir.moc" +QTEST_MAIN(bench_QDir_10000) +#include "bench_qdir_10000.moc" diff --git a/tests/benchmarks/corelib/io/qdir/qdir.pro b/tests/benchmarks/corelib/io/qdir/qdir.pro index 2cdebfd..c572566 100644 --- a/tests/benchmarks/corelib/io/qdir/qdir.pro +++ b/tests/benchmarks/corelib/io/qdir/qdir.pro @@ -1,8 +1,2 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qdir -DEPENDPATH += . -INCLUDEPATH += . - -# Input -SOURCES += tst_qdir.cpp +TEMPLATE = subdirs +SUBDIRS = 10000 |