summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qbytearray
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/corelib/tools/qbytearray')
-rw-r--r--tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
index 18739cb4e1..d010ff807d 100644
--- a/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
+++ b/tests/auto/corelib/tools/qbytearray/tst_qbytearray.cpp
@@ -2000,6 +2000,9 @@ void tst_QByteArray::toUpperLower_data()
QTest::addColumn<QByteArray>("lower");
QTest::newRow("empty") << QByteArray() << QByteArray() << QByteArray();
+ QTest::newRow("literal") << QByteArrayLiteral("Hello World")
+ << QByteArrayLiteral("HELLO WORLD")
+ << QByteArrayLiteral("hello world");
QTest::newRow("ascii") << QByteArray("Hello World, this is a STRING")
<< QByteArray("HELLO WORLD, THIS IS A STRING")
<< QByteArray("hello world, this is a string");
@@ -2014,8 +2017,34 @@ void tst_QByteArray::toUpperLower()
QFETCH(QByteArray, input);
QFETCH(QByteArray, upper);
QFETCH(QByteArray, lower);
+ QCOMPARE(lower.toLower(), lower);
+ QCOMPARE(upper.toUpper(), upper);
QCOMPARE(input.toUpper(), upper);
QCOMPARE(input.toLower(), lower);
+
+ QByteArray copy = input;
+ QCOMPARE(qMove(copy).toUpper(), upper);
+ copy = input;
+ copy.detach();
+ QCOMPARE(qMove(copy).toUpper(), upper);
+
+ copy = input;
+ QCOMPARE(qMove(copy).toLower(), lower);
+ copy = input;
+ copy.detach();
+ QCOMPARE(qMove(copy).toLower(), lower);
+
+ copy = lower;
+ QCOMPARE(qMove(copy).toLower(), lower);
+ copy = lower;
+ copy.detach();
+ QCOMPARE(qMove(copy).toLower(), lower);
+
+ copy = upper;
+ QCOMPARE(qMove(copy).toUpper(), upper);
+ copy = upper;
+ copy.detach();
+ QCOMPARE(qMove(copy).toUpper(), upper);
}
void tst_QByteArray::macTypes()