diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-16 09:39:22 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2018-07-16 13:54:24 +0000 |
commit | e613de803c85191d3fbbef5a8b0f5e8b5ed8c76f (patch) | |
tree | bec3bb6ee87a1101f0b52c21349d6001d863d686 /tests | |
parent | 43645fd59c6bcb0a3e37eef530ef970f51ed48af (diff) |
Revert "Tighten expected output for floating point conversions"
This reverts commit e199ef2fbb9a96dc7ed0c6549addfd1ec2a31e40.
qtdeclarative needs to get into qt5.git dev with an up-to-date qtbase
before this change can be applied.
Change-Id: I3c3fc9a9b53b29169398d1e1b3e4bdef27c28af9
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 26 |
1 files changed, 18 insertions, 8 deletions
diff --git a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp index 27e06c6f67..ba7c85df15 100644 --- a/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp +++ b/tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp @@ -2064,14 +2064,15 @@ void tst_qqmlproperty::floatToStringPrecision_data() QTest::addColumn<QString>("propertyName"); QTest::addColumn<double>("number"); QTest::addColumn<QString>("qtString"); + QTest::addColumn<QString>("alternateQtString"); QTest::addColumn<QString>("jsString"); - 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"; + 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"; } void tst_qqmlproperty::floatToStringPrecision() @@ -2083,15 +2084,24 @@ 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); - QCOMPARE(obj->property(name).toString(), qtString); + if (obj->property(name).toString() != qtString) { + QCOMPARE(obj->property(name).toString(), alternateQtString); + } else { + QCOMPARE(obj->property(name).toString(), qtString); + } QByteArray name1 = (propertyName + QLatin1Char('1')).toLatin1(); QCOMPARE(obj->property(name1).toDouble(), number); - QCOMPARE(obj->property(name1).toString(), qtString); + if (obj->property(name1).toString() != qtString) { + QCOMPARE(obj->property(name1).toString(), alternateQtString); + } else { + QCOMPARE(obj->property(name1).toString(), qtString); + } QByteArray name2 = (propertyName + QLatin1Char('2')).toLatin1(); QCOMPARE(obj->property(name2).toDouble(), number); |