summaryrefslogtreecommitdiff
path: root/tests/auto
diff options
context:
space:
mode:
authorCaroline Chao <caroline.chao@digia.com>2013-04-09 15:32:19 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-04-22 13:52:33 +0200
commit6254af55e319568b75c304e52801c1a8c3a49ef5 (patch)
treed3d15560d320250f863630bd84eaceed3dd90359 /tests/auto
parent2230afcb3e891dd48531e24e1dc6fcb32e72bbc7 (diff)
downloadqtquickcontrols-6254af55e319568b75c304e52801c1a8c3a49ef5.tar.gz
ComboBox: Add activeFocusOnPress property
We want this property to allow the user to open the menu using the space key. Change-Id: I291195cdb0e9658860636934d25315b100747eca Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/controls/data/tst_combobox.qml32
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index d6b5f540..5dbf2921 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -54,6 +54,15 @@ TestCase {
height:400
property var model
+
+ Timer {
+ id: timer
+ running: true
+ repeat: false
+ interval: 500
+ onTriggered: testCase.keyPress(Qt.Key_Escape)
+ }
+
function init() {
model = Qt.createQmlObject("import QtQuick 2.1; ListModel {}", testCase, '')
model.append({ text: "Banana", color: "Yellow" })
@@ -192,5 +201,28 @@ TestCase {
verify(!control.control3.activeFocus)
control.destroy()
}
+
+ function test_activeFocusOnPress(){
+ if (Qt.platform.os === "mac")
+ skip("When the menu pops up on OS X, it does not return and the test fails after time out")
+
+ var comboBox = Qt.createQmlObject('import QtQuick.Controls 1.0 ; ComboBox { model: 4 }', container, '');
+ comboBox.activeFocusOnPress = false
+ verify(!comboBox.activeFocus)
+ if (Qt.platform.os === "mac") // on mac when the menu open, the __popup function does not return
+ timer.start()
+ else // two mouse clicks to open and close the popup menu
+ mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1)
+ mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1)
+ verify(!comboBox.activeFocus)
+ comboBox.activeFocusOnPress = true
+ if (Qt.platform.os === "mac") // on mac when the menu open, the __popup function does not return
+ timer.start()
+ else // two mouse clicks to open and close the popup menu
+ mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1)
+ mouseClick(comboBox, comboBox.x + 1, comboBox.y + 1)
+ verify(comboBox.activeFocus)
+ comboBox.destroy()
+ }
}
}