diff options
author | Jarkko Koivikko <jarkko.koivikko@code-q.fi> | 2017-09-21 23:28:23 +0300 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2018-01-19 09:40:22 +0000 |
commit | 46f6b84e7e8d5cff6e038d47026baf657ecb1460 (patch) | |
tree | b5a0fd8a5a8f149244011026956b274f914ddac5 /tests/auto | |
parent | d297dfd0641e6608386205d99a0518726c315867 (diff) |
Add support for external language switch
Added new signal InputPanel::externalLanguageSwitch and
a property InputPanel::externalLanguageSwitchEnabled for
enabling external language switch.
If the externalLanguageSwitchEnabled is true, the signal is
triggered instead of built-in language popup.
The new language can be selected by setting the
VirtualKeyboardSettings::locale property.
[ChangeLog] Add option to use external language dialog instead of
built-in language popup.
Change-Id: I44f88e6b3e52db4cfbee02bd3b6d7f4be38a9521
Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/inputpanel/data/inputpanel/inputpanel.qml | 11 | ||||
-rw-r--r-- | tests/auto/inputpanel/data/tst_inputpanel.qml | 16 |
2 files changed, 24 insertions, 3 deletions
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml index dfdb941b..ded8aee3 100644 --- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml +++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml @@ -91,6 +91,7 @@ InputPanel { property alias wordCandidateListVisibleSpy: wordCandidateListVisibleSpy property alias shiftStateSpy: shiftStateSpy property alias shadowInputControlVisibleSpy: shadowInputControlVisibleSpy + property alias externalLanguageSwitchSpy: externalLanguageSwitchSpy signal inputMethodResult(var text) @@ -188,6 +189,12 @@ InputPanel { signalName: "onVisibleChanged" } + SignalSpy { + id: externalLanguageSwitchSpy + target: inputPanel + signalName: "onExternalLanguageSwitch" + } + function findChildByProperty(parent, propertyName, propertyValue, compareCb) { var obj = null if (parent === null) @@ -293,6 +300,10 @@ InputPanel { return true } + function setExternalLanguageSwitchEnabled(enabled) { + externalLanguageSwitchEnabled = enabled + } + function findVirtualKey(key) { return Utils.findChild(keyboardLayoutLoader, key, function(obj, param) { if (!obj.hasOwnProperty("key") || !obj.hasOwnProperty("text")) diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml index 61d6f509..f9164f97 100644 --- a/tests/auto/inputpanel/data/tst_inputpanel.qml +++ b/tests/auto/inputpanel/data/tst_inputpanel.qml @@ -82,6 +82,7 @@ Rectangle { inputPanel.setWclAlwaysVisible(data !== undefined && data.hasOwnProperty("wclAlwaysVisible") && data.wclAlwaysVisible) inputPanel.setWclAutoCommitWord(data !== undefined && data.hasOwnProperty("wclAutoCommitWord") && data.wclAutoCommitWord) inputPanel.setFullScreenMode(data !== undefined && data.hasOwnProperty("fullScreenMode") && data.fullScreenMode) + inputPanel.setExternalLanguageSwitchEnabled(data !== undefined && data.hasOwnProperty("externalLanguageSwitchEnabled") && data.externalLanguageSwitchEnabled) container.forceActiveFocus() if (data !== undefined && data.hasOwnProperty("initText")) { textInput.text = data.initText @@ -1527,14 +1528,23 @@ Rectangle { } } - function test_languagePopupListToggle() { - prepareTest() + function test_languagePopupListToggle_data() { + return [ + { externalLanguageSwitchEnabled: true }, + { externalLanguageSwitchEnabled: false }, + ] + } + + function test_languagePopupListToggle(data) { + prepareTest(data) if (inputPanel.availableLocales.length < 2) skip("Input language can not be changed") var changeLanguageKey = inputPanel.findObjectByName("changeLanguageKey") var languagePopupList = inputPanel.findObjectByName("languagePopupList") + inputPanel.externalLanguageSwitchSpy.clear() inputPanel.virtualKeyClick(changeLanguageKey) - compare(languagePopupList.visible, true) + compare(languagePopupList.visible, !data.externalLanguageSwitchEnabled) + compare(inputPanel.externalLanguageSwitchSpy.count, data.externalLanguageSwitchEnabled ? 1 : 0) inputPanel.virtualKeyClick(changeLanguageKey) compare(languagePopupList.visible, false) } |