summaryrefslogtreecommitdiff
path: root/tests/auto
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/controls/data/tst_button.qml73
-rw-r--r--tests/auto/controls/data/tst_checkbox.qml73
-rw-r--r--tests/auto/controls/data/tst_combobox.qml75
-rw-r--r--tests/auto/controls/data/tst_groupbox.qml78
-rw-r--r--tests/auto/controls/data/tst_label.qml75
-rw-r--r--tests/auto/controls/data/tst_progressbar.qml75
-rw-r--r--tests/auto/controls/data/tst_radiobutton.qml74
-rw-r--r--tests/auto/controls/data/tst_scrollview.qml72
-rw-r--r--tests/auto/controls/data/tst_slider.qml69
-rw-r--r--tests/auto/controls/data/tst_spinbox.qml72
-rw-r--r--tests/auto/controls/data/tst_statusbar.qml72
-rw-r--r--tests/auto/controls/data/tst_textarea.qml77
-rw-r--r--tests/auto/controls/data/tst_textfield.qml77
-rw-r--r--tests/auto/controls/data/tst_toolbar.qml72
-rw-r--r--tests/auto/controls/data/tst_toolbutton.qml73
15 files changed, 1107 insertions, 0 deletions
diff --git a/tests/auto/controls/data/tst_button.qml b/tests/auto/controls/data/tst_button.qml
index 2ac5cea2..f949ec6e 100644
--- a/tests/auto/controls/data/tst_button.qml
+++ b/tests/auto/controls/data/tst_button.qml
@@ -120,5 +120,78 @@ TestCase {
verify(control.activeFocus)
control.destroy()
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ Button { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ text: "control1" \
+ } \
+ Button { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ text: "control2" \
+ } \
+ Button { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ text: "control3" \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_checkbox.qml b/tests/auto/controls/data/tst_checkbox.qml
index 1c9162a8..1c74e34d 100644
--- a/tests/auto/controls/data/tst_checkbox.qml
+++ b/tests/auto/controls/data/tst_checkbox.qml
@@ -233,5 +233,78 @@ Item {
mouseClick(checkBox, checkBox.x + 1, checkBox.y + 1)
verify(checkBox.activeFocus)
}
+
+ function test_activeFocusOnTab() {
+ checkBox.destroy()
+ wait(0) //QTBUG-30523 so processEvents is called
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ CheckBox { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ text: "control1" \
+ } \
+ CheckBox { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ text: "control2" \
+ } \
+ CheckBox { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ text: "control3" \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_combobox.qml b/tests/auto/controls/data/tst_combobox.qml
index 7609c51d..d6b5f540 100644
--- a/tests/auto/controls/data/tst_combobox.qml
+++ b/tests/auto/controls/data/tst_combobox.qml
@@ -41,6 +41,11 @@
import QtQuick 2.1
import QtTest 1.0
+Item {
+ id: container
+ width: 400
+ height: 400
+
TestCase {
id: testCase
name: "Tests_ComboBox"
@@ -118,4 +123,74 @@ TestCase {
compare(comboBox.currentText, "Yellow")
comboBox.destroy()
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ ComboBox { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ } \
+ ComboBox { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ } \
+ ComboBox { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
+}
}
diff --git a/tests/auto/controls/data/tst_groupbox.qml b/tests/auto/controls/data/tst_groupbox.qml
index 81a8580e..12784b48 100644
--- a/tests/auto/controls/data/tst_groupbox.qml
+++ b/tests/auto/controls/data/tst_groupbox.qml
@@ -42,6 +42,11 @@ import QtQuick 2.1
import QtTest 1.0
import QtQuick.Controls 1.0
+Item {
+ id: container
+ width: 400
+ height: 400
+
TestCase {
id: testCase
name: "Tests_GroupBox"
@@ -106,4 +111,77 @@ TestCase {
compare(groupBox.child1.enabled, true)
compare(groupBox.child2.enabled, true)
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ GroupBox { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ title: "control1" \
+ } \
+ GroupBox { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ title: "control2" \
+ } \
+ GroupBox { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ title: "control3" \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
+}
}
diff --git a/tests/auto/controls/data/tst_label.qml b/tests/auto/controls/data/tst_label.qml
index c904d8be..a5078691 100644
--- a/tests/auto/controls/data/tst_label.qml
+++ b/tests/auto/controls/data/tst_label.qml
@@ -41,6 +41,11 @@
import QtQuick 2.1
import QtTest 1.0
+Item {
+ id: container
+ width: 400
+ height: 400
+
TestCase {
id: testCase
name: "Tests_Label"
@@ -52,4 +57,74 @@ TestCase {
var label = Qt.createQmlObject('import QtQuick.Controls 1.0; Label {}', testCase, '');
label.destroy()
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ Label { \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ text: "control1" \
+ } \
+ Label { \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ text: "control2" \
+ } \
+ Label { \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ text: "control3" \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
+}
}
diff --git a/tests/auto/controls/data/tst_progressbar.qml b/tests/auto/controls/data/tst_progressbar.qml
index 02b96ac3..3dc7a29a 100644
--- a/tests/auto/controls/data/tst_progressbar.qml
+++ b/tests/auto/controls/data/tst_progressbar.qml
@@ -41,6 +41,11 @@
import QtQuick 2.1
import QtTest 1.0
+Item {
+ id: container
+ width: 400
+ height: 400
+
TestCase {
id: testCase
name: "Tests_ProgressBar"
@@ -123,4 +128,74 @@ TestCase {
progressBar3.destroy()
progressBar4.destroy()
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ ProgressBar { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ } \
+ ProgressBar { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ } \
+ ProgressBar { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
+}
}
diff --git a/tests/auto/controls/data/tst_radiobutton.qml b/tests/auto/controls/data/tst_radiobutton.qml
index 1bdb1c93..855f8c7a 100644
--- a/tests/auto/controls/data/tst_radiobutton.qml
+++ b/tests/auto/controls/data/tst_radiobutton.qml
@@ -186,5 +186,79 @@ Item {
mouseClick(radioButton, radioButton.x + 1, radioButton.y + 1)
verify(radioButton.activeFocus)
}
+
+ function test_activeFocusOnTab() {
+ radioButton.destroy()
+ wait(0) //QTBUG-30523 so processEvents is called
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ RadioButton { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ text: "control1" \
+ } \
+ RadioButton { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ text: "control2" \
+ } \
+ RadioButton { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ text: "control3" \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_scrollview.qml b/tests/auto/controls/data/tst_scrollview.qml
index a9e73d1e..c273c16b 100644
--- a/tests/auto/controls/data/tst_scrollview.qml
+++ b/tests/auto/controls/data/tst_scrollview.qml
@@ -42,6 +42,11 @@ import QtQuick 2.1
import QtTest 1.0
import QtQuick.Controls 1.0
+Item {
+ id: container
+ width: 400
+ height: 400
+
TestCase {
id: testCase
name: "Tests_ScrollView"
@@ -107,4 +112,71 @@ TestCase {
verify(scrollView.viewport.width < prevViewportWidth, "Viewport should be smaller with frame")
scrollView.destroy()
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ ScrollView { \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ } \
+ ScrollView { \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ } \
+ ScrollView { \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
+}
}
diff --git a/tests/auto/controls/data/tst_slider.qml b/tests/auto/controls/data/tst_slider.qml
index 88171da5..6d846fdb 100644
--- a/tests/auto/controls/data/tst_slider.qml
+++ b/tests/auto/controls/data/tst_slider.qml
@@ -155,5 +155,74 @@ Item {
verify(control.activeFocus)
control.destroy()
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ Slider { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ } \
+ Slider { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ } \
+ Slider { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_spinbox.qml b/tests/auto/controls/data/tst_spinbox.qml
index e8b0b5b9..a43dce41 100644
--- a/tests/auto/controls/data/tst_spinbox.qml
+++ b/tests/auto/controls/data/tst_spinbox.qml
@@ -293,6 +293,76 @@ Item {
spinbox.destroy()
}
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ SpinBox { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ } \
+ SpinBox { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ } \
+ SpinBox { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ sleep(4000)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
+
function test_ImplicitSize() // Verify if we correctly grow and shrink depending on contents
{
var spinbox = Qt.createQmlObject('import QtQuick.Controls 1.0; SpinBox {}', container, '')
@@ -338,6 +408,8 @@ Item {
downCoord.x = upCoord.x
downCoord.y = item.y + item.height - arrowMargin
}
+
+
}
}
diff --git a/tests/auto/controls/data/tst_statusbar.qml b/tests/auto/controls/data/tst_statusbar.qml
index df0a768c..aa8a7d54 100644
--- a/tests/auto/controls/data/tst_statusbar.qml
+++ b/tests/auto/controls/data/tst_statusbar.qml
@@ -41,6 +41,11 @@
import QtQuick 2.1
import QtTest 1.0
+Item {
+ id: container
+ width: 400
+ height: 400
+
TestCase {
id: testCase
name: "Tests_StatusBar"
@@ -52,5 +57,72 @@ TestCase {
var statusBar = Qt.createQmlObject('import QtQuick.Controls 1.0; StatusBar {}', testCase, '');
statusBar.destroy()
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ StatusBar { \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ } \
+ StatusBar { \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ } \
+ StatusBar { \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
+}
}
diff --git a/tests/auto/controls/data/tst_textarea.qml b/tests/auto/controls/data/tst_textarea.qml
index 0756e4c2..7391daea 100644
--- a/tests/auto/controls/data/tst_textarea.qml
+++ b/tests/auto/controls/data/tst_textarea.qml
@@ -78,5 +78,82 @@ TestCase {
verify(control.activeFocus)
control.destroy()
}
+
+ function test_activeFocusOnTab() {
+ // Set TextArea readonly so the tab/backtab can be tested toward the navigation
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ TextArea { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ text: "control1"; \
+ readOnly: true \
+ } \
+ TextArea { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ text: "control2"; \
+ readOnly: true \
+ } \
+ TextArea { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ text: "control3"; \
+ readOnly: true \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_textfield.qml b/tests/auto/controls/data/tst_textfield.qml
index 14a18b0e..6c5ce6b5 100644
--- a/tests/auto/controls/data/tst_textfield.qml
+++ b/tests/auto/controls/data/tst_textfield.qml
@@ -276,5 +276,82 @@ TestCase {
verify(control.activeFocus)
control.destroy()
}
+
+ function test_activeFocusOnTab() {
+ // Set TextField readonly so the tab/backtab can be tested toward the navigation
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ TextField { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ text: "control1"; \
+ readOnly: true \
+ } \
+ TextField { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ text: "control2"; \
+ readOnly: true \
+ } \
+ TextField { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ text: "control3"; \
+ readOnly: true \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
}
}
diff --git a/tests/auto/controls/data/tst_toolbar.qml b/tests/auto/controls/data/tst_toolbar.qml
index 75cacf93..fc545bd5 100644
--- a/tests/auto/controls/data/tst_toolbar.qml
+++ b/tests/auto/controls/data/tst_toolbar.qml
@@ -41,6 +41,11 @@
import QtQuick 2.1
import QtTest 1.0
+Item {
+ id: container
+ width: 400
+ height: 400
+
TestCase {
id: testCase
name: "Tests_ToolBar"
@@ -52,5 +57,72 @@ TestCase {
var toolBar = Qt.createQmlObject('import QtQuick.Controls 1.0; ToolBar {}', testCase, '');
toolBar.destroy()
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ ToolBar { \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ } \
+ ToolBar { \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ } \
+ ToolBar { \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
+}
}
diff --git a/tests/auto/controls/data/tst_toolbutton.qml b/tests/auto/controls/data/tst_toolbutton.qml
index af33cd5a..9ce7b143 100644
--- a/tests/auto/controls/data/tst_toolbutton.qml
+++ b/tests/auto/controls/data/tst_toolbutton.qml
@@ -70,6 +70,79 @@ TestCase {
verify(control.activeFocus)
control.destroy()
}
+
+ function test_activeFocusOnTab() {
+ var test_control = 'import QtQuick 2.1; \
+ import QtQuick.Controls 1.0; \
+ Item { \
+ width: 200; \
+ height: 200; \
+ property alias control1: _control1; \
+ property alias control2: _control2; \
+ property alias control3: _control3; \
+ ToolButton { \
+ y: 20; \
+ id: _control1; \
+ activeFocusOnTab: true; \
+ text: "control1" \
+ } \
+ ToolButton { \
+ y: 70; \
+ id: _control2; \
+ activeFocusOnTab: false; \
+ text: "control2" \
+ } \
+ ToolButton { \
+ y: 120; \
+ id: _control3; \
+ activeFocusOnTab: true; \
+ text: "control3" \
+ } \
+ } '
+
+ var control = Qt.createQmlObject(test_control, container, '')
+
+ control.control1.forceActiveFocus()
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+
+ control.control2.activeFocusOnTab = true
+ control.control3.activeFocusOnTab = false
+ keyPress(Qt.Key_Tab)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(!control.control1.activeFocus)
+ verify(control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ keyPress(Qt.Key_Tab, Qt.ShiftModifier)
+ verify(control.control1.activeFocus)
+ verify(!control.control2.activeFocus)
+ verify(!control.control3.activeFocus)
+ control.destroy()
+ }
}
}