diff options
Diffstat (limited to 'tests/auto/qbytearray/tst_qbytearray.cpp')
-rw-r--r-- | tests/auto/qbytearray/tst_qbytearray.cpp | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/auto/qbytearray/tst_qbytearray.cpp b/tests/auto/qbytearray/tst_qbytearray.cpp index 07fdbc3..e3341d1 100644 --- a/tests/auto/qbytearray/tst_qbytearray.cpp +++ b/tests/auto/qbytearray/tst_qbytearray.cpp @@ -142,6 +142,8 @@ private slots: void repeated_data() const; void byteRefDetaching() const; + + void reserve(); }; tst_QByteArray::tst_QByteArray() @@ -1516,6 +1518,22 @@ void tst_QByteArray::byteRefDetaching() const } } +void tst_QByteArray::reserve() +{ + int capacity = 100; + QByteArray qba; + qba.reserve(capacity); + QVERIFY(qba.capacity() == capacity); + char *data = qba.data(); + + // FIXME count from 0 to make it fail + for (int i = 1; i < capacity; i++) { + qba.resize(i); + QVERIFY(capacity == qba.capacity()); + QVERIFY(data == qba.data()); + } +} + const char globalChar = '1'; QTEST_APPLESS_MAIN(tst_QByteArray) |