diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2018-06-28 14:06:27 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2018-07-02 11:21:11 +0000 |
commit | e199ef2fbb9a96dc7ed0c6549addfd1ec2a31e40 (patch) | |
tree | 7cd1f0b06803e1ce569474e007e28e2a7a8092cc | |
parent | 90a7a1a6c143c610ff08119cd513526da9e637f7 (diff) |
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 <liang.qi@qt.io>
-rw-r--r-- | tests/auto/qml/qqmlproperty/tst_qqmlproperty.cpp | 26 |
1 files changed, 8 insertions, 18 deletions
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<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" << "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); |