diff options
author | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-05-24 15:16:38 +0200 |
---|---|---|
committer | Volker Hilsheimer <volker.hilsheimer@qt.io> | 2023-05-30 09:27:10 +0200 |
commit | 511e23d1bf2dfbca1c419bddf49b2b9c11251a0b (patch) | |
tree | 8764a8d541488abb2559cda4a5e76c53e0a97574 /tests/auto | |
parent | 747d2cc1a15ffcbb3743b77f8f9ba71d1feceb95 (diff) |
API review: remove the synthesized signal and the simple slot
They were only need for QML clients, for C++ client the version taking
a callable is more convenient. But QML clients cannot really use
QAudioFormat (there is no QML version of the type), and operating
on QByteArrays is also not something we want QML (or JavaScript code)
to do.
The engines still emit a signal, as that makes it easier to implement
the engine.
Change-Id: Ie24a41195cd5b7e27ec2b1562fb3f8e515c5adc3
Reviewed-by: Axel Spoerl <axel.spoerl@qt.io>
Reviewed-by: Jeremy Whiting <jpwhiting@kde.org>
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qtexttospeech/tst_qtexttospeech.cpp | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/tests/auto/qtexttospeech/tst_qtexttospeech.cpp b/tests/auto/qtexttospeech/tst_qtexttospeech.cpp index 317c683..d2d1830 100644 --- a/tests/auto/qtexttospeech/tst_qtexttospeech.cpp +++ b/tests/auto/qtexttospeech/tst_qtexttospeech.cpp @@ -944,15 +944,12 @@ void tst_QTextToSpeech::synthesize() QAudioFormat pcmFormat; QByteArray pcmData; - connect(&tts, &QTextToSpeech::synthesized, - this, [&pcmFormat, &pcmData](const QAudioFormat &format, const QByteArray &bytes) { + QElapsedTimer notBlockingTimer; + notBlockingTimer.start(); + tts.synthesize(text, [&pcmFormat, &pcmData](const QAudioFormat &format, const QByteArray &bytes) { pcmFormat = format; pcmData += bytes; }); - - QElapsedTimer notBlockingTimer; - notBlockingTimer.start(); - tts.synthesize(text); QCOMPARE_LT(notBlockingTimer.elapsed(), 250); QTRY_VERIFY(running); QTRY_VERIFY(finished); @@ -997,16 +994,14 @@ void tst_QTextToSpeech::synthesizeCallback() QAudioFormat expectedFormat; QByteArray expectedBytes; - // record a reference using the already tested synthesized() signal - auto connection = connect(&tts, &QTextToSpeech::synthesized, - [&expectedFormat, &expectedBytes](const QAudioFormat &format, const QByteArray &bytes){ + // record a reference using the already tested version + tts.synthesize(text,[&expectedFormat, &expectedBytes] + (const QAudioFormat &format, const QByteArray &bytes) { expectedFormat = format; expectedBytes += bytes; }); - tts.synthesize(text); QTRY_VERIFY(expectedFormat.isValid()); QTRY_COMPARE(tts.state(), QTextToSpeech::Ready); - tts.disconnect(connection); struct Processor : QObject { void process(const QAudioFormat &format, const QByteArray &bytes) |