diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-01-31 01:04:45 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-04-12 11:12:04 +0000 |
commit | d68c162c1b90e9e5a3d9dd4b035663ba57d3391b (patch) | |
tree | e070d4e414c3c92c0857307c70feea8c2083ed9a /tests | |
parent | 9c243d26373ba6ae3f94b21bd52b12b59140cfc3 (diff) |
QLocale: add toString(Q(Date|QTime)+, QStringView format) overloads
While at it, change the interface of qt_repeatCount() to just take
a single QStringView, since QStringView::mid() is so cheap. Add some
\internal docs.
[ChangeLog][QtCore][QLocale] Added toString(QDate/QTime/QDateTime)
overloads taking the format string as a QStringView.
Change-Id: Ic078796677a6db06227c8a3e276dbdb1039ceead
Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru>
Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 9248970c96..2c342dcfe6 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -1163,6 +1163,9 @@ void tst_QLocale::dayOfWeek() QCOMPARE(QLocale::c().toString(date, "ddd"), shortName); QCOMPARE(QLocale::c().toString(date, "dddd"), longName); + + QCOMPARE(QLocale::c().toString(date, QStringViewLiteral("ddd")), shortName); + QCOMPARE(QLocale::c().toString(date, QStringViewLiteral("dddd")), longName); } void tst_QLocale::formatDate_data() @@ -1205,6 +1208,7 @@ void tst_QLocale::formatDate() QLocale l(QLocale::C); QCOMPARE(l.toString(date, format), result); + QCOMPARE(l.toString(date, QStringView(format)), result); } @@ -1260,6 +1264,7 @@ void tst_QLocale::formatTime() QLocale l(QLocale::C); QCOMPARE(l.toString(time, format), result); + QCOMPARE(l.toString(time, QStringView(format)), result); } @@ -1421,6 +1426,7 @@ void tst_QLocale::formatDateTime() QLocale l(localeName); QCOMPARE(l.toString(dateTime, format), result); + QCOMPARE(l.toString(dateTime, QStringView(format)), result); } void tst_QLocale::formatTimeZone() |