diff options
author | Albert Astals Cid <albert.astals@canonical.com> | 2013-10-16 17:20:59 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-10-21 09:09:15 +0200 |
commit | 9bbb073592989565ec407c19ec2492dfba9317c4 (patch) | |
tree | 255b3de8d83da47c4f71f1c0fb514e140f4f37e8 /tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | |
parent | b93ddb95a74fff4bc61073b6b04e9dd7a7dc7f36 (diff) |
Reset on model layout changed
Otherwise the next dataChanged from the model may not be received
Change-Id: I16b859d92fdb1823c4a56c297d4451abe438fbb1
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'tests/auto/quick/qquicklistview/tst_qquicklistview.cpp')
-rw-r--r-- | tests/auto/quick/qquicklistview/tst_qquicklistview.cpp | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp index 5b1dfc7e83..f62151c2d8 100644 --- a/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp +++ b/tests/auto/quick/qquicklistview/tst_qquicklistview.cpp @@ -54,6 +54,7 @@ #include "../shared/viewtestutil.h" #include "../shared/visualtestutil.h" #include "incrementalmodel.h" +#include "proxytestinnermodel.h" #include <math.h> Q_DECLARE_METATYPE(Qt::LayoutDirection) @@ -210,6 +211,7 @@ private slots: void accessEmptyCurrentItem_QTBUG_30227(); void delayedChanges_QTBUG_30555(); void outsideViewportChangeNotAffectingView(); + void testProxyModelChangedAfterMove(); private: template <class T> void items(const QUrl &source); @@ -319,6 +321,9 @@ void tst_QQuickListView::init() m_view = 0; } #endif + qmlRegisterType<QAbstractItemModel>(); + qmlRegisterType<ProxyTestInnerModel>("Proxy", 1, 0, "ProxyTestInnerModel"); + qmlRegisterType<QSortFilterProxyModel>("Proxy", 1, 0, "QSortFilterProxyModel"); } void tst_QQuickListView::cleanupTestCase() @@ -6938,6 +6943,23 @@ void tst_QQuickListView::outsideViewportChangeNotAffectingView() delete window; } +void tst_QQuickListView::testProxyModelChangedAfterMove() +{ + QQuickView *window = createView(); + QQuickViewTestUtil::moveMouseAway(window); + window->setSource(testFileUrl("proxytest.qml")); + + QQuickListView *listview = window->rootObject()->findChild<QQuickListView*>(); + QTRY_VERIFY(listview != 0); + + window->show(); + QVERIFY(QTest::qWaitForWindowExposed(window)); + + QTRY_COMPARE(listview->count(), 3); + + delete window; +} + QTEST_MAIN(tst_QQuickListView) #include "tst_qquicklistview.moc" |