summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorVolker Hilsheimer <volker.hilsheimer@qt.io>2023-04-22 12:47:41 +0200
committerVolker Hilsheimer <volker.hilsheimer@qt.io>2023-04-25 20:42:10 +0200
commitc2e8d20fcf742cac2ff30c335acfcff122ef1ba5 (patch)
treee08f4b636f49535f6a6aec38d76784ec9354ddfb /tests/auto
parent48a9a6a394d15f30074c2d257422bca15018814b (diff)
TextToSpeech: make engine parameters available from QML
Add a map-type property that QML code can initialize to engine-specific key/value mappings. Changing the property at runtime re-initializes the engine. Implement asnychronous initialization option in the mock engine so that we can test those code paths better. Change-Id: I0f2667b9b8e2339fa2e6966a2669f6f54ff2572a Reviewed-by: Axel Spoerl <axel.spoerl@qt.io> Reviewed-by: Jarkko Koivikko <jarkko.koivikko@code-q.fi>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/qtexttospeech_qml/tst_texttospeech.qml14
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/auto/qtexttospeech_qml/tst_texttospeech.qml b/tests/auto/qtexttospeech_qml/tst_texttospeech.qml
index 7782694..f687bc3 100644
--- a/tests/auto/qtexttospeech_qml/tst_texttospeech.qml
+++ b/tests/auto/qtexttospeech_qml/tst_texttospeech.qml
@@ -109,6 +109,10 @@ TestCase {
id: name_selector
TextToSpeech {
engine: "mock"
+ engineParameters: {
+ "delayedInitialization": true
+ }
+
VoiceSelector.name: "Ingvild"
}
}
@@ -117,6 +121,10 @@ TestCase {
id: genderLanguage_selector
TextToSpeech {
engine: "mock"
+ engineParameters: {
+ "delayedInitialization": true
+ }
+
VoiceSelector.gender: Voice.Female
VoiceSelector.language: Qt.locale("en")
}
@@ -124,12 +132,16 @@ TestCase {
function test_voiceSelector() {
var selector = createTemporaryObject(name_selector, testCase)
+ tryCompare(selector, "state", TextToSpeech.Ready)
+
compare(selector.voice.name, "Ingvild")
// there is no way to get to QLocale::English from QML
let EnglishID = 75
selector = createTemporaryObject(genderLanguage_selector, testCase)
+ tryCompare(selector, "state", TextToSpeech.Ready)
+
verify(["Anne", "Mary"].includes(selector.voice.name))
let oldName = selector.voice.name
compare(selector.voice.gender, Voice.Female)
@@ -148,6 +160,7 @@ TestCase {
function test_delayedSelection() {
var selector = createTemporaryObject(name_selector, testCase)
+ tryCompare(selector, "state", TextToSpeech.Ready)
selector.VoiceSelector.gender = Voice.Female
selector.VoiceSelector.name = "Kjersti"
@@ -158,6 +171,7 @@ TestCase {
function test_regularExpressionName() {
var selector = createTemporaryObject(name_selector, testCase)
+ tryCompare(selector, "state", TextToSpeech.Ready)
selector.VoiceSelector.name = /K.*/
selector.VoiceSelector.select()