summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2017-05-04 19:41:48 +0200
committerMarc Mutz <marc.mutz@kdab.com>2017-05-16 09:34:59 +0000
commitcafefd1d33349209617d391b3b49c9663590b3c9 (patch)
treea5e8043ea2bc07afdf5e79fd313702ba3dc16d1c /tests/auto/corelib
parent51e1374bae4ae449b04ddeb30c14bc67935705ca (diff)
QStringView/QLatin1String: add trimmed()
... using the same qt_trimmed(), qTrimmed(), Q..::trimmed() split we've been using for all other out-of-line string-view member functions to avoid forcing string-view objects onto the stack for the passing of 'this'. In the test, had to fix nullness not being propagated from a QByteArray to the QLatin1String constructed from it. Probably worth fixing in QLatin1String(QByteArray), too. [ChangeLog][QtCore] Added qTrimmed() free functions. [ChangeLog][QtCore][QLatin1String] Added trimmed() function. Change-Id: I73c18ef87e203f30f7552c10dd5c84223bcfae0e Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib')
-rw-r--r--tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
index 0c495d2c8f..e482b409a5 100644
--- a/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
+++ b/tests/auto/corelib/tools/qstringapisymmetry/tst_qstringapisymmetry.cpp
@@ -349,6 +349,10 @@ private Q_SLOTS:
void trim_trimmed_QString() { trimmed_impl<QString>(); }
void trim_trimmed_QStringRef_data() { trimmed_data(); }
void trim_trimmed_QStringRef() { trimmed_impl<QStringRef>(); }
+ void trim_trimmed_QStringView_data() { trimmed_data(); }
+ void trim_trimmed_QStringView() { trimmed_impl<QStringView>(); }
+ void trim_trimmed_QLatin1String_data() { trimmed_data(); }
+ void trim_trimmed_QLatin1String() { trimmed_impl<QLatin1String>(); }
void trim_trimmed_QByteArray_data() { trimmed_data(); }
void trim_trimmed_QByteArray() { trimmed_impl<QByteArray>(); }
@@ -1050,7 +1054,7 @@ void tst_QStringApiSymmetry::trimmed_impl()
const auto utf8 = unicode.toUtf8();
const auto l1s = unicode.toLatin1();
- const auto l1 = QLatin1String(l1s);
+ const auto l1 = l1s.isNull() ? QLatin1String() : QLatin1String(l1s);
const auto ref = unicode.isNull() ? QStringRef() : QStringRef(&unicode);
const auto s = make<String>(ref, l1, utf8);