未验证 提交 703af7fc 编写于 作者: O openharmony_ci 提交者: Gitee

!6899 audio player timeupdate 事件从seekdon改成position上报,测试用例进行对应修改

Merge pull request !6899 from FULIZHONG/OpenHarmony-3.1-Release
......@@ -128,6 +128,9 @@ describe('PlayerLocalTestAudioAPI', function () {
case SEEK_STATE:
console.info(`case seek to time is ${mySteps[SECOND_INDEX]}`);
audioPlayer.seek(mySteps[SECOND_INDEX]);
mySteps.shift();
mySteps.shift();
nextStep(mySteps, done);
break;
case VOLUME_STATE:
console.info(`case to setVolume`);
......@@ -206,22 +209,7 @@ describe('PlayerLocalTestAudioAPI', function () {
console.info(`case seek filed,errcode is ${seekDoneTime}`);
return;
}
if (mySteps[0] != SEEK_STATE) {
return;
}
mySteps.shift();
mySteps.shift();
console.info(`case seekDoneTime is ${seekDoneTime}`);
console.info(`case seek called`);
expect(audioPlayer.currentTime + DELTA_TIME).assertClose(seekDoneTime + DELTA_TIME, DELTA_TIME);
console.info(`case loop is ${audioPlayer.loop}`);
if ((audioPlayer.loop == true) && (seekDoneTime == DURATION_TIME)) {
console.info('case loop is true');
sleep(PLAY_STATE);
}
if ((seekDoneTime < audioPlayer.duration) || (audioPlayer.state == 'paused')) {
nextStep(mySteps,done);
}
console.info(`case timeUpdate, seekDoneTime is ${seekDoneTime}`);
});
audioPlayer.on('volumeChange', () => {
console.info(`case setvolume called`);
......@@ -250,6 +238,7 @@ describe('PlayerLocalTestAudioAPI', function () {
nextStep(mySteps,done);
} else if (mySteps[0] == ERROR_STATE) {
mySteps.shift();
nextStep(mySteps,done);
} else if (mySteps[0] == END_STATE) {
console.info('case release player error');
} else {
......
......@@ -129,6 +129,11 @@ describe('PlayerLocalTestAudioFUNC', function () {
case SEEK_STATE:
console.info(`case seek to time is ${mySteps[SECOND_INDEX]}`);
audioPlayer.seek(mySteps[SECOND_INDEX]);
if (mySteps[2] != ERROR_STATE) {
mySteps.shift();
mySteps.shift();
nextStep(mySteps, done);
}
break;
case VOLUME_STATE:
console.info(`case to setVolume`);
......@@ -139,6 +144,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
mySteps.shift();
audioPlayer.release();
audioPlayer = undefined;
nextStep(mySteps, done);
break;
case LOOP_STATE:
audioPlayer.loop = mySteps[SECOND_INDEX];
......@@ -205,26 +211,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
nextStep(mySteps,done);
});
audioPlayer.on('timeUpdate', (seekDoneTime) => {
if (typeof (seekDoneTime) == 'undefined') {
console.info(`case seek filed,errcode is ${seekDoneTime}`);
return;
}
if (mySteps[0] != SEEK_STATE) {
return;
}
mySteps.shift();
mySteps.shift();
console.info(`case seekDoneTime is ${seekDoneTime}`);
console.info(`case seek called`);
expect(audioPlayer.currentTime + DELTA_TIME).assertClose(seekDoneTime + DELTA_TIME, DELTA_TIME);
console.info(`case loop is ${audioPlayer.loop}`);
if ((audioPlayer.loop == true) && (seekDoneTime == DURATION_TIME)) {
console.info('case loop is true');
sleep(PLAY_STATE);
}
if ((seekDoneTime < audioPlayer.duration) || (audioPlayer.state == 'paused')) {
nextStep(mySteps,done);
}
console.info('case timeUpdate seekDoneTime is' + seekDoneTime);
});
audioPlayer.on('volumeChange', () => {
console.info(`case setvolume called`);
......@@ -243,18 +230,16 @@ describe('PlayerLocalTestAudioFUNC', function () {
nextStep(mySteps,done);
});
audioPlayer.on('error', (err) => {
console.info(`case error called,errName is ${err.name}`);
console.info(`case error called,errCode is ${err.code}`);
console.info(`case error called,errMessage is ${err.message}`);
if ((mySteps[0] == SEEK_STATE) || (mySteps[0] == VOLUME_STATE)) {
mySteps.shift();
mySteps.shift();
mySteps.shift();
} else {
mySteps.shift();
mySteps.shift();
}
nextStep(mySteps,done);
expect(mySteps[0]).assertEqual(ERROR_STATE);
mySteps.shift();
nextStep(mySteps, done);
});
}
......@@ -452,7 +437,7 @@ describe('PlayerLocalTestAudioFUNC', function () {
*/
it('SUB_MEDIA_PLAYER_LOCAL_AUDIO_FUNCTION_04_1500', 0, async function (done) {
let mySteps = new Array(SRC_STATE, PLAY_STATE, PAUSE_STATE, SEEK_STATE, DURATION_TIME,
PLAY_STATE, FINISH_STATE, END_STATE);
PLAY_STATE, FINISH_STATE, RESET_STATE, RELEASE_STATE, END_STATE);
initAudioPlayer();
setCallback(mySteps, done);
audioPlayer.src = fdPath;
......
......@@ -114,13 +114,11 @@ describe('PlayerLocalTestAudioFormat', function () {
return;
}
console.info('case seek success, and seek time is ' + seekDoneTime);
if (!isToDuration) {
if ((!isToDuration) && (seekDoneTime >= SEEK_TIME)) {
expect(SEEK_TIME).assertEqual(seekDoneTime);
isToDuration = true;
sleep(PLAY_TIME);
audioPlayer.seek(audioPlayer.duration);
} else {
expect(audioPlayer.duration).assertEqual(seekDoneTime);
}
});
audioPlayer.on('volumeChange', () => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册