aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-10-14 19:20:22 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-10-19 09:20:38 +0200
commitc5ac1b8a060affdf73dfbed4322741fe1f2b43f9 (patch)
treeaf2693671114f7bd6704ac65a34adcf3a0939d93 /tests/auto
parent8103b8ce129b607003728171dd6b0d4756263441 (diff)
Do grabs out of order
...while extending the autotest to cover more complicated cases, such as grabbing again after show-hide and doing show-grab-hide-grab-show-grab. In fact some of these cases have not been working in Qt 5. Now the basic render loop is fixed up to support the all the combinations threaded does. Task-number: QTBUG-87399 Change-Id: Id01995bc3a2660b16cfb2f8bedc84becea0be1bb Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 5f88276d14..a29122c0f4 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -1528,6 +1528,34 @@ void tst_qquickwindow::grab()
} else {
QCOMPARE((uint) content.convertToFormat(QImage::Format_RGB32).pixel(0, 0), (uint) 0xffff0000);
}
+
+ if (visible) {
+ // Now hide() and regrab to exercise the case of a window that is
+ // renderable and then becomes non-exposed (non-renderable). This is not
+ // the same as the visible==false case which starts with a window that
+ // never was renderable before grabbing.
+ window.hide();
+ QImage content = window.grabWindow();
+ QCOMPARE(content.width(), int(window.width() * window.devicePixelRatio()));
+ QCOMPARE(content.height(), int(window.height() * window.devicePixelRatio()));
+ if (alpha) {
+ QCOMPARE((uint) content.convertToFormat(QImage::Format_ARGB32_Premultiplied).pixel(0, 0), (uint) 0x00000000);
+ } else {
+ QCOMPARE((uint) content.convertToFormat(QImage::Format_RGB32).pixel(0, 0), (uint) 0xffff0000);
+ }
+
+ // now make it visible and exercise the main grab path again to see if it still works
+ window.show();
+ QVERIFY(QTest::qWaitForWindowExposed(&window));
+ content = window.grabWindow();
+ QCOMPARE(content.width(), int(window.width() * window.devicePixelRatio()));
+ QCOMPARE(content.height(), int(window.height() * window.devicePixelRatio()));
+ if (alpha) {
+ QCOMPARE((uint) content.convertToFormat(QImage::Format_ARGB32_Premultiplied).pixel(0, 0), (uint) 0x00000000);
+ } else {
+ QCOMPARE((uint) content.convertToFormat(QImage::Format_RGB32).pixel(0, 0), (uint) 0xffff0000);
+ }
+ }
}
void tst_qquickwindow::multipleWindows()