aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorJarkko Koivikko <jarkko.koivikko@code-q.fi>2015-10-09 19:26:23 +0300
committerJarkko Koivikko <jarkko.koivikko@code-q.fi>2015-10-12 11:04:43 +0000
commit78f145fe269add8d5187e28fd52ef2294b2abbe7 (patch)
tree8f52443220949048da0c9abfd01cf11fe1780ef5 /tests
parentadd8b802c2d1ba5a28a77c3fcae760b1daca6a5b (diff)
Fix numeric input modes for handwriting input
Added missing dialable input mode for LipiInputMethod. Prevent changing the input mode in numeric only input mode. Update test cases to include tests for numeric only input modes. Task-number: QTRD-3705 Task-number: QTRD-3706 Change-Id: Ic3fa090ba4dfa07efd33f4c6b4441c8f95614f75 Reviewed-by: Rainer Keller <rainer.keller@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/inputpanel/data/inputpanel/inputpanel.qml6
-rw-r--r--tests/auto/inputpanel/data/inputpanel/unipen_data.js245
-rw-r--r--tests/auto/inputpanel/data/tst_inputpanel.qml69
-rw-r--r--tests/auto/inputpanel/hwr_test_data/alphanumeric/16781694_100_0.txt24
-rw-r--r--tests/auto/inputpanel/hwr_test_data/alphanumeric/43_096_0.txt41
5 files changed, 381 insertions, 4 deletions
diff --git a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
index 70f8214b..69b82590 100644
--- a/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
+++ b/tests/auto/inputpanel/data/inputpanel/inputpanel.qml
@@ -464,8 +464,10 @@ InputPanel {
}
function setHandwritingMode(enabled) {
- if (inputPanel.keyboard.handwritingMode !== enabled)
- virtualKeyClick(Qt.Key_Context2)
+ if (inputPanel.keyboard.handwritingMode !== enabled) {
+ if (!enabled || inputPanel.keyboard.isHandwritingAvailable())
+ inputPanel.keyboard.handwritingMode = enabled
+ }
return inputPanel.keyboard.handwritingMode === enabled
}
diff --git a/tests/auto/inputpanel/data/inputpanel/unipen_data.js b/tests/auto/inputpanel/data/inputpanel/unipen_data.js
index 28ca3aad..5f5f6afa 100644
--- a/tests/auto/inputpanel/data/inputpanel/unipen_data.js
+++ b/tests/auto/inputpanel/data/inputpanel/unipen_data.js
@@ -116,6 +116,167 @@ var unipenData = {
".Y_DIM": 211,
".Y_POINTS_PER_INCH": 100
},
+ "0x002b": {
+ ".COORD": [
+ "X",
+ "Y",
+ "T"
+ ],
+ ".HIERARCHY": "CHARACTER",
+ ".PEN": [
+ [
+ [
+ 452,
+ 40,
+ 0
+ ],
+ [
+ 452,
+ 39,
+ 54
+ ],
+ [
+ 452,
+ 40,
+ 106
+ ],
+ [
+ 452,
+ 42,
+ 126
+ ],
+ [
+ 453,
+ 50,
+ 144
+ ],
+ [
+ 453,
+ 60,
+ 165
+ ],
+ [
+ 453,
+ 71,
+ 187
+ ],
+ [
+ 453,
+ 96,
+ 208
+ ],
+ [
+ 454,
+ 106,
+ 228
+ ],
+ [
+ 455,
+ 126,
+ 248
+ ],
+ [
+ 455,
+ 135,
+ 280
+ ],
+ [
+ 455,
+ 144,
+ 304
+ ],
+ [
+ 456,
+ 154,
+ 323
+ ],
+ [
+ 455,
+ 156,
+ 345
+ ]
+ ],
+ [
+ [
+ 409,
+ 94,
+ 602
+ ],
+ [
+ 409,
+ 93,
+ 629
+ ],
+ [
+ 410,
+ 93,
+ 692
+ ],
+ [
+ 412,
+ 93,
+ 727
+ ],
+ [
+ 419,
+ 93,
+ 749
+ ],
+ [
+ 428,
+ 94,
+ 765
+ ],
+ [
+ 452,
+ 95,
+ 786
+ ],
+ [
+ 463,
+ 95,
+ 809
+ ],
+ [
+ 497,
+ 92,
+ 835
+ ],
+ [
+ 505,
+ 91,
+ 851
+ ],
+ [
+ 512,
+ 90,
+ 872
+ ],
+ [
+ 516,
+ 90,
+ 904
+ ],
+ [
+ 518,
+ 90,
+ 917
+ ],
+ [
+ 520,
+ 90,
+ 952
+ ]
+ ]
+ ],
+ ".POINTS_PER_SECOND": 60,
+ ".SEGMENT": "CHARACTER",
+ ".VERSION": "1.0",
+ ".X_DIM": 821,
+ ".X_POINTS_PER_INCH": 100,
+ ".Y_DIM": 211,
+ ".Y_POINTS_PER_INCH": 100
+ },
"0x0030": {
".COORD": [
"X",
@@ -12048,5 +12209,89 @@ var unipenData = {
".X_POINTS_PER_INCH": 100,
".Y_DIM": 211,
".Y_POINTS_PER_INCH": 100
+ },
+ "0x100117e": {
+ ".COORD": [
+ "X",
+ "Y",
+ "T"
+ ],
+ ".HIERARCHY": "CHARACTER",
+ ".PEN": [
+ [
+ [
+ 498,
+ 412,
+ 0
+ ],
+ [
+ 497,
+ 405,
+ 25
+ ],
+ [
+ 499,
+ 355,
+ 51
+ ],
+ [
+ 504,
+ 282,
+ 90
+ ],
+ [
+ 504,
+ 228,
+ 126
+ ],
+ [
+ 503,
+ 192,
+ 165
+ ],
+ [
+ 504,
+ 173,
+ 204
+ ],
+ [
+ 506,
+ 155,
+ 250
+ ],
+ [
+ 506,
+ 151,
+ 286
+ ],
+ [
+ 506,
+ 148,
+ 322
+ ],
+ [
+ 506,
+ 146,
+ 360
+ ],
+ [
+ 506,
+ 145,
+ 413
+ ],
+ [
+ 506,
+ 144,
+ 444
+ ]
+ ]
+ ],
+ ".POINTS_PER_SECOND": 60,
+ ".SEGMENT": "CHARACTER",
+ ".VERSION": "1.0",
+ ".X_DIM": 1024,
+ ".X_POINTS_PER_INCH": 100,
+ ".Y_DIM": 600,
+ ".Y_POINTS_PER_INCH": 100
}
}
diff --git a/tests/auto/inputpanel/data/tst_inputpanel.qml b/tests/auto/inputpanel/data/tst_inputpanel.qml
index 65d6dcbc..f5077c57 100644
--- a/tests/auto/inputpanel/data/tst_inputpanel.qml
+++ b/tests/auto/inputpanel/data/tst_inputpanel.qml
@@ -803,7 +803,6 @@ Rectangle {
{ initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 0, inputSequence: "abcdefghij", outputText: "Abcdefghij" },
{ initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 1, inputSequence: "klmnopqrst", outputText: "klmnopqrst" },
{ initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 3, inputSequence: "uvwxyz", outputText: "UVWXYZ" },
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhPreferNumbers, toggleShiftCount: 0, inputSequence: "0123456789", outputText: "0123456789" },
]
}
@@ -832,6 +831,42 @@ Rectangle {
compare(textInput.text, data.outputText)
}
+ function test_hwrNumericInputSequence_data() {
+ return [
+ { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhPreferNumbers, modeSwitchAllowed: true, inputSequence: "0123456789", outputText: "0123456789" },
+ { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDigitsOnly, modeSwitchAllowed: false, inputSequence: "1234567890", outputText: "1234567890" },
+ { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhFormattedNumbersOnly, modeSwitchAllowed: false, inputSequence: "1234567890+", outputText: "1234567890+" },
+ { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDialableCharactersOnly, modeSwitchAllowed: false, inputSequence: "1234567890+", outputText: "1234567890+" },
+ ]
+ }
+
+ function test_hwrNumericInputSequence(data) {
+ prepareTest(data)
+
+ if (!inputPanel.setHandwritingMode(true))
+ expectFail("", "Handwriting not enabled")
+ verify(inputPanel.handwritingMode === true)
+
+ for (var inputIndex in data.inputSequence) {
+ verify(inputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
+ }
+
+ if (inputPanel.wordCandidateView.count > 0) {
+ if (inputPanel.selectionListSearchSuggestion(data.outputText)) {
+ inputPanel.selectionListSelectCurrentItem()
+ }
+ }
+
+ Qt.inputMethod.commit()
+ waitForRendering(inputPanel)
+ compare(textInput.text, data.outputText)
+
+ var inputMode = inputPanel.inputMode
+ verify(inputPanel.virtualKeyClick(Qt.Key_Mode_switch))
+ waitForRendering(inputPanel)
+ compare(inputPanel.inputMode !== inputMode, data.modeSwitchAllowed)
+ }
+
function test_hwrSpellCorrectionSuggestions_data() {
return [
{ initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: "bello", unexpectedSuggestion: "Hello", outputText: "Bello" },
@@ -877,7 +912,6 @@ Rectangle {
{ initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 0, inputSequence: "abcdefghij", outputText: "Abcdefghij" },
{ initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 1, inputSequence: "klmnopqrst", outputText: "klmnopqrst" },
{ initInputMethodHints: Qt.ImhNoPredictiveText, toggleShiftCount: 3, inputSequence: "uvwxyz", outputText: "UVWXYZ" },
- { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhPreferNumbers, toggleShiftCount: 0, inputSequence: "0123456789", outputText: "0123456789" },
]
}
@@ -904,6 +938,37 @@ Rectangle {
compare(textInput.text, data.outputText)
}
+ function test_hwrFullScreenNumericInputSequence_data() {
+ return [
+ { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhPreferNumbers, inputSequence: "0123456789", outputText: "0123456789" },
+ { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDigitsOnly, inputSequence: "1234567890", outputText: "1234567890" },
+ { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhFormattedNumbersOnly, inputSequence: "1234567890+", outputText: "1234567890+" },
+ { initInputMethodHints: Qt.ImhNoPredictiveText | Qt.ImhDialableCharactersOnly, inputSequence: "1234567890+", outputText: "1234567890+" },
+ ]
+ }
+
+ function test_hwrFullScreenNumericInputSequence(data) {
+ prepareTest(data)
+
+ if (!inputPanel.setHandwritingMode(true))
+ expectFail("", "Handwriting not enabled")
+ verify(inputPanel.handwritingMode === true)
+
+ for (var inputIndex in data.inputSequence) {
+ verify(inputPanel.emulateHandwriting(data.inputSequence.charAt(inputIndex), true))
+ }
+
+ if (inputPanel.wordCandidateView.count > 0) {
+ if (inputPanel.selectionListSearchSuggestion(data.outputText)) {
+ inputPanel.selectionListSelectCurrentItem()
+ }
+ }
+
+ Qt.inputMethod.commit()
+ waitForRendering(inputPanel)
+ compare(textInput.text, data.outputText)
+ }
+
function test_hwrFullScreenGestures_data() {
return [
{ initInputMethodHints: Qt.ImhNoPredictiveText, inputSequence: ["a","b","c",Qt.Key_Backspace,Qt.Key_Space,"c"], outputText: "Ab c" },
diff --git a/tests/auto/inputpanel/hwr_test_data/alphanumeric/16781694_100_0.txt b/tests/auto/inputpanel/hwr_test_data/alphanumeric/16781694_100_0.txt
new file mode 100644
index 00000000..c2feed08
--- /dev/null
+++ b/tests/auto/inputpanel/hwr_test_data/alphanumeric/16781694_100_0.txt
@@ -0,0 +1,24 @@
+.VERSION 1.0
+.HIERARCHY CHARACTER
+.COORD X Y T
+.SEGMENT CHARACTER
+.X_DIM 1024
+.Y_DIM 600
+.X_POINTS_PER_INCH 100
+.Y_POINTS_PER_INCH 100
+.POINTS_PER_SECOND 60
+.PEN_DOWN
+498 412 0
+497 405 25
+499 355 51
+504 282 90
+504 228 126
+503 192 165
+504 173 204
+506 155 250
+506 151 286
+506 148 322
+506 146 360
+506 145 413
+506 144 444
+.PEN_UP
diff --git a/tests/auto/inputpanel/hwr_test_data/alphanumeric/43_096_0.txt b/tests/auto/inputpanel/hwr_test_data/alphanumeric/43_096_0.txt
new file mode 100644
index 00000000..4bcda386
--- /dev/null
+++ b/tests/auto/inputpanel/hwr_test_data/alphanumeric/43_096_0.txt
@@ -0,0 +1,41 @@
+.VERSION 1.0
+.HIERARCHY CHARACTER
+.COORD X Y T
+.SEGMENT CHARACTER
+.X_DIM 821
+.Y_DIM 211
+.X_POINTS_PER_INCH 100
+.Y_POINTS_PER_INCH 100
+.POINTS_PER_SECOND 60
+.PEN_DOWN
+452 40 0
+452 39 54
+452 40 106
+452 42 126
+453 50 144
+453 60 165
+453 71 187
+453 96 208
+454 106 228
+455 126 248
+455 135 280
+455 144 304
+456 154 323
+455 156 345
+.PEN_UP
+.PEN_DOWN
+409 94 602
+409 93 629
+410 93 692
+412 93 727
+419 93 749
+428 94 765
+452 95 786
+463 95 809
+497 92 835
+505 91 851
+512 90 872
+516 90 904
+518 90 917
+520 90 952
+.PEN_UP