mirror of
https://github.com/classilla/tenfourfox.git
synced 2024-10-22 02:25:05 +00:00
86 lines
2.5 KiB
HTML
86 lines
2.5 KiB
HTML
<!DOCTYPE HTML>
|
|
<html lang="en-US">
|
|
<!--
|
|
https://bugzilla.mozilla.org/show_bug.cgi?id=525444
|
|
-->
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Test for Bug 525444: Web Speech API, check speech synth queue</title>
|
|
<script type="application/javascript">
|
|
window.SimpleTest = parent.SimpleTest;
|
|
window.is = parent.is;
|
|
window.isnot = parent.isnot;
|
|
window.ok = parent.ok;
|
|
</script>
|
|
<script type="application/javascript" src="common.js"></script>
|
|
</head>
|
|
<body>
|
|
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=525444">Mozilla Bug 525444</a>
|
|
<p id="display"></p>
|
|
<div id="content" style="display: none">
|
|
|
|
</div>
|
|
<pre id="test">
|
|
<script type="application/javascript">
|
|
|
|
/** Test for Bug 525444 **/
|
|
|
|
// XXX: Rate and pitch are not tested.
|
|
|
|
var langUriMap = {};
|
|
|
|
for (var voice of speechSynthesis.getVoices()) {
|
|
if (voice.voiceURI.indexOf('urn:moz-tts:fake-direct') < 0) {
|
|
continue;
|
|
}
|
|
langUriMap[voice.lang] = voice.voiceURI;
|
|
ok(true, voice.lang + ' ' + voice.voiceURI + ' ' + voice.default);
|
|
is(voice.default, voice.lang == 'en-JM', 'Only Jamaican voice should be default');
|
|
}
|
|
|
|
ok(langUriMap['en-JM'], 'No English-Jamaican voice');
|
|
ok(langUriMap['en-GB'], 'No English-British voice');
|
|
ok(langUriMap['en-CA'], 'No English-Canadian voice');
|
|
ok(langUriMap['fr-CA'], 'No French-Canadian voice');
|
|
ok(langUriMap['es-MX'], 'No Spanish-Mexican voice');
|
|
|
|
function testFunc(done_cb) {
|
|
synthTestQueue(
|
|
[[{text: "Hello, world."},
|
|
{ uri: langUriMap['en-JM'] }],
|
|
[{text: "Bonjour tout le monde .",
|
|
args: { lang: "fr", rate: 0.5, pitch: 0.75 }},
|
|
{ uri: langUriMap['fr-CA'], rate: 0.5, pitch: 0.75}],
|
|
[{text: "How are you doing?", args: { lang: "en-GB" } },
|
|
{ rate: 1, pitch: 1, uri: langUriMap['en-GB']}],
|
|
[{text: "¡hasta mañana!", args: { lang: "es-MX" } },
|
|
{ uri: langUriMap['es-MX'] }]],
|
|
function () {
|
|
var test_data = [];
|
|
var voices = speechSynthesis.getVoices();
|
|
for (var voice of voices) {
|
|
if (voice.voiceURI.indexOf('urn:moz-tts:fake-direct') < 0) {
|
|
continue;
|
|
}
|
|
test_data.push([{text: "Hello world", args: { voice: voice} },
|
|
{uri: voice.voiceURI}]);
|
|
}
|
|
|
|
synthTestQueue(test_data, done_cb);
|
|
});
|
|
}
|
|
|
|
// Run test with no global queue, and then run it with a global queue.
|
|
testFunc(function() {
|
|
SpecialPowers.pushPrefEnv(
|
|
{ set: [['media.webspeech.synth.force_global_queue', true]] }, function() {
|
|
testFunc(SimpleTest.finish)
|
|
});
|
|
});
|
|
|
|
|
|
</script>
|
|
</pre>
|
|
</body>
|
|
</html>
|