Make sure QML type "real" always maps to C++ type "double"
[profile/ivi/qtdeclarative.git] / tests / auto / qml / qqmlecmascript / tst_qqmlecmascript.cpp
index 676557a..0dc0e5a 100644 (file)
@@ -236,6 +236,7 @@ private slots:
     void revisionErrors();
     void revision();
     void invokableWithQObjectDerived();
+    void realTypePrecision();
 
     void automaticSemicolon();
     void unaryExpression();
@@ -6092,6 +6093,20 @@ void tst_qqmlecmascript::invokableWithQObjectDerived()
     }
 }
 
+void tst_qqmlecmascript::realTypePrecision()
+{
+    // Properties and signal parameters of type real should have double precision.
+    QQmlComponent component(&engine, testFileUrl("realTypePrecision.qml"));
+    QScopedPointer<QObject> object(component.create());
+    QVERIFY(object != 0);
+    QCOMPARE(object->property("test").toDouble(), 1234567890.);
+    QCOMPARE(object->property("test2").toDouble(), 1234567890.);
+    QCOMPARE(object->property("test3").toDouble(), 1234567890.);
+    QCOMPARE(object->property("test4").toDouble(), 1234567890.);
+    QCOMPARE(object->property("test5").toDouble(), 1234567890.);
+    QCOMPARE(object->property("test6").toDouble(), 1234567890.*2);
+}
+
 QTEST_MAIN(tst_qqmlecmascript)
 
 #include "tst_qqmlecmascript.moc"