summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools/qstring
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2016-01-21 08:17:21 +0100
committerLiang Qi <liang.qi@theqtcompany.com>2016-01-21 08:17:21 +0100
commit158a3a4159bdc5a49caecd63e021dacbc06cf23c (patch)
treec3ed9aee6cabd46e5e8615b3815b92d32857c4da /tests/auto/corelib/tools/qstring
parent26ece94a68fb5ae680c5639716b06c4e1ae979a8 (diff)
parent7b2fb038ae4b8b9231ae989ad309b6eca107a858 (diff)
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts: src/corelib/io/qiodevice_p.h src/corelib/kernel/qvariant_p.h src/corelib/tools/qsimd.cpp src/gui/kernel/qguiapplication.cpp tests/auto/network/socket/qtcpsocket/tst_qtcpsocket.cpp Change-Id: I742a093cbb231b282b43e463ec67173e0d29f57a
Diffstat (limited to 'tests/auto/corelib/tools/qstring')
-rw-r--r--tests/auto/corelib/tools/qstring/tst_qstring.cpp39
1 files changed, 37 insertions, 2 deletions
diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
index 3d5167d574..544d0e9a73 100644
--- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp
+++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp
@@ -1150,7 +1150,7 @@ void tst_QString::constructorQByteArray_data()
ba1[5] = 'e';
ba1[6] = 'f';
- QTest::newRow( "2" ) << ba1 << QStringLiteral("abc\0def");
+ QTest::newRow( "2" ) << ba1 << QString("abc");
QTest::newRow( "3" ) << QByteArray::fromRawData("abcd", 3) << QString("abc");
QTest::newRow( "4" ) << QByteArray("\xc3\xa9") << QString("\xc3\xa9");
@@ -1171,6 +1171,12 @@ void tst_QString::constructorQByteArray()
QCOMPARE( strBA, expected );
// test operator= too
+ if (src.constData()[src.length()] == '\0') {
+ str1.clear();
+ str1 = src.constData();
+ QCOMPARE( str1, expected );
+ }
+
strBA.clear();
strBA = src;
QCOMPARE( strBA, expected );
@@ -2594,6 +2600,14 @@ void tst_QString::append_bytearray_special_cases()
QTEST( str, "res" );
}
+
+ QFETCH( QByteArray, ba );
+ if (ba.constData()[ba.length()] == '\0') {
+ QFETCH( QString, str );
+
+ str.append(ba.constData());
+ QTEST( str, "res" );
+ }
}
void tst_QString::operator_pluseq_data(bool emptyIsNoop)
@@ -2624,6 +2638,14 @@ void tst_QString::operator_pluseq_bytearray_special_cases()
QTEST( str, "res" );
}
+
+ QFETCH( QByteArray, ba );
+ if (ba.constData()[ba.length()] == '\0') {
+ QFETCH( QString, str );
+
+ str += ba.constData();
+ QTEST( str, "res" );
+ }
}
void tst_QString::operator_eqeq_bytearray_data()
@@ -2638,6 +2660,11 @@ void tst_QString::operator_eqeq_bytearray()
QVERIFY(expected == src);
QVERIFY(!(expected != src));
+
+ if (src.constData()[src.length()] == '\0') {
+ QVERIFY(expected == src.constData());
+ QVERIFY(!(expected != src.constData()));
+ }
}
void tst_QString::swap()
@@ -2695,7 +2722,7 @@ void tst_QString::prepend_bytearray_special_cases_data()
// byte array with only a 0
ba.resize( 1 );
ba[0] = 0;
- QTest::newRow( "emptyString" ) << QString("foobar ") << ba << QStringLiteral("\0foobar ");
+ QTest::newRow( "emptyString" ) << QString("foobar ") << ba << QString("foobar ");
// empty byte array
ba.resize( 0 );
@@ -2725,6 +2752,14 @@ void tst_QString::prepend_bytearray_special_cases()
QTEST( str, "res" );
}
+
+ QFETCH( QByteArray, ba );
+ if (ba.constData()[ba.length()] == '\0') {
+ QFETCH( QString, str );
+
+ str.prepend(ba.constData());
+ QTEST( str, "res" );
+ }
}
void tst_QString::replace_uint_uint()