diff options
author | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-04-07 13:20:20 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@theqtcompany.com> | 2016-04-08 13:27:20 +0000 |
commit | 4d3e2361b64a1b991c366435fd1a2edc667d2e31 (patch) | |
tree | 0a21224028bb64cc26cc6aaa90f9ae1e6539863f /tests | |
parent | c80f44d0ce67d88053ea7c1494bdd62f3d2ecdd8 (diff) |
Compile on linux without speechd
Also make sure that the speechd ifdefs only remove the code in case
we're actually using speechd, not for every engine.
Change-Id: I752312af64f7e453dfeaed4f0b277947482aca1d
Reviewed-by: Frederik Gladhorn <frederik.gladhorn@theqtcompany.com>
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/texttospeech/texttospeech.pro | 8 | ||||
-rw-r--r-- | tests/auto/texttospeech/tst_qtexttospeech.cpp | 10 |
2 files changed, 13 insertions, 5 deletions
diff --git a/tests/auto/texttospeech/texttospeech.pro b/tests/auto/texttospeech/texttospeech.pro index c83eaa4..8789213 100644 --- a/tests/auto/texttospeech/texttospeech.pro +++ b/tests/auto/texttospeech/texttospeech.pro @@ -2,3 +2,11 @@ CONFIG += testcase TARGET = tst_qtexttospeech QT += testlib core texttospeech SOURCES += tst_qtexttospeech.cpp + +unix { + CONFIG += link_pkgconfig + packagesExist(speech-dispatcher) { + PKGCONFIG = speech-dispatcher + DEFINES += HAVE_SPEECHD + } +} diff --git a/tests/auto/texttospeech/tst_qtexttospeech.cpp b/tests/auto/texttospeech/tst_qtexttospeech.cpp index afdecba..2e54d78 100644 --- a/tests/auto/texttospeech/tst_qtexttospeech.cpp +++ b/tests/auto/texttospeech/tst_qtexttospeech.cpp @@ -39,10 +39,10 @@ #include <QTextToSpeech> #include <QSignalSpy> -#if defined(Q_OS_UNIX) && !(defined(Q_OS_MAC) || defined(Q_OS_ANDROID)) +#if defined(HAVE_SPEECHD) #include <speech-dispatcher/libspeechd.h> - #if LIBSPEECHD_MAJOR_VERSION > 0 || LIBSPEECHD_MINOR_VERSION >= 9 - #define HAVE_SPD_090 + #if LIBSPEECHD_MAJOR_VERSION == 0 && LIBSPEECHD_MINOR_VERSION < 9 + #define HAVE_SPEECHD_BEFORE_090 #endif #endif @@ -80,7 +80,7 @@ void tst_QTextToSpeech::speech_rate() QTextToSpeech tts; tts.setRate(0.5); QCOMPARE(tts.state(), QTextToSpeech::Ready); -#ifdef HAVE_SPD_090 +#ifndef HAVE_SPEECHD_BEFORE_090 QCOMPARE(tts.rate(), 0.5); #endif @@ -106,7 +106,7 @@ void tst_QTextToSpeech::pitch() QTextToSpeech tts; for (int i = -10; i <= 10; ++i) { tts.setPitch(i / 10.0); -#ifdef HAVE_SPD_090 +#ifndef HAVE_SPEECHD_BEFORE_090 QCOMPARE(tts.pitch(), i / 10.0); #endif } |