diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2010-04-14 00:19:53 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2010-04-14 00:19:53 (GMT) |
commit | fde57b83333571aae33a660c16169a23ed96e6dd (patch) | |
tree | d2a9d930668ac9a63c0e242651ac2e8c093e9d1d /tests/auto/declarative | |
parent | 3905f8a0801b0160bae3f6947678c4156d96e5dc (diff) | |
parent | 532c21c7fc0a4075fe691507ec17b3dea7e3c043 (diff) | |
download | Qt-fde57b83333571aae33a660c16169a23ed96e6dd.zip Qt-fde57b83333571aae33a660c16169a23ed96e6dd.tar.gz Qt-fde57b83333571aae33a660c16169a23ed96e6dd.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7
Diffstat (limited to 'tests/auto/declarative')
9 files changed, 100 insertions, 26 deletions
diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 3e5c0ae..dfcc9c0 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -90,6 +90,12 @@ tst_examples::tst_examples() excludedDirs << "examples/declarative/plugins"; excludedDirs << "examples/declarative/proxywidgets"; excludedDirs << "examples/declarative/gestures"; + +#ifdef QT_NO_WEBKIT + excludedDirs << "examples/declarative/webview"; + excludedDirs << "demos/declarative/webbrowser"; +#endif + #ifdef QT_NO_XMLPATTERNS excludedDirs << "examples/declarative/xmldata"; excludedDirs << "demos/declarative/twitter"; diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp index 39ce9eb..501debd 100644 --- a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -141,12 +141,12 @@ void tst_qdeclarativeanimatedimage::remote() QFETCH(QString, fileName); QFETCH(bool, paused); - TestHTTPServer server(14445); + TestHTTPServer server(14449); QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14445/" + fileName)); + QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14449/" + fileName)); TRY_WAIT(component.isReady()); QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp index 8aeba6d..90d2412 100644 --- a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -55,8 +55,8 @@ #include "../shared/testhttpserver.h" -#define SERVER_PORT 14445 -#define SERVER_ADDR "http://127.0.0.1:14445" +#define SERVER_PORT 14446 +#define SERVER_ADDR "http://127.0.0.1:14446" #define TRY_WAIT(expr) \ do { \ @@ -148,7 +148,7 @@ void tst_qdeclarativeborderimage::imageSource() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); QVERIFY(obj != 0); - + if (remote) TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); @@ -267,14 +267,14 @@ void tst_qdeclarativeborderimage::sciSource() component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); QVERIFY(obj != 0); - + if (remote) TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); - + QCOMPARE(obj->source(), remote ? source : QUrl(source)); QCOMPARE(obj->width(), 300.); QCOMPARE(obj->height(), 300.); - + if (valid) { TRY_WAIT(obj->status() == QDeclarativeBorderImage::Ready); QCOMPARE(obj->border()->left(), 10); @@ -342,8 +342,8 @@ void tst_qdeclarativeborderimage::pendingRemoteRequest_data() { QTest::addColumn<QString>("source"); - QTest::newRow("png file") << "http://no-such-qt-server-like-this/none.png"; - QTest::newRow("sci file") << "http://no-such-qt-server-like-this/none.sci"; + QTest::newRow("png file") << "http://localhost/none.png"; + QTest::newRow("sci file") << "http://localhost/none.sci"; } QTEST_MAIN(tst_qdeclarativeborderimage) diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp index 375e801..859da46 100644 --- a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -45,7 +45,7 @@ #include "../../../shared/util.h" #include "../shared/testhttpserver.h" -#define SERVER_PORT 14445 +#define SERVER_PORT 14448 class tst_qdeclarativefontloader : public QObject @@ -134,7 +134,7 @@ void tst_qdeclarativefontloader::failLocalFont() void tst_qdeclarativefontloader::webFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/tarzeau_ocr_a.ttf\" }"; + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14448/tarzeau_ocr_a.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -150,7 +150,7 @@ void tst_qdeclarativefontloader::redirWebFont() { server.addRedirect("olddir/oldname.ttf","../tarzeau_ocr_a.ttf"); - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/olddir/oldname.ttf\" }"; + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14448/olddir/oldname.ttf\" }"; QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); @@ -164,8 +164,8 @@ void tst_qdeclarativefontloader::redirWebFont() void tst_qdeclarativefontloader::failWebFont() { - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14445/nonexist.ttf\" }"; - QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14445/nonexist.ttf\" ) "); + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://localhost:14448/nonexist.ttf\" }"; + QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://localhost:14448/nonexist.ttf\" ) "); QDeclarativeComponent component(&engine); component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index ec9f4ec..ecbcfc3 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -54,8 +54,8 @@ #include "../shared/testhttpserver.h" -#define SERVER_PORT 14445 -#define SERVER_ADDR "http://127.0.0.1:14445" +#define SERVER_PORT 14451 +#define SERVER_ADDR "http://127.0.0.1:14451" #define TRY_WAIT(expr) \ do { \ diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp index c033c48..373842b 100644 --- a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -1307,7 +1307,7 @@ void tst_qdeclarativelanguage::basicRemote_data() QTest::addColumn<QString>("type"); QTest::addColumn<QString>("error"); - QString serverdir = "http://127.0.0.1:14445/qtest/declarative/qmllanguage/"; + QString serverdir = "http://127.0.0.1:14447/qtest/declarative/qmllanguage/"; QTest::newRow("no need for qmldir") << QUrl(serverdir+"Test.qml") << "" << ""; QTest::newRow("need qmldir") << QUrl(serverdir+"TestLocal.qml") << "" << ""; @@ -1319,7 +1319,7 @@ void tst_qdeclarativelanguage::basicRemote() QFETCH(QString, type); QFETCH(QString, error); - TestHTTPServer server(14445); + TestHTTPServer server(14447); server.serveDirectory(SRCDIR); QDeclarativeComponent component(&engine, url); @@ -1341,7 +1341,7 @@ void tst_qdeclarativelanguage::importsRemote_data() QTest::addColumn<QString>("type"); QTest::addColumn<QString>("error"); - QString serverdir = "http://127.0.0.1:14445/qtest/declarative/qmllanguage"; + QString serverdir = "http://127.0.0.1:14447/qtest/declarative/qmllanguage"; QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QDeclarativeRectangle" << ""; @@ -1363,7 +1363,7 @@ void tst_qdeclarativelanguage::importsRemote() QFETCH(QString, type); QFETCH(QString, error); - TestHTTPServer server(14445); + TestHTTPServer server(14447); server.serveDirectory(SRCDIR); testType(qml,type,error); diff --git a/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml new file mode 100644 index 0000000..6fc41fa --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/strictlyenforcerange.qml @@ -0,0 +1,29 @@ +import Qt 4.7 + +ListView { + id: list + objectName: "list" + width: 320 + height: 480 + + function fillModel() { + list.model.append({"col": "red"}); + list.currentIndex = list.count-1 + list.model.append({"col": "blue"}); + list.currentIndex = list.count-1 + list.model.append({"col": "green"}); + list.currentIndex = list.count-1 + } + + model: ListModel { id: listModel } // empty model + delegate: Rectangle { id: wrapper; objectName: "wrapper"; color: col; width: 300; height: 400 } + orientation: "Horizontal" + snapMode: "SnapToItem" + cacheBuffer: 1000 + + preferredHighlightBegin: 10 + preferredHighlightEnd: 10 + + highlightRangeMode: "StrictlyEnforceRange" + focus: true +} diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index e76da42..46d90aa 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -89,6 +89,7 @@ private slots: void propertyChanges(); void componentChanges(); void modelChanges(); + void QTBUG_9791(); private: template <class T> void items(); @@ -1425,6 +1426,44 @@ void tst_QDeclarativeListView::modelChanges() delete canvas; } +void tst_QDeclarativeListView::QTBUG_9791() +{ + QDeclarativeView *canvas = createView(); + + QDeclarativeContext *ctxt = canvas->rootContext(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/strictlyenforcerange.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = qobject_cast<QDeclarativeListView*>(canvas->rootObject()); + QTRY_VERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QTRY_VERIFY(viewport != 0); + QTRY_VERIFY(listview->delegate() != 0); + QTRY_VERIFY(listview->model() != 0); + + QMetaObject::invokeMethod(listview, "fillModel"); + qApp->processEvents(); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + QVERIFY(itemCount == 3); + + for (int i = 0; i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QTRY_VERIFY(item); + QTRY_COMPARE(item->x(), i*300.0); + } + + // check that view is positioned correctly + QTRY_COMPARE(listview->contentX(), 590.0); + + delete canvas; +} + + void tst_QDeclarativeListView::qListModelInterface_items() { items<TestModel>(); diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp index 20e709d..ca850a6 100644 --- a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -48,7 +48,7 @@ #include <private/qdeclarativeloader_p.h> #include "testhttpserver.h" -#define SERVER_PORT 14445 +#define SERVER_PORT 14450 inline QUrl TEST_FILE(const QString &filename) { @@ -412,7 +412,7 @@ void tst_QDeclarativeLoader::networkRequestUrl() server.serveDirectory(SRCDIR "/data"); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/Rect120x60.qml\" }"), QUrl(SRCDIR "/dummy.qml")); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/Rect120x60.qml\" }"), QUrl(SRCDIR "/dummy.qml")); if (component.isError()) qDebug() << component.errors(); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); @@ -437,7 +437,7 @@ void tst_QDeclarativeLoader::networkComponent() QDeclarativeComponent component(&engine); component.setData(QByteArray( "import Qt 4.6\n" - "import \"http://127.0.0.1:14445/\" as NW\n" + "import \"http://127.0.0.1:14450/\" as NW\n" "Item {\n" " Component { id: comp; NW.SlowRect {} }\n" " Loader { sourceComponent: comp } }") @@ -465,10 +465,10 @@ void tst_QDeclarativeLoader::failNetworkRequest() QVERIFY(server.isValid()); server.serveDirectory(SRCDIR "/data"); - QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14445/IDontExist.qml) "); + QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14450/IDontExist.qml) "); QDeclarativeComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/IDontExist.qml\" }"), QUrl("http://127.0.0.1:14445/dummy.qml")); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14450/IDontExist.qml\" }"), QUrl("http://127.0.0.1:14450/dummy.qml")); QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); QVERIFY(loader != 0); |