summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-01-26 16:13:55 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-01-26 16:13:55 (GMT)
commit41de32155e0a862ec7f6aacbcf985f06950bfda9 (patch)
tree9fe6b20d6e0b12fb53a0398f67f0a2702a9ad750 /tests/auto
parentb885787eee96f444e73c7a9d6f6b63f65ef2c172 (diff)
parent5498dcd7b10e147734a3414cab824b8b435aa3d9 (diff)
downloadQt-41de32155e0a862ec7f6aacbcf985f06950bfda9.zip
Qt-41de32155e0a862ec7f6aacbcf985f06950bfda9.tar.gz
Qt-41de32155e0a862ec7f6aacbcf985f06950bfda9.tar.bz2
Merge branch 4.7 into qt-master-from-4.7
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qnetworkreply/tst_qnetworkreply.cpp30
-rw-r--r--tests/auto/qtextcursor/tst_qtextcursor.cpp28
2 files changed, 48 insertions, 10 deletions
diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
index 91eff6f..1d2a69f 100644
--- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp
@@ -213,6 +213,7 @@ private Q_SLOTS:
void ioGetFromBuiltinHttp();
void ioGetFromHttpWithReuseParallel();
void ioGetFromHttpWithReuseSequential();
+ void ioGetFromHttpWithAuth_data();
void ioGetFromHttpWithAuth();
void ioGetFromHttpWithAuthSynchronous();
void ioGetFromHttpWithProxyAuth();
@@ -2178,15 +2179,27 @@ void tst_QNetworkReply::ioGetFromHttpWithReuseSequential()
}
}
+void tst_QNetworkReply::ioGetFromHttpWithAuth_data()
+{
+ QTest::addColumn<QUrl>("url");
+ QTest::addColumn<QByteArray>("expectedData");
+
+ QFile reference(SRCDIR "/rfc3252.txt");
+ reference.open(QIODevice::ReadOnly);
+ QByteArray referenceData = reference.readAll();
+ QTest::newRow("basic") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt") << referenceData;
+ QTest::newRow("digest") << QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/auth-digest/") << QByteArray("digest authentication successful\n");
+}
+
void tst_QNetworkReply::ioGetFromHttpWithAuth()
{
// This test sends three requests
// The first two in parallel
// The third after the first two finished
- QFile reference(SRCDIR "/rfc3252.txt");
- QVERIFY(reference.open(QIODevice::ReadOnly));
- QNetworkRequest request(QUrl("http://" + QtNetworkSettings::serverName() + "/qtest/rfcs-auth/rfc3252.txt"));
+ QFETCH(QUrl, url);
+ QFETCH(QByteArray, expectedData);
+ QNetworkRequest request(url);
{
QNetworkReplyPtr reply1 = manager.get(request);
QNetworkReplyPtr reply2 = manager.get(request);
@@ -2211,14 +2224,12 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth()
QCOMPARE(reply1->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
QCOMPARE(reply2->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
- QByteArray referenceData = reference.readAll();
- QCOMPARE(reader1.data, referenceData);
- QCOMPARE(reader2.data, referenceData);
+ QCOMPARE(reader1.data, expectedData);
+ QCOMPARE(reader2.data, expectedData);
QCOMPARE(authspy.count(), 1);
}
- reference.seek(0);
// rinse and repeat:
{
QNetworkReplyPtr reply = manager.get(request);
@@ -2234,13 +2245,12 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth()
this, SLOT(authenticationRequired(QNetworkReply*,QAuthenticator*)));
QCOMPARE(reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
- QCOMPARE(reader.data, reference.readAll());
+ QCOMPARE(reader.data, expectedData);
QCOMPARE(authspy.count(), 0);
}
// now check with synchronous calls:
- reference.seek(0);
{
request.setAttribute(
static_cast<QNetworkRequest::Attribute>(SynchronousRequestAttribute),
@@ -2256,7 +2266,7 @@ void tst_QNetworkReply::ioGetFromHttpWithAuth()
// the only thing we check here is that the auth cache was used when using synchronous requests
QCOMPARE(replySync->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(), 200);
- QCOMPARE(replySync->readAll(), reference.readAll());
+ QCOMPARE(replySync->readAll(), expectedData);
}
}
diff --git a/tests/auto/qtextcursor/tst_qtextcursor.cpp b/tests/auto/qtextcursor/tst_qtextcursor.cpp
index ee2baef..4d52dd7 100644
--- a/tests/auto/qtextcursor/tst_qtextcursor.cpp
+++ b/tests/auto/qtextcursor/tst_qtextcursor.cpp
@@ -134,6 +134,7 @@ private slots:
void endOfLine();
void editBlocksDuringRemove();
+ void selectAllDuringRemove();
void update_data();
void update();
@@ -1388,6 +1389,17 @@ public slots:
++recordingCount;
}
+ void selectAllContents()
+ {
+ // Only test the first time
+ if (!recordingCount) {
+ recordingCount++;
+ cursor->select(QTextCursor::Document);
+ lastRecordedPosition = cursor->position();
+ lastRecordedAnchor = cursor->anchor();
+ }
+ }
+
private:
QTextCursor *cursor;
};
@@ -1411,6 +1423,22 @@ void tst_QTextCursor::editBlocksDuringRemove()
QVERIFY(doc->toPlainText().isEmpty());
}
+void tst_QTextCursor::selectAllDuringRemove()
+{
+ CursorListener listener(&cursor);
+
+ cursor.insertText("Hello World");
+ cursor.movePosition(QTextCursor::End);
+
+ connect(doc, SIGNAL(contentsChanged()), &listener, SLOT(selectAllContents()));
+ listener.recordingCount = 0;
+ QTextCursor localCursor = cursor;
+ localCursor.deletePreviousChar();
+
+ QCOMPARE(listener.lastRecordedPosition, 10);
+ QCOMPARE(listener.lastRecordedAnchor, 0);
+}
+
void tst_QTextCursor::update_data()
{
QTest::addColumn<QString>("text");