Fix MSVC-warnings about double to float truncation in QML-tests.
authorFriedemann Kleint <Friedemann.Kleint@digia.com>
Fri, 24 Jan 2014 14:16:10 +0000 (15:16 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Fri, 24 Jan 2014 16:28:34 +0000 (17:28 +0100)
Change-Id: Ie58585ca3555f0f7808b59221a00763cc702863a
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp
tests/auto/qml/qqmlvaluetypeproviders/testtypes.h
tests/auto/qml/qqmlvaluetypes/testtypes.h
tests/auto/qml/qqmlvaluetypes/tst_qqmlvaluetypes.cpp

index 908f63e7a30d007606d2cab2de8cc2cf63cac241..9ad4a2020785619767aeac8625f50f30dc5dc3e8 100644 (file)
@@ -384,7 +384,7 @@ void tst_qqmlecmascript::assignBasicTypes()
     QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99));
     QCOMPARE(object->boolProperty(), true);
     QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
-    QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2));
+    QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2f));
     QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml")));
     delete object;
     }
@@ -413,7 +413,7 @@ void tst_qqmlecmascript::assignBasicTypes()
     QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99));
     QCOMPARE(object->boolProperty(), true);
     QCOMPARE(object->variantProperty(), QVariant("Hello World!"));
-    QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2));
+    QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2f));
     QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml")));
     delete object;
     }
index 86ac04317f22b403545938cfd0f85615e4e1e00f..3b0c83c000cf8f754c7e20d183aa9f334e51b65a 100644 (file)
@@ -91,10 +91,10 @@ public:
         m_rect(2, 3, 109, 102),
         m_rectf(103.8, 99.2, 88.1, 77.6),
         m_rectfrect(2.0, 3.0, 109.0, 102.0),
-        m_vector2(32.88, 1.3),
-        m_vector(23.88, 3.1, 4.3),
-        m_vector4(54.2, 23.88, 3.1, 4.3),
-        m_quaternion(4.3, 54.2, 23.88, 3.1),
+        m_vector2(32.88f, 1.3f),
+        m_vector(23.88f, 3.1f, 4.3f),
+        m_vector4(54.2f, 23.88f, 3.1f, 4.3f),
+        m_quaternion(4.3f, 54.2f, 23.88f, 3.1f),
         m_matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
     {
         m_font.setFamily("Arial");
index 3e5952f64df292926bfe046e97e486025aa42560..b32afcb53ae3be4644d025115ee81a4fcd45689e 100644 (file)
@@ -95,10 +95,10 @@ public:
         m_rect(2, 3, 109, 102),
         m_rectf(103.8, 99.2, 88.1, 77.6),
         m_rectfrect(2.0, 3.0, 109.0, 102.0),
-        m_vector2(32.88, 1.3),
-        m_vector(23.88, 3.1, 4.3),
-        m_vector4(54.2, 23.88, 3.1, 4.3),
-        m_quaternion(4.3, 54.2, 23.88, 3.1),
+        m_vector2(32.88f, 1.3f),
+        m_vector(23.88f, 3.1f, 4.3f),
+        m_vector4(54.2f, 23.88f, 3.1f, 4.3f),
+        m_quaternion(4.3f, 54.2f, 23.88f, 3.1f),
         m_matrix(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16)
     {
         m_font.setFamily("Arial");
index 5b8695f8f803a7740dbf654bf7f18457c35c834f..f109fb1fc0195750e74a66c8b7ca0df815f4edaa 100644 (file)
@@ -468,7 +468,7 @@ void tst_qqmlvaluetypes::vector2d()
 
         QCOMPARE((float)object->property("v_x").toDouble(), (float)32.88);
         QCOMPARE((float)object->property("v_y").toDouble(), (float)1.3);
-        QCOMPARE(object->property("copy"), QVariant(QVector2D(32.88, 1.3)));
+        QCOMPARE(object->property("copy"), QVariant(QVector2D(32.88f, 1.3f)));
 
         delete object;
     }
@@ -478,7 +478,7 @@ void tst_qqmlvaluetypes::vector2d()
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
-        QCOMPARE(object->vector2(), QVector2D(-0.3, -12.9));
+        QCOMPARE(object->vector2(), QVector2D(-0.3f, -12.9f));
 
         delete object;
     }
