summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtreeview
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-05-27 21:04:41 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-05-27 21:04:41 (GMT)
commitfcfdccc03b6dd26a82e87a6b6a0ca48d67f78cf6 (patch)
tree2cdd417bc0be39b12674f33052462d19d9e38ef9 /tests/auto/qtreeview
parent7b1f8c542bc9f41408f0a54b853d75d0c09a2775 (diff)
parentd0bc0a26f8ac4c2f02819c262b8aa7c3dd1cad3b (diff)
downloadQt-fcfdccc03b6dd26a82e87a6b6a0ca48d67f78cf6.zip
Qt-fcfdccc03b6dd26a82e87a6b6a0ca48d67f78cf6.tar.gz
Qt-fcfdccc03b6dd26a82e87a6b6a0ca48d67f78cf6.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts: tests/auto/qtreeview/tst_qtreeview.cpp
Diffstat (limited to 'tests/auto/qtreeview')
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp30
1 files changed, 28 insertions, 2 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index c4517d6..2ef76a4 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -227,6 +227,7 @@ private slots:
void task246536_scrollbarsNotWorking();
void task250683_wrongSectionSize();
void task239271_addRowsWithFirstColumnHidden();
+ void task254234_proxySort();
};
class QtTestModel: public QAbstractItemModel
@@ -2498,7 +2499,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"));
-
}
/*
@@ -3346,7 +3346,6 @@ void tst_QTreeView::task246536_scrollbarsNotWorking()
QVERIFY(o.count > 0);
}
-
void tst_QTreeView::task250683_wrongSectionSize()
{
QDirModel model;
@@ -3400,5 +3399,32 @@ void tst_QTreeView::task239271_addRowsWithFirstColumnHidden()
QVERIFY(delegate.paintedIndexes.contains(sub11.index()));
}
+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"