diff options
Diffstat (limited to 'tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp')
-rw-r--r-- | tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp index 2f0f5654ca..cf70a7bbaa 100644 --- a/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/corelib/text/qbytearray/tst_qbytearray.cpp @@ -838,6 +838,12 @@ void tst_QByteArray::prepend() QCOMPARE(ba.prepend(-1, 'x'), QByteArray("321foo")); QCOMPARE(ba.prepend(3, 'x'), QByteArray("xxx321foo")); QCOMPARE(ba.prepend("\0 ", 2), QByteArray::fromRawData("\0 xxx321foo", 11)); + + QByteArray tenChars; + tenChars.reserve(10); + QByteArray twoChars("ab"); + tenChars.prepend(twoChars); + QCOMPARE(tenChars.capacity(), 10); } void tst_QByteArray::prependExtended_data() @@ -882,6 +888,12 @@ void tst_QByteArray::append() QCOMPARE(ba.append("\0"), QByteArray("foo123xxx")); QCOMPARE(ba.append("\0", 1), QByteArray::fromRawData("foo123xxx\0", 10)); QCOMPARE(ba.size(), 10); + + QByteArray tenChars; + tenChars.reserve(10); + QByteArray twoChars("ab"); + tenChars.append(twoChars); + QCOMPARE(tenChars.capacity(), 10); } void tst_QByteArray::appendExtended_data() |