summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/tools
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2016-07-28 13:20:41 +0200
committerEdward Welbourne <edward.welbourne@qt.io>2016-08-01 18:20:00 +0200
commitf6fc34294f5691da8aa7ab8dc0452c6fa9036b67 (patch)
tree3b8fe9841f88aa81e2f8f2d57cbbca2c4736ca6f /tests/auto/corelib/tools
parent6f75096afc000991111bb0fd7a7e530ce3518627 (diff)
parent0eb77c3011ee4d6bbc46dd2d40c9324e9bfcbecf (diff)
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts: configure 5.7 now supports clang on android; but dev re-worked configure src/gui/kernel/qevent.h One side renamed a parameter of a constructor; the other added an alternate constructor on the next line. Applied the rename to both for consistency. tests/auto/tools/moc/tst_moc.cpp Each side added a new test at the end. .qmake.conf Ignored 5.7's change to MODULE_VERSION. configure.json No conflict noticed by git; but changes in 5.7 were needed for the re-worked configure to accommodate 5.7's stricter handling of C++11. Change-Id: I9cda53836a32d7bf83828212c7ea00b1de3e09d2
Diffstat (limited to 'tests/auto/corelib/tools')
-rw-r--r--tests/auto/corelib/tools/qvector/tst_qvector.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/corelib/tools/qvector/tst_qvector.cpp b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
index 825cb05d74..374fec221e 100644
--- a/tests/auto/corelib/tools/qvector/tst_qvector.cpp
+++ b/tests/auto/corelib/tools/qvector/tst_qvector.cpp
@@ -271,6 +271,7 @@ private slots:
void testOperators() const;
void reserve();
+ void reserveZero();
void reallocAfterCopy_data();
void reallocAfterCopy();
void initializeListInt();
@@ -2365,13 +2366,34 @@ void tst_QVector::reserve()
{
QVector<Foo> a;
a.resize(2);
+ QCOMPARE(fooCtor, 2);
QVector<Foo> b(a);
b.reserve(1);
QCOMPARE(b.size(), a.size());
+ QCOMPARE(fooDtor, 0);
}
QCOMPARE(fooCtor, fooDtor);
}
+// This is a regression test for QTBUG-51758
+void tst_QVector::reserveZero()
+{
+ QVector<int> vec;
+ vec.detach();
+ vec.reserve(0); // should not crash
+ QCOMPARE(vec.size(), 0);
+ QCOMPARE(vec.capacity(), 0);
+ vec.squeeze();
+ QCOMPARE(vec.size(), 0);
+ QCOMPARE(vec.capacity(), 0);
+ vec.reserve(-1);
+ QCOMPARE(vec.size(), 0);
+ QCOMPARE(vec.capacity(), 0);
+ vec.append(42);
+ QCOMPARE(vec.size(), 1);
+ QVERIFY(vec.capacity() >= 1);
+}
+
// This is a regression test for QTBUG-11763, where memory would be reallocated
// soon after copying a QVector.
void tst_QVector::reallocAfterCopy_data()