summaryrefslogtreecommitdiff
path: root/tests/auto/controls
diff options
context:
space:
mode:
authorFilippo Cucchetto <filippocucchetto@gmail.com>2015-11-24 22:35:51 +0100
committerFilippo Cucchetto <filippocucchetto@gmail.com>2015-11-26 23:03:20 +0000
commit812f5779855d94cbe779f77003cc14935e02ef63 (patch)
tree931a601a7deb5125ef3d2ee8be286f6248f4f05f /tests/auto/controls
parent2407d7ede10547025af05d875f33f4580cdbb565 (diff)
downloadqtquickcontrols-812f5779855d94cbe779f77003cc14935e02ef63.tar.gz
Menubar popups should handle only release events of a previous press event
When a popup is brought up by a press event for a menu inside the menubar it should not handle the relative next release event if it falls outside the popup. Before forwarding the release event we first check if a previous press event was seen, if not we simply discard the event. Task-number: QTBUG-47295 Task-number: QTBUG-45117 Change-Id: I632fab0a3abfdfc9872f85f99f9d7f50d41526cc Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'tests/auto/controls')
-rw-r--r--tests/auto/controls/data/tst_menubar.qml51
1 files changed, 51 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_menubar.qml b/tests/auto/controls/data/tst_menubar.qml
index bf6371e0..44238e21 100644
--- a/tests/auto/controls/data/tst_menubar.qml
+++ b/tests/auto/controls/data/tst_menubar.qml
@@ -39,6 +39,7 @@
****************************************************************************/
import QtQuick 2.2
+import QtQuick.Controls 1.4
import QtTest 1.0
TestCase {
@@ -48,8 +49,58 @@ TestCase {
width:400
height:400
+ Component {
+ id: windowComponent
+ ApplicationWindow {
+ width: 300; height: 300
+ visible: true
+ menuBar: MenuBar {
+ Menu {
+ title: "&File"; objectName: "fileMenu"
+ Menu {
+ title: "&Recent Files"; objectName: "recentFilesSubMenu"
+ MenuItem { text: "RecentFile1"; objectName: "recentFile1MenuItem" }
+ MenuItem { text: "RecentFile2"; objectName: "recentFile2MenuItem" }
+ }
+ MenuItem { text: "&Save"; objectName: "saveMenuItem" }
+ MenuItem { text: "&Load"; objectName: "loadMenuItem" }
+ MenuItem { text: "&Exit"; objectName: "exitMenuItem" }
+ }
+ Menu {
+ title: "&Edit"; objectName: "editMenu"
+ Menu {
+ title: "&Advanced"; objectName: "advancedSubMenu"
+ MenuItem { text: "advancedOption1"; objectName: "advancedOption1MenuItem" }
+ }
+ MenuItem { text: "&Preferences"; objectName: "preferencesMenuItem" }
+ }
+ }
+ }
+ }
+
function test_createMenuBar() {
var menuBar = Qt.createQmlObject('import QtQuick.Controls 1.2; MenuBar {}', testCase, '');
menuBar.destroy()
}
+
+
+ function test_qtBug47295()
+ {
+ if (Qt.platform.os === "osx")
+ skip("MenuBar cannot be reliably tested on OS X")
+
+ var window = windowComponent.createObject()
+ waitForRendering(window.contentItem)
+ var fileMenu = findChild(window, "fileMenu")
+ verify(fileMenu)
+ tryCompare(fileMenu, "__popupVisible", false)
+ mousePress(fileMenu.__visualItem)
+ wait(200);
+ tryCompare(fileMenu, "__popupVisible", true)
+ mouseMove(fileMenu.__contentItem, 0, -10)
+ wait(200)
+ mouseRelease(fileMenu.__contentItem, 0, -10)
+ tryCompare(fileMenu, "__popupVisible", true)
+ wait(200)
+ }
}