summaryrefslogtreecommitdiffstats
path: root/tests/auto/qscopedpointer/tst_qscopedpointer.cpp
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-08-11 23:42:51 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2011-08-11 23:42:51 (GMT)
commit72c58996a5fc7c7a1a82fefa5a0034f57383e788 (patch)
treecde90f301afe3783f95a683dc0a54d31aafb673e /tests/auto/qscopedpointer/tst_qscopedpointer.cpp
parenteb5fae761ff2aaf3d35245ac1f9d1ea10c4e84bb (diff)
parentc7b8fdf5d866b5202dada00ba175606807f69fca (diff)
downloadQt-72c58996a5fc7c7a1a82fefa5a0034f57383e788.zip
Qt-72c58996a5fc7c7a1a82fefa5a0034f57383e788.tar.gz
Qt-72c58996a5fc7c7a1a82fefa5a0034f57383e788.tar.bz2
Merge branch 'master' of ../qt-qml-staging
Diffstat (limited to 'tests/auto/qscopedpointer/tst_qscopedpointer.cpp')
-rw-r--r--tests/auto/qscopedpointer/tst_qscopedpointer.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp
index 1a6f944..06c0ecb 100644
--- a/tests/auto/qscopedpointer/tst_qscopedpointer.cpp
+++ b/tests/auto/qscopedpointer/tst_qscopedpointer.cpp
@@ -72,6 +72,7 @@ private Q_SLOTS:
void isNullSignature();
void objectSize();
void comparison();
+ void array();
// TODO instanciate on const object
};
@@ -437,5 +438,26 @@ void tst_QScopedPointer::comparison()
QCOMPARE( int(RefCounted::instanceCount), 0 );
}
+void tst_QScopedPointer::array()
+{
+ int instCount = RefCounted::instanceCount;
+ {
+ QScopedArrayPointer<RefCounted> array;
+ array.reset(new RefCounted[42]);
+ QCOMPARE(instCount + 42, int(RefCounted::instanceCount));
+ }
+ QCOMPARE(instCount, int(RefCounted::instanceCount));
+ {
+ QScopedArrayPointer<RefCounted> array(new RefCounted[42]);
+ QCOMPARE(instCount + 42, int(RefCounted::instanceCount));
+ array.reset(new RefCounted[28]);
+ QCOMPARE(instCount + 28, int(RefCounted::instanceCount));
+ array.reset(0);
+ QCOMPARE(instCount, int(RefCounted::instanceCount));
+ }
+ QCOMPARE(instCount, int(RefCounted::instanceCount));
+}
+
+
QTEST_MAIN(tst_QScopedPointer)
#include "tst_qscopedpointer.moc"