diff options
author | Axel Spoerl <axel.spoerl@qt.io> | 2022-09-15 08:59:21 +0200 |
---|---|---|
committer | Axel Spoerl <axel.spoerl@qt.io> | 2022-09-16 07:48:41 +0000 |
commit | dee94d1685d816aca1e181b9704927f204c2e75f (patch) | |
tree | d0c43b06764dd1758300e5ac28420f97a305fa15 | |
parent | 9de53a16e1abe846c7a1a63618b9bf1d20d7618a (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
Pick-to: 6.4
Change-Id: I8823bbf567c47229966041611f1defb3f75f9fc6
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
-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); |