From 1c6a510c16b35c937af202f517604620b4a97ff0 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Mon, 7 Sep 2015 13:28:15 +0200 Subject: Button: only enable mnemonic if button itself is enabled. Otherwise users can trigger shortcuts even when buttons are disabled. Change-Id: If97c6a3c3df574a4271c53cf7bcfd8fdb1a059d6 Task-number: QTBUG-48144 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_button.qml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml index 136f82cc..0d226ffc 100644 --- a/tests/auto/controls/data/tst_button.qml +++ b/tests/auto/controls/data/tst_button.qml @@ -40,6 +40,7 @@ import QtQuick 2.2 import QtTest 1.0 +import QtQuick.Controls 1.4 import QtQuickControlsTests 1.0 Item { @@ -278,5 +279,26 @@ TestCase { button.destroy() } + + Component { + id: mnemonicButtonComponent + + Button { + text: "&Hi" + enabled: false + } + } + + function test_mnemonic() { + var button = mnemonicButtonComponent.createObject(container); + verify(button); + + clickSpy.clear(); + clickSpy.target = button; + keyClick(Qt.Key_H, Qt.AltModifier); + compare(clickSpy.count, 0); + + button.destroy(); + } } } -- cgit v1.2.1 From 3799188e704e48ff8e9aa728cd76101b15f21fd2 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Mon, 7 Sep 2015 14:35:47 +0200 Subject: Menu: Schedule popup deletion when it's about to hide This leads to serious memory/OpenGL context leaks on Windows. No such thing has been noticed on Linux which may hint to differences in the backend. Task-number: QTBUG-47682 Change-Id: I274ed98db348ffe2c78707f2c92b812f272c2723 Reviewed-by: Mitch Curtis --- tests/auto/controls/data/tst_combobox.qml | 1 + 1 file changed, 1 insertion(+) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index af1fc9dd..057ff471 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -74,6 +74,7 @@ TestCase { function cleanup() { if (model !== 0) model.destroy() + wait(0) // spin the event loop to get all popups to close } function test_keyupdown() { -- cgit v1.2.1 From b27a01a86e614207025e569926d0c419857e8965 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 24 Sep 2015 19:56:23 +0200 Subject: Menus: Clean popup hide and destroy logic When a menu popup gets closed it usually needs to be destroyed right away since we don't recycle its contents. There is an exception, however, and it's when he user triggers a menu item. In this case, we need to proceed in three steps. First, we hide the menu popup, then we emit the triggered signal, and when that one returns, the menu contents can be disposed. If we did all in a single step, we may end up with a crash since we don't support deleting a QtQuick item while it's running a signal handler. Delayed deletions don't work either in the case when the triggered handler ends up running the event loop. Task-number: QTBUG-45182 Task-number: QTBUG-47682 Task-number: QTBUG-48382 Change-Id: Ic39717e09f38df602f641250cd81cf4931863db6 Reviewed-by: J-P Nurmi --- tests/auto/controls/data/tst_combobox.qml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml index 057ff471..da8c79f8 100644 --- a/tests/auto/controls/data/tst_combobox.qml +++ b/tests/auto/controls/data/tst_combobox.qml @@ -524,7 +524,7 @@ TestCase { verify(comboBox.data[menuIndex].__popupVisible) // close the menu before destroying the combobox - comboBox.data[menuIndex].__closeMenu() + comboBox.data[menuIndex].__closeAndDestroy() verify(!comboBox.data[menuIndex].__popupVisible) comboBox.destroy() @@ -550,7 +550,7 @@ TestCase { verify(comboBox.data[menuIndex].items[i].checked) } // close the menu before destroying the combobox - comboBox.data[menuIndex].__closeMenu() + comboBox.data[menuIndex].__closeAndDestroy() verify(!comboBox.data[menuIndex].__popupVisible) comboBox.destroy() } -- cgit v1.2.1 From a21a33fe79e82a7bd3471612b46106ac1343648f Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Thu, 1 Oct 2015 18:08:51 +0200 Subject: Fix failing Tumbler tests on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit By default, it’s not possible to tab into certain controls. Change-Id: Ia0941e5016926f65ab58a7391d6271d15b0c5248 Task-number: QTBUG-46393 Reviewed-by: Gabriel de Dietrich --- tests/auto/extras/data/tst_tumbler.qml | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tests') diff --git a/tests/auto/extras/data/tst_tumbler.qml b/tests/auto/extras/data/tst_tumbler.qml index bc97f35d..9f3ecc2f 100644 --- a/tests/auto/extras/data/tst_tumbler.qml +++ b/tests/auto/extras/data/tst_tumbler.qml @@ -175,6 +175,9 @@ Item { } function test_keyboardNavigation() { + if (Qt.platform.os === "osx") + skip("OS X doesn't allow tab focus for certain controls by default"); + var column = simpleColumn.createObject(tumbler); compare(tumbler.addColumn(column), column); column = simpleColumn.createObject(tumbler); @@ -244,6 +247,9 @@ Item { } function test_itemsCorrectlyPositioned() { + if (Qt.platform.os === "osx") + skip("OS X doesn't allow tab focus for certain controls by default"); + // TODO: rewrite this test so that it tests supported usecases. // Somehow it works with the Base style. It could be rewritten to use an // equal amount of items for the model and visibleItemCount, judging from @@ -346,6 +352,9 @@ Item { } function test_focusPastLastColumn() { + if (Qt.platform.os === "osx") + skip("OS X doesn't allow tab focus for certain controls by default"); + var column = dayOfMonthColumn.createObject(tumbler); compare(tumbler.addColumn(column), column); column = yearColumn.createObject(tumbler); -- cgit v1.2.1