summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShawn Rutledge <shawn.rutledge@digia.com>2014-11-07 12:54:16 +0100
committerShawn Rutledge <shawn.rutledge@digia.com>2014-11-07 13:48:43 +0100
commit82c36e4ff05459a5affbb6f8fab75723baee20db (patch)
treecd2ee9e95d4edc6dd1ba485e1f721146c18e57ff
parent911b940c97e88dd9769d4831807e132706c38125 (diff)
downloadqtdeclarative-82c36e4ff05459a5affbb6f8fab75723baee20db.tar.gz
qtdeclarative-82c36e4ff05459a5affbb6f8fab75723baee20db.tar.bz2
qtdeclarative-82c36e4ff05459a5affbb6f8fab75723baee20db.zip
QQuickWindow autotest: verify that onClosing can block close()
Task-number: QTBUG-40093 Change-Id: I800259f45d95736172d500494e68042180178e93 Reviewed-by: Caroline Chao <caroline.chao@theqtcompany.com>
-rw-r--r--tests/auto/quick/qquickwindow/tst_qquickwindow.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
index 043203c25..a25ed9bf9 100644
--- a/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
+++ b/tests/auto/quick/qquickwindow/tst_qquickwindow.cpp
@@ -341,6 +341,7 @@ private slots:
void testWindowVisibilityOrder();
void blockClosing();
+ void blockCloseMethod();
void crashWhenHoverItemDeleted();
@@ -1739,6 +1740,25 @@ void tst_qquickwindow::blockClosing()
QTRY_VERIFY(!window->isVisible());
}
+void tst_qquickwindow::blockCloseMethod()
+{
+ QQmlEngine engine;
+ QQmlComponent component(&engine);
+ component.loadUrl(testFileUrl("ucantclosethis.qml"));
+ QQuickWindow *window = qobject_cast<QQuickWindow *>(component.create());
+ QVERIFY(window);
+ window->show();
+ QTest::qWaitForWindowExposed(window);
+ QVERIFY(window->isVisible());
+ QVERIFY(QMetaObject::invokeMethod(window, "close", Qt::DirectConnection));
+ QVERIFY(window->isVisible());
+ QVERIFY(QMetaObject::invokeMethod(window, "close", Qt::DirectConnection));
+ QVERIFY(window->isVisible());
+ window->setProperty("canCloseThis", true);
+ QVERIFY(QMetaObject::invokeMethod(window, "close", Qt::DirectConnection));
+ QTRY_VERIFY(!window->isVisible());
+}
+
void tst_qquickwindow::crashWhenHoverItemDeleted()
{
// QTBUG-32771