提交 348d3087 编写于 作者: L lwx1121892

<liuxueqi3@huawei.com>

Signed-off-by: Nlwx1121892 <liuxueqi3@huawei.com>
上级 dcbec281
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
], ],
"type": "AppInstallKit", "type": "AppInstallKit",
"run-command": [ "run-command": [
"mkdir /data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media" "mkdir /data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media"
], ],
"cleanup-apps": true "cleanup-apps": true
}, },
...@@ -22,25 +22,25 @@ ...@@ -22,25 +22,25 @@
"pre-push": [ "pre-push": [
], ],
"push": [ "push": [
"./resource/audio/audioManager/Believer.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/Believer60s.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/Believer60s.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-8000-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-1C-8000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-16000-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-1C-16000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-32000-1SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-1C-32000-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-1C-44100-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-64000-3SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-1C-64000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-1C-96000-4SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-1C-96000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-11025-1SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-2C-11025-1SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-12000-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-2C-12000-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-2C-16000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-2C-22050-2SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-2C-24000-3SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files", "./resource/audio/audioManager/StarWars10s-2C-48000-4SW.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/",
"./resource/audio/audioManager/Believer.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media", "./resource/audio/audioManager/Believer.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media",
"./resource/audio/audioManager/file_example_WAV_1MG.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media", "./resource/audio/audioManager/file_example_WAV_1MG.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media",
"./resource/audio/audioManager/safe_and_sound_32.wav ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media", "./resource/audio/audioManager/safe_and_sound_32.wav ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media",
"./resource/audio/audioManager/test.mp3 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media", "./resource/audio/audioManager/test.mp3 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media",
"./resource/audio/audioManager/test.mp4 ->/data/accounts/account_0/appdata/ohos.acts.multimedia.audio.audiomanager/files/media" "./resource/audio/audioManager/test.mp4 ->/data/app/el2/100/base/ohos.acts.multimedia.audio.audiomanager/haps/entry/files/media"
] ]
} }
] ]
......
...@@ -23,7 +23,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; ...@@ -23,7 +23,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import featureAbility from '@ohos.ability.featureAbility' import featureAbility from '@ohos.ability.featureAbility'
import resourceManager from '@ohos.resourceManager'; import resourceManager from '@ohos.resourceManager';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index';
describe('audioCall', function () { describe('audioCall', function () {
var mediaDir; var mediaDir;
...@@ -31,6 +31,8 @@ describe('audioCall', function () { ...@@ -31,6 +31,8 @@ describe('audioCall', function () {
let readpath; let readpath;
var resultFlagRec; var resultFlagRec;
var resultFlagRen; var resultFlagRen;
let fdPath;
let filePath;
const audioManager = audio.getAudioManager(); const audioManager = audio.getAudioManager();
console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework'); console.info('AudioFrameworkRenderLog: Create AudioManger Object JS Framework');
...@@ -55,11 +57,19 @@ describe('audioCall', function () { ...@@ -55,11 +57,19 @@ describe('audioCall', function () {
return mediaDirTemp; return mediaDirTemp;
}*/ }*/
async function getAbilityInfo(fileName) {
let context = await featureAbility.getContext();
console.info("case0 context is " + context);
await context.getFilesDir().then((data) => {
console.info("case1 getFilesDir is path " + data);
mediaDir = data + '/' + fileName;
console.info('case2 mediaDir is ' + mediaDir);
})
}
beforeAll(async function () { beforeAll(async function () {
await applyPermission(); await applyPermission();
console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level');
mediaDir = '/data/storage/el2/base/haps/entry/cache'; // mediaDir = '/data/storage/el2/base/haps/entry/cache';
}) })
beforeEach(async function () { beforeEach(async function () {
...@@ -76,21 +86,10 @@ describe('audioCall', function () { ...@@ -76,21 +86,10 @@ describe('audioCall', function () {
console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition'); console.info('AudioFrameworkTest: afterAll: Test suite-level cleanup condition');
}) })
function sleep (ms) { function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
async function getFileDescriptor(fileName) {
let fileDescriptor = undefined;
await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.getRawFileDescriptor(fileName).then(value => {
fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length };
}).catch(error => {
console.log('AudioFrameworkRenderLog:case getRawFileDescriptor err: ' + error);
});
});
return fileDescriptor;
}
async function closeFileDescriptor(fileName) { async function closeFileDescriptor(fileName) {
await resourceManager.getResourceManager().then(async (mgr) => { await resourceManager.getResourceManager().then(async (mgr) => {
...@@ -101,19 +100,40 @@ describe('audioCall', function () { ...@@ -101,19 +100,40 @@ describe('audioCall', function () {
}); });
}); });
} }
async function getFdRead(pathName, done) { // async function getFdRead(pathName, done) {
await getFileDescriptor(pathName).then((res) => { // await getFileDescriptor(pathName).then((res) => {
if (res == undefined) { // if (res == undefined) {
expect().assertFail(); // expect().assertFail();
console.info('AudioFrameworkRenderLog:case error fileDescriptor undefined, open file fail'); // console.info('AudioFrameworkRenderLog:case error fileDescriptor undefined, open file fail');
done(); // done();
} else { // } else {
fdRead = res.fd; // fdRead = res.fd;
console.info("AudioFrameworkRenderLog:case 0 fdRead is: " + fdRead); // console.info("AudioFrameworkRenderLog:case 0 fdRead is: " + fdRead);
} // }
// })
// }
async function getFdRead(pathName) {
let context = await featureAbility.getContext();
console.info("case0 context is " + context);
await context.getFilesDir().then((data) => {
console.info("case1 getFilesDir is path " + data);
filePath = data + '/' + pathName;
console.info('case4 filePath is ' + filePath);
}) })
fdPath = 'fd://';
await fileio.open(filePath).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber;
fdRead = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
console.info('[fileIO]case open fd success,fdRead is ' + fdRead);
}, (err) => {
console.info('[fileIO]case open fd failed');
}).catch((err) => {
console.info('[fileIO]case catch open fd failed');
});
} }
async function applyPermission() { async function applyPermission() {
let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100); let appInfo = await bundle.getApplicationInfo('ohos.acts.multimedia.audio.audiomanager', 0, 100);
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
...@@ -144,7 +164,7 @@ describe('audioCall', function () { ...@@ -144,7 +164,7 @@ describe('audioCall', function () {
} }
async function playbackPromise (AudioRendererOptions, pathName, AudioScene) { async function playbackPromise(AudioRendererOptions, pathName, AudioScene) {
resultFlagRen = 'new'; resultFlagRen = 'new';
console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function'); console.info('AudioFrameworkRenderLog: Promise : Audio Playback Function');
...@@ -153,11 +173,11 @@ describe('audioCall', function () { ...@@ -153,11 +173,11 @@ describe('audioCall', function () {
audioRen = data; audioRen = data;
console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS'); console.info('AudioFrameworkRenderLog: AudioRender Created : Success : Stream Type: SUCCESS');
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : '+err.message); console.info('AudioFrameworkRenderLog: AudioRender Created : ERROR : ' + err.message);
resultFlagRen=false; resultFlagRen = false;
return resultFlagRen; return resultFlagRen;
}); });
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state);
await audioRen.getStreamInfo().then(async function (audioParamsGet) { await audioRen.getStreamInfo().then(async function (audioParamsGet) {
console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:'); console.info('AudioFrameworkRenderLog: Renderer getStreamInfo:');
...@@ -166,11 +186,11 @@ describe('audioCall', function () { ...@@ -166,11 +186,11 @@ describe('audioCall', function () {
console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRenderLog: Renderer channels:' + audioParamsGet.channels);
console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType); console.info('AudioFrameworkRenderLog: Renderer encodingType:' + audioParamsGet.encodingType);
}).catch((err) => { }).catch((err) => {
console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: '+err.message); console.log('AudioFrameworkRenderLog: getStreamInfo :ERROR: ' + err.message);
resultFlagRen = false; resultFlagRen = false;
}); });
if (resultFlagRen == false){ if (resultFlagRen == false) {
console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen);
return resultFlagRen; return resultFlagRen;
} }
...@@ -180,37 +200,37 @@ describe('audioCall', function () { ...@@ -180,37 +200,37 @@ describe('audioCall', function () {
console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage); console.info('AudioFrameworkRenderLog: Renderer usage:' + audioParamsGet.usage);
console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags); console.info('AudioFrameworkRenderLog: Renderer rendererFlags:' + audioParamsGet.rendererFlags);
}).catch((err) => { }).catch((err) => {
console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: '+err.message); console.log('AudioFrameworkRenderLog: RendererInfo :ERROR: ' + err.message);
resultFlagRen = false; resultFlagRen = false;
}); });
if (resultFlagRen == false){ if (resultFlagRen == false) {
console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen);
return resultFlagRen; return resultFlagRen;
} }
await audioRen.start().then(async function () { await audioRen.start().then(async function () {
console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS '); console.info('AudioFrameworkRenderLog: renderInstant started :SUCCESS ');
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : '+err.message); console.info('AudioFrameworkRenderLog: renderInstant start :ERROR : ' + err.message);
resultFlagRen=false; resultFlagRen = false;
}); });
if (resultFlagRen == false){ if (resultFlagRen == false) {
console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen);
return resultFlagRen; return resultFlagRen;
} }
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state);
var bufferSize; var bufferSize;
await audioRen.getBufferSize().then(async function (data) { await audioRen.getBufferSize().then(async function (data) {
console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data); console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS ' + data);
bufferSize=data; bufferSize = data;
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message); console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : ' + err.message);
resultFlagRen=false; resultFlagRen = false;
}); });
if (resultFlagRen == false){ if (resultFlagRen == false) {
console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen);
return resultFlagRen; return resultFlagRen;
} }
...@@ -219,21 +239,21 @@ describe('audioCall', function () { ...@@ -219,21 +239,21 @@ describe('audioCall', function () {
let discardHeader = new ArrayBuffer(44); let discardHeader = new ArrayBuffer(44);
ss.readSync(discardHeader); ss.readSync(discardHeader);
let totalSize = fileio.fstatSync(fdRead).size; let totalSize = fileio.fstatSync(fdRead).size;
console.info('AudioFrameworkRenderLog:case3: File totalSize size: ' +totalSize); console.info('AudioFrameworkRenderLog:case3: File totalSize size: ' + totalSize);
totalSize = totalSize-44; totalSize = totalSize - 44;
console.info('AudioFrameworkRenderLog: File size : Removing header: ' +totalSize); console.info('AudioFrameworkRenderLog: File size : Removing header: ' + totalSize);
let rlen = 0; let rlen = 0;
while (rlen < totalSize/4) { while (rlen < totalSize / 4) {
let buf = new ArrayBuffer(bufferSize); let buf = new ArrayBuffer(bufferSize);
rlen += ss.readSync(buf); rlen += ss.readSync(buf);
console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' +rlen); console.info('AudioFrameworkRenderLog:BufferAudioFramework: bytes read from file: ' + rlen);
await audioRen.write(buf); await audioRen.write(buf);
if (rlen > (totalSize/2)){ if (rlen > (totalSize / 2)) {
await audioManager.getAudioScene().then(async function (data) { await audioManager.getAudioScene().then(async function (data) {
console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : '+data); console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : Value : ' + data);
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : '+err.message); console.info('AudioFrameworkRenderLog:AudioFrameworkAudioScene: getAudioScene : ERROR : ' + err.message);
resultFlagRen=false; resultFlagRen = false;
}); });
} }
} }
...@@ -242,42 +262,42 @@ describe('audioCall', function () { ...@@ -242,42 +262,42 @@ describe('audioCall', function () {
await audioRen.drain().then(async function () { await audioRen.drain().then(async function () {
console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS'); console.info('AudioFrameworkRenderLog: Renderer drained : SUCCESS');
}).catch((err) => { }).catch((err) => {
console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : '+err.message); console.error('AudioFrameworkRenderLog: Renderer drain: ERROR : ' + err.message);
resultFlagRen=false; resultFlagRen = false;
}); });
if (resultFlagRen == false){ if (resultFlagRen == false) {
console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen);
return resultFlagRen; return resultFlagRen;
} }
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state);
await audioRen.stop().then(async function () { await audioRen.stop().then(async function () {
console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS'); console.info('AudioFrameworkRenderLog: Renderer stopped : SUCCESS');
resultFlagRen=true; resultFlagRen = true;
console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen);
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : '+err.message); console.info('AudioFrameworkRenderLog: Renderer stop:ERROR : ' + err.message);
resultFlagRen=false; resultFlagRen = false;
}); });
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state);
await audioRen.release().then(async function () { await audioRen.release().then(async function () {
console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS'); console.info('AudioFrameworkRenderLog: Renderer release : SUCCESS');
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRenderLog: Renderer release :ERROR : '+err.message); console.info('AudioFrameworkRenderLog: Renderer release :ERROR : ' + err.message);
resultFlagRen=false; resultFlagRen = false;
}); });
console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : '+audioRen.state); console.info('AudioFrameworkRenderLog: AudioRenderer : STATE : ' + audioRen.state);
console.info('AudioFrameworkRenderLog: resultFlagRen : '+resultFlagRen); console.info('AudioFrameworkRenderLog: resultFlagRen : ' + resultFlagRen);
return resultFlagRen; return resultFlagRen;
} }
async function recPromise (AudioCapturerOptions, fpath, AudioScene) { async function recPromise(AudioCapturerOptions, fpath, AudioScene) {
resultFlagRec = 'new'; resultFlagRec = 'new';
console.info('AudioFrameworkRecLog: Promise : Audio Recording Function'); console.info('AudioFrameworkRecLog: Promise : Audio Recording Function');
...@@ -288,13 +308,13 @@ describe('audioCall', function () { ...@@ -288,13 +308,13 @@ describe('audioCall', function () {
audioCap = data; audioCap = data;
console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS'); console.info('AudioFrameworkRecLog: AudioCapturer Created : Success : Stream Type: SUCCESS');
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : '+err.message); console.info('AudioFrameworkRecLog: AudioCapturer Created : ERROR : ' + err.message);
return resultFlagRec; return resultFlagRec;
}); });
console.info('AudioFrameworkRecLog: AudioCapturer : Path : '+fpath); console.info('AudioFrameworkRecLog: AudioCapturer : Path : ' + fpath);
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state);
await audioCap.getStreamInfo().then(async function (audioParamsGet) { await audioCap.getStreamInfo().then(async function (audioParamsGet) {
...@@ -304,11 +324,11 @@ describe('audioCall', function () { ...@@ -304,11 +324,11 @@ describe('audioCall', function () {
console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels); console.info('AudioFrameworkRecLog: Capturer channels:' + audioParamsGet.channels);
console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType); console.info('AudioFrameworkRecLog: Capturer encodingType:' + audioParamsGet.encodingType);
}).catch((err) => { }).catch((err) => {
console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: '+err.message); console.log('AudioFrameworkRecLog: getStreamInfo :ERROR: ' + err.message);
resultFlagRec = false; resultFlagRec = false;
}); });
if (resultFlagRec == false){ if (resultFlagRec == false) {
console.info('AudioFrameworkRecLog: resultFlagRec : '+resultFlagRec); console.info('AudioFrameworkRecLog: resultFlagRec : ' + resultFlagRec);
return resultFlagRec; return resultFlagRec;
} }
...@@ -317,26 +337,26 @@ describe('audioCall', function () { ...@@ -317,26 +337,26 @@ describe('audioCall', function () {
console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source); console.info('AudioFrameworkRecLog: Capturer SourceType:' + audioParamsGet.source);
console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags); console.info('AudioFrameworkRecLog: Capturer capturerFlags:' + audioParamsGet.capturerFlags);
}).catch((err) => { }).catch((err) => {
console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: '+err.message); console.log('AudioFrameworkRecLog: CapturerInfo :ERROR: ' + err.message);
resultFlagRec = false; resultFlagRec = false;
}); });
if (resultFlagRec == false){ if (resultFlagRec == false) {
console.info('AudioFrameworkRecLog: resultFlag : '+resultFlagRec); console.info('AudioFrameworkRecLog: resultFlag : ' + resultFlagRec);
return resultFlagRec; return resultFlagRec;
} }
await audioCap.start().then(async function () { await audioCap.start().then(async function () {
console.info('AudioFrameworkRecLog: Capturer started :SUCCESS '); console.info('AudioFrameworkRecLog: Capturer started :SUCCESS ');
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message);
resultFlagRec=false; resultFlagRec = false;
}); });
if (resultFlagRec == false){ if (resultFlagRec == false) {
console.info('AudioFrameworkRecLog: resultFlagRec : '+resultFlagRec); console.info('AudioFrameworkRecLog: resultFlagRec : ' + resultFlagRec);
return resultFlagRec; return resultFlagRec;
} }
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state);
var bufferSize = await audioCap.getBufferSize(); var bufferSize = await audioCap.getBufferSize();
console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize); console.info('AudioFrameworkRecLog: buffer size: ' + bufferSize);
...@@ -345,9 +365,9 @@ describe('audioCall', function () { ...@@ -345,9 +365,9 @@ describe('audioCall', function () {
if (fd !== null) { if (fd !== null) {
console.info('AudioFrameworkRecLog: file fd created'); console.info('AudioFrameworkRecLog: file fd created');
} }
else{ else {
console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer start :ERROR : ' + err.message);
resultFlagRec=false; resultFlagRec = false;
return resultFlagRec; return resultFlagRec;
} }
...@@ -355,9 +375,9 @@ describe('audioCall', function () { ...@@ -355,9 +375,9 @@ describe('audioCall', function () {
if (fd !== null) { if (fd !== null) {
console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS'); console.info('AudioFrameworkRecLog: file fd opened : Append Mode :PASS');
} }
else{ else {
console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED'); console.info('AudioFrameworkRecLog: file fd Open: Append Mode : FAILED');
resultFlagRec=false; resultFlagRec = false;
return resultFlagRec; return resultFlagRec;
} }
...@@ -369,27 +389,27 @@ describe('audioCall', function () { ...@@ -369,27 +389,27 @@ describe('audioCall', function () {
numBuffersToCapture--; numBuffersToCapture--;
} }
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state);
await audioCap.stop().then(async function () { await audioCap.stop().then(async function () {
console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS'); console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS');
resultFlagRec=true; resultFlagRec = true;
console.info('AudioFrameworkRecLog: resultFlagRec : '+resultFlagRec); console.info('AudioFrameworkRecLog: resultFlagRec : ' + resultFlagRec);
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer stop:ERROR : ' + err.message);
resultFlagRec=false; resultFlagRec = false;
}); });
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state);
await audioCap.release().then(async function () { await audioCap.release().then(async function () {
console.info('AudioFrameworkRecLog: Capturer release : SUCCESS'); console.info('AudioFrameworkRecLog: Capturer release : SUCCESS');
}).catch((err) => { }).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer release :ERROR : '+err.message); console.info('AudioFrameworkRecLog: Capturer release :ERROR : ' + err.message);
resultFlagRec=false; resultFlagRec = false;
}); });
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCap.state); console.info('AudioFrameworkRecLog: AudioCapturer : STATE : ' + audioCap.state);
return resultFlagRec; return resultFlagRec;
...@@ -424,11 +444,10 @@ describe('audioCall', function () { ...@@ -424,11 +444,10 @@ describe('audioCall', function () {
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
readpath = 'StarWars10s-1C-44100-2SW.wav'; await getFdRead("StarWars10s-1C-44100-2SW.wav");
await getFdRead(readpath,done); var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await sleep(100); await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag);
expect(resultFlag).assertTrue(); expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath); await closeFileDescriptor(readpath);
done(); done();
...@@ -453,84 +472,85 @@ describe('audioCall', function () { ...@@ -453,84 +472,85 @@ describe('audioCall', function () {
var AudioCapturerInfo = { var AudioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC, source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 0 capturerFlags: 1
} }
var AudioCapturerOptions = { var AudioCapturerOptions = {
streamInfo: AudioStreamInfo, streamInfo: AudioStreamInfo,
capturerInfo: AudioCapturerInfo capturerInfo: AudioCapturerInfo
} }
await getAbilityInfo("capture_js-44100-2C-16B.pcm");
var resultFlag = await recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); var resultFlag = await recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await sleep(100); await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); console.info('AudioFrameworkRenderLog: resultFlag : ' + resultFlag);
expect(resultFlag).assertTrue(); expect(resultFlag).assertTrue();
done(); done();
}) })
/* * /* *
* @tc.number : SUB_AUDIO_VOIP_RecPlay_001 * @tc.number : SUB_AUDIO_VOIP_RecPlay_001
* @tc.name : * @tc.name :
* @tc.desc : * @tc.desc :
* @tc.size : MEDIUM * @tc.size : MEDIUM
* @tc.type : Function * @tc.type : Function
* @tc.level : Level 0 * @tc.level : Level 0
*/ */
it('SUB_AUDIO_VOIP_RecPlay_001', 0, async function (done) { it('SUB_AUDIO_VOIP_RecPlay_001', 0, async function (done) {
var AudioStreamInfoCap = { var AudioStreamInfoCap = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_2, channels: audio.AudioChannel.CHANNEL_2,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
var AudioCapturerInfo = { var AudioCapturerInfo = {
source: audio.SourceType.SOURCE_TYPE_MIC, source: audio.SourceType.SOURCE_TYPE_MIC,
capturerFlags: 0 capturerFlags: 1
} }
var AudioCapturerOptions = { var AudioCapturerOptions = {
streamInfo: AudioStreamInfoCap, streamInfo: AudioStreamInfoCap,
capturerInfo: AudioCapturerInfo capturerInfo: AudioCapturerInfo
} }
var AudioStreamInfoRen = { var AudioStreamInfoRen = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
channels: audio.AudioChannel.CHANNEL_1, channels: audio.AudioChannel.CHANNEL_1,
sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
} }
var AudioRendererInfo = { var AudioRendererInfo = {
content: audio.ContentType.CONTENT_TYPE_SPEECH, content: audio.ContentType.CONTENT_TYPE_SPEECH,
usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
rendererFlags: 1 rendererFlags: 1
} }
var AudioRendererOptions = { var AudioRendererOptions = {
streamInfo: AudioStreamInfoRen, streamInfo: AudioStreamInfoRen,
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B-2.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await getAbilityInfo("capture_js-44100-2C-16B-2.pcm");
await sleep(500); recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
readpath = 'StarWars10s-1C-44100-2SW.wav'; await sleep(500);
await getFdRead(readpath,done); readpath = 'StarWars10s-1C-44100-2SW.wav';
await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); await getFdRead(readpath);
await sleep(1000); await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
console.info('AudioFrameworkRecLog: resultFlag : Capturer : '+resultFlagRec); await sleep(1000);
console.info('AudioFrameworkRenderLog: resultFlag : Renderer : '+resultFlagRen); console.info('AudioFrameworkRecLog: resultFlag : Capturer : ' + resultFlagRec);
console.info('AudioFrameworkRenderLog: resultFlag : Renderer : ' + resultFlagRen);
if (resultFlagRec == true){
if (resultFlagRec == true) {
expect(resultFlagRen).assertTrue(); expect(resultFlagRen).assertTrue();
} }
else{ else {
expect(false).assertTrue(); expect(false).assertTrue();
} }
await closeFileDescriptor(readpath); await closeFileDescriptor(readpath);
done(); done();
}) })
}) })
\ No newline at end of file
...@@ -28,6 +28,8 @@ describe('audioRenderer_audo2', function () { ...@@ -28,6 +28,8 @@ describe('audioRenderer_audo2', function () {
var mediaDir; var mediaDir;
let fdRead; let fdRead;
let readpath; let readpath;
let fdPath;
let filePath;
/*async function getPathName(){ /*async function getPathName(){
var path1 = '/data/app/el1/bundle/public/'; var path1 = '/data/app/el1/bundle/public/';
var packageName; var packageName;
...@@ -55,7 +57,7 @@ describe('audioRenderer_audo2', function () { ...@@ -55,7 +57,7 @@ describe('audioRenderer_audo2', function () {
beforeAll(async function () { beforeAll(async function () {
await applyPermission(); await applyPermission();
console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level'); console.info('AudioFrameworkTest: beforeAll: Prerequisites at the test suite level');
mediaDir = '/data/storage/el2/base/haps/entry/cache'; // mediaDir = '/data/storage/el2/base/haps/entry/cache';
}) })
beforeEach(async function () { beforeEach(async function () {
...@@ -75,18 +77,15 @@ describe('audioRenderer_audo2', function () { ...@@ -75,18 +77,15 @@ describe('audioRenderer_audo2', function () {
return new Promise(resolve => setTimeout(resolve, ms)); return new Promise(resolve => setTimeout(resolve, ms));
} }
async function getFileDescriptor(fileName) { async function getAbilityInfo(fileName) {
let fileDescriptor = undefined; let context = await featureAbility.getContext();
await resourceManager.getResourceManager().then(async (mgr) => { console.info("case0 context is " + context);
await mgr.getRawFileDescriptor(fileName).then(value => { await context.getFilesDir().then((data) => {
fileDescriptor = { fd: value.fd, offset: value.offset, length: value.length }; console.info("case1 getFilesDir is path " + data);
}).catch(error => { mediaDir = data + '/' + fileName;
console.log('AudioFrameworkRenderLog:case getRawFileDescriptor err: ' + error); console.info('case2 mediaDir is ' + mediaDir);
}); })
});
return fileDescriptor;
} }
async function closeFileDescriptor(fileName) { async function closeFileDescriptor(fileName) {
await resourceManager.getResourceManager().then(async (mgr) => { await resourceManager.getResourceManager().then(async (mgr) => {
await mgr.closeRawFileDescriptor(fileName).then(value => { await mgr.closeRawFileDescriptor(fileName).then(value => {
...@@ -96,17 +95,39 @@ describe('audioRenderer_audo2', function () { ...@@ -96,17 +95,39 @@ describe('audioRenderer_audo2', function () {
}); });
}); });
} }
async function getFdRead(pathName, done) { // async function getFdRead(pathName, done) {
await getFileDescriptor(pathName).then((res) => { // await getFileDescriptor(pathName).then((res) => {
if (res == undefined) { // if (res == undefined) {
expect().assertFail(); // expect().assertFail();
console.info('AudioFrameworkRenderLog:case error fileDescriptor undefined, open file fail'); // console.info('AudioFrameworkRenderLog:case error fileDescriptor undefined, open file fail');
done(); // done();
} else { // } else {
fdRead = res.fd; // fdRead = res.fd;
console.info("AudioFrameworkRenderLog:case 0 fdRead is: " + fdRead); // console.info("AudioFrameworkRenderLog:case 0 fdRead is: " + fdRead);
} // }
// })
// }
async function getFdRead(pathName) {
let context = await featureAbility.getContext();
console.info("case0 context is " + context);
await context.getFilesDir().then((data) => {
console.info("case1 getFilesDir is path " + data);
filePath = data + '/' + pathName;
console.info('case4 filePath is ' + filePath);
}) })
fdPath = 'fd://';
await fileio.open(filePath).then((fdNumber) => {
fdPath = fdPath + '' + fdNumber;
fdRead = fdNumber;
console.info('[fileIO]case open fd success,fdPath is ' + fdPath);
console.info('[fileIO]case open fd success,fdRead is ' + fdRead);
}, (err) => {
console.info('[fileIO]case open fd failed');
}).catch((err) => {
console.info('[fileIO]case catch open fd failed');
});
} }
async function applyPermission() { async function applyPermission() {
...@@ -434,13 +455,13 @@ describe('audioRenderer_audo2', function () { ...@@ -434,13 +455,13 @@ describe('audioRenderer_audo2', function () {
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
readpath = 'StarWars10s-1C-44100-2SW.wav'; // readpath = 'StarWars10s-1C-44100-2SW.wav';
await getFdRead(readpath,done); await getFdRead("StarWars10s-1C-44100-2SW.wav");
var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); var resultFlag = await playbackPromise(AudioRendererOptions, filePath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await sleep(100); await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue(); expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath); await closeFileDescriptor(filePath);
done(); done();
}) })
...@@ -470,8 +491,9 @@ describe('audioRenderer_audo2', function () { ...@@ -470,8 +491,9 @@ describe('audioRenderer_audo2', function () {
streamInfo: AudioStreamInfo, streamInfo: AudioStreamInfo,
capturerInfo: AudioCapturerInfo capturerInfo: AudioCapturerInfo
} }
await getAbilityInfo("capture_js-44100-2C-16B.pcm");
var resultFlag = await recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); var resultFlag = await recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
// var resultFlag = await recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B.pcm', audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await sleep(100); await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue(); expect(resultFlag).assertTrue();
...@@ -522,17 +544,17 @@ describe('audioRenderer_audo2', function () { ...@@ -522,17 +544,17 @@ describe('audioRenderer_audo2', function () {
streamInfo: AudioStreamInfoRen, streamInfo: AudioStreamInfoRen,
rendererInfo: AudioRendererInfo rendererInfo: AudioRendererInfo
} }
await getAbilityInfo("capture_js-44100-2C-16B-2.pcm");
recPromise(AudioCapturerOptions, mediaDir+'/capture_js-44100-2C-16B-2.pcm', audio.AudioScene.AUDIO_SCENE_PHONE_CHAT); recPromise(AudioCapturerOptions, mediaDir, audio.AudioScene.AUDIO_SCENE_PHONE_CHAT);
await sleep(500); await sleep(500);
readpath = 'StarWars10s-1C-44100-2SW.wav'; readpath = 'StarWars10s-1C-44100-2SW.wav';
await getFdRead(readpath,done); await getFdRead(readpath);
var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT); var resultFlag = await playbackPromise(AudioRendererOptions, readpath, audio.AudioScene.AUDIO_SCENE_VOICE_CHAT);
await sleep(100); await sleep(100);
console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag); console.info('AudioFrameworkRenderLog: resultFlag : '+resultFlag);
expect(resultFlag).assertTrue(); expect(resultFlag).assertTrue();
await closeFileDescriptor(readpath,done); await closeFileDescriptor(readpath);
done(); done();
}) })
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
{ {
"type": "ShellKit", "type": "ShellKit",
"run-command": [ "run-command": [
"mkdir /data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache/", "mkdir -p /data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache/",
"chmod -R 666 /data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache/*" "chmod -R 666 /data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache/*"
], ],
"teardown-command":[ "teardown-command":[
......
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ohos.acts.multimedia.image;
import ohos.ace.ability.AceAbility;
import ohos.aafwk.content.Intent;
/*
* java MainAbility
*/
public class MainAbility extends AceAbility {
@Override
public void onStart(Intent intent) {
super.onStart(intent);
}
@Override
public void onStop() {
super.onStop();
}
}
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package ohos.acts.multimedia.image;
import ohos.aafwk.ability.AbilityPackage;
/*
* java MyApplication
*/
public class MyApplication extends AbilityPackage {
@Override
public void onInitialize() {
super.onInitialize();
}
}
...@@ -2412,7 +2412,7 @@ describe('Image', function () { ...@@ -2412,7 +2412,7 @@ describe('Image', function () {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
let packOpts = { format: ["image/jpeg"], quality: 99 } let packOpts = { format: "image/jpeg", quality: 99 }
imagePackerApi.packing(imageSourceApi, packOpts) imagePackerApi.packing(imageSourceApi, packOpts)
.then(data => { .then(data => {
console.info('TC_062 success'); console.info('TC_062 success');
...@@ -2460,7 +2460,7 @@ describe('Image', function () { ...@@ -2460,7 +2460,7 @@ describe('Image', function () {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
let packOpts = { format: ["image/jpeg"], quality: 1 } let packOpts = { format: "image/jpeg", quality: 1 }
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
console.info('TC_062-1 success'); console.info('TC_062-1 success');
expect(data != undefined).assertTrue(); expect(data != undefined).assertTrue();
...@@ -2692,7 +2692,7 @@ describe('Image', function () { ...@@ -2692,7 +2692,7 @@ describe('Image', function () {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
let packOpts = { format: ["image/jpeg"], quality: 100 } let packOpts = { format: "image/jpeg", quality: 100 }
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
if (err) { if (err) {
expect(false).assertTrue(); expect(false).assertTrue();
...@@ -2745,7 +2745,7 @@ describe('Image', function () { ...@@ -2745,7 +2745,7 @@ describe('Image', function () {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
let packOpts = { format: ["image/jpeg"], quality: 0 } let packOpts = { format: "image/jpeg", quality: 0 }
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
console.info('TC_062-8 success'); console.info('TC_062-8 success');
expect(data != undefined).assertTrue(); expect(data != undefined).assertTrue();
...@@ -2785,7 +2785,7 @@ describe('Image', function () { ...@@ -2785,7 +2785,7 @@ describe('Image', function () {
expect(false).assertTrue(); expect(false).assertTrue();
done(); done();
} else { } else {
let packOpts = { format: ["image/jpeg"], quality: -1 } let packOpts = { format: "image/jpeg", quality: -1 }
imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => {
console.info('TC_062-9 success'); console.info('TC_062-9 success');
expect(data == undefined).assertTrue(); expect(data == undefined).assertTrue();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册