diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-05-18 02:26:56 (GMT) |
---|---|---|
committer | Aaron Kennedy <aaron.kennedy@nokia.com> | 2010-05-18 02:26:56 (GMT) |
commit | f784d8f70d864c89c778ce3c0951d51260857523 (patch) | |
tree | 9177dce9b27d81bf878d5dc444c9cbe9cab4cf75 | |
parent | 273024e58d90bb9b3a5da0161f884f1af22d75df (diff) | |
download | Qt-f784d8f70d864c89c778ce3c0951d51260857523.zip Qt-f784d8f70d864c89c778ce3c0951d51260857523.tar.gz Qt-f784d8f70d864c89c778ce3c0951d51260857523.tar.bz2 |
Round correctly in binding optimizer
QTBUG-9538
-rw-r--r-- | src/declarative/qml/qdeclarativecompiledbindings.cpp | 2 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 5 |
2 files changed, 3 insertions, 4 deletions
diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp index f55d330..7ddc735 100644 --- a/src/declarative/qml/qdeclarativecompiledbindings.cpp +++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp @@ -1200,7 +1200,7 @@ void QDeclarativeCompiledBindingsPrivate::run(int instrIndex, const Register &input = registers[instr->unaryop.src]; Register &output = registers[instr->unaryop.output]; if (input.isUndefined()) output.setUndefined(); - else output.setint(int(input.getqreal())); + else output.setint(qRound(input.getqreal())); } break; diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp index 64e5b3f..0710e15 100644 --- a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -2083,10 +2083,9 @@ void tst_qdeclarativeecmascript::compiled() QCOMPARE(object->property("test15").toBool(), false); QCOMPARE(object->property("test16").toBool(), true); - QCOMPARE(object->property("test17").toInt(), 4); + QCOMPARE(object->property("test17").toInt(), 5); QCOMPARE(object->property("test18").toReal(), qreal(176)); - QEXPECT_FAIL("", "QTBUG-9538", Continue); - QCOMPARE(object->property("test19").toInt(), 6); + QCOMPARE(object->property("test19").toInt(), 7); QCOMPARE(object->property("test20").toReal(), qreal(6.7)); QCOMPARE(object->property("test21").toString(), QLatin1String("6.7")); QCOMPARE(object->property("test22").toString(), QLatin1String("!")); |