提交 8d3a54e6 编写于 作者: H Harshaprasad

Adding scripts for State Change Listners

Signed-off-by: NHarshaprasad <harshaprasad@huawei.com>
上级 f0ecba6a
......@@ -13,12 +13,13 @@
* limitations under the License.
*/
import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
describe('audioManger_audio_1', function () {
describe('audioManger', function () {
console.info('AudioFrameworkTest: Create AudioManger Object JS Framework');
const audioManager = audio.getAudioManager();
var deviceRoleValue = null;
......@@ -59,9 +60,6 @@ describe('audioManger_audio_1', function () {
else if (value.deviceType == 3){
devTypeName = 'WIRED_HEADSET';
}
else if (value.deviceType == 7){
devTypeName = 'BLUETOOTH_SCO';
}
else if (value.deviceType == 8){
devTypeName = 'BLUETOOTH_A2DP';
}
......@@ -491,63 +489,7 @@ describe('audioManger_audio_1', function () {
done();
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_013
* @tc.name : setDeviceActive - BLUETOOTH_SCO - Activate - Promise
* @tc.desc : Activate BLUETOOTH_SCO - Promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_013', 0, async function (done) {
await audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Activate');
audioManager.isDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO).then(function (value){
if(value==true){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL : Error :' + err.message);
expect(false).assertTrue();
});
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_ENUM_014
* @tc.name : setDeviceActive - BLUETOOTH_SCO - Activate - Promise
* @tc.desc : Activate BLUETOOTH_SCO - Promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Activate_ENUM_014', 0, async function (done) {
await audioManager.setDeviceActive(7,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Activate');
audioManager.isDeviceActive(7).then(function (value){
if(value==true){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL : Error :' + err.message);
expect(false).assertTrue();
});
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_015
* @tc.name : setDeviceActive - SPEAKER - deactivate - Promise
......@@ -665,139 +607,6 @@ describe('audioManger_audio_1', function () {
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_019
* @tc.name : setDeviceActive - BLUETOOTH_SCO - deactivate - Promise
* @tc.desc : Deactivate BLUETOOTH_SCO - Promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_019', 0, async function (done) {
await audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,false).then(function (){
// Setting device active ENUM 3 = BLUETOOTH_SCO
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Deactivate');
audioManager.isDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO).then(function (value){
if(value==false){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL : Error :' + err.message);
expect(false).assertTrue();
});
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_ENUM_020
* @tc.name : setDeviceActive - BLUETOOTH_SCO - deactivate - Promise
* @tc.desc : Deactivate BLUETOOTH_SCO - Promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_PR_Deactivate_ENUM_020', 0, async function (done) {
await audioManager.setDeviceActive(7,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Active');
});
await audioManager.setDeviceActive(7,false).then(function (){
// Setting device active ENUM 3 = BLUETOOTH_SCO
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Deactivate');
audioManager.isDeviceActive(7).then(function (value){
if(value==false){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL : Error :' + err.message);
expect(false).assertTrue();
});
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_Activate_021
* @tc.name : setDeviceActive - BLUETOOTH_SCO - Activate - Callback
* @tc.desc : Activate BLUETOOTH_SCO - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_CB_Activate_021', 0, async function (done) {
audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
audioManager.isDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==true){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : FAIL :' +value);
expect(false).assertTrue();
}
done();
});
}
done();
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_Activate_ENUM_022
* @tc.name : setDeviceActive - BLUETOOTH_SCO - Activate - Callback
* @tc.desc : Activate BLUETOOTH_SCO - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_CB_Activate_ENUM_022', 0, async function (done) {
audioManager.setDeviceActive(7,true, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
audioManager.isDeviceActive(7,(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==true){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : FAIL :' +value);
expect(false).assertTrue();
}
done();
});
}
done();
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_CB_DEACTIVATE_023
* @tc.name : setDeviceActive - SPEAKER - deactivate - Callback
......@@ -946,83 +755,6 @@ describe('audioManger_audio_1', function () {
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_DEACTIVATE_027
* @tc.name : setDeviceActive - BLUETOOTH_SCO - deactivate - Callback
* @tc.desc : Deactivate BLUETOOTH_SCO - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_DEACTIVATE_027', 0, async function (done) {
audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
audioManager.isDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==false){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
done();
});
}
done();
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_DEACTIVATE_ENUM_028
* @tc.name : setDeviceActive - BLUETOOTH_SCO - deactivate - Callback
* @tc.desc : Deactivate BLUETOOTH_SCO - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_DEACTIVATE_ENUM_028', 0, async function (done) {
await audioManager.setDeviceActive(7,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO : Active');
});
audioManager.setDeviceActive(7,false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
audioManager.isDeviceActive(7,async(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==false){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
done();
await sleep(1000);
});
}
done();
});
await sleep(1000);
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_DeviceType_001
* @tc.name : DeviceType - INVALID
......
......@@ -13,11 +13,12 @@
* limitations under the License.
*/
import audio from '@ohos.multimedia.audio';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
describe('audioManger_audio_2', function () {
describe('audioManger', function () {
console.info('AudioFrameworkTest: Create AudioManger Object JS Framework');
const audioManager = audio.getAudioManager();
var deviceRoleValue = null;
......@@ -29,7 +30,6 @@ describe('audioManger_audio_2', function () {
var maxVol = 15;
var lowVol = 5;
var highVol = 14;
var newVol = 20;
var outOfRangeVol = 28;
var longValue = '28374837458743875804735081439085918459801437584738967509184509813904850914375904790589104801843';
......@@ -59,9 +59,6 @@ describe('audioManger_audio_2', function () {
else if (value.deviceType == 3){
devTypeName = 'WIRED_HEADSET';
}
else if (value.deviceType == 7){
devTypeName = 'BLUETOOTH_SCO';
}
else if (value.deviceType == 8){
devTypeName = 'BLUETOOTH_A2DP';
}
......@@ -883,32 +880,6 @@ describe('audioManger_audio_2', function () {
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_SetVolume_030
* @tc.name : setVolume - Media - Promise - Change Ringtone vol
* @tc.desc : Setvol to 20
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_030', 0, async function (done) {
const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA,newVol);
promise.then(function () {
audioManager.setVolume(audio.AudioVolumeType.RINGTONE,maxVol);
audioManager.getVolume(audio.AudioVolumeType.MEDIA).then(function (data) {
if(data == lowVol){
console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data);
expect(false).assertTrue();
}
});
});
await promise;
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_SetVolume_026
* @tc.name : setVolume - Media - Callback - Change Ringtone vol
......@@ -973,35 +944,6 @@ describe('audioManger_audio_2', function () {
await promise;
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_SetVolume_029
* @tc.name : setVolume - Ringtone - Promise - Change Media vol
* @tc.desc : Setvol to 20
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_SetVolume_029', 0, async function (done) {
const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE,newVol);
promise.then(function () {
console.info('AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful');
audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol);
audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then(function (data) {
if(data == highVol){
console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data);
expect(false).assertTrue();
}
});
});
await promise;
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_SetVolume_028
......@@ -3159,34 +3101,6 @@ describe('audioManger_audio_2', function () {
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_001
* @tc.name : setDeviceActive - BLUETOOTH_SCO - Activate - Promise
* @tc.desc : Activate BLUETOOTH_SCO - Promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_001', 0, async function (done) {
await audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true).then(function (){
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Activate');
audioManager.isDeviceActive(7).then(function (value){
if(value==true){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL : Error :' + err.message);
expect(false).assertTrue();
});
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_002
* @tc.name : setDeviceActive - SPEAKER - deactivate - Promise
......@@ -3244,71 +3158,7 @@ describe('audioManger_audio_2', function () {
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_004
* @tc.name : setDeviceActive - BLUETOOTH_SCO - deactivate - Promise
* @tc.desc : Deactivate BLUETOOTH_SCO - Promise
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_004', 0, async function (done) {
await audioManager.setDeviceActive(7,false).then(function (){
// Setting device active ENUM 3 = BLUETOOTH_SCO
console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : BLUETOOTH_SCO: Deactivate');
audioManager.isDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO).then(function (value){
if(value==false){
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
});
}).catch((err) => {
console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL : Error :' + err.message);
expect(false).assertTrue();
});
done();
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_005
* @tc.name : setDeviceActive - BLUETOOTH_SCO - Activate - Callback
* @tc.desc : Activate BLUETOOTH_SCO - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_005', 0, async function (done) {
audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
audioManager.isDeviceActive(7,(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==true){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : FAIL :' +value);
expect(false).assertTrue();
}
done();
});
}
done();
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_006
* @tc.name : setDeviceActive - SPEAKER - deactivate - Callback
......@@ -3381,42 +3231,7 @@ describe('audioManger_audio_2', function () {
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setDeviceActive_008
* @tc.name : setDeviceActive - BLUETOOTH_SCO - deactivate - Callback
* @tc.desc : Deactivate BLUETOOTH_SCO - Callback
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_MANAGER_setDeviceActive_008', 0, async function (done) {
audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,false, (err) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else {
console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : BLUETOOTH_SCO: Active');
audioManager.isDeviceActive(7,(err, value) => {
if (err) {
console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate: Error: ${err.message}`);
expect(false).assertTrue();
}
else if(value==false){
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : PASS :' +value);
expect(true).assertTrue();
}
else{
console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' +value);
expect(false).assertTrue();
}
done();
});
}
done();
});
})
/* *
* @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_001
* @tc.name : setAudioParameter - Promise - Character & Number
......
......@@ -23,7 +23,7 @@ import ability_featureAbility from '@ohos.ability.featureAbility';
import resourceManager from '@ohos.resourceManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
describe('audioRenderer_audio_1', function () {
describe('audioRenderer', function () {
let fdRead;
let readpath;
......@@ -1400,7 +1400,7 @@ describe('audioRenderer_audio_1', function () {
});
await sleep(waitTime);
}
await sleep(2000);
await sleep(100);
if (resultFlag == false){
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
return resultFlag;
......@@ -7523,416 +7523,4 @@ describe('audioRenderer_audio_1', function () {
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_082
* @tc.name : AudioRenderer-Set11-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 11
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_082', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-2C-48000-4SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
await sleep(9000);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_083
* @tc.name : AudioRenderer-Set1-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 1
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_083', 0, async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-1C-44100-2SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
await sleep(5000);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_084
* @tc.name : AudioRenderer-Set2-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 2
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_084', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_8000,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-1C-8000-2SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_085
* @tc.name : AudioRenderer-Set3-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 3
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_085', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_32000,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-1C-32000-1SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_086
* @tc.name : AudioRenderer-Set4-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 4
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_086', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_64000,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-1C-64000-3SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_087
* @tc.name : AudioRenderer-Set5-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 5
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_087', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_96000,
channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-1C-96000-4SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_088
* @tc.name : AudioRenderer-Set6-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 6
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_088', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_11025,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_U8,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-2C-11025-1SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_089
* @tc.name : AudioRenderer-Set7-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 7
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_089', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_12000,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-2C-12000-2SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_090
* @tc.name : AudioRenderer-Set8-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 8
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_090', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_16000,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-2C-16000-3SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_091
* @tc.name : AudioRenderer-Set9-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 9
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_091', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_22050,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-2C-22050-2SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
/* *
* @tc.number : SUB_AUDIO_RENDERER_Play_audio_092
* @tc.name : AudioRenderer-Set10-Media - CALLBACK
* @tc.desc : AudioRenderer with parameter set 10
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_AUDIO_RENDERER_Play_audio_092', 0,async function (done) {
var AudioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_24000,
channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S24LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
}
var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1
}
var AudioRendererOptions = {
streamInfo: AudioStreamInfo,
rendererInfo: AudioRendererInfo
}
readpath='StarWars10s-2C-24000-3SW.wav'
await getFdRead(readpath, done)
var resultFlag = await playbackCB(AudioRendererOptions, readpath);
await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath);
done();
})
})
\ No newline at end of file
......@@ -24,7 +24,7 @@ import featureAbility from '@ohos.ability.featureAbility'
import resourceManager from '@ohos.resourceManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index';
describe('audioRenderer_audio_2', function () {
describe('audioRenderer', function () {
var mediaDir;
let fdRead;
let readpath;
......
......@@ -20,4 +20,6 @@ require('./AudioCall.test.js')
require('./AudioCapturer.test.js')
require('./AudioEventManagement.test.js')
require('./AudioRenderer.test.js')
require('./AudioRendererChangeInfo.test.js')
require('./AudioCapturerChangeInfo.test.js')
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册