diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2021-04-07 11:31:10 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-20 22:00:15 +0000 |
commit | 64dcf17f94e4c2b1fd9cd10f88e7d53b3f843905 (patch) | |
tree | f43908d1a02e91005c7047559324924f71619c47 /tests | |
parent | ac55ee919abf0e8248945fc5b9147922baa0c576 (diff) |
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.
Change-Id: I0a84dfabb218acf42cb3816ba50ef899c8762523
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
(cherry picked from commit b1f956106cf0fc41eb12d76bb3625fae7687e5f3)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/gui/image/qicon/tst_qicon.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/auto/gui/image/qicon/tst_qicon.cpp b/tests/auto/gui/image/qicon/tst_qicon.cpp index 5130351c36..7bd7fe3feb 100644 --- a/tests/auto/gui/image/qicon/tst_qicon.cpp +++ b/tests/auto/gui/image/qicon/tst_qicon.cpp @@ -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")); |