summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-10-25 20:00:42 +0100
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2018-01-08 09:41:43 +0000
commit9c53f4d33a1953bc84e5b5e8bbef14db375bb180 (patch)
tree9f48e30e24dda4c9913d5f9bfa40e26d5c7cf8a6 /tests/auto/corelib/tools/qstringbuilder/qstringbuilder1
parent641e010cc7b52b6c3ac213e151781ffcbdd89145 (diff)
QStringBuilder: add support for QStringView
[ChangeLog][QtCore][QStringBuilder] Added support for QStringView. Change-Id: I5b6803397b107ef69d198a935b3ba4339ac95087 Reviewed-by: Anton Kudryavtsev <antkudr@mail.ru> Reviewed-by: Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
Diffstat (limited to 'tests/auto/corelib/tools/qstringbuilder/qstringbuilder1')
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
index 4f7b05530c..ac7f439248 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
@@ -60,6 +60,7 @@ template <typename T> QString toQString(const T &t);
template <> QString toQString(const QString &s) { return s; }
template <> QString toQString(const QStringRef &r) { return r.toString(); }
+template <> QString toQString(const QStringView &v) { return v.toString(); }
template <> QString toQString(const QLatin1String &l) { return l; }
template <> QString toQString(const QLatin1Char &l) { return QChar(l); }
template <> QString toQString(const QChar &c) { return c; }
@@ -84,6 +85,7 @@ void runScenario()
QLatin1String l1string(LITERAL);
QString string(l1string);
QStringRef stringref(&string, 2, 10);
+ QStringView stringview(stringref);
QLatin1Char lchar('c');
QChar qchar(lchar);
QChar::SpecialCharacter special(QChar::Nbsp);
@@ -108,6 +110,7 @@ void runScenario()
CHECK(P, l1string, l1string);
CHECK(P, l1string, string);
CHECK(P, l1string, stringref);
+ CHECK(Q, l1string, stringview);
CHECK(P, l1string, lchar);
CHECK(P, l1string, qchar);
CHECK(P, l1string, special);
@@ -118,6 +121,7 @@ void runScenario()
CHECK(P, string, string);
CHECK(P, string, stringref);
+ CHECK(Q, string, stringview);
CHECK(P, string, lchar);
CHECK(P, string, qchar);
CHECK(P, string, special);
@@ -127,6 +131,7 @@ void runScenario()
CHECK(Q, string, u16charstar);
CHECK(P, stringref, stringref);
+ CHECK(Q, stringref, stringview);
CHECK(P, stringref, lchar);
CHECK(P, stringref, qchar);
CHECK(P, stringref, special);
@@ -135,6 +140,15 @@ void runScenario()
CHECK(Q, stringref, u16chararray);
CHECK(Q, stringref, u16charstar);
+ CHECK(Q, stringview, stringview);
+ CHECK(Q, stringview, lchar);
+ CHECK(Q, stringview, qchar);
+ CHECK(Q, stringview, special);
+ CHECK(P, stringview, QStringLiteral(LITERAL));
+ CHECK(Q, stringview, u16char);
+ CHECK(Q, stringview, u16chararray);
+ CHECK(Q, stringview, u16charstar);
+
CHECK(P, lchar, lchar);
CHECK(P, lchar, qchar);
CHECK(P, lchar, special);