diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-11-05 13:20:24 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-11-05 21:13:00 +0100 |
commit | 4ffa7d3f651757b7bc10ae9801b7802a8f2e260f (patch) | |
tree | 973b50f41d00719c179b9a332feca11dc0c0f32c /tests | |
parent | b63e2e270f79d76d5624e73eb6d05b1bbb55968f (diff) |
Fix rounding behavior of Qml when assigning doubles to integer properties
The engine used to round, but that is inconsistent with ECMAScript's way of
converting doubles to integers by truncation.
With this patch we can also enable the propagation of integer type information
into the IR, but we have to be careful not to utilize it when writing
properties.
Change-Id: I04af4879ba5131349eca2eeff2b27f4598f5267b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp | 8 | ||||
-rw-r--r-- | tests/auto/quick/qquickstates/tst_qquickstates.cpp | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp index 5b06c3cce9..b1cf8c905f 100644 --- a/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp +++ b/tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp @@ -3489,9 +3489,9 @@ void tst_qqmlecmascript::compiled() QCOMPARE(object->property("test15").toBool(), false); QCOMPARE(object->property("test16").toBool(), true); - QCOMPARE(object->property("test17").toInt(), 5); + QCOMPARE(object->property("test17").toInt(), 4); QCOMPARE(object->property("test18").toReal(), qreal(176)); - QCOMPARE(object->property("test19").toInt(), 7); + QCOMPARE(object->property("test19").toInt(), 6); QCOMPARE(object->property("test20").toReal(), qreal(6.7)); QCOMPARE(object->property("test21").toString(), QLatin1String("6.7")); QCOMPARE(object->property("test22").toString(), QLatin1String("!")); @@ -3516,7 +3516,7 @@ void tst_qqmlecmascript::numberAssignment() QCOMPARE(object->property("test3"), QVariant((qreal)6)); QCOMPARE(object->property("test4"), QVariant((qreal)6)); - QCOMPARE(object->property("test5"), QVariant((int)7)); + QCOMPARE(object->property("test5"), QVariant((int)6)); QCOMPARE(object->property("test6"), QVariant((int)7)); QCOMPARE(object->property("test7"), QVariant((int)6)); QCOMPARE(object->property("test8"), QVariant((int)6)); @@ -6445,7 +6445,7 @@ void tst_qqmlecmascript::realToInt() QMetaObject::invokeMethod(object, "test1"); QCOMPARE(object->value(), int(4)); QMetaObject::invokeMethod(object, "test2"); - QCOMPARE(object->value(), int(8)); + QCOMPARE(object->value(), int(7)); } void tst_qqmlecmascript::urlProperty() diff --git a/tests/auto/quick/qquickstates/tst_qquickstates.cpp b/tests/auto/quick/qquickstates/tst_qquickstates.cpp index e165b559f7..0c9b75636f 100644 --- a/tests/auto/quick/qquickstates/tst_qquickstates.cpp +++ b/tests/auto/quick/qquickstates/tst_qquickstates.cpp @@ -1567,7 +1567,7 @@ void tst_qquickstates::QTBUG_14830() QVERIFY(rect != 0); QQuickItem *item = rect->findChild<QQuickItem*>("area"); - QCOMPARE(item->width(), qreal(171)); + QCOMPARE(item->width(), qreal(170)); } void tst_qquickstates::avoidFastForward() |