Fix tst_qicon for fractional dpr

Add rounding one place, and skip addFile for now since
the assumption about rounding dpr up no longer applies.

Pick-to: 6.1
Change-Id: I0a84dfabb218acf42cb3816ba50ef899c8762523
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
bb10
Allan Sandfeld Jensen 2021-04-07 11:31:10 +02:00
parent 28b75584c8
commit b1f956106c
1 changed files with 5 additions and 2 deletions

View File

@ -145,8 +145,8 @@ void tst_QIcon::actualSize()
auto expectedDeviceSize = [](QSize deviceIndependentExpectedSize, QSize maxSourceImageSize) -> QSize {
qreal dpr = qApp->devicePixelRatio();
return QSize(qMin(int(deviceIndependentExpectedSize.width() * dpr), maxSourceImageSize.width()),
qMin(int(deviceIndependentExpectedSize.height() * dpr), maxSourceImageSize.height()));
return QSize(qMin(qRound(deviceIndependentExpectedSize.width() * dpr), maxSourceImageSize.width()),
qMin(qRound(deviceIndependentExpectedSize.height() * dpr), maxSourceImageSize.height()));
};
QSize sourceSize = QImage(source).size();
@ -411,6 +411,9 @@ void tst_QIcon::detach()
void tst_QIcon::addFile()
{
if (qApp->devicePixelRatio() != int(qApp->devicePixelRatio()))
QSKIP("Test is not ready for non integer devicePixelRatio", QTest::SkipAll);
QIcon icon;
icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-open-16.png"));
icon.addFile(QLatin1String(":/styles/commonstyle/images/standardbutton-open-32.png"));