diff options
author | Bramastyo Harimukti <bramastyo.harimukti.santoso@pelagicore.com> | 2016-06-23 18:02:43 +0200 |
---|---|---|
committer | Dominik Holland <dominik.holland@pelagicore.com> | 2016-09-27 18:06:50 +0000 |
commit | e8b7dcea885f5b5873ede6fb1a1da0a447c888bc (patch) | |
tree | 1afa16864701e69aa7abb4b2c7b285b8849e74d6 /tests | |
parent | c9a252d2a16552143e83925040555df66a8841da (diff) |
Implemented proper double click behavior of shift handler
Previously, there is nothing to separate whether the button
command is a single click or a double click. Every time we
click the shift button, it always look for the second click
and always activate the caps lock. There is no time limit to
specify if there will be a second click and always recognized
the upcoming click to activate the caps lock. The correct be-
havior of a shift button is that a single click is used to
enable the upper-case and automatically turned into lower case
when the next letter is typed. Another case, within a specific
time, if a second click comes, the caps-lock is activated and
keep the upper-case mode, otherwise the upcoming click is used
to abort the upper-case and change the keyboard mode back to
lower-case.
Unit test is also updated.
[ChangeLog] Changed behavior of shift handler to only activate
caps lock if the shift key is double-clicked.
Change-Id: Ia04a61ca6df5407f37eb73b9de65c6ccd0128547
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 51 |
1 files changed, 46 insertions, 5 deletions
diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml index 4c5c8879..1fedfc51 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -352,11 +352,6 @@ Rectangle { return [ { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 0, inputSequence: "aaa bbb", outputText: "Aaa bbb", autoCapitalizationEnabled: true, toggleShiftEnabled: true }, { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 1, inputSequence: "aaa bbb", outputText: "aaa bbb", autoCapitalizationEnabled: true, toggleShiftEnabled: true }, - { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 2, inputSequence: "aaa bbb", outputText: "Aaa bbb", autoCapitalizationEnabled: true, toggleShiftEnabled: true }, - { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 3, inputSequence: "aaa bbb", outputText: "AAA BBB", autoCapitalizationEnabled: true, toggleShiftEnabled: true }, - { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 4, inputSequence: "aaa bbb", outputText: "aaa bbb", autoCapitalizationEnabled: true, toggleShiftEnabled: true }, - { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 5, inputSequence: "aaa bbb", outputText: "Aaa bbb", autoCapitalizationEnabled: true, toggleShiftEnabled: true }, - { initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 6, inputSequence: "aaa bbb", outputText: "AAA BBB", autoCapitalizationEnabled: true, toggleShiftEnabled: true }, { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, toggleShiftCount: 0, inputSequence: "aaa bbb", outputText: "aaa bbb", autoCapitalizationEnabled: false, toggleShiftEnabled: true }, { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, toggleShiftCount: 1, inputSequence: "aaa bbb", outputText: "AAA BBB", autoCapitalizationEnabled: false, toggleShiftEnabled: true }, { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhNoAutoUppercase, toggleShiftCount: 2, inputSequence: "aaa bbb", outputText: "aaa bbb", autoCapitalizationEnabled: false, toggleShiftEnabled: true }, @@ -383,6 +378,52 @@ Rectangle { compare(textInput.text, data.outputText) } + function test_shiftCapsLock_data() { + return [ + { initInputMethodHints: Qt.ImhNoPredictiveText, capsLock: false, inputSequence: "aa bbb", outputText: "Aaa bbb", toggleShiftEnabled: true, beginLowerCase: false, midUpperCase: false }, + { initInputMethodHints: Qt.ImhNoPredictiveText, capsLock: true, inputSequence: "aa bbb", outputText: "AAA BBB", toggleShiftEnabled: true, beginLowerCase: false, midUpperCase: false }, + { initInputMethodHints: Qt.ImhNoPredictiveText, capsLock: false, inputSequence: "aa bbb", outputText: "aaa bbb", toggleShiftEnabled: true, beginLowerCase: true, midUpperCase: false }, + { initInputMethodHints: Qt.ImhNoPredictiveText, capsLock: false, inputSequence: "aa bbb", outputText: "aaa Bbb", toggleShiftEnabled: true, beginLowerCase: true, midUpperCase: true }, + { initInputMethodHints: Qt.ImhNoPredictiveText, capsLock: false, inputSequence: "aa bbb", outputText: "Aaa BBB", toggleShiftEnabled: true, beginLowerCase: false, midUpperCase: true } + ] + } + + function test_shiftCapsLock(data) { + prepareTest(data) + + compare(inputPanel.toggleShiftEnabled, data.toggleShiftEnabled) + + // Toggle shift when the first letter should be a lower case + if (data.beginLowerCase) { + inputPanel.toggleShift() + } + + verify(inputPanel.virtualKeyClick("a")) + + // Toggle shift when the caps lock should be enabled + if (data.capsLock) { + inputPanel.toggleShift() + wait(300) + inputPanel.toggleShift() + } + + for (var inputIndex in data.inputSequence) { + if (inputIndex == 3 && data.beginLowerCase && data.midUpperCase) { + inputPanel.toggleShift() + } + + else if (data.inputSequence[inputIndex] == "b" && !data.beginLowerCase && data.midUpperCase) { + inputPanel.toggleShift() + } + + verify(inputPanel.virtualKeyClick(data.inputSequence[inputIndex])) + } + + Qt.inputMethod.commit() + waitForRendering(inputPanel) + compare(textInput.text, data.outputText) + } + function test_symbolMode() { prepareTest({ initInputMethodHints: Qt.ImhNoPredictiveText }) |