aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2016-11-12 22:00:48 +0200
committerLiang Qi <liang.qi@qt.io>2016-11-25 09:59:45 +0000
commit98aa04821f6b851a990f3fc0e1ac29291d28de14 (patch)
treecda4f3395181e7b5f8676252e641b65ea1172be6 /tests
parent13a199e6e2c5f27b0f12eff380df4f0c0d156e6e (diff)
Fix duplicate shift state change when focus object changes
Previously the shift state could be set twice when focus object changed, first in reset() method and then in autoCapitalize() method. This change eliminates the initial shift state in reset() method. Task-number: QTBUG-57082 Change-Id: I4bba5c85aae1d0d631e7e30577d0d4068c9cc582 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/inputpanel/data/inputpanel/inputpanel.qml7
-rw-r--r--tests/auto/inputpanel/data/tst_inputpanel.qml21
2 files changed, 28 insertions, 0 deletions
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
index 5f864445..9586a736 100644
--- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
+++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
@@ -72,6 +72,7 @@ InputPanel {
property alias soundEffectSpy: soundEffectSpy
property alias inputMethodResultSpy: inputMethodResultSpy
property alias wordCandidateListChangedSpy: wordCandidateListChangedSpy
+ property alias shiftStateSpy: shiftStateSpy
signal inputMethodResult(var text)
@@ -151,6 +152,12 @@ InputPanel {
signalName: "dataChanged"
}
+ SignalSpy {
+ id: shiftStateSpy
+ target: InputContext
+ signalName: "onShiftChanged"
+ }
+
function findChildByProperty(parent, propertyName, propertyValue, compareCb) {
var obj = null
if (parent === null)
diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml
index 85de31d4..919597a1 100644
--- a/tests/auto/inputpanel/data/tst_inputpanel.qml
+++ b/tests/auto/inputpanel/data/tst_inputpanel.qml
@@ -363,6 +363,27 @@ Rectangle {
compare(textInput.text, data.outputText)
}
+ function test_focusAndShiftState() {
+ prepareTest()
+
+ // Initial focus is set to textInput, shift state should not change
+ // when focus is set to container
+ inputPanel.shiftStateSpy.clear()
+ container.forceActiveFocus()
+ compare(inputPanel.shiftStateSpy.count, 0, "Unexpected number of shift state changes after focus change (ImhNone -> ImhNone)")
+
+ // Change to lower case
+ inputPanel.shiftStateSpy.clear()
+ inputPanel.toggleShift()
+ compare(inputPanel.shiftStateSpy.count, 1, "Unexpected number of shift state changes after shift key press")
+
+ // Set focus back to textInput, and expect that shift state is changed
+ // to auto upper case
+ inputPanel.shiftStateSpy.clear()
+ textInput.forceActiveFocus()
+ compare(inputPanel.shiftStateSpy.count, 1, "Unexpected number of shift state changes after focus change (auto upper case)")
+ }
+
function test_symbolMode() {
prepareTest({ initInputMethodHints: Qt.ImhNoPredictiveText })