aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/quick')
-rw-r--r--tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp33
1 files changed, 32 insertions, 1 deletions
diff --git a/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp b/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp
index d81c40f5b6..4bf48f5a58 100644
--- a/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp
+++ b/tests/auto/quick/qquickrendercontrol/tst_qquickrendercontrol.cpp
@@ -232,7 +232,38 @@ void tst_RenderControl::renderAndReadBackWithRhi()
// redirect Qt Quick rendering into our texture
quickWindow->setRenderTarget(QQuickRenderTarget::fromRhiRenderTarget(texRt.data()));
+ QSize currentSize = size;
+
for (int frame = 0; frame < 100; ++frame) {
+ // QTBUG-88761 - change the render target size at some point and verify the renderer continues to function
+ if (frame == 80) {
+ currentSize -= QSize(2, 2); // small enough change to not bother the pixel verification checks
+ tex->setPixelSize(currentSize);
+ QVERIFY(tex->create()); // internally we now have a whole new native texture object
+ ds->setPixelSize(currentSize);
+ QVERIFY(ds->create());
+ QVERIFY(texRt->create());
+ // setRenderTarget is mandatory upon changing something, even if the texRt pointer itself is the same
+ quickWindow->setRenderTarget(QQuickRenderTarget::fromRhiRenderTarget(texRt.data()));
+ } else if (frame == 90) {
+ // Go berserk, destroy and recreate the texture and related stuff
+ // (the QRhi objects themselves, not just the native stuff
+ // internally), it should still work.
+ currentSize -= QSize(2, 2); // chip off another 2 pixels
+ tex.reset(rhi->newTexture(QRhiTexture::RGBA8, currentSize, 1,
+ QRhiTexture::RenderTarget | QRhiTexture::UsedAsTransferSource));
+ QVERIFY(tex->create());
+ ds.reset(rhi->newRenderBuffer(QRhiRenderBuffer::DepthStencil, currentSize, 1));
+ QVERIFY(ds->create());
+ rtDesc = QRhiTextureRenderTargetDescription(QRhiColorAttachment(tex.data()));
+ rtDesc.setDepthStencilBuffer(ds.data());
+ texRt.reset(rhi->newTextureRenderTarget(rtDesc));
+ rp.reset(texRt->newCompatibleRenderPassDescriptor());
+ texRt->setRenderPassDescriptor(rp.data());
+ QVERIFY(texRt->create());
+ quickWindow->setRenderTarget(QQuickRenderTarget::fromRhiRenderTarget(texRt.data()));
+ }
+
// have to process events, e.g. to get queued metacalls delivered
QCoreApplication::processEvents();
@@ -276,7 +307,7 @@ void tst_RenderControl::renderAndReadBackWithRhi()
QImage img = result;
QVERIFY(!img.isNull());
- QCOMPARE(img.size(), rootItem->size());
+ QCOMPARE(img.size(), currentSize);
const int maxFuzz = 2;