summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qstringbuilder/qstringbuilder1')
-rw-r--r--tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
index 556b9ac16a..429652d92d 100644
--- a/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
+++ b/tests/auto/corelib/tools/qstringbuilder/qstringbuilder1/stringbuilder.cpp
@@ -107,6 +107,21 @@ void runScenario()
QCOMPARE(r, r3);
#endif
+ {
+ static const QStaticStringData<12> literalData = {
+ { Q_REFCOUNT_INITIALIZE_STATIC, 12, 0, 0, sizeof(QStringData) },
+ { 's', 'o', 'm', 'e', ' ', 'l', 'i', 't', 'e', 'r', 'a', 'l' }
+ };
+ static QStringDataPtr literal = { literalData.data_ptr() };
+
+ r = literal;
+ QCOMPARE(r, string);
+ r = r Q literal;
+ QCOMPARE(r, r2);
+ r = literal Q literal;
+ QCOMPARE(r, r2);
+ }
+
#ifndef QT_NO_CAST_FROM_ASCII
r = string P LITERAL;
QCOMPARE(r, r2);
@@ -211,6 +226,21 @@ void runScenario()
QCOMPARE(r, ba);
}
+ {
+ static const QStaticByteArrayData<12> literalData = {
+ { Q_REFCOUNT_INITIALIZE_STATIC, 12, 0, 0, sizeof(QByteArrayData) },
+ { 's', 'o', 'm', 'e', ' ', 'l', 'i', 't', 'e', 'r', 'a', 'l' }
+ };
+ static QByteArrayDataPtr literal = { literalData.data_ptr() };
+
+ QByteArray ba = literal;
+ QCOMPARE(ba, QByteArray(LITERAL));
+ ba = ba Q literal;
+ QCOMPARE(ba, QByteArray(LITERAL LITERAL));
+ ba = literal Q literal;
+ QCOMPARE(ba, QByteArray(LITERAL LITERAL));
+ }
+
//operator QString +=
{
QString str = QString::fromUtf8(UTF8_LITERAL);