1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
|
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include "common/text-to-speech.h"
#include "common/system.h"
#include "common/events.h"
#include "common/array.h"
#include "engines/testbed/speech.h"
namespace Testbed {
void Speechtests::waitForSpeechEnd(Common::TextToSpeechManager *ttsMan) {
Common::Event event;
while (ttsMan->isSpeaking()) {
g_system->delayMillis(100);
g_system->getEventManager()->pollEvent(event);
}
}
TestExitStatus Speechtests::testMale() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
Testsuite::clearScreen();
Common::String info = "Male voice test. You should expect a male voice to say \"Testing text to speech with male voice.\"";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing male TTS voice", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testMale\n");
return kTestSkipped;
}
Common::Array<int> maleVoices = ttsMan->getVoiceIndicesByGender(Common::TTSVoice::MALE);
if (maleVoices.size() == 0) {
Testsuite::displayMessage("No male voice available");
return kTestFailed;
}
ttsMan->setVoice(maleVoices[0]);
ttsMan->say("Testing text to speech with male voice.");
if (!ttsMan->isSpeaking()) {
Testsuite::logDetailedPrintf("Male TTS failed\n");
return kTestFailed;
}
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear male voice saying: \"Testing text to speech with male voice.\" ?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("Male TTS failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testFemale() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
Testsuite::clearScreen();
Common::String info = "Female voice test. You should expect a female voice to say \"Testing text to speech with female voice.\"";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing female TTS voice", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testFemale\n");
return kTestSkipped;
}
Common::Array<int> femaleVoices = ttsMan->getVoiceIndicesByGender(Common::TTSVoice::FEMALE);
if (femaleVoices.size() == 0) {
Testsuite::logDetailedPrintf("Female TTS failed\n");
return kTestFailed;
}
ttsMan->setVoice(femaleVoices[0]);
ttsMan->say("Testing text to speech with female voice.");
if (!ttsMan->isSpeaking()) {
Testsuite::logDetailedPrintf("Female TTS failed\n");
return kTestFailed;
}
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear female voice saying: \"Testing text to speech with female voice.\" ?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("Female TTS failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testStop() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech stop test. You should expect a voice to start speaking and after approximately a second it should stop the speech";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS stop", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testStop\n");
return kTestSkipped;
}
ttsMan->say("Testing text to speech, the speech should stop after approximately a second after it started, so it shouldn't have the time to read this.");
g_system->delayMillis(1000);
ttsMan->stop();
// It is allright if the voice isn't available right away, but a second should be
// enough for the TTS to recover and get ready.
g_system->delayMillis(1000);
if (!ttsMan->isReady()) {
Testsuite::logDetailedPrintf("TTS stop failed\n");
return kTestFailed;
}
Common::String prompt = "Did you hear a voice saying: \"Testing text to speech, the speech should stop after approximately a second after it started, so it shouldn't have the time to read this.\" but stopping in the middle?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS stop failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testStopAndSpeak() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech stop and speak test. You should expect a voice to start speaking and after approximately a second it should stop the speech and start another sentence.";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS stop and speak", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testStop\n");
return kTestSkipped;
}
ttsMan->say("Testing text to speech, the speech should stop after approximately a second after it started, so it shouldn't have the time to read this.");
g_system->delayMillis(1000);
ttsMan->stop();
ttsMan->say("Now starting the second sentence.", Common::TextToSpeechManager::QUEUE);
ttsMan->say("You should hear that one in totality.", Common::TextToSpeechManager::QUEUE);
if (!ttsMan->isSpeaking()) {
Testsuite::logDetailedPrintf("Male TTS failed\n");
return kTestFailed;
}
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a voice saying: \"Testing text to speech, the speech should stop after approximately a second after it started, so it shouldn't have the time to read this.\" but stopping in the middle, and then saying \"Now starting the second sentence. You should hear that one in totality.\"?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS stop failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testPauseResume() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech pause test. You should expect a voice to start speaking, then after approximately a second of speech, it should pause and then continue from where it left.";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS pause", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testPauseResume\n");
return kTestSkipped;
}
ttsMan->say("Testing text to speech, the speech should pause after a second");
g_system->delayMillis(1000);
ttsMan->pause();
if (!ttsMan->isPaused()) {
Testsuite::logDetailedPrintf("TTS pause failed\n");
return kTestFailed;
}
ttsMan->say("and then resume again", Common::TextToSpeechManager::QUEUE);
g_system->delayMillis(3000);
if (!ttsMan->isPaused()) {
Testsuite::logDetailedPrintf("TTS pause failed\n");
return kTestFailed;
}
ttsMan->resume();
if (!ttsMan->isSpeaking()) {
Testsuite::logDetailedPrintf("TTS pause failed\n");
return kTestFailed;
}
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a voice saying: \"Testing text to speech, the speech should pause after a second and then resume again.\" but with a pause in the middle?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS pauseResume failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testRate() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech rate test. You should expect a voice to say: \"Text to speech slow rate.\" really slowly and then \"Text to speech fast rate\" really fast";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS rate", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testRate\n");
return kTestSkipped;
}
ttsMan->setRate(-100);
ttsMan->say("Text to speech slow rate.");
waitForSpeechEnd(ttsMan);
ttsMan->setRate(100);
ttsMan->say("Text to speech fast rate.");
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a voice saying: \"Text to speech slow rate.\" slowly and then \"Text to speech fast rate.\" fast?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS rate failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testVolume() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech volume test. You should expect a voice to say: \"Text to speech low volume.\" quietly and then \"Text to speech max volume\" at a higher volume";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS volume", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testVolume\n");
return kTestSkipped;
}
ttsMan->setVolume(20);
ttsMan->say("Text to speech low volume.");
waitForSpeechEnd(ttsMan);
ttsMan->setVolume(100);
ttsMan->say("Text to speech max volume.");
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a voice saying: \"Text to speech low volume.\" quietly and then \"Text to speech max volume.\" at a higher volume?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS volume failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testPitch() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech pitch test. You should expect a high pitched voice to say: \"Text to speech high pitch.\" and then a low pitched voice: \"Text to speech low pitch\"";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS pitch", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testPitch\n");
return kTestSkipped;
}
ttsMan->setPitch(100);
ttsMan->say("Text to speech high pitch.");
waitForSpeechEnd(ttsMan);
ttsMan->setPitch(-100);
ttsMan->say("Text to speech low pitch.");
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a high pitched voice saying: \"Text to speech high pitch.\" and then a low pitched voice: \"Text to speech low pitch.\" ?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS pitch failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testStateStacking() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech state stacking test. You should expect a speech from three different voices (different pitch, gender, volume and speech rate), each voice will say: \"Voice number X is speaking.\", the voices will speak in this order: 1, 2, 3, 2, 1. A voice with the same number should sound the same every time";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS state stacking", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testStateStacking\n");
return kTestSkipped;
}
ttsMan->say("Voice number 1 is speaking");
waitForSpeechEnd(ttsMan);
ttsMan->pushState();
Common::Array<int> femaleVoices = ttsMan->getVoiceIndicesByGender(Common::TTSVoice::FEMALE);
Common::Array<Common::TTSVoice> allVoices = ttsMan->getVoicesArray();
if (femaleVoices.size() == 0)
ttsMan->setVoice(1 % allVoices.size());
else
ttsMan->setVoice(femaleVoices[0]);
ttsMan->setVolume(80);
ttsMan->setPitch(40);
ttsMan->setRate(-30);
ttsMan->say("Voice number 2 is speaking");
waitForSpeechEnd(ttsMan);
ttsMan->pushState();
ttsMan->setVoice(2 % allVoices.size());
ttsMan->setVolume(90);
ttsMan->setPitch(-80);
ttsMan->setRate(-50);
ttsMan->say("Voice number 3 is speaking");
waitForSpeechEnd(ttsMan);
ttsMan->popState();
ttsMan->say("Voice number 2 is speaking");
waitForSpeechEnd(ttsMan);
ttsMan->popState();
ttsMan->say("Voice number 1 is speaking");
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear three different voices speaking in this order: 1, 2, 3, 2, 1 and each time the same voice spoke, it sounded the same?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS state stacking\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testQueueing() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech queue test. You should expect a voice to say: \"This is first speech. This is second speech\"";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS queue", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testQueueing\n");
return kTestSkipped;
}
ttsMan->say("This is first speech.");
ttsMan->say("This is second speech.", Common::TextToSpeechManager::QUEUE);
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a voice saying: \"This is first speech. This is second speech\" ?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS queue failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testInterrupting() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech interrupt test. You should expect a voice to start saying english alphabet and after about a second it should get interrupted and say: \"Speech interrupted\" instead.";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS interrupt", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testInterrupting\n");
return kTestSkipped;
}
ttsMan->say("A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z");
g_system->delayMillis(1000);
ttsMan->say("Speech interrupted", Common::TextToSpeechManager::INTERRUPT);
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a voice saying the engilsh alphabet, but it got interrupted and said: \"Speech interrupted\" instead?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS interrupt failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testDroping() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech drop test. You should expect a voice to start say:\"Today is a really nice weather, perfect day to use ScummVM, don't you think?\" and nothing else.";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS drop", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testDroping\n");
return kTestSkipped;
}
ttsMan->say("Today is a really nice weather, perfect day to use ScummVM, don't you think?");
ttsMan->say("Speech interrupted, fail", Common::TextToSpeechManager::DROP);
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a voice say: \"Today is a really nice weather, perfect day to use ScummVM, don't you think?\" and nothing else?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS drop failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testInterruptNoRepeat() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech interrupt no repeat test. You should expect a voice to start saying:\"This is the first sentence, this should get interrupted\", but the speech gets interrupted and \"This is the second sentence, it should play only once\" is said instead.";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS Interrupt No Repeat", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testInterruptNoRepeat\n");
return kTestSkipped;
}
ttsMan->say("This is the first sentence, this should get interrupted");
ttsMan->say("Failure", Common::TextToSpeechManager::QUEUE);
g_system->delayMillis(1000);
ttsMan->say("This is the second sentence, it should play only once", Common::TextToSpeechManager::INTERRUPT_NO_REPEAT);
ttsMan->say("Failure", Common::TextToSpeechManager::QUEUE);
g_system->delayMillis(1000);
ttsMan->say("This is the second sentence, it should play only once", Common::TextToSpeechManager::INTERRUPT_NO_REPEAT);
ttsMan->say("Failure", Common::TextToSpeechManager::QUEUE);
g_system->delayMillis(1000);
ttsMan->say("This is the second sentence, it should play only once", Common::TextToSpeechManager::INTERRUPT_NO_REPEAT);
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a voice say: \"This is the first sentence, this should get interrupted\", but it got interrupted and \"This is the second sentence, it should play only once.\" got said instead?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS interruptNoRepeat failed\n");
return kTestFailed;
}
return kTestPassed;
}
TestExitStatus Speechtests::testQueueNoRepeat() {
Common::TextToSpeechManager *ttsMan = g_system->getTextToSpeechManager();
ttsMan->setLanguage("en");
ttsMan->setVolume(100);
ttsMan->setRate(0);
ttsMan->setPitch(0);
ttsMan->setVoice(ttsMan->getDefaultVoice());
Testsuite::clearScreen();
Common::String info = "Text to speech queue no repeat test. You should expect a voice to start say:\"This is the first sentence. This is the second sentence\" and nothing else";
Common::Point pt(0, 100);
Testsuite::writeOnScreen("Testing TTS Queue No Repeat", pt);
if (Testsuite::handleInteractiveInput(info, "OK", "Skip", kOptionRight)) {
Testsuite::logPrintf("Info! Skipping test : testQueueNoRepeat\n");
return kTestSkipped;
}
ttsMan->say("This is the first sentence.");
ttsMan->say("This is the first sentence.", Common::TextToSpeechManager::QUEUE_NO_REPEAT);
g_system->delayMillis(1000);
ttsMan->say("This is the first sentence.", Common::TextToSpeechManager::QUEUE_NO_REPEAT);
ttsMan->say("This is the second sentence.", Common::TextToSpeechManager::QUEUE_NO_REPEAT);
ttsMan->say("This is the second sentence.", Common::TextToSpeechManager::QUEUE_NO_REPEAT);
g_system->delayMillis(1000);
ttsMan->say("This is the second sentence.", Common::TextToSpeechManager::QUEUE_NO_REPEAT);
waitForSpeechEnd(ttsMan);
Common::String prompt = "Did you hear a voice say: \"This is the first sentence. This the second sentence\" and nothing else?";
if (!Testsuite::handleInteractiveInput(prompt, "Yes", "No", kOptionLeft)) {
Testsuite::logDetailedPrintf("TTS QueueNoRepeat failed\n");
return kTestFailed;
}
return kTestPassed;
}
SpeechTestSuite::SpeechTestSuite() {
_isTsEnabled = true;
if (!g_system->getTextToSpeechManager())
_isTsEnabled = false;
addTest("testMale", &Speechtests::testMale, true);
addTest("testFemale", &Speechtests::testFemale, true);
addTest("testStop", &Speechtests::testStop, true);
addTest("testStopAndSpeak", &Speechtests::testStopAndSpeak, true);
addTest("testPauseResume", &Speechtests::testPauseResume, true);
addTest("testRate", &Speechtests::testRate, true);
addTest("testVolume", &Speechtests::testVolume, true);
addTest("testPitch", &Speechtests::testPitch, true);
addTest("testStateStacking", &Speechtests::testStateStacking, true);
addTest("testQueueing", &Speechtests::testQueueing, true);
addTest("testInterrupting", &Speechtests::testInterrupting, true);
addTest("testDroping", &Speechtests::testDroping, true);
addTest("testInterruptNoRepeat", &Speechtests::testInterruptNoRepeat, true);
addTest("testQueueNoRepeat", &Speechtests::testQueueNoRepeat, true);
}
} // End of namespace Testbed
|