QSortFilterProxyModel test: fix failing appearsAndSort
Testcase appearsAndSort failed when running the complete testcase but
not as single test. More irritating was the fact that the error was in
QAbstractItemModelTester::headerDataChanged() but the affected test did
not change any header nor does it use the blamed model...
The reason for this is, that QAbstractProxyModel emits a queued
headerDataChanged signal when the header item count changes and
therefore only evaluated when the event loop is run.
Fix it by calling processEvents() after the rowCount change in
filterColumns().
Amends 72e802f3b0
Pick-to: 6.6 6.5
Change-Id: I10cb5aa9c40a6925113cc9c23616774bf15784a4
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
e115d28ce7
commit
cdc608359a
@ -62,6 +62,7 @@ void tst_QSortFilterProxyModel::cleanup()
|
||||
m_proxy->sort(-1, Qt::AscendingOrder);
|
||||
m_model->clear();
|
||||
m_model->insertColumns(0, 1);
|
||||
QCoreApplication::processEvents(); // cleanup possibly queued events
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1100,7 +1101,6 @@ void tst_QSortFilterProxyModel::filterColumns_data()
|
||||
<< "bravo"
|
||||
<< "lima")
|
||||
<< true;
|
||||
|
||||
QTest::newRow("some") << "lie"
|
||||
<< (QStringList()
|
||||
<< "charlie"
|
||||
@ -1126,6 +1126,7 @@ void tst_QSortFilterProxyModel::filterColumns()
|
||||
// prepare model
|
||||
m_model->setColumnCount(initial.size());
|
||||
m_model->setRowCount(1);
|
||||
QCoreApplication::processEvents(); // QAbstractProxyModel queues the headerDataChanged() signal
|
||||
QCOMPARE(m_model->columnCount(QModelIndex()), initial.size());
|
||||
QCOMPARE(m_model->rowCount(QModelIndex()), 1);
|
||||
// set data
|
||||
|
Loading…
Reference in New Issue
Block a user