diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2009-10-29 14:44:08 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2009-10-29 14:44:08 (GMT) |
commit | 02d815b4bd497a5c7f07330576a5e3c3da3f46ab (patch) | |
tree | 952187386613641bb1a51df67d2077dfc97bac9b /tests/auto | |
parent | 95ddf23a0c9e0120d55d7104480d78a64fa8cc77 (diff) | |
download | Qt-02d815b4bd497a5c7f07330576a5e3c3da3f46ab.zip Qt-02d815b4bd497a5c7f07330576a5e3c3da3f46ab.tar.gz Qt-02d815b4bd497a5c7f07330576a5e3c3da3f46ab.tar.bz2 |
QListView: make sure we relayout items when data changes in the model
Task-number: QTBUG-633
Reviewed-by: ogoffart
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qlistview/tst_qlistview.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/auto/qlistview/tst_qlistview.cpp b/tests/auto/qlistview/tst_qlistview.cpp index 65ab12d..727e6d3 100644 --- a/tests/auto/qlistview/tst_qlistview.cpp +++ b/tests/auto/qlistview/tst_qlistview.cpp @@ -119,6 +119,7 @@ private slots: void task262152_setModelColumnNavigate(); void taskQTBUG_2233_scrollHiddenItems_data(); void taskQTBUG_2233_scrollHiddenItems(); + void taskQTBUG_633_changeModelData(); }; // Testing get/set functions @@ -1832,5 +1833,25 @@ void tst_QListView::taskQTBUG_2233_scrollHiddenItems() } } +void tst_QListView::taskQTBUG_633_changeModelData() +{ + QListView view; + view.setFlow(QListView::LeftToRight); + QStandardItemModel model(5,1); + for (int i = 0; i < model.rowCount(); ++i) { + model.setData( model.index(i, 0), QString::number(i)); + } + + view.setModel(&model); + view.show(); + QTest::qWaitForWindowShown(&view); + model.setData( model.index(1, 0), QLatin1String("long long text")); + QTest::qWait(100); //leave time for relayouting the items + QRect rectLongText = view.visualRect(model.index(1,0)); + QRect rect2 = view.visualRect(model.index(2,0)); + QVERIFY( ! rectLongText.intersects(rect2) ); +} + + QTEST_MAIN(tst_QListView) #include "tst_qlistview.moc" |