diff options
author | Lars Knoll <lars.knoll@nokia.com> | 2012-03-07 22:00:57 +0100 |
---|---|---|
committer | Lars Knoll <lars.knoll@nokia.com> | 2012-03-07 22:01:11 +0100 |
commit | 616bbd1988f3b92f7d980b6c9a1278f11b712573 (patch) | |
tree | c6f9489bc1b53649130be21de858870f574db906 /tests/auto/qml/qqmlecmascript | |
parent | 3bc907d155034fe64efc8cb6056b48f0c6401bfb (diff) | |
parent | 70966df1be02dd94ecf9a122ff9e4976245aeb92 (diff) |
Merge remote-tracking branch 'origin/master' into api_changes
Change-Id: I121cb9c9316b5e47476dcb982bc28b6f3f358f78
Diffstat (limited to 'tests/auto/qml/qqmlecmascript')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/data/realTypePrecision.qml | 22 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/qqmlecmascript.pro | 4 | ||||
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 15 |
3 files changed, 38 insertions, 3 deletions
diff --git a/tests/auto/qml/qqmlecmascript/data/realTypePrecision.qml b/tests/auto/qml/qqmlecmascript/data/realTypePrecision.qml new file mode 100644 index 0000000000..524478887e --- /dev/null +++ b/tests/auto/qml/qqmlecmascript/data/realTypePrecision.qml @@ -0,0 +1,22 @@ +import Qt.test 1.0 +import QtQuick 2.0 + +QtObject { + property real test: 1234567890 + property real test2 + property real test3 + property real test4: test3 + property real test5: func() + property real test6: test2 + test3 + + signal sig(real arg) + + Component.onCompleted: { + test2 = 1234567890; + sig(1234567890) + } + + onSig: { test3 = arg; } + + function func() { return 1234567890; } +} diff --git a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro index b07e4393a9..553dc4339f 100644 --- a/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro +++ b/tests/auto/qml/qqmlecmascript/qqmlecmascript.pro @@ -14,9 +14,7 @@ include (../../shared/util.pri) # QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage # LIBS += -lgcov -testDataFiles.files = data -testDataFiles.path = . -DEPLOYMENT += testDataFiles +TESTDATA = data/* CONFIG += parallel_test QT += core-private gui-private v8-private qml-private network widgets testlib diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 45406390de..f8b268199d 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -237,6 +237,7 @@ private slots: void revisionErrors(); void revision(); void invokableWithQObjectDerived(); + void realTypePrecision(); void automaticSemicolon(); void unaryExpression(); @@ -6120,6 +6121,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" |