@@ -520,7 +520,7 @@ void tst_qqmlvaluetypes::vector3d()
         QCOMPARE((float)object->property("v_x").toDouble(), (float)23.88);
         QCOMPARE((float)object->property("v_y").toDouble(), (float)3.1);
         QCOMPARE((float)object->property("v_z").toDouble(), (float)4.3);
-        QCOMPARE(object->property("copy"), QVariant(QVector3D(23.88, 3.1, 4.3)));
+        QCOMPARE(object->property("copy"), QVariant(QVector3D(23.88f, 3.1f, 4.3f)));
 
         delete object;
     }
@@ -530,7 +530,7 @@ void tst_qqmlvaluetypes::vector3d()
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
-        QCOMPARE(object->vector(), QVector3D(-0.3, -12.9, 907.4));
+        QCOMPARE(object->vector(), QVector3D(-0.3f, -12.9f, 907.4f));
 
         delete object;
     }
@@ -574,7 +574,7 @@ void tst_qqmlvaluetypes::vector4d()
         QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88);
         QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1);
         QCOMPARE((float)object->property("v_w").toDouble(), (float)4.3);
-        QCOMPARE(object->property("copy"), QVariant(QVector4D(54.2, 23.88, 3.1, 4.3)));
+        QCOMPARE(object->property("copy"), QVariant(QVector4D(54.2f, 23.88f, 3.1f, 4.3f)));
 
         delete object;
     }
@@ -584,7 +584,7 @@ void tst_qqmlvaluetypes::vector4d()
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
-        QCOMPARE(object->vector4(), QVector4D(-0.3, -12.9, 907.4, 88.5));
+        QCOMPARE(object->vector4(), QVector4D(-0.3f, -12.9f, 907.4f, 88.5f));
 
         delete object;
     }
@@ -627,7 +627,7 @@ void tst_qqmlvaluetypes::quaternion()
         QCOMPARE((float)object->property("v_x").toDouble(), (float)54.2);
         QCOMPARE((float)object->property("v_y").toDouble(), (float)23.88);
         QCOMPARE((float)object->property("v_z").toDouble(), (float)3.1);
-        QCOMPARE(object->property("copy"), QVariant(QQuaternion(4.3, 54.2, 23.88, 3.1)));
+        QCOMPARE(object->property("copy"), QVariant(QQuaternion(4.3f, 54.2f, 23.88f, 3.1f)));
 
         delete object;
     }
@@ -637,7 +637,7 @@ void tst_qqmlvaluetypes::quaternion()
         MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create());
         QVERIFY(object != 0);
 
-        QCOMPARE(object->quaternion(), QQuaternion(88.5, -0.3, -12.9, 907.4));
+        QCOMPARE(object->quaternion(), QQuaternion(88.5f, -0.3f, -12.9f, 907.4f));
 
         delete object;
     }
@@ -1184,10 +1184,10 @@ void tst_qqmlvaluetypes::cppClasses()
     CPP_TEST(QQmlSizeFValueType, QSizeF(-100.7, 18.2));
     CPP_TEST(QQmlRectValueType, QRect(13, 39, 10928, 88));
     CPP_TEST(QQmlRectFValueType, QRectF(88.2, -90.1, 103.2, 118));
-    CPP_TEST(QQuickVector2DValueType, QVector2D(19.7, 1002));
-    CPP_TEST(QQuickVector3DValueType, QVector3D(18.2, 19.7, 1002));
-    CPP_TEST(QQuickVector4DValueType, QVector4D(18.2, 19.7, 1002, 54));
-    CPP_TEST(QQuickQuaternionValueType, QQuaternion(18.2, 19.7, 1002, 54));
+    CPP_TEST(QQuickVector2DValueType, QVector2D(19.7f, 1002));
+    CPP_TEST(QQuickVector3DValueType, QVector3D(18.2f, 19.7f, 1002));
+    CPP_TEST(QQuickVector4DValueType, QVector4D(18.2f, 19.7f, 1002, 54));
+    CPP_TEST(QQuickQuaternionValueType, QQuaternion(18.2f, 19.7f, 1002, 54));
     CPP_TEST(QQuickMatrix4x4ValueType,
              QMatrix4x4(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16));
     CPP_TEST(QQuickFontValueType, QFont("Helvetica"));