From e199ef2fbb9a96dc7ed0c6549addfd1ec2a31e40 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 28 Jun 2018 14:06:27 +0200 Subject: Tighten expected output for floating point conversions After the qt5 update this amends commit ffeaac704efc9eb85464d0a401d98e28991ec4d3 to test only the new values that the QString functions in qtbase produce. Task-number: QTBUG-69181 Change-Id: I3aa8bcc1dd4a9387dc983f40ab74bd2ce620b409 Reviewed-by: Liang Qi --- tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 26 ++++++++---------------- 1 file changed, 8 insertions(+), 18 deletions(-) (limited to 'tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp') diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 68ba879ce9..ef2136bc64 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -2064,15 +2064,14 @@ void tst_qqmlproperty::floatToStringPrecision_data() QTest::addColumn("propertyName"); QTest::addColumn("number"); QTest::addColumn("qtString"); - QTest::addColumn("alternateQtString"); QTest::addColumn("jsString"); - QTest::newRow("3.4") << "a" << 3.4 << "3.4" << "3.4" << "3.4"; - QTest::newRow("0.035003945") << "b" << 0.035003945 << "0.035003945" << "0.0035003945" << "0.035003945"; - QTest::newRow("0.0000012345") << "c" << 0.0000012345 << "1.2345e-6" << "1.2345e-06" << "0.0000012345"; - QTest::newRow("0.00000012345") << "d" << 0.00000012345 << "1.2345e-7" << "1.2345e-07" << "1.2345e-7"; - QTest::newRow("1e20") << "e" << 1e20 << "1e+20" << "1e+20" << "100000000000000000000"; - QTest::newRow("1e21") << "f" << 1e21 << "1e+21" << "1e+21" << "1e+21"; + QTest::newRow("3.4") << "a" << 3.4 << "3.4" << "3.4"; + QTest::newRow("0.035003945") << "b" << 0.035003945 << "0.035003945" << "0.035003945"; + QTest::newRow("0.0000012345") << "c" << 0.0000012345 << "1.2345e-06" << "0.0000012345"; + QTest::newRow("0.00000012345") << "d" << 0.00000012345 << "1.2345e-07" << "1.2345e-7"; + QTest::newRow("1e20") << "e" << 1e20 << "1e+20" << "100000000000000000000"; + QTest::newRow("1e21") << "f" << 1e21 << "1e+21" << "1e+21"; } void tst_qqmlproperty::floatToStringPrecision() @@ -2084,24 +2083,15 @@ void tst_qqmlproperty::floatToStringPrecision() QFETCH(QString, propertyName); QFETCH(double, number); QFETCH(QString, qtString); - QFETCH(QString, alternateQtString); QFETCH(QString, jsString); QByteArray name = propertyName.toLatin1(); QCOMPARE(obj->property(name).toDouble(), number); - if (obj->property(name).toString() != qtString) { - QCOMPARE(obj->property(name).toString(), alternateQtString); - } else { - QCOMPARE(obj->property(name).toString(), qtString); - } + QCOMPARE(obj->property(name).toString(), qtString); QByteArray name1 = (propertyName + QLatin1Char('1')).toLatin1(); QCOMPARE(obj->property(name1).toDouble(), number); - if (obj->property(name1).toString() != qtString) { - QCOMPARE(obj->property(name1).toString(), alternateQtString); - } else { - QCOMPARE(obj->property(name1).toString(), qtString); - } + QCOMPARE(obj->property(name1).toString(), qtString); QByteArray name2 = (propertyName + QLatin1Char('2')).toLatin1(); QCOMPARE(obj->property(name2).toDouble(), number); -- cgit v1.2.3