aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/popup
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2016-09-26 14:10:14 +0200
committerJ-P Nurmi <jpnurmi@qt.io>2016-09-26 14:13:35 +0200
commit11b066beb45e7da084c6f792cf9421d48d4b40bf (patch)
tree0a27017508682b812b9fa533a3cab95aeb3c33c6 /tests/auto/popup
parentf1eef22d0d1ddcc2ee48e45e522788eb97f429b0 (diff)
parentd1efdcd2beac4d40d06ac7258b4d84e4376ab9d6 (diff)
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts: examples/quickcontrols2/gallery/gallery.qrc src/imports/controls/doc/src/qtquickcontrols2-styles.qdoc src/quicktemplates2/qquickstackview_p.cpp src/quicktemplates2/qquickstackview_p_p.h tests/auto/controls/data/tst_stackview.qml Change-Id: If451fe0e5653572d305b4de90a6d5cb878463e8d
Diffstat (limited to 'tests/auto/popup')
-rw-r--r--tests/auto/popup/data/nested.qml64
-rw-r--r--tests/auto/popup/tst_popup.cpp27
2 files changed, 91 insertions, 0 deletions
diff --git a/tests/auto/popup/data/nested.qml b/tests/auto/popup/data/nested.qml
new file mode 100644
index 00000000..bf9e86c5
--- /dev/null
+++ b/tests/auto/popup/data/nested.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** You may use this file under the terms of the BSD license as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.6
+import QtQuick.Controls 2.0
+
+ApplicationWindow {
+ width: 400
+ height: 400
+
+ property alias modalPopup: modalPopup
+ property alias modelessPopup: modelessPopup
+
+ Popup {
+ id: modalPopup
+ modal: true
+ width: 200
+ height: 200
+ }
+
+ Popup {
+ id: modelessPopup
+ modal: false
+ width: 100
+ height: 100
+ }
+}
diff --git a/tests/auto/popup/tst_popup.cpp b/tests/auto/popup/tst_popup.cpp
index 298328de..6d1e1e3c 100644
--- a/tests/auto/popup/tst_popup.cpp
+++ b/tests/auto/popup/tst_popup.cpp
@@ -69,6 +69,7 @@ private slots:
void wheel_data();
void wheel();
void parentDestroyed();
+ void nested();
};
void tst_popup::visible_data()
@@ -609,6 +610,32 @@ void tst_popup::parentDestroyed()
QVERIFY(!popup.parentItem());
}
+void tst_popup::nested()
+{
+ QQuickApplicationHelper helper(this, QStringLiteral("nested.qml"));
+ QQuickWindow *window = helper.window;
+ window->show();
+ QVERIFY(QTest::qWaitForWindowExposed(window));
+
+ QQuickPopup *modalPopup = window->property("modalPopup").value<QQuickPopup *>();
+ QVERIFY(modalPopup);
+
+ QQuickPopup *modelessPopup = window->property("modelessPopup").value<QQuickPopup *>();
+ QVERIFY(modelessPopup);
+
+ modalPopup->open();
+ QCOMPARE(modalPopup->isVisible(), true);
+
+ modelessPopup->open();
+ QCOMPARE(modelessPopup->isVisible(), true);
+
+ // click outside the modeless popup on the top, but inside the modal popup below
+ QTest::mouseClick(window, Qt::LeftButton, Qt::NoModifier, QPoint(150, 150));
+
+ QTRY_COMPARE(modelessPopup->isVisible(), false);
+ QCOMPARE(modalPopup->isVisible(), true);
+}
+
QTEST_MAIN(tst_popup)
#include "tst_popup.moc"