summaryrefslogtreecommitdiffstats
path: root/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2015-07-02 12:20:33 +0200
committerPaul Lemire <paul.lemire@kdab.com>2015-07-02 20:11:13 +0000
commitf6e989709cef935027ae5b822328004527ff3711 (patch)
tree1c3a645ff8ce5627071fb0724b9601d049da7ee5 /tests/auto/core/qframeallocator/tst_qframeallocator.cpp
parent01e371dfaff7697456cf91d32d017ee994ba50f9 (diff)
QFrameAllocator add a new isEmpty method
+ Unit tests Will help making sure everything is properly deleted after submitting the RenderViews. Change-Id: I097e02b095ad6ffd02db07a406a33982a794b7eb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/auto/core/qframeallocator/tst_qframeallocator.cpp')
-rw-r--r--tests/auto/core/qframeallocator/tst_qframeallocator.cpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/auto/core/qframeallocator/tst_qframeallocator.cpp b/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
index 821053fd8..38c97ed6d 100644
--- a/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
+++ b/tests/auto/core/qframeallocator/tst_qframeallocator.cpp
@@ -102,6 +102,7 @@ private slots:
void allocateSubclass();
void deallocateSubclass();
void clearQFrameAllocator();
+ void isEmptyQFrameAllocator();
};
void tst_QFrameAllocator::initQFrameChunk()
@@ -676,6 +677,43 @@ void tst_QFrameAllocator::clearQFrameAllocator()
}
}
+void tst_QFrameAllocator::isEmptyQFrameAllocator()
+{
+ // GIVEN
+ Qt3D::QFrameAllocator f(128, 32);
+
+
+ // WHEN
+ for (int i = 0; i < 256; ++i)
+ f.allocate<composed>();
+ // THEN
+ QVERIFY(!f.isEmpty());
+
+ // WHEN
+ f.clear();
+ // THEN
+ QVERIFY(f.isEmpty());
+
+ for (int i = 0; i < 256; ++i) {
+
+ // GIVEN
+ QVector<composed *> composeds;
+ for (int j = 0; j < 256; ++j) {
+ composed *c = f.allocate<composed>();
+ c ->t = i * j;
+ composeds << c;
+ }
+ // THEN
+ QVERIFY(!f.isEmpty());
+
+ // WHEN
+ for (int j = 0; j < 256; ++j)
+ f.deallocate(composeds.takeAt(0));
+ // THEN
+ QVERIFY(f.isEmpty());
+ }
+}
+
QTEST_APPLESS_MAIN(tst_QFrameAllocator)
#include "tst_qframeallocator.moc"