Verify that QFileIconProvider returns valid pixmaps

Extend and rename the pixmap() crash test to also verify
that a non-null pixmap is returned.

Change-Id: Ia972c4f705724cfa1394521a2dfd87451d9c5d64
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Morten Johan Sørvig 2021-02-16 14:59:27 +01:00
parent 462410a08b
commit 700d1037aa

View File

@ -47,7 +47,7 @@ private slots:
void type_data();
void type();
void taskQTBUG_46755_QFileIconEngine_crash();
void iconPixmaps();
};
void tst_QFileIconProvider::qfileiconprovider()
@ -129,14 +129,14 @@ static QIcon getIcon()
return fip.icon(QFileInfo(QDir::currentPath()));
}
void tst_QFileIconProvider::taskQTBUG_46755_QFileIconEngine_crash()
void tst_QFileIconProvider::iconPixmaps()
{
const QIcon &icon = getIcon();
const auto sizes = icon.availableSizes();
for (const QSize &size : sizes)
icon.pixmap(size);
// No crash, all good.
for (const QSize &size : sizes) {
QPixmap pixmap = icon.pixmap(size);
QVERIFY(!pixmap.isNull());
}
}
QTEST_MAIN(tst_QFileIconProvider)