aboutsummaryrefslogtreecommitdiffstats
path: root/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
diff options
context:
space:
mode:
Diffstat (limited to 'tests/auto/inputpanel/data/inputpanel/inputpanel.qml')
-rw-r--r--tests/auto/inputpanel/data/inputpanel/inputpanel.qml57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
index a467fb15..c3682b8a 100644
--- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
+++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
@@ -67,6 +67,7 @@ InputPanel {
naviationHighlight.widthAnimation.running ||
naviationHighlight.heightAnimation.running
readonly property var wordCandidateView: Utils.findChildByProperty(keyboard, "objectName", "wordCandidateView", null)
+ readonly property var wordCandidateContextMenu: Utils.findChildByProperty(keyboard, "objectName", "wordCandidateContextMenu", null)
readonly property var shadowInputControl: Utils.findChildByProperty(keyboard, "objectName", "shadowInputControl", null)
readonly property var shadowInput: Utils.findChildByProperty(keyboard, "objectName", "shadowInput", null)
readonly property var selectionControl: Utils.findChildByProperty(inputPanel, "objectName", "selectionControl", null)
@@ -178,6 +179,12 @@ InputPanel {
}
SignalSpy {
+ id: wordCandidateContextMenuActiveSpy
+ target: wordCandidateContextMenu
+ signalName: "onActiveChanged"
+ }
+
+ SignalSpy {
id: shiftStateSpy
target: InputContext
signalName: "onShiftChanged"
@@ -530,6 +537,14 @@ InputPanel {
InputContext.shiftHandler.toggleShift()
}
+ function setShift(shift) {
+ InputContext.shift = shift
+ }
+
+ function setCapsLock(capsLock) {
+ InputContext.capsLock = capsLock
+ }
+
function style() {
return VirtualKeyboardSettings.styleName
}
@@ -583,6 +598,48 @@ InputPanel {
return true
}
+ function selectionListCurrentIndex() {
+ return inputPanel.wordCandidateView.currentIndex
+ }
+
+ function selectionListSuggestionIsFromUserDictionary() {
+ if (!inputPanel.wordCandidateView.currentItem)
+ return false
+ var dictionaryType = inputPanel.wordCandidateView.model.dataAt(inputPanel.wordCandidateView.currentIndex, SelectionListModel.DictionaryTypeRole)
+ return dictionaryType !== undefined && dictionaryType === SelectionListModel.UserDictionary
+ }
+
+ function openWordCandidateContextMenu() {
+ if (!inputPanel.wordCandidateView.currentItem)
+ return false
+ testcase.wait(200)
+ wordCandidateContextMenuActiveSpy.clear()
+ testcase.mousePress(inputPanel.wordCandidateView.currentItem)
+ wordCandidateContextMenuActiveSpy.wait()
+ testcase.mouseRelease(inputPanel.wordCandidateView.currentItem)
+ return wordCandidateContextMenu.active
+ }
+
+ function selectItemFromWordCandidateContextMenu(index) {
+ if (!inputPanel.wordCandidateView.currentItem)
+ return false
+ if (!wordCandidateContextMenu.active)
+ return false
+ var wordCandidateContextMenuList = Utils.findChildByProperty(keyboard, "objectName", "wordCandidateContextMenuList", null)
+ if (wordCandidateContextMenuList.currentIndex !== index) {
+ wordCandidateContextMenuList.currentIndex = index
+ testcase.waitForRendering(inputPanel)
+ }
+ if (!wordCandidateContextMenuList.currentItem)
+ return false
+ var itemPos = inputPanel.mapFromItem(wordCandidateContextMenuList.currentItem,
+ wordCandidateContextMenuList.currentItem.width / 2,
+ wordCandidateContextMenuList.currentItem.height / 2)
+ testcase.mouseClick(inputPanel, itemPos.x, itemPos.y, Qt.LeftButton, 0, 20)
+ testcase.waitForRendering(inputPanel)
+ return true
+ }
+
function setHandwritingMode(enabled) {
if (inputPanel.keyboard.handwritingMode !== enabled) {
if (!enabled || inputPanel.keyboard.isHandwritingAvailable())