diff options
author | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-11-07 12:54:16 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@digia.com> | 2014-11-07 13:48:43 +0100 |
commit | 82c36e4ff05459a5affbb6f8fab75723baee20db (patch) | |
tree | cd2ee9e95d4edc6dd1ba485e1f721146c18e57ff | |
parent | 911b940c97e88dd9769d4831807e132706c38125 (diff) | |
download | qtdeclarative-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.cpp | 20 |
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 |