diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2022-09-15 08:59:21 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2022-09-16 08:34:17 +0000 |
commit | 239ccddd23a9ee743fdb7a3d16ba114fb03ea305 (patch) | |
tree | 15cfae2d57fda225bff1f5bb16244892480ce22d | |
parent | e267aef9146b9bd9b3c2aa8d72b610dfa85f997a (diff) |
Detect speechd misconfigurations in tst_QTextToSpeech
init() used QTRY_VERIFY to assert that the speechd engine reported
ready after construction. The following QSKIP statement was not reached
if the QTRY_VERIFY failed.
This patch removes the QTRY_VERIFY, which leads to speechd being
skipped, when an error is reported after engine construction.
sayWithVoices created a test text for each available voice to be
spoken. The default speech-dispatcher installation on RHEL 9 provides
158 voices, which leads to the test failing with a timeout.
This patch ends the loop with a qWarning after 10 voices. Timeout is
thereby prevented, if any engine has too many.
Both fixes are combined in one commit, because they would fail CI
if staged separately.
Fixes: QTBUG-106286
Change-Id: I8823bbf567c47229966041611f1defb3f75f9fc6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit dee94d1685d816aca1e181b9704927f204c2e75f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | tests/auto/qtexttospeech/tst_qtexttospeech.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/auto/qtexttospeech/tst_qtexttospeech.cpp b/tests/auto/qtexttospeech/tst_qtexttospeech.cpp index 75a761c..bc0f899 100644 --- a/tests/auto/qtexttospeech/tst_qtexttospeech.cpp +++ b/tests/auto/qtexttospeech/tst_qtexttospeech.cpp @@ -101,7 +101,6 @@ void tst_QTextToSpeech::init() QFETCH_GLOBAL(QString, engine); if (engine == "speechd") { QTextToSpeech tts(engine); - QTRY_COMPARE(tts.state(), QTextToSpeech::Ready); if (tts.state() == QTextToSpeech::Error) { QSKIP("speechd engine reported an error, " "make sure the speech-dispatcher service is running!"); @@ -375,7 +374,14 @@ void tst_QTextToSpeech::sayWithVoices() selectWorkingVoice(&tts); const QList<QVoice> voices = tts.availableVoices(); - for (const auto &voice : voices) { + for (qsizetype i = 0; i < voices.count(); ++i) { + + if (i > 9) { + qWarning() << "sayWithVoices ended after 10 out of" << voices.count() << "voices."; + break; + } + + const auto voice = voices.at(i); if (engine == "speechd" && voice.name().startsWith("dfki-")) { qWarning() << "Voice dysfunctional:" << voice; continue; @@ -388,6 +394,7 @@ void tst_QTextToSpeech::sayWithVoices() QElapsedTimer timer; timer.start(); + qDebug() << text.arg(engine, voice.name()); tts.say(text.arg(engine, voice.name())); QTRY_COMPARE(tts.state(), QTextToSpeech::Speaking); QSignalSpy spy(&tts, &QTextToSpeech::stateChanged); |