aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@qt.io>2018-04-24 10:34:05 +0200
committerLars Knoll <lars.knoll@qt.io>2018-04-26 21:37:14 +0000
commit35ecc40091455631c5f3b6b8724dcdab91068411 (patch)
tree2a98ea8e635f2846c1894d7f4b22738d944505f1 /tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
parenta1e5364b492610adf0636fefa3fc400558e211b6 (diff)
Fix recurring test failure on some Linux systems
Fonts created through Qt.font(), are derived from the application font by setting different values. Construct the font to compare against in the same way, otherwise we end up with test failures, if the system font sets other properties such as the style hint. Change-Id: I0b3ea88a3553bbb52a523466363db5cb3fabf1f0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'tests/auto/qml/qqmlqt/tst_qqmlqt.cpp')
-rw-r--r--tests/auto/qml/qqmlqt/tst_qqmlqt.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
index b96eecafe8..2d8115e867 100644
--- a/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
+++ b/tests/auto/qml/qqmlqt/tst_qqmlqt.cpp
@@ -505,8 +505,14 @@ void tst_qqmlqt::font()
QObject *object = component.create();
QVERIFY(object != nullptr);
- QCOMPARE(qvariant_cast<QFont>(object->property("test1")), QFont("Arial", 22));
- QCOMPARE(qvariant_cast<QFont>(object->property("test2")), QFont("Arial", 20, QFont::DemiBold, true));
+ QFont f;
+ f.setFamily("Arial");
+ f.setPointSize(22);
+ QCOMPARE(qvariant_cast<QFont>(object->property("test1")), f);
+ f.setPointSize(20);
+ f.setWeight(QFont::DemiBold);
+ f.setItalic(true);
+ QCOMPARE(qvariant_cast<QFont>(object->property("test2")), f);
QCOMPARE(qvariant_cast<QFont>(object->property("test3")), QFont());
QCOMPARE(qvariant_cast<QFont>(object->property("test4")), QFont());