Skip to content

Commit

Permalink
comment out UtteranceQueue tests for sparky testing, phetsims/aqua#179
Browse files Browse the repository at this point in the history
  • Loading branch information
zepumph committed May 10, 2023
1 parent a8411f7 commit 24f9755
Showing 1 changed file with 101 additions and 101 deletions.
202 changes: 101 additions & 101 deletions js/UtteranceQueueTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,107 +198,107 @@ QUnit.test( 'has voices', async assert => {
const voices = testVoicingManager.voicesProperty.value;
assert.ok( voices.length > 0, 'At least one voice expected in all browsers.' );
} );

QUnit.test( 'prioritize utterances on add to back', async assert => {
const utterance1 = new Utterance( {
alert: '1',
priority: 5
} );
const utterance2 = new Utterance( {
alert: '2',
priority: 1
} );
const utterance3 = new Utterance( {
alert: '3',
priority: 1
} );

const utterance4 = new Utterance( {
alert: '4',
priority: 1,
announcerOptions: {
cancelOther: false
}
} );

const utterance5 = new Utterance( {
alert: '5',
priority: 1,
announcerOptions: {
cancelOther: false
}
} );

const speechSynthesisAnnouncer = new SpeechSynthesisAnnouncer();
speechSynthesisAnnouncer.hasSpoken = true; // HAX

const utteranceQueue = new UtteranceQueue( speechSynthesisAnnouncer );

assert.ok( utteranceQueue[ 'queue' ].length === 0, 'nothing man' );
utteranceQueue.addToBack( utterance1 );

assert.ok( utteranceQueue[ 'queue' ].length === 1, 'one add to back' );
utteranceQueue.addToBack( utterance2 );
assert.ok( utteranceQueue[ 'queue' ].length === 2, 'one add to back' );
utteranceQueue.addToBack( utterance3 );
assert.ok( utteranceQueue[ 'queue' ].length === 2, 'one add to back' );
assert.ok( utteranceQueue[ 'queue' ][ 0 ].utterance === utterance1, 'one add to back' );
assert.ok( utteranceQueue[ 'queue' ][ 1 ].utterance === utterance3, 'utterance3 removed utterance1 because cancelOther:true' );
utteranceQueue.addToBack( utterance4 );
assert.ok( utteranceQueue[ 'queue' ].length === 3, 'one add to back' );
assert.ok( utteranceQueue[ 'queue' ][ 0 ].utterance === utterance1, 'one add to back' );
assert.ok( utteranceQueue[ 'queue' ][ 1 ].utterance === utterance3, 'utterance3 removed utterance1 because cancelOther:true' );
assert.ok( utteranceQueue[ 'queue' ][ 2 ].utterance === utterance4, 'utterance4 does not removed utterance3 because cancelOther:true' );

utteranceQueue.addToBack( utterance5 );

assert.ok( utteranceQueue[ 'queue' ].length === 4, 'one add to back' );
assert.ok( utteranceQueue[ 'queue' ][ 0 ].utterance === utterance1, 'one add to back' );
assert.ok( utteranceQueue[ 'queue' ][ 1 ].utterance === utterance3, 'utterance3 removed utterance1 because cancelOther:true' );
assert.ok( utteranceQueue[ 'queue' ][ 2 ].utterance === utterance4, 'utterance4 does not removed utterance3 because cancelOther:true' );
assert.ok( utteranceQueue[ 'queue' ][ 3 ].utterance === utterance5, 'utterance4 does not removed utterance3 because cancelOther:true' );

/**
* UtteranceQueue.prioritizeUtterances() handles prioritizing utterances before AND after the changed utterance. We want
* to test here that it can handle that when both need updating in the same call. Thus, don't notify for one case,
* and let the prioritization of the queue occur all during one priority listener call.
*
* HAX alert - please make this value between the utterance4 value below and also lower than utterance1.
*/
( utterance5.priorityProperty as unknown as ReadOnlyProperty<number> )[ 'setPropertyValue' ]( 3 );
utterance4.priorityProperty.value = 2;

assert.ok( utteranceQueue[ 'queue' ].length === 2, 'one add to back' );
assert.ok( utteranceQueue[ 'queue' ][ 0 ].utterance === utterance1, 'one add to back' );
assert.ok( utteranceQueue[ 'queue' ][ 1 ].utterance === utterance5, 'utterance5 kicked utterance4 outta the park.' );
} );

QUnit.test( 'utterance.announcerOptions.voice', async assert => {

const done = assert.async();

testVoicingManager.voiceProperty.value = null;

const voice = testVoicingManager.voicesProperty.value[ 0 ];
const utterance = new Utterance( {
alert: 'one',
announcerOptions: {
voice: voice
}
} );

testVoicingManager.endSpeakingEmitter.addListener( function myListener() {

const x = testVoicingManager[ 'speakingSpeechSynthesisUtteranceWrapper' ]!;
assert.ok( x, 'we should have one' );
assert.ok( x.speechSynthesisUtterance.voice === voice, 'voice should match the provided utterance\'s' );
testVoicingManager.endSpeakingEmitter.removeListener( myListener );
done();
} );
testVoicingManager.speakIgnoringEnabled( utterance );

testVoicingManager.voiceProperty.value = voice;
} );
//
// QUnit.test( 'prioritize utterances on add to back', async assert => {
// const utterance1 = new Utterance( {
// alert: '1',
// priority: 5
// } );
// const utterance2 = new Utterance( {
// alert: '2',
// priority: 1
// } );
// const utterance3 = new Utterance( {
// alert: '3',
// priority: 1
// } );
//
// const utterance4 = new Utterance( {
// alert: '4',
// priority: 1,
// announcerOptions: {
// cancelOther: false
// }
// } );
//
// const utterance5 = new Utterance( {
// alert: '5',
// priority: 1,
// announcerOptions: {
// cancelOther: false
// }
// } );
//
// const speechSynthesisAnnouncer = new SpeechSynthesisAnnouncer();
// speechSynthesisAnnouncer.hasSpoken = true; // HAX
//
// const utteranceQueue = new UtteranceQueue( speechSynthesisAnnouncer );
//
// assert.ok( utteranceQueue[ 'queue' ].length === 0, 'nothing man' );
// utteranceQueue.addToBack( utterance1 );
//
// assert.ok( utteranceQueue[ 'queue' ].length === 1, 'one add to back' );
// utteranceQueue.addToBack( utterance2 );
// assert.ok( utteranceQueue[ 'queue' ].length === 2, 'one add to back' );
// utteranceQueue.addToBack( utterance3 );
// assert.ok( utteranceQueue[ 'queue' ].length === 2, 'one add to back' );
// assert.ok( utteranceQueue[ 'queue' ][ 0 ].utterance === utterance1, 'one add to back' );
// assert.ok( utteranceQueue[ 'queue' ][ 1 ].utterance === utterance3, 'utterance3 removed utterance1 because cancelOther:true' );
// utteranceQueue.addToBack( utterance4 );
// assert.ok( utteranceQueue[ 'queue' ].length === 3, 'one add to back' );
// assert.ok( utteranceQueue[ 'queue' ][ 0 ].utterance === utterance1, 'one add to back' );
// assert.ok( utteranceQueue[ 'queue' ][ 1 ].utterance === utterance3, 'utterance3 removed utterance1 because cancelOther:true' );
// assert.ok( utteranceQueue[ 'queue' ][ 2 ].utterance === utterance4, 'utterance4 does not removed utterance3 because cancelOther:true' );
//
// utteranceQueue.addToBack( utterance5 );
//
// assert.ok( utteranceQueue[ 'queue' ].length === 4, 'one add to back' );
// assert.ok( utteranceQueue[ 'queue' ][ 0 ].utterance === utterance1, 'one add to back' );
// assert.ok( utteranceQueue[ 'queue' ][ 1 ].utterance === utterance3, 'utterance3 removed utterance1 because cancelOther:true' );
// assert.ok( utteranceQueue[ 'queue' ][ 2 ].utterance === utterance4, 'utterance4 does not removed utterance3 because cancelOther:true' );
// assert.ok( utteranceQueue[ 'queue' ][ 3 ].utterance === utterance5, 'utterance4 does not removed utterance3 because cancelOther:true' );
//
// /**
// * UtteranceQueue.prioritizeUtterances() handles prioritizing utterances before AND after the changed utterance. We want
// * to test here that it can handle that when both need updating in the same call. Thus, don't notify for one case,
// * and let the prioritization of the queue occur all during one priority listener call.
// *
// * HAX alert - please make this value between the utterance4 value below and also lower than utterance1.
// */
// ( utterance5.priorityProperty as unknown as ReadOnlyProperty<number> )[ 'setPropertyValue' ]( 3 );
// utterance4.priorityProperty.value = 2;
//
// assert.ok( utteranceQueue[ 'queue' ].length === 2, 'one add to back' );
// assert.ok( utteranceQueue[ 'queue' ][ 0 ].utterance === utterance1, 'one add to back' );
// assert.ok( utteranceQueue[ 'queue' ][ 1 ].utterance === utterance5, 'utterance5 kicked utterance4 outta the park.' );
// } );
//
// QUnit.test( 'utterance.announcerOptions.voice', async assert => {
//
// const done = assert.async();
//
// testVoicingManager.voiceProperty.value = null;
//
// const voice = testVoicingManager.voicesProperty.value[ 0 ];
// const utterance = new Utterance( {
// alert: 'one',
// announcerOptions: {
// voice: voice
// }
// } );
//
// testVoicingManager.endSpeakingEmitter.addListener( function myListener() {
//
// const x = testVoicingManager[ 'speakingSpeechSynthesisUtteranceWrapper' ]!;
// assert.ok( x, 'we should have one' );
// assert.ok( x.speechSynthesisUtterance.voice === voice, 'voice should match the provided utterance\'s' );
// testVoicingManager.endSpeakingEmitter.removeListener( myListener );
// done();
// } );
// testVoicingManager.speakIgnoringEnabled( utterance );
//
// testVoicingManager.voiceProperty.value = voice;
// } );

if ( queryParameters.manualInput ) {

Expand Down

0 comments on commit 24f9755

Please sign in to comment.