From e75a96a920fb867fbe698e1aeb5a292a0ea35b8b Mon Sep 17 00:00:00 2001 From: Matthew Vogt Date: Mon, 20 Aug 2012 16:42:11 +1000 Subject: Fix V4 calculations that vary from V8 results Task-number: QTBUG-24706 Change-Id: I4475a772c5cd92776f2cb73dab9bc06ae4c019fa Reviewed-by: Martin Jones --- tests/auto/qml/v4/data/mathMax.qml | 12 +++++++---- tests/auto/qml/v4/data/mathMin.qml | 10 +++++++--- tests/auto/qml/v4/tst_v4.cpp | 41 +++++++++++++++++++------------------- 3 files changed, 36 insertions(+), 27 deletions(-) (limited to 'tests') diff --git a/tests/auto/qml/v4/data/mathMax.qml b/tests/auto/qml/v4/data/mathMax.qml index 543b4994aa..cd8a88a3e7 100644 --- a/tests/auto/qml/v4/data/mathMax.qml +++ b/tests/auto/qml/v4/data/mathMax.qml @@ -20,9 +20,13 @@ Item { property real subtest9: Math.max(i1.p10, i1.p9) property bool test9: subtest9 === 0 && (1/subtest9) === Infinity - property real test10: Math.max(i1.p11, i1.p1) - property real test11: Math.max(i1.p11, i1.p2) - property real test12: Math.max(i1.p1, i1.p2, i1.p3) + // Reverse the inputs to Math.max + property real subtest10: Math.max(i1.p9, i1.p10) + property bool test10: subtest10 === 0 && (1/subtest10) === Infinity + + property real test11: Math.max(i1.p11, i1.p1) + property real test12: Math.max(i1.p11, i1.p2) + property real test13: Math.max(i1.p1, i1.p2, i1.p3) QtObject { id: i1 @@ -38,4 +42,4 @@ Item { property real p10: -0 property var p11: null } - } +} diff --git a/tests/auto/qml/v4/data/mathMin.qml b/tests/auto/qml/v4/data/mathMin.qml index 7d2a561623..4ae5408b58 100644 --- a/tests/auto/qml/v4/data/mathMin.qml +++ b/tests/auto/qml/v4/data/mathMin.qml @@ -20,9 +20,13 @@ Item { property real subtest9: Math.min(i1.p10, i1.p9) property bool test9: subtest9 === 0 && (1/subtest9) === -Infinity - property real test10: Math.min(i1.p11, i1.p1) - property real test11: Math.min(i1.p11, i1.p2) - property real test12: Math.min(i1.p1, i1.p2, i1.p3) + // Reverse the inputs to Math.min + property real subtest10: Math.min(i1.p9, i1.p10) + property bool test10: subtest10 === 0 && (1/subtest10) === -Infinity + + property real test11: Math.min(i1.p11, i1.p1) + property real test12: Math.min(i1.p11, i1.p2) + property real test13: Math.min(i1.p1, i1.p2, i1.p3) QtObject { id: i1 diff --git a/tests/auto/qml/v4/tst_v4.cpp b/tests/auto/qml/v4/tst_v4.cpp index 90551e1aeb..78d6b8612a 100644 --- a/tests/auto/qml/v4/tst_v4.cpp +++ b/tests/auto/qml/v4/tst_v4.cpp @@ -142,13 +142,13 @@ void tst_v4::qtscript_data() QTest::newRow("unary minus") << "unaryMinus.qml"; QTest::newRow("null qobject") << "nullQObject.qml"; QTest::newRow("qobject -> bool") << "objectToBool.qml"; - QTest::newRow("conversion from bool") << "conversions.1.qml"; // QTBUG-24706 - QTest::newRow("conversion from int") << "conversions.2.qml"; // QTBUG-24706 + QTest::newRow("conversion from bool") << "conversions.1.qml"; + QTest::newRow("conversion from int") << "conversions.2.qml"; QTest::newRow("conversion from float") << "conversions.3.qml"; - QTest::newRow("conversion from double") << "conversions.4.qml"; // QTBUG-24706 - QTest::newRow("conversion from real") << "conversions.5.qml"; // QTBUG-24706 - QTest::newRow("conversion from string") << "conversions.6.qml"; // QTBUG-24706 - QTest::newRow("conversion from url") << "conversions.7.qml"; // QTBUG-24706 + QTest::newRow("conversion from double") << "conversions.4.qml"; + QTest::newRow("conversion from real") << "conversions.5.qml"; + QTest::newRow("conversion from string") << "conversions.6.qml"; + QTest::newRow("conversion from url") << "conversions.7.qml"; QTest::newRow("conversion from vec3") << "conversions.8.qml"; QTest::newRow("variantHandling") << "variantHandling.qml"; QTest::newRow("varHandling") << "varHandling.qml"; @@ -536,7 +536,7 @@ void tst_v4::mathAbs() QCOMPARE(o->property("test9").toBool(), true); QCOMPARE(o->property("test10").toBool(), true); QCOMPARE(o->property("test11").toInt(), 0); - //QCOMPARE(o->property("test12").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test12").toBool(), true); delete o; } @@ -551,13 +551,13 @@ void tst_v4::mathCeil() QCOMPARE(o->property("test1").toReal(), qreal(-3)); QCOMPARE(o->property("test2").toReal(), qreal(5)); QCOMPARE(o->property("test3").toBool(), true); - //QCOMPARE(o->property("test4").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test4").toBool(), true); QCOMPARE(o->property("test5").toBool(), true); QCOMPARE(o->property("test6").toReal(), qreal(83)); - //QCOMPARE(o->property("test7").toBool(), true); //QTBUG-24706 - //QCOMPARE(o->property("test8").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test7").toBool(), true); + QCOMPARE(o->property("test8").toBool(), true); QCOMPARE(o->property("test9").toInt(), 0); - //QCOMPARE(o->property("test10").toBool(), true); //QTBUG-24706 + QCOMPARE(o->property("test10").toBool(), true); delete o; } @@ -577,10 +577,11 @@ void tst_v4::mathMax() QCOMPARE(o->property("test6").toReal(), qreal(82.6)); QCOMPARE(o->property("test7").toReal(), qreal(4.4)); QCOMPARE(o->property("test8").toBool(), true); - //QCOMPARE(o->property("test9").toBool(), true); //QTBUG-24706 - QCOMPARE(o->property("test10").toReal(), qreal(0)); - QCOMPARE(o->property("test11").toReal(), qreal(4.4)); - QCOMPARE(o->property("test12").toReal(), qreal(7)); + QCOMPARE(o->property("test9").toBool(), true); + QCOMPARE(o->property("test10").toBool(), true); + QCOMPARE(o->property("test11").toReal(), qreal(0)); + QCOMPARE(o->property("test12").toReal(), qreal(4.4)); + QCOMPARE(o->property("test13").toReal(), qreal(7)); delete o; } @@ -600,10 +601,11 @@ void tst_v4::mathMin() QCOMPARE(o->property("test6").toReal(), qreal(82.6)); QCOMPARE(o->property("test7").toBool(), true); QCOMPARE(o->property("test8").toReal(), qreal(4.4)); - //QCOMPARE(o->property("test9").toBool(), true); //QTBUG-24706 - QCOMPARE(o->property("test10").toReal(), qreal(-3.7)); - QCOMPARE(o->property("test11").toReal(), qreal(0)); - QCOMPARE(o->property("test12").toReal(), qreal(-3.7)); + QCOMPARE(o->property("test9").toBool(), true); + QCOMPARE(o->property("test10").toBool(), true); + QCOMPARE(o->property("test11").toReal(), qreal(-3.7)); + QCOMPARE(o->property("test12").toReal(), qreal(0)); + QCOMPARE(o->property("test13").toReal(), qreal(-3.7)); delete o; } @@ -726,7 +728,6 @@ void tst_v4::conversions_data() << QUrl(testFileUrl("").toString() + QString(QLatin1String("4"))) << QVector3D(4, 4, 4); - // QTBUG-24706 QTest::newRow("from url") << testFileUrl("conversions.7.qml") << (QStringList() << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":6:14: Unable to assign QUrl to int")) << (testFileUrl("conversions.7.qml").toString() + QLatin1String(":7:16: Unable to assign QUrl to number")) -- cgit v1.2.3