summaryrefslogtreecommitdiffstats
path: root/tests/auto/qtreeview/tst_qtreeview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/qtreeview/tst_qtreeview.cpp')
-rw-r--r--tests/auto/qtreeview/tst_qtreeview.cpp43
1 files changed, 43 insertions, 0 deletions
diff --git a/tests/auto/qtreeview/tst_qtreeview.cpp b/tests/auto/qtreeview/tst_qtreeview.cpp
index c0747a8..07a5a7d 100644
--- a/tests/auto/qtreeview/tst_qtreeview.cpp
+++ b/tests/auto/qtreeview/tst_qtreeview.cpp
@@ -245,6 +245,7 @@ private slots:
void taskQTBUG_9216_setSizeAndUniformRowHeightsWrongRepaint();
void taskQTBUG_11466_keyboardNavigationRegression();
void taskQTBUG_13567_removeLastItemRegression();
+ void taskQTBUG_25333_adjustViewOptionsForIndex();
};
class QtTestModel: public QAbstractItemModel
@@ -3038,6 +3039,7 @@ void tst_QTreeView::styleOptionViewItem()
// Test the rendering to pixmap before painting the widget.
// The rendering to pixmap should not depend on having been
// painted already yet.
+ delegate.count = 0;
QItemSelection sel(model.index(0,0), model.index(0,modelColumns-1));
QRect rect;
view.aiv_priv()->renderToPixmap(sel.indexes(), &rect);
@@ -4008,5 +4010,46 @@ void tst_QTreeView::taskQTBUG_13567_removeLastItemRegression()
CHECK_VISIBLE(198, 0);
}
+// From QTBUG-25333 (QTreeWidget drag crashes when there was a hidden item in tree)
+// The test passes simply if it doesn't crash, hence there are no calls
+// to QCOMPARE() or QVERIFY().
+// Note: define QT_BUILD_INTERNAL to run this test
+void tst_QTreeView::taskQTBUG_25333_adjustViewOptionsForIndex()
+{
+ PublicView view;
+ QStandardItemModel model;
+ QStandardItem *item1 = new QStandardItem("Item1");
+ QStandardItem *item2 = new QStandardItem("Item2");
+ QStandardItem *item3 = new QStandardItem("Item3");
+ QStandardItem *data1 = new QStandardItem("Data1");
+ QStandardItem *data2 = new QStandardItem("Data2");
+ QStandardItem *data3 = new QStandardItem("Data3");
+
+ // Create a treeview
+ model.appendRow(QList<QStandardItem*>() << item1 << data1 );
+ model.appendRow(QList<QStandardItem*>() << item2 << data2 );
+ model.appendRow(QList<QStandardItem*>() << item3 << data3 );
+
+ view.setModel(&model);
+
+ // Hide a row
+ view.setRowHidden(1, QModelIndex(), true);
+ view.expandAll();
+
+ view.show();
+
+#ifdef QT_BUILD_INTERNAL
+ {
+ QStyleOptionViewItemV4 option;
+
+ view.aiv_priv()->adjustViewOptionsForIndex(&option, model.indexFromItem(item1));
+
+ view.aiv_priv()->adjustViewOptionsForIndex(&option, model.indexFromItem(item3));
+ }
+#endif
+
+}
+
+
QTEST_MAIN(tst_QTreeView)
#include "tst_qtreeview.moc"