summaryrefslogtreecommitdiffstats
path: root/tests/auto/texturemanager/tst_texturemanagertest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/texturemanager/tst_texturemanagertest.cpp')
-rw-r--r--tests/auto/texturemanager/tst_texturemanagertest.cpp50
1 files changed, 48 insertions, 2 deletions
diff --git a/tests/auto/texturemanager/tst_texturemanagertest.cpp b/tests/auto/texturemanager/tst_texturemanagertest.cpp
index 3d29eb4..9805478 100644
--- a/tests/auto/texturemanager/tst_texturemanagertest.cpp
+++ b/tests/auto/texturemanager/tst_texturemanagertest.cpp
@@ -70,6 +70,8 @@ private Q_SLOTS:
void gracefullyRunOutOfMemory();
void gracefullyFailOnTooLarge();
+ void deletingTextures();
+
void maxTextureSize();
public slots:
@@ -156,7 +158,7 @@ void TextureManagerTest::requestUpload()
QVERIFY(t->status() == QSGTexture::Ready || t->status() == QSGTexture::Loading);
QTime time;
time.start();
- while (t->status() == QSGTexture::Loading && time.elapsed() < 1000) {
+ while (t->status() == QSGTexture::Loading && time.elapsed() < 10000) {
QTest::qWait(50);
QApplication::processEvents();
}
@@ -181,7 +183,7 @@ void TextureManagerTest::requestUploadSameImageTwiceWithDelay()
QTime time;
time.start();
- while (t->status() == QSGTexture::Loading && time.elapsed() < 1000) {
+ while (t->status() == QSGTexture::Loading && time.elapsed() < 10000) {
QTest::qWait(50);
QApplication::processEvents();
}
@@ -297,6 +299,50 @@ void TextureManagerTest::uploadAfterRequestUpload()
+void TextureManagerTest::deletingTextures()
+{
+ QImage image(100, 100, QImage::Format_ARGB32_Premultiplied);
+
+ // Verify that scheduling several textures which are then removed
+ // does not cause problems for a following requests.
+ // - Async when async is deleted
+ for (int i=0; i<100; ++i)
+ QSGTextureRef async2 = tm->requestUpload(image.copy());
+ QSGTextureRef async1 = tm->requestUpload(image);
+ QTime time;
+ time.start();
+ while (!async1.isReady() && time.elapsed() < 10000) {
+ QTest::qWait(50);
+ QApplication::processEvents();
+ }
+ QVERIFY(async1.isReady());
+
+
+ // Delete the uploaded texture and force upload it again
+ // - sync when async is deleted
+ async1 = QSGTextureRef();
+ QSGTextureRef sync = tm->upload(image);
+ QVERIFY(sync.isReady());
+
+
+ // Delete the sync texture and upload again
+ // - sync when sync is deleted
+ sync = QSGTextureRef();
+ sync = tm->upload(image);
+
+
+ // Delete the sync texture and upload it async
+ // - async when sync is deleted
+ sync = QSGTextureRef();
+ async1 = tm->requestUpload(image);
+ time.start();
+ while (!async1.isReady() && time.elapsed() < 10000) {
+ QTest::qWait(50);
+ QApplication::processEvents();
+ }
+ QVERIFY(async1.isReady());
+}
+
QTEST_MAIN(TextureManagerTest);