diff options
author | Robert Griebl <rgriebl@trolltech.com> | 2009-06-10 11:46:23 (GMT) |
---|---|---|
committer | Robert Griebl <rgriebl@trolltech.com> | 2009-06-10 11:46:23 (GMT) |
commit | 7604f8087f88171ef933d8ae08f501467e647338 (patch) | |
tree | 51d071f462ed48d0b25884d9f62b8ba11c5dff13 /tests/auto/qbitarray | |
parent | 8c265860b41214daade7c8a28237c1e07ea71a3c (diff) | |
download | Qt-7604f8087f88171ef933d8ae08f501467e647338.zip Qt-7604f8087f88171ef933d8ae08f501467e647338.tar.gz Qt-7604f8087f88171ef933d8ae08f501467e647338.tar.bz2 |
Make Qt exception safer.
Squashed commit of the branch haralds-haralds-qt-s60-topics/topic/exceptions,
which also contains the full history.
Rev-By: Harald Fernengel
Rev-By: Ralf Engels
Diffstat (limited to 'tests/auto/qbitarray')
-rw-r--r-- | tests/auto/qbitarray/tst_qbitarray.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/qbitarray/tst_qbitarray.cpp b/tests/auto/qbitarray/tst_qbitarray.cpp index 12fbdc3..244183e 100644 --- a/tests/auto/qbitarray/tst_qbitarray.cpp +++ b/tests/auto/qbitarray/tst_qbitarray.cpp @@ -108,6 +108,8 @@ private slots: void invertOnNull() const; void operator_noteq_data(); void operator_noteq(); + + void resize(); }; Q_DECLARE_METATYPE(QBitArray) @@ -628,5 +630,30 @@ void tst_QBitArray::operator_noteq() QCOMPARE(b, res); } +void tst_QBitArray::resize() +{ + // -- check that a resize handles the bits correctly + QBitArray a = QStringToQBitArray(QString("11")); + a.resize(10); + QVERIFY(a.size() == 10); + QCOMPARE( a, QStringToQBitArray(QString("1100000000")) ); + + a.setBit(9); + a.resize(9); + // now the bit in a should have been gone: + QCOMPARE( a, QStringToQBitArray(QString("110000000")) ); + + // grow the array back and check the new bit + a.resize(10); + QCOMPARE( a, QStringToQBitArray(QString("1100000000")) ); + + // other test with and + a.resize(9); + QBitArray b = QStringToQBitArray(QString("1111111111")); + b &= a; + QCOMPARE( b, QStringToQBitArray(QString("1100000000")) ); + +} + QTEST_APPLESS_MAIN(tst_QBitArray) #include "tst_qbitarray.moc" |