diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2010-11-16 06:09:03 (GMT) |
---|---|---|
committer | Alan Alpert <alan.alpert@nokia.com> | 2010-11-16 06:09:03 (GMT) |
commit | 0aba1250db9ac414fbe4b0fed9fcba713bf5a619 (patch) | |
tree | 9df51e80e3989d83d05f8005921a71a035deaee1 /tests | |
parent | df1a50f6bd25c0955c7d8e4b6b89a7b7957b69f6 (diff) | |
parent | 6cf397f7ac35a058096528a7ad8bfaf623b30747 (diff) | |
download | Qt-0aba1250db9ac414fbe4b0fed9fcba713bf5a619.zip Qt-0aba1250db9ac414fbe4b0fed9fcba713bf5a619.tar.gz Qt-0aba1250db9ac414fbe4b0fed9fcba713bf5a619.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests')
4 files changed, 50 insertions, 2 deletions
diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 3dd69da..652404c 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -1566,7 +1566,7 @@ void tst_qdeclarativeecmascript::callQtInvokables() o.reset(); { - QString expected = "MyInvokableObject(0x" + QString::number((intptr_t)&o, 16) + ")"; + QString expected = "MyInvokableObject(0x" + QString::number((quintptr)&o, 16) + ")"; QCOMPARE(engine->evaluate("object.method_QString(object)").isUndefined(), true); QCOMPARE(o.error(), false); QCOMPARE(o.invoked(), 11); diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index 0aad099..29a065c 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -121,6 +121,7 @@ private slots: void objectListModel(); void singleRole(); void modelProperties(); + void noDelegate(); private: QDeclarativeEngine engine; @@ -472,6 +473,29 @@ void tst_qdeclarativevisualdatamodel::modelProperties() //### should also test QStringList and QVariantList } +void tst_qdeclarativevisualdatamodel::noDelegate() +{ + QDeclarativeView view; + + QStandardItemModel model; + initStandardTreeModel(&model); + + view.rootContext()->setContextProperty("myModel", &model); + + view.setSource(QUrl::fromLocalFile(SRCDIR "/data/datalist.qml")); + + QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(view.rootObject()); + QVERIFY(listview != 0); + + QDeclarativeVisualDataModel *vdm = listview->findChild<QDeclarativeVisualDataModel*>("visualModel"); + QVERIFY(vdm != 0); + QCOMPARE(vdm->count(), 3); + + vdm->setDelegate(0); + QCOMPARE(vdm->count(), 0); +} + + template<typename T> T *tst_qdeclarativevisualdatamodel::findItem(QGraphicsObject *parent, const QString &objectName, int index) { diff --git a/tests/auto/gestures/tst_gestures.cpp b/tests/auto/gestures/tst_gestures.cpp index 667cdd3..ee19125 100644 --- a/tests/auto/gestures/tst_gestures.cpp +++ b/tests/auto/gestures/tst_gestures.cpp @@ -1486,13 +1486,15 @@ void tst_Gestures::ungrabGesture() // a method on QWidget QVERIFY(customGestureA.data() != customGestureB.data()); a->ungrabGesture(CustomGesture::GestureType); - QVERIFY(customGestureA.isNull()); + //We changed the deletion of Gestures to lazy during QT-4022, so we can't ensure the QGesture is deleted until now QVERIFY(!customGestureB.isNull()); a->gestures.clear(); a->reset(); // send again to 'b' and make sure a never gets it. sendCustomGesture(&event, b); + //After all Gestures are processed in the QGestureManager, we can ensure the QGesture is now deleted + QVERIFY(customGestureA.isNull()); QCOMPARE(a->gestureEventsReceived, 0); QCOMPARE(a->gestureOverrideEventsReceived, 0); } diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index a986438..41b3e0a 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -301,6 +301,8 @@ private Q_SLOTS: void httpWithNoCredentialUsage(); + void qtbug15311doubleContentLength(); + // NOTE: This test must be last! void parentingRepliesToTheApp(); }; @@ -4724,6 +4726,26 @@ void tst_QNetworkReply::httpWithNoCredentialUsage() QCOMPARE(reply->error(), QNetworkReply::AuthenticationRequiredError); } +void tst_QNetworkReply::qtbug15311doubleContentLength() +{ + QByteArray response("HTTP/1.0 200 OK\r\nContent-Length: 3\r\nServer: bogus\r\nContent-Length: 3\r\n\r\nABC"); + MiniHttpServer server(response); + server.doClose = true; + + QNetworkRequest request(QUrl("http://localhost:" + QString::number(server.serverPort()))); + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(reply->isFinished()); + QCOMPARE(reply->error(), QNetworkReply::NoError); + QCOMPARE(reply->size(), qint64(3)); + QCOMPARE(reply->header(QNetworkRequest::ContentLengthHeader).toLongLong(), qint64(3)); + QCOMPARE(reply->rawHeader("Content-length"), QByteArray("3, 3")); + QCOMPARE(reply->readAll(), QByteArray("ABC")); +} + // NOTE: This test must be last testcase in tst_qnetworkreply! |