From dee94d1685d816aca1e181b9704927f204c2e75f Mon Sep 17 00:00:00 2001 From: Axel Spoerl Date: Thu, 15 Sep 2022 08:59:21 +0200 Subject: 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 --- tests/auto/qtexttospeech/tst_qtexttospeech.cpp | 11 +++++++++-- 1 file 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 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); -- cgit v1.2.3