summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstring
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-06-30 22:59:21 +0200
committerLiang Qi <liang.qi@qt.io>2018-07-02 11:23:45 +0200
commite3ed2281c0c891cf3b15c95f9f7cdae42e9f233a (patch)
treeaae8da6ce616eae02b69fb1fcdcb4383c8fe6811 /tests/auto/corelib/tools/qstring
parent3be141d5bc199080b524d8f6f5ce514e8f74d23a (diff)
parente75e4b39b78ba05ea2cd45dc96acf99fc89c5915 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_dragging.mm src/plugins/platforms/ios/qiosinputcontext.mm src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/tools/androiddeployqt/main.cpp Was moved from qttools into qtbase in 5.11. So re-apply 32398e4d here. tests/auto/corelib/global/qlogging/test/test.pro tests/auto/corelib/global/qlogging/tst_qlogging.cpp tests/auto/corelib/io/qfile/tst_qfile.cpp tests/auto/corelib/kernel/qtimer/tst_qtimer.cpp tests/auto/corelib/thread/qthreadstorage/test/test.pro tests/auto/widgets/itemviews/qheaderview/tst_qheaderview.cpp tests/auto/widgets/kernel/qapplication/test/test.pro Done-with: Gatis Paeglis <gatis.paeglis@qt.io> Done-with: MÃ¥rten Nordheim <marten.nordheim@qt.io> Done-with: Oliver Wolff <oliver.wolff@qt.io> Change-Id: Id970486c5315a1718c540f00deb2633533e8fc7b
Diffstat (limited to 'tests/auto/corelib/tools/qstring')
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 47ccfb8b8a..cdabd51d43 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -518,6 +518,7 @@ private slots:
void toUcs4();
void arg();
void number();
+ void doubleOut();
void arg_fillChar_data();
void arg_fillChar();
void capacity_data();
@@ -4922,6 +4923,28 @@ void tst_QString::number()
#endif
}
+void tst_QString::doubleOut()
+{
+ // Regression test for QTBUG-63620; the first two paths lost the exponent's
+ // leading 0 at 5.7; C's printf() family guarantee a two-digit exponent (in
+ // contrast with ECMAScript, which forbids leading zeros).
+ const QString expect(QStringLiteral("1e-06"));
+ const double micro = 1e-6;
+ QCOMPARE(QString::number(micro), expect);
+ QCOMPARE(QString("%1").arg(micro), expect);
+ {
+ QString text;
+ text.sprintf("%g", micro);
+ QCOMPARE(text, expect);
+ }
+ {
+ QString text;
+ QTextStream stream(&text);
+ stream << micro;
+ QCOMPARE(text, expect);
+ }
+}
+
void tst_QString::capacity_data()
{
length_data();