aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/quick/qquickwindow
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-05-28 16:58:00 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-06-03 10:51:26 +0200
commit5e0bf417fb38c53d4ae43f9f84fe42461cd2e00c (patch)
treec0dcc0954ce73447819841202cacd7615715aab6 /tests/auto/quick/qquickwindow
parentff6369767321afc49b37645bb6b85d3556921645 (diff)
Fix handling of destroy-show and re-enable the zoom test for qmlpreview
Fixes: QTBUG-84059 Change-Id: Id70c043f96e9525a5a6053efbf99c5ea3408da65 Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests/auto/quick/qquickwindow')
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp36
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 9b88946090..b2ff74b631 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -390,6 +390,7 @@ private slots:
void constantUpdatesOnWindow();
void mouseFiltering();
void headless();
+ void destroyShowWithoutHide();
void noUpdateWhenNothingChanges();
void touchEvent_basic();
@@ -1624,6 +1625,41 @@ void tst_qquickwindow::headless()
qPrintable(errorMessage));
}
+void tst_qquickwindow::destroyShowWithoutHide()
+{
+ // this is a variation of the headless case, to test if the more aggressive
+ // destroy(); show(); sequence survives.
+
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("Headless.qml"));
+ QObject *created = component.create();
+ QScopedPointer<QObject> cleanup(created);
+
+ QQuickWindow *window = qobject_cast<QQuickWindow*>(created);
+ QVERIFY(window);
+ window->setTitle(QTest::currentTestFunction());
+ window->show();
+
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+ QVERIFY(window->isSceneGraphInitialized());
+
+ QImage originalContent = window->grabWindow();
+
+ window->destroy();
+ QVERIFY(!window->handle());
+
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QVERIFY(window->isSceneGraphInitialized());
+
+ QImage newContent = window->grabWindow();
+ QString errorMessage;
+ QVERIFY2(QQuickVisualTestUtil::compareImages(newContent, originalContent, &errorMessage),
+ qPrintable(errorMessage));
+}
+
void tst_qquickwindow::noUpdateWhenNothingChanges()
{
QQuickWindow window;