summaryrefslogtreecommitdiffstats
path: root/tests/auto/widgets/itemviews/qitemdelegate
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2019-07-11 17:17:13 +0200
committerAlexandru Croitor <alexandru.croitor@qt.io>2019-07-11 17:17:51 +0200
commit4dac45c9ee59ff6586d90d423654da91523ab679 (patch)
treecd4a4adf2cbc9e77bf86d2d11e71ec66afdf3be4 /tests/auto/widgets/itemviews/qitemdelegate
parent078cd61751aeaa310d35a3d596a21a36004a1a0f (diff)
parentf44850b5c3464cdda0ee9b1ee858d95f3ffaa3e2 (diff)
Merge remote-tracking branch 'origin/wip/qt6' into wip/cmake
Diffstat (limited to 'tests/auto/widgets/itemviews/qitemdelegate')
-rw-r--r--tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
index 7fd1822295..dc246c0ebf 100644
--- a/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
+++ b/tests/auto/widgets/itemviews/qitemdelegate/tst_qitemdelegate.cpp
@@ -26,6 +26,7 @@
**
****************************************************************************/
+#include "../../../shared/highdpi.h"
#include <QtTest/QtTest>
@@ -51,6 +52,8 @@
#include <QPlainTextEdit>
#include <QDialog>
+#include <qscreen.h>
+
#include <QtWidgets/private/qabstractitemdelegate_p.h>
Q_DECLARE_METATYPE(QAbstractItemDelegate::EndEditHint)
@@ -223,8 +226,8 @@ private slots:
void dateTextForRole_data();
void dateTextForRole();
-#ifdef QT_BUILD_INTERNAL
private:
+#ifdef QT_BUILD_INTERNAL
struct RoleDelegate : public QItemDelegate
{
QString textForRole(Qt::ItemDataRole role, const QVariant &value, const QLocale &locale)
@@ -234,6 +237,8 @@ private:
}
};
#endif
+
+ const int m_fuzz = int(QGuiApplication::primaryScreen()->devicePixelRatio());
};
@@ -286,8 +291,8 @@ void tst_QItemDelegate::textRectangle()
QFont font;
TestItemDelegate delegate;
QRect result = delegate.textRectangle(0, rect, font, text);
-
- QCOMPARE(result, expected);
+ QVERIFY2(HighDpi::fuzzyCompare(result, expected, m_fuzz),
+ HighDpi::msgRectMismatch(result, expected).constData());
}
void tst_QItemDelegate::sizeHint_data()