diff options
author | Liang Qi <liang.qi@qt.io> | 2016-11-26 12:56:18 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-11-26 19:55:26 +0100 |
commit | 573fb399f9917713621d25e0c0aeb48fbc085af5 (patch) | |
tree | edb575544ccc2e48a410f41472a3827ea1f00477 /tests | |
parent | 947a55149aec2724158934efde1be496b3c5e04e (diff) | |
parent | e67e97e9543eae2de42666eec3ff4d3cdca81db3 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
src/virtualkeyboard/doc/qtvirtualkeyboard.qdocconf
Change-Id: I2aac70f4bf65794c73096ec575c9f72bc63ec61c
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/inputpanel/data/inputpanel/inputpanel.qml | 7 | ||||
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 24 |
2 files changed, 30 insertions, 1 deletions
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml index 5a7dfc11..4d42d941 100644 --- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml +++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml @@ -83,6 +83,7 @@ InputPanel { property alias soundEffectSpy: soundEffectSpy property alias inputMethodResultSpy: inputMethodResultSpy property alias wordCandidateListChangedSpy: wordCandidateListChangedSpy + property alias shiftStateSpy: shiftStateSpy signal inputMethodResult(var text) @@ -162,6 +163,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 4c5c8879..915d7441 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -327,10 +327,11 @@ Rectangle { } function test_inputMethodHints_data() { + var decmialPoint = Qt.locale().decimalPoint return [ { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhUppercaseOnly, inputSequence: "uppercase text? yes.", outputText: "UPPERCASE TEXT? YES." }, { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhLowercaseOnly, inputSequence: "uppercase text? no.", outputText: "uppercase text? no." }, - { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDigitsOnly, inputSequence: "1234567890.", outputText: "1234567890." }, + { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDigitsOnly, inputSequence: "1234567890" + decmialPoint, outputText: "1234567890" + decmialPoint }, { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhFormattedNumbersOnly, inputSequence: "1234567890+-,.()", outputText: "1234567890+-,.()" }, { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDialableCharactersOnly, inputSequence: "1234567890+*#", outputText: "1234567890+*#" }, ] @@ -383,6 +384,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 }) |