aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/qquickpopup/tst_qquickpopup.cpp
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2019-01-08 14:01:13 +0100
committerMitch Curtis <mitch.curtis@qt.io>2019-01-14 09:07:08 +0000
commitfa4b1aa6024f5f3b2d0e0502561b1eaedddd0c78 (patch)
treede53a5ff59354557228b1a69e62e1d2d4bea4d36 /tests/auto/qquickpopup/tst_qquickpopup.cpp
parent7b51dd69b7a871f799379203d066c899c2ffe304 (diff)
QQuickPopupPositioner: fix crash on application exit
Don't add duplicate change listeners, since only one of them will be removed. Coincidentally, this is the same fix as d56c193e, which was reverted for unrelated reasons as part of a bulk revert in d3545dbd. Change-Id: If6fde09f884929c7928f3a1f78625559c9fcbf07 Fixes: QTBUG-72746 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'tests/auto/qquickpopup/tst_qquickpopup.cpp')
-rw-r--r--tests/auto/qquickpopup/tst_qquickpopup.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/auto/qquickpopup/tst_qquickpopup.cpp b/tests/auto/qquickpopup/tst_qquickpopup.cpp
index 9230116b..35d05244 100644
--- a/tests/auto/qquickpopup/tst_qquickpopup.cpp
+++ b/tests/auto/qquickpopup/tst_qquickpopup.cpp
@@ -41,8 +41,10 @@
#include "../shared/qtest_quickcontrols.h"
#include <QtGui/qpa/qwindowsysteminterface.h>
+#include <QtQuick/qquickview.h>
#include <QtQuickTemplates2/private/qquickapplicationwindow_p.h>
#include <QtQuickTemplates2/private/qquickcombobox_p.h>
+#include <QtQuickTemplates2/private/qquickdialog_p.h>
#include <QtQuickTemplates2/private/qquickoverlay_p.h>
#include <QtQuickTemplates2/private/qquickpopup_p.h>
#include <QtQuickTemplates2/private/qquickbutton_p.h>
@@ -83,6 +85,7 @@ private slots:
void enabled();
void orientation_data();
void orientation();
+ void qquickview();
};
void tst_QQuickPopup::initTestCase()
@@ -1060,6 +1063,26 @@ void tst_QQuickPopup::orientation()
QCOMPARE(popup->popupItem()->position(), position);
}
+void tst_QQuickPopup::qquickview()
+{
+ QQuickView view;
+ view.setObjectName("QQuickView");
+ view.resize(400, 400);
+ view.setSource(testFileUrl("dialog.qml"));
+ QVERIFY(view.status() != QQuickView::Error);
+ view.contentItem()->setObjectName("QQuickViewContentItem");
+ view.show();
+
+ QQuickDialog *dialog = view.rootObject()->property("dialog").value<QQuickDialog*>();
+ QVERIFY(dialog);
+ QTRY_COMPARE(dialog->property("opened").toBool(), true);
+
+ dialog->close();
+ QTRY_COMPARE(dialog->property("visible").toBool(), false);
+
+ // QTBUG-72746: shouldn't crash on application exit after closing a Dialog when using QQuickView.
+}
+
QTEST_QUICKCONTROLS_MAIN(tst_QQuickPopup)
#include "tst_qquickpopup.moc"