summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/text/qstring
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-07-30 15:26:28 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2022-04-01 23:11:35 +0200
commit9e1a2b4603c9791081481a34576970e1e6c85ef5 (patch)
tree495515c0625672f23713ff12c23fe425de4970f8 /tests/auto/corelib/text/qstring
parent2e044791b8f3c62c32b379f7781799a89165c984 (diff)
We do in fact support 'F' format for floating-point values
Update docs and add tests. [ChangeLog][QtCore] Documented existing support for 'F' format when converting floating-point numbers to strings in QLocale::toString(), hence equally for QString's floating-point formatting. Previously it was supported but the documentation neglected to mention it; it only differs from 'f' for infinities and NaN. Change-Id: Ic946c0f7b9e86fdf512daa3124bea57fc664b34b Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Sona Kurazyan <sona.kurazyan@qt.io>
Diffstat (limited to 'tests/auto/corelib/text/qstring')
-rw-r--r--tests/auto/corelib/text/qstring/tst_qstring.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/corelib/text/qstring/tst_qstring.cpp b/tests/auto/corelib/text/qstring/tst_qstring.cpp
index 7743c13dc0..e42ca7d199 100644
--- a/tests/auto/corelib/text/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/text/qstring/tst_qstring.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2021 The Qt Company Ltd.
+** Copyright (C) 2022 The Qt Company Ltd.
** Copyright (C) 2020 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
@@ -6430,6 +6430,11 @@ void tst_QString::nanAndInf()
QCOMPARE(form.arg(-qInf(), 6, 'f', 3, '0'), u"00-inf");
QCOMPARE(form.arg(-qInf(), -6, 'f', 3, '0'), u"-inf00");
QCOMPARE(form.arg(qQNaN(), -5, 'f', 3, '0'), u"nan00");
+ QCOMPARE(form.arg(qInf(), 5, 'F', 3, '0'), u"00INF");
+ QCOMPARE(form.arg(qInf(), -5, 'F', 3, '0'), u"INF00");
+ QCOMPARE(form.arg(-qInf(), 6, 'F', 3, '0'), u"00-INF");
+ QCOMPARE(form.arg(-qInf(), -6, 'F', 3, '0'), u"-INF00");
+ QCOMPARE(form.arg(qQNaN(), -5, 'F', 3, '0'), u"NAN00");
QCOMPARE(form.arg(qInf(), 5, 'e', 3, '0'), u"00inf");
QCOMPARE(form.arg(qInf(), -5, 'e', 3, '0'), u"inf00");
QCOMPARE(form.arg(-qInf(), 6, 'e', 3, '0'), u"00-inf");