diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-27 02:20:32 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-08-27 02:20:32 (GMT) |
commit | 06f2a6982680beb5d72321b690af1ac9df5afd95 (patch) | |
tree | 00ef85308d2e6eb7e564e72ab7647590bea86110 /tests | |
parent | a5ac66200f77fd09d4c4ee5af3a9380efce871ad (diff) | |
parent | f2245941f0d1bc8244aa0d88437f0a42c9bba1fc (diff) | |
download | Qt-06f2a6982680beb5d72321b690af1ac9df5afd95.zip Qt-06f2a6982680beb5d72321b690af1ac9df5afd95.tar.gz Qt-06f2a6982680beb5d72321b690af1ac9df5afd95.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml:
Update example screenshot in doc.
Handle layoutChanged() properly in QML views.
Fix ListView and GridView tests following off-by-one fixes.
Revert 4bc81bb1cb3cd4a0a3fe071e00556124e770d7ac
Fix off-by-one at end when views scroll to keep currentItem visible.
Make declarative examples a bit more qt-like.
Add quit buttons to declarative demos
ListView.view and GridView.view properties should not be writable.
Avoid Flickable view jumping when drag threashold is exceeded.
Fix ListView.view attached property with VisualItemModel
Remove dead code.
Add test for VisualItemModel layoutChanged() handling
Remove unused code.
Handle QAbstractItemModel layoutChanged() signal
Diffstat (limited to 'tests')
5 files changed, 58 insertions, 7 deletions
diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp index 1a28b71..896d69e 100644 --- a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -590,7 +590,7 @@ void tst_QDeclarativeGridView::currentIndex() QCOMPARE(gridview->currentIndex(), 35); QCOMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 35)); QCOMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); - QCOMPARE(gridview->contentY(), 399.0); + QCOMPARE(gridview->contentY(), 400.0); gridview->moveCurrentIndexRight(); QCOMPARE(gridview->currentIndex(), 36); @@ -629,7 +629,7 @@ void tst_QDeclarativeGridView::currentIndex() gridview->moveCurrentIndexLeft(); QCOMPARE(gridview->currentIndex(), model.count()-1); - QTRY_COMPARE(gridview->contentY(), 879.0); + QTRY_COMPARE(gridview->contentY(), 880.0); gridview->moveCurrentIndexRight(); QCOMPARE(gridview->currentIndex(), 0); diff --git a/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml b/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml index 66728d6..9ea5953 100644 --- a/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml @@ -13,17 +13,17 @@ Rectangle { objectName: "itemModel" Rectangle { objectName: "item1" - height: view.height; width: view.width; color: "#FFFEF0" + height: ListView.view.height; width: view.width; color: "#FFFEF0" Text { objectName: "text1"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } } Rectangle { objectName: "item2" - height: view.height; width: view.width; color: "#F0FFF7" + height: ListView.view.height; width: view.width; color: "#F0FFF7" Text { objectName: "text2"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } } Rectangle { objectName: "item3" - height: view.height; width: view.width; color: "#F4F0FF" + height: ListView.view.height; width: view.width; color: "#F4F0FF" Text { objectName: "text3"; text: "index: " + parent.VisualItemModel.index; font.bold: true; anchors.centerIn: parent } } } diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp index 9c24e03..bf4754d 100644 --- a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -979,7 +979,7 @@ void tst_QDeclarativeListView::currentIndex() // current item should be 20th item at startup // and current item should be in view QCOMPARE(listview->currentIndex(), 20); - QCOMPARE(listview->contentY(), 99.0); + QCOMPARE(listview->contentY(), 100.0); QCOMPARE(listview->currentItem(), findItem<QDeclarativeItem>(contentItem, "wrapper", 20)); QCOMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); @@ -1002,7 +1002,7 @@ void tst_QDeclarativeListView::currentIndex() listview->decrementCurrentIndex(); QCOMPARE(listview->currentIndex(), model.count()-1); - QTRY_COMPARE(listview->contentY(), 279.0); + QTRY_COMPARE(listview->contentY(), 280.0); listview->incrementCurrentIndex(); QCOMPARE(listview->currentIndex(), 0); @@ -1066,6 +1066,7 @@ void tst_QDeclarativeListView::itemList() QDeclarativeItem *item = findItem<QDeclarativeItem>(contentItem, "item1"); QTRY_VERIFY(item); QTRY_COMPARE(item->x(), 0.0); + QCOMPARE(item->height(), listview->height()); QDeclarativeText *text = findItem<QDeclarativeText>(contentItem, "text1"); QTRY_VERIFY(text); diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml new file mode 100644 index 0000000..a798f77 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/data/datalist.qml @@ -0,0 +1,15 @@ +import Qt 4.7 + +ListView { + width: 100 + height: 100 + anchors.fill: parent + model: myModel + delegate: Component { + Rectangle { + height: 25 + width: 100 + Text { objectName: "display"; text: display } + } + } +} diff --git a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp index e0f32ea..3cd786f 100644 --- a/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp +++ b/tests/auto/declarative/qdeclarativevisualdatamodel/tst_qdeclarativevisualdatamodel.cpp @@ -83,6 +83,7 @@ public: private slots: void rootIndex(); + void updateLayout(); void objectListModel(); private: @@ -155,6 +156,40 @@ void tst_qdeclarativevisualdatamodel::rootIndex() delete obj; } +void tst_qdeclarativevisualdatamodel::updateLayout() +{ + 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); + + QDeclarativeItem *contentItem = listview->contentItem(); + QVERIFY(contentItem != 0); + + QDeclarativeText *name = findItem<QDeclarativeText>(contentItem, "display", 0); + QCOMPARE(name->text(), QString("Row 1 Item")); + name = findItem<QDeclarativeText>(contentItem, "display", 1); + QCOMPARE(name->text(), QString("Row 2 Item")); + name = findItem<QDeclarativeText>(contentItem, "display", 2); + QCOMPARE(name->text(), QString("Row 3 Item")); + + model.invisibleRootItem()->sortChildren(0, Qt::DescendingOrder); + + name = findItem<QDeclarativeText>(contentItem, "display", 0); + QCOMPARE(name->text(), QString("Row 3 Item")); + name = findItem<QDeclarativeText>(contentItem, "display", 1); + QCOMPARE(name->text(), QString("Row 2 Item")); + name = findItem<QDeclarativeText>(contentItem, "display", 2); + QCOMPARE(name->text(), QString("Row 1 Item")); +} + void tst_qdeclarativevisualdatamodel::objectListModel() { QDeclarativeView view; |