diff options
author | axis <qt-info@nokia.com> | 2009-06-02 08:14:04 (GMT) |
---|---|---|
committer | axis <qt-info@nokia.com> | 2009-06-02 08:14:04 (GMT) |
commit | 3c594257c4aedf113de92c5888e74f676ba87385 (patch) | |
tree | e309c7502e13f552203b509494a20792125fed29 /tests/auto/qtreeview | |
parent | 539989f41316329e7aba69ba97e1579eed6036e6 (diff) | |
parent | 0ff7b68f2e3f184d809cf6fd13ff930efa493e9f (diff) | |
download | Qt-3c594257c4aedf113de92c5888e74f676ba87385.zip Qt-3c594257c4aedf113de92c5888e74f676ba87385.tar.gz Qt-3c594257c4aedf113de92c5888e74f676ba87385.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
configure.exe
examples/itemviews/puzzle/puzzle.pro
examples/qtconcurrent/imagescaling/imagescaling.pro
examples/widgets/movie/movie.pro
tools/configure/configureapp.cpp
Will rebuild configure.exe in next commit.
Diffstat (limited to 'tests/auto/qtreeview')
-rw-r--r-- | tests/auto/qtreeview/tst_qtreeview.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp index 3612f2e..e7d548f 100644 --- a/tests/auto/qtreeview/tst_qtreeview.cpp +++ b/tests/auto/qtreeview/tst_qtreeview.cpp @@ -229,6 +229,7 @@ private slots: void task238873_avoidAutoReopening(); void task244304_clickOnDecoration(); void task246536_scrollbarsNotWorking(); + void task254234_proxySort(); }; class QtTestModel: public QAbstractItemModel @@ -2503,7 +2504,6 @@ void tst_QTreeView::sortByColumn() QCOMPARE(view.header()->sortIndicatorSection(), 0); QCOMPARE(view.model()->data(view.model()->index(0,0)).toString(), QString::fromLatin1("a")); QCOMPARE(view.model()->data(view.model()->index(1,0)).toString(), QString::fromLatin1("b")); - } /* @@ -3282,5 +3282,32 @@ void tst_QTreeView::task246536_scrollbarsNotWorking() QVERIFY(o.count > 0); } +void tst_QTreeView::task254234_proxySort() +{ + //based on tst_QTreeView::sortByColumn + // it used not to work when setting the source of a proxy after enabling sorting + QTreeView view; + QStandardItemModel model(4,2); + model.setItem(0,0,new QStandardItem("b")); + model.setItem(1,0,new QStandardItem("d")); + model.setItem(2,0,new QStandardItem("c")); + model.setItem(3,0,new QStandardItem("a")); + model.setItem(0,1,new QStandardItem("e")); + model.setItem(1,1,new QStandardItem("g")); + model.setItem(2,1,new QStandardItem("h")); + model.setItem(3,1,new QStandardItem("f")); + + view.sortByColumn(1); + view.setSortingEnabled(true); + + QSortFilterProxyModel proxy; + proxy.setDynamicSortFilter(true); + view.setModel(&proxy); + proxy.setSourceModel(&model); + QCOMPARE(view.header()->sortIndicatorSection(), 1); + QCOMPARE(view.model()->data(view.model()->index(0,1)).toString(), QString::fromLatin1("h")); + QCOMPARE(view.model()->data(view.model()->index(1,1)).toString(), QString::fromLatin1("g")); +} + QTEST_MAIN(tst_QTreeView) #include "tst_qtreeview.moc" |