diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2021-04-11 15:21:41 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-04-12 11:38:18 +0000 |
commit | f783ab6049774888308e24bf6e4218a7035a4d12 (patch) | |
tree | 70328085ea8995193ae7cc15a52e29624e82bf78 /tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | |
parent | ce452b70e158461b021aa47faf5cce87964b6cf7 (diff) |
Fix warnings about lossy double/float conversion in tests
QColor operates on floats, not qreal or double, so explicitly use float
literals in test code.
Change-Id: I6f0cb56e861b4812fc79ce67ade9abe3ee9dfddc
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: David Skoland <david.skoland@qt.io>
(cherry picked from commit 8bb955e22f027fc3fd9402383445685cb4185744)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp')
-rw-r--r-- | tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp index 41fb80d8ed..f058b97605 100644 --- a/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp +++ b/tests/auto/qml/qqmllanguage/tst_qqmllanguage.cpp @@ -905,7 +905,7 @@ void tst_qqmllanguage::assignLiteralToVar() QCOMPARE(object->property("test9"), QVariant(QString(QLatin1String("#FF008800")))); QCOMPARE(object->property("test10"), QVariant(bool(true))); QCOMPARE(object->property("test11"), QVariant(bool(false))); - QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2, 0.3, 0.4, 0.5))); + QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2f, 0.3f, 0.4f, 0.5f))); QCOMPARE(object->property("test13"), QVariant(QRectF(10, 10, 10, 10))); QCOMPARE(object->property("test14"), QVariant(QPointF(10, 10))); QCOMPARE(object->property("test15"), QVariant(QSizeF(10, 10))); @@ -1060,7 +1060,7 @@ void tst_qqmllanguage::bindJSValueToVar() QCOMPARE(object->property("test9"), QVariant(QString(QLatin1String("#FF008800")))); QCOMPARE(object->property("test10"), QVariant(bool(true))); QCOMPARE(object->property("test11"), QVariant(bool(false))); - QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2, 0.3, 0.4, 0.5))); + QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2f, 0.3f, 0.4f, 0.5f))); QCOMPARE(object->property("test13"), QVariant(QRectF(10, 10, 10, 10))); QCOMPARE(object->property("test14"), QVariant(QPointF(10, 10))); QCOMPARE(object->property("test15"), QVariant(QSizeF(10, 10))); @@ -1109,7 +1109,7 @@ void tst_qqmllanguage::bindJSValueToVariant() QCOMPARE(object->property("test9"), QVariant(QString(QLatin1String("#FF008800")))); QCOMPARE(object->property("test10"), QVariant(bool(true))); QCOMPARE(object->property("test11"), QVariant(bool(false))); - QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2, 0.3, 0.4, 0.5))); + QCOMPARE(object->property("test12"), QVariant(QColor::fromRgbF(0.2f, 0.3f, 0.4f, 0.5f))); QCOMPARE(object->property("test13"), QVariant(QRectF(10, 10, 10, 10))); QCOMPARE(object->property("test14"), QVariant(QPointF(10, 10))); QCOMPARE(object->property("test15"), QVariant(QSizeF(10, 10))); @@ -1133,7 +1133,7 @@ void tst_qqmllanguage::bindJSValueToType() QCOMPARE(object->doubleProperty(), double(1.7)); QCOMPARE(object->stringProperty(), QString(QLatin1String("Hello world!"))); QCOMPARE(object->boolProperty(), true); - QCOMPARE(object->colorProperty(), QColor::fromRgbF(0.2, 0.3, 0.4, 0.5)); + QCOMPARE(object->colorProperty(), QColor::fromRgbF(0.2f, 0.3f, 0.4f, 0.5f)); QCOMPARE(object->rectFProperty(), QRectF(10, 10, 10, 10)); QCOMPARE(object->pointFProperty(), QPointF(10, 10)); QCOMPARE(object->sizeFProperty(), QSizeF(10, 10)); |