From 0b6ed7641e2dc15211dcddc048fef548390c7b7b Mon Sep 17 00:00:00 2001 From: Filippo Cucchetto Date: Mon, 17 Aug 2015 15:46:45 +0200 Subject: MenuBar added test for close on Escape pressed Pressing the escape key when a menu is currently opened inside the menubar should close it. A new test is added for checking this behavior. Change-Id: I446cd4f22e1f8d756d89bb20712e354a6d7fe909 Reviewed-by: Filippo Cucchetto Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_menubar.qml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_menubar.qml b/tests/auto/controls/data/tst_menubar.qml index c71cdc33..e268b059 100644 --- a/tests/auto/controls/data/tst_menubar.qml +++ b/tests/auto/controls/data/tst_menubar.qml @@ -106,4 +106,24 @@ TestCase { tryCompare(fileMenu, "__popupVisible", false) window.destroy() } + + function test_closeOnEscapePressed() { + 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) + // Click menu should open + compare(fileMenu.__popupVisible, false) + mouseClick(fileMenu.__visualItem) + tryCompare(fileMenu, "__popupVisible", true) + // wait until popup is visible + tryCompare(fileMenu.__contentItem, "status", Loader.Ready) + waitForRendering(fileMenu.__contentItem.item) + // Pressing escape should close the popup + keyPress(Qt.Key_Escape) + compare(fileMenu.__popupVisible, false) + } } -- cgit v1.2.1