tst_QHeaderView: fix defaultSectionSizeTest() on High-DPI screens

tst_QHeaderView::defaultSectionSizeTest() fails on High-DPI screens
because the default minimum section size is greater than the values used
for testing the header sizes. Therefore the test will fail.
Fix it by explicitly setting the minimum header size to something
smaller than the test values.
Also add a debug line to output the default minimum section sizes so
other failures due to this problem can be debugged better.

Fixes: QTBUG-73309
Change-Id: I257f341cef9381f140aa4d4f68376c5edadc39cc
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Christian Ehrlicher 2019-01-30 17:35:48 +01:00
parent 850c922036
commit d726ccb83c

View File

@ -442,7 +442,13 @@ tst_QHeaderView::tst_QHeaderView()
void tst_QHeaderView::initTestCase()
{
m_tableview = new QTableView();
m_tableview = new QTableView;
qDebug().noquote().nospace()
<< "default min section size is "
<< QString::number(m_tableview->verticalHeader()->minimumSectionSize())
<< QLatin1Char('/')
<< m_tableview->horizontalHeader()->minimumSectionSize()
<< " (v/h)";
}
void tst_QHeaderView::cleanupTestCase()
@ -1840,6 +1846,7 @@ void tst_QHeaderView::defaultSectionSizeTest()
// Setup
QTableView qtv;
QHeaderView *hv = qtv.verticalHeader();
hv->setMinimumSectionSize(10);
hv->setDefaultSectionSize(99); // Set it to a value different from defaultSize.
QStandardItemModel amodel(4, 4);
qtv.setModel(&amodel);