diff --git a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js index d92610e8a17e2b1c8fb1f40d89037cc3aaed7bbf..ff7407fb395f0f16d39a26164978af51ba43cada 100644 --- a/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js +++ b/multimedia/audio/audio_js_standard/audioManager/src/main/js/test/AudioFramework.test.js @@ -15,7 +15,7 @@ import audio from '@ohos.multimedia.audio'; -import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index'; describe('audioManger_audio2', function () { console.info('AudioFrameworkTest: Create AudioManger Object JS Framework'); @@ -32,43 +32,43 @@ describe('audioManger_audio2', function () { var outOfRangeVol = 28; var longValue = '28374837458743875804735081439085918459801437584738967509184509813904850914375904790589104801843'; - function sleep (ms) { + function sleep(ms) { return new Promise(resolve => setTimeout(resolve, ms)); } function displayDeviceProp(value, index, array) { var devRoleName; var devTypeName; - if (value.deviceRole==1) { + if (value.deviceRole == 1) { devRoleName = 'INPUT_DEVICE'; } - else if (value.deviceRole==2) { + else if (value.deviceRole == 2) { devRoleName = 'OUTPUT_DEVICE '; } else { - devRoleName = 'ERROR : UNKNOWN : '+value.deviceRole; + devRoleName = 'ERROR : UNKNOWN : ' + value.deviceRole; } if (value.deviceType == 1) { devTypeName = 'EARPIECE'; } - else if (value.deviceType == 2){ + else if (value.deviceType == 2) { devTypeName = 'SPEAKER'; } - else if (value.deviceType == 3){ + else if (value.deviceType == 3) { devTypeName = 'WIRED_HEADSET'; } - else if (value.deviceType == 7){ + else if (value.deviceType == 7) { devTypeName = 'BLUETOOTH_SCO'; } - else if (value.deviceType == 8){ + else if (value.deviceType == 8) { devTypeName = 'BLUETOOTH_A2DP'; } - else if (value.deviceType == 15){ + else if (value.deviceType == 15) { devTypeName = 'MIC'; } else { - devTypeName = 'ERROR : UNKNOWN :'+value.deviceType; + devTypeName = 'ERROR : UNKNOWN :' + value.deviceType; } console.info(`AudioFrameworkTest: device role: ${devRoleName}`); @@ -105,11 +105,11 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getAudioManger_001', 0, function (done) { - if(audioManager!=null){ + if (audioManager != null) { console.info('AudioFrameworkTest: getAudioManger : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: getAudioManger : FAIL'); expect(false).assertTrue(); } @@ -135,35 +135,35 @@ describe('audioManger_audio2', function () { const audioManager8 = audio.getAudioManager(); const audioManager9 = audio.getAudioManager(); const audioManager10 = audio.getAudioManager(); - const promise = audioManager.setVolume(audioMedia,lowVol); + const promise = audioManager.setVolume(audioMedia, lowVol); promise.then(function () { console.info('AudioFrameworkTest: Media setVolume promise: successful'); - audioManager1.setVolume(audioMedia,highVol); + audioManager1.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager1 : Media setVolume promise: successful'); - audioManager2.setVolume(audioMedia,highVol); + audioManager2.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager2 : Media setVolume promise: successful'); - audioManager3.setVolume(audioMedia,highVol); + audioManager3.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager3 : Media setVolume promise: successful'); - audioManager4.setVolume(audioMedia,lowVol); + audioManager4.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager4 : Media setVolume promise: successful'); - audioManager5.setVolume(audioMedia,highVol); + audioManager5.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager5 : Media setVolume promise: successful'); - audioManager6.setVolume(audioMedia,lowVol); + audioManager6.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager6 : Media setVolume promise: successful'); - audioManager7.setVolume(audioMedia,highVol); + audioManager7.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager7 : Media setVolume promise: successful'); - audioManager8.setVolume(audioMedia,lowVol); + audioManager8.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager8 : Media setVolume promise: successful'); - audioManager9.setVolume(audioMedia,highVol); + audioManager9.setVolume(audioMedia, highVol); console.info('AudioFrameworkTest:audioManager9 : Media setVolume promise: successful'); - audioManager10.setVolume(audioMedia,lowVol); + audioManager10.setVolume(audioMedia, lowVol); console.info('AudioFrameworkTest:audioManager10 : Media setVolume promise: successful'); audioManager.getVolume(audioMedia).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -184,15 +184,15 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_001', 0, async function (done) { - const promise = audioManager.setVolume(audioMedia,lowVol); + const promise = audioManager.setVolume(audioMedia, lowVol); promise.then(function () { console.info('AudioFrameworkTest: Media setVolume promise: successful'); audioManager.getVolume(audioMedia).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -211,15 +211,15 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_002', 0, async function (done) { - const promise = audioManager.setVolume(audioMedia,maxVol); + const promise = audioManager.setVolume(audioMedia, maxVol); promise.then(function () { console.info('AudioFrameworkTest: Media setVolume promise: successful'); audioManager.getVolume(audioMedia).then(function (data) { - if(data == maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -238,16 +238,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_003', 0, async function (done) { - const promise = audioManager.setVolume(audioMedia,minVol); + const promise = audioManager.setVolume(audioMedia, minVol); promise.then(function () { console.info('AudioFrameworkTest: Media setVolume promise: successful'); audioManager.getVolume(audioMedia).then(function (data) { - if(data == minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Media getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -267,7 +267,7 @@ describe('audioManger_audio2', function () { */ it('SUB_AUDIO_MANAGER_SetVolume_004', 0, async function (done) { console.info('AudioFrameworkTest: Media setVolume Promise:Out of range: Setvol 100'); - await audioManager.setVolume(audioMedia,outOfRangeVol).then(() => { + await audioManager.setVolume(audioMedia, outOfRangeVol).then(() => { console.info('AudioFrameworkTest: Media setVolume Promise:Out of range: FAIL'); expect(false).assertTrue(); }).catch((err) => { @@ -286,24 +286,23 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_005', 0, async function (done) { - audioManager.setVolume(audioMedia,highVol, (err) => { + audioManager.setVolume(audioMedia, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else - { + else { console.info(`AudioFrameworkTest: callback : Media setVolume successful `); audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == highVol){ + else if (value == highVol) { console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -323,24 +322,23 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_006', 0, async function (done) { - audioManager.setVolume(audioMedia,maxVol, (err) => { + audioManager.setVolume(audioMedia, maxVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else - { + else { console.info(`AudioFrameworkTest: callback : Media setVolume successful `); audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -360,24 +358,23 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_007', 0, async function (done) { - audioManager.setVolume(audioMedia,minVol, (err) => { + audioManager.setVolume(audioMedia, minVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else - { + else { console.info(`AudioFrameworkTest: callback : Media setVolume successful `); audioManager.getVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -397,12 +394,12 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_008', 0, async function (done) { - audioManager.setVolume(audioMedia,outOfRangeVol, (err) => { + audioManager.setVolume(audioMedia, outOfRangeVol, (err) => { if (err) { console.error(`AudioFrameworkTest: setVolume: Out of range: Callback: PASS: ${err.message}`); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: setVolume: callback : Media Out of range: FAIL'); expect(false).assertTrue(); } @@ -419,15 +416,15 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_009', 0, async function (done) { - const promise = audioManager.setVolume(audioRingtone,lowVol); + const promise = audioManager.setVolume(audioRingtone, lowVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: successful'); audioManager.getVolume(audioRingtone).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -446,15 +443,15 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_010', 0, async function (done) { - const promise = audioManager.setVolume(audioRingtone,maxVol); + const promise = audioManager.setVolume(audioRingtone, maxVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: successful'); audioManager.getVolume(audioRingtone).then(function (data) { - if(data == maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -473,15 +470,15 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_011', 0, async function (done) { - const promise = audioManager.setVolume(audioRingtone,minVol); + const promise = audioManager.setVolume(audioRingtone, minVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: successful'); audioManager.getVolume(audioRingtone).then(function (data) { - if(data == minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: FAIL :' + data); expect(false).assertTrue(); } @@ -501,7 +498,7 @@ describe('audioManger_audio2', function () { */ it('SUB_AUDIO_MANAGER_SetVolume_012', 0, async function (done) { console.info('AudioFrameworkTest: Ringtone setVolume Promise: Out of range: Setvol 30'); - await audioManager.setVolume(audioRingtone,outOfRangeVol).then(() => { + await audioManager.setVolume(audioRingtone, outOfRangeVol).then(() => { console.info('AudioFrameworkTest: Ringtone setVolume Promise:Out of range: FAIL'); expect(false).assertTrue(); }).catch((err) => { @@ -520,23 +517,23 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_013', 0, async function (done) { - audioManager.setVolume(audioRingtone,highVol, (err) => { + audioManager.setVolume(audioRingtone, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `); audioManager.getVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == highVol){ + else if (value == highVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -556,24 +553,24 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_014', 0, async function (done) { - audioManager.setVolume(audioRingtone,maxVol, (err) => { + audioManager.setVolume(audioRingtone, maxVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `); audioManager.getVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -593,23 +590,23 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_015', 0, async function (done) { - audioManager.setVolume(audioRingtone,minVol, (err) => { + audioManager.setVolume(audioRingtone, minVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : Ringtone setVolume successful `); audioManager.getVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: FAIL :' + value); expect(false).assertTrue(); } @@ -629,12 +626,12 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_016', 0, async function (done) { - audioManager.setVolume(audioRingtone,outOfRangeVol, (err) => { + audioManager.setVolume(audioRingtone, outOfRangeVol, (err) => { if (err) { console.error(`AudioFrameworkTest: Out of range Volume: Callback: ${err.message}`); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Out of range Volume: callback : Ringtone set volume: FAIL'); expect(false).assertTrue(); } @@ -652,7 +649,7 @@ describe('audioManger_audio2', function () { */ it('SUB_AUDIO_MANAGER_SetVolume_017', 0, async function (done) { console.info('AudioFrameworkTest: Media setVolume promise: Negative Value -1'); - await audioManager.setVolume(audioMedia,-1).then(() => { + await audioManager.setVolume(audioMedia, -1).then(() => { // Setting negative audio volume for error Scenario console.info('AudioFrameworkTest: Media setVolume Promise:Negative: FAIL'); expect(false).assertTrue(); @@ -672,13 +669,13 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_018', 0, async function (done) { - audioManager.setVolume(audioMedia,-1, (err) => { + audioManager.setVolume(audioMedia, -1, (err) => { // Setting negative audio volume for error Scenario if (err) { console.error(`AudioFrameworkTest: setVolume Callback: Negative: PASS: ${err.message}`); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: setVolume callback : Media Negative: FAIL'); expect(false).assertTrue(); } @@ -696,7 +693,7 @@ describe('audioManger_audio2', function () { */ it('SUB_AUDIO_MANAGER_SetVolume_019', 0, async function (done) { console.info('AudioFrameworkTest: Ringtone setVolume promise: Negative'); - await audioManager.setVolume(audioRingtone,-1).then(() => { + await audioManager.setVolume(audioRingtone, -1).then(() => { // Setting negative audio volume for error Scenario console.info('AudioFrameworkTest: Ringtone setVolume Promise:Negative: FAIL'); expect(false).assertTrue(); @@ -716,13 +713,13 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_020', 0, async function (done) { - audioManager.setVolume(audioRingtone,-1, (err) => { + audioManager.setVolume(audioRingtone, -1, (err) => { // Setting negative audio volume for error Scenario if (err) { console.error(`AudioFrameworkTest:Ringtone setVolume Callback:Negative: PASS : ${err.message}`); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: setVolume: Negative: callback : Ringtone set volume: FAIL'); expect(false).assertTrue(); } @@ -739,14 +736,14 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_021', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol); + const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); promise.then(function () { audioManager.getVolume(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data); expect(false).assertTrue(); } @@ -765,23 +762,23 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_022', 0, async function (done) { - audioManager.setVolume(audio.AudioVolumeType.MEDIA,highVol, (err) => { + audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME : ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : ENAME : Media setVolume successful `); audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: ENAME : Error ${err.message}`); expect(false).assertTrue(); } - else if(value == highVol){ + else if (value == highVol) { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :' + value); expect(false).assertTrue(); } @@ -801,15 +798,15 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_023', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE,highVol); + const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE, highVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful'); audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == highVol){ + if (data == highVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data); expect(false).assertTrue(); } @@ -828,23 +825,23 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_024', 0, async function (done) { - audioManager.setVolume(audio.AudioVolumeType.RINGTONE,lowVol, (err) => { + audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `); audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == lowVol){ + else if (value == lowVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :' + value); expect(false).assertTrue(); } @@ -864,15 +861,15 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_025', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol); + const promise = audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); promise.then(function () { - audioManager.setVolume(audio.AudioVolumeType.RINGTONE,maxVol); + audioManager.setVolume(audio.AudioVolumeType.RINGTONE, maxVol); audioManager.getVolume(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data == lowVol){ + if (data == lowVol) { console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getVolume Promise: ENAME : FAIL :' + data); expect(false).assertTrue(); } @@ -891,24 +888,24 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_026', 0, async function (done) { - audioManager.setVolume(audio.AudioVolumeType.MEDIA,highVol, (err) => { + audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME : ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : ENAME : Media setVolume successful `); - audioManager.setVolume(audio.AudioVolumeType.RINGTONE,lowVol); + audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol); audioManager.getVolume(audio.AudioVolumeType.MEDIA, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media: ENAME : Error: ${err.message}`); expect(false).assertTrue(); } - else if(value == highVol){ + else if (value == highVol) { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media getVolume: ENAME : FAIL :' + value); expect(false).assertTrue(); } @@ -928,16 +925,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_027', 0, async function (done) { - const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE,highVol); + const promise = audioManager.setVolume(audio.AudioVolumeType.RINGTONE, highVol); promise.then(function () { console.info('AudioFrameworkTest: Ringtone setVolume promise: ENAME: successful'); - audioManager.setVolume(audio.AudioVolumeType.MEDIA,lowVol); + audioManager.setVolume(audio.AudioVolumeType.MEDIA, lowVol); audioManager.getVolume(audio.AudioVolumeType.RINGTONE).then(function (data) { - if(data == highVol){ + if (data == highVol) { console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: PASS :' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getVolume Promise: ENAME: FAIL :' + data); expect(false).assertTrue(); } @@ -956,24 +953,24 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_SetVolume_028', 0, async function (done) { - audioManager.setVolume(audio.AudioVolumeType.RINGTONE,lowVol, (err) => { + audioManager.setVolume(audio.AudioVolumeType.RINGTONE, lowVol, (err) => { if (err) { console.error(`AudioFrameworkTest: failed to set volume: Callback: ENAME: ${err.message}`); expect(false).assertTrue(); } - else{ + else { console.info(`AudioFrameworkTest: callback : ENAME: Ringtone setVolume successful `); - audioManager.setVolume(audio.AudioVolumeType.MEDIA,highVol); + audioManager.setVolume(audio.AudioVolumeType.MEDIA, highVol); audioManager.getVolume(audio.AudioVolumeType.RINGTONE, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone: ENAME: failed to get volume ${err.message}`); expect(false).assertTrue(); } - else if(value == lowVol){ + else if (value == lowVol) { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: PASS :' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone getVolume: ENAME: FAIL :' + value); expect(false).assertTrue(); } @@ -995,11 +992,11 @@ describe('audioManger_audio2', function () { it('SUB_AUDIO_MANAGER_getMaxVolume_001', 0, async function (done) { const promise = audioManager.getMaxVolume(audioMedia); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1022,11 +1019,11 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1045,11 +1042,11 @@ describe('audioManger_audio2', function () { it('SUB_AUDIO_MANAGER_getMaxVolume_003', 0, async function (done) { const promise = audioManager.getMaxVolume(audioRingtone); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1072,11 +1069,11 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1093,14 +1090,14 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_005', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); const promise = audioManager.getMaxVolume(audioMedia); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1118,14 +1115,14 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_006', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); const promise = audioManager.getMaxVolume(audioRingtone); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1144,18 +1141,18 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_007', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); audioManager.getMaxVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1172,17 +1169,17 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_008', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); audioManager.getMaxVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1199,14 +1196,14 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_009', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); const promise = audioManager.getMaxVolume(audioMedia); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Media getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1224,14 +1221,14 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_010', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); const promise = audioManager.getMaxVolume(audioRingtone); promise.then(function (data) { - if (data==maxVol){ + if (data == maxVol) { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMaxVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1249,17 +1246,17 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_011', 0, async function (done) { - audioManager.setVolume(audioMedia,highVol); + audioManager.setVolume(audioMedia, highVol); audioManager.getMaxVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1276,17 +1273,17 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMaxVolume_012', 0, async function (done) { - audioManager.setVolume(audioRingtone,highVol); + audioManager.setVolume(audioRingtone, highVol); audioManager.getMaxVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMaxVolume ${err.message}`); expect(false).assertTrue(); } - else if (value==maxVol){ + else if (value == maxVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMaxVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1305,11 +1302,11 @@ describe('audioManger_audio2', function () { it('SUB_AUDIO_MANAGER_getMinVolume_001', 0, async function (done) { const promise = audioManager.getMinVolume(audioMedia); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1332,11 +1329,11 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1355,11 +1352,11 @@ describe('audioManger_audio2', function () { it('SUB_AUDIO_MANAGER_getMinVolume_003', 0, async function (done) { const promise = audioManager.getMinVolume(audioRingtone); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1383,11 +1380,11 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1404,18 +1401,18 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_005', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); const promise = audioManager.getMinVolume(audioMedia); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } - }); + }); await promise; done(); }) @@ -1429,17 +1426,17 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_006', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); audioManager.getMinVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1456,14 +1453,14 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_007', 0, async function (done) { - audioManager.setVolume(audioMedia,highVol); + audioManager.setVolume(audioMedia, highVol); const promise = audioManager.getMinVolume(audioRingtone); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1481,17 +1478,17 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_008', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); audioManager.getMinVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1508,14 +1505,14 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_009', 0, async function (done) { - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); const promise = audioManager.getMinVolume(audioMedia); promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Media getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Media getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1533,17 +1530,17 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_010', 0, async function (done) { - audioManager.setVolume(audioMedia,highVol); + audioManager.setVolume(audioMedia, highVol); audioManager.getMinVolume(audioMedia, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Media : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Media: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Media: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1560,14 +1557,14 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_011', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); const promise = audioManager.getMinVolume(audioRingtone) promise.then(function (data) { - if (data==minVol){ + if (data == minVol) { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : PASS:' + data); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Ringtone getMinVolume promise : FAIL: ' + data); expect(false).assertTrue(); } @@ -1585,17 +1582,17 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getMinVolume_012', 0, async function (done) { - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); audioManager.getMinVolume(audioRingtone, (err, value) => { if (err) { console.error(`AudioFrameworkTest: callback : Ringtone : failed to getMinVolume ${err.message}`); expect().assertFail(); } - else if (value==minVol){ + else if (value == minVol) { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : PASS:' + value); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: callback : Ringtone: getMinVolume : FAIL: ' + value); expect(false).assertTrue(); } @@ -1619,11 +1616,11 @@ describe('audioManger_audio2', function () { promise.then(function (value) { console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1649,11 +1646,11 @@ describe('audioManger_audio2', function () { console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1680,11 +1677,11 @@ describe('audioManger_audio2', function () { console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1715,11 +1712,11 @@ describe('audioManger_audio2', function () { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1748,15 +1745,15 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -1785,15 +1782,15 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -1818,11 +1815,11 @@ describe('audioManger_audio2', function () { console.info('AudioFrameworkTest: Promise: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1847,11 +1844,11 @@ describe('audioManger_audio2', function () { console.info('AudioFrameworkTest: Promise: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : INPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1876,11 +1873,11 @@ describe('audioManger_audio2', function () { console.info('AudioFrameworkTest: Promise: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Promise: getDevices : ALL_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1906,14 +1903,14 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback: OUTPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices OUTPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : OUTPUT_DEVICES_FLAG : FAIL'); expect(false).assertTrue(); } @@ -1939,15 +1936,15 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback: INPUT_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices INPUT_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : INPUT_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -1973,14 +1970,14 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback: ALL_DEVICES_FLAG: failed to get devices ${err.message}`); expect().assertFail(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices ALL_DEVICES_FLAG'); value.forEach(displayDeviceProp); - if (deviceTypeValue != null && deviceRoleValue != null){ + if (deviceTypeValue != null && deviceRoleValue != null) { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: PASS'); expect(true).assertTrue(); } - else{ + else { console.info('AudioFrameworkTest: Callback: getDevices : ALL_DEVICES_FLAG: FAIL'); expect(false).assertTrue(); } @@ -2002,13 +1999,13 @@ describe('audioManger_audio2', function () { // Setting Ringtone Mode to Normal ENUM 2 = RINGER_MODE_NORMAL promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL'); - audioManager.getRingerMode().then(function (value){ - if(value==2){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == 2) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2028,15 +2025,15 @@ describe('audioManger_audio2', function () { it('SUB_AUDIO_MANAGER_setRingerMode_002', 0, async function (done) { const promise = audioManager.setRingerMode(0); // Setting Ringtone Mode to Silent ENUM 0 = RINGER_MODE_SILENT - promise.then(function (){ + promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT'); - audioManager.getRingerMode().then(function (value){ - if(value==0){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == 0) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2056,15 +2053,15 @@ describe('audioManger_audio2', function () { it('SUB_AUDIO_MANAGER_setRingerMode_003', 0, async function (done) { const promise = audioManager.setRingerMode(1); // Setting Ringtone Mode to Vibration ENUM 1 = RINGER_MODE_VIBRATE - promise.then(function (){ + promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE'); - audioManager.getRingerMode().then(function (value){ - if(value==1){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == 1) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2089,18 +2086,18 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); } - else{ + else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); } - else if(value==2){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' +value); + else if (value == 2) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2126,19 +2123,19 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : setRingerMode RINGER_MODE_SILENT: Error: ${err.message}`); expect().assertFail(); } - else{ + else { audioManager.getRingerMode((err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_SILENT: Error: ${err.message}`); expect().assertFail(); } - if(value==0){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' +value); + if (value == 0) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2171,12 +2168,12 @@ describe('audioManger_audio2', function () { expect().assertFail(); } - if(value==1){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value); + if (value == 1) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2198,13 +2195,13 @@ describe('audioManger_audio2', function () { const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL); promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL'); - audioManager.getRingerMode().then(function (value){ - if(value==audio.AudioRingMode.RINGER_MODE_NORMAL){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == audio.AudioRingMode.RINGER_MODE_NORMAL) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2223,15 +2220,15 @@ describe('audioManger_audio2', function () { */ it('SUB_AUDIO_MANAGER_setRingerMode_008', 0, async function (done) { const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_SILENT); - promise.then(function (){ + promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT'); - audioManager.getRingerMode().then(function (value){ - if(value==audio.AudioRingMode.RINGER_MODE_SILENT){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == audio.AudioRingMode.RINGER_MODE_SILENT) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2250,15 +2247,15 @@ describe('audioManger_audio2', function () { */ it('SUB_AUDIO_MANAGER_setRingerMode_009', 0, async function (done) { const promise = audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_VIBRATE); - promise.then(function (){ + promise.then(function () { console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE'); - audioManager.getRingerMode().then(function (value){ - if(value==audio.AudioRingMode.RINGER_MODE_VIBRATE){ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value); + audioManager.getRingerMode().then(function (value) { + if (value == audio.AudioRingMode.RINGER_MODE_VIBRATE) { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } }); @@ -2288,12 +2285,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : RINGER_MODE_NORMAL: Error: ${err.message}`); expect().assertFail(); } - else if(value==audio.AudioRingMode.RINGER_MODE_NORMAL){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' +value); + else if (value == audio.AudioRingMode.RINGER_MODE_NORMAL) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_NORMAL: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2325,12 +2322,12 @@ describe('audioManger_audio2', function () { expect().assertFail(); } - if(value==audio.AudioRingMode.RINGER_MODE_SILENT){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' +value); + if (value == audio.AudioRingMode.RINGER_MODE_SILENT) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_SILENT: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2362,12 +2359,12 @@ describe('audioManger_audio2', function () { expect().assertFail(); } - if(value==audio.AudioRingMode.RINGER_MODE_VIBRATE){ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' +value); + if (value == audio.AudioRingMode.RINGER_MODE_VIBRATE) { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: setRingerMode RINGER_MODE_VIBRATE: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -2386,7 +2383,7 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_006', 0, async function (done) { - audioManager.mute(audioMedia,false, (err) => { + audioManager.mute(audioMedia, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect(false).assertTrue(); @@ -2398,12 +2395,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : FALSE: Media : failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2422,16 +2419,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_005', 0, async function (done) { - await audioManager.mute(audioMedia,false).then(function () { + await audioManager.mute(audioMedia, false).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Media: Promise: FALSE'); audioManager.isMute(audioMedia).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2450,7 +2447,7 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_008', 0, async function (done) { - audioManager.mute(audioRingtone,false, (err) => { + audioManager.mute(audioRingtone, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect(false).assertTrue(); @@ -2462,12 +2459,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : FALSE: Ringtone : failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2486,16 +2483,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_007', 0, async function (done) { - await audioManager.mute(audioRingtone,false).then(function () { + await audioManager.mute(audioRingtone, false).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: FALSE'); audioManager.isMute(audioRingtone).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2514,7 +2511,7 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_015', 0, async function (done) { - audioManager.mute(audio.AudioVolumeType.MEDIA,false, (err) => { + audioManager.mute(audio.AudioVolumeType.MEDIA, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect().assertFail(); @@ -2526,12 +2523,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : FALSE: Media : ENAME: failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: ENAME: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2550,16 +2547,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_011', 0, async function (done) { - await audioManager.mute(audio.AudioVolumeType.MEDIA,false).then(function () { + await audioManager.mute(audio.AudioVolumeType.MEDIA, false).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Media: ENAME: Promise: FALSE'); audioManager.isMute(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2578,7 +2575,7 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_016', 0, async function (done) { - audioManager.mute(audio.AudioVolumeType.RINGTONE,false, (err) => { + audioManager.mute(audio.AudioVolumeType.RINGTONE, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Set Stream Mute: Media: Callback: Error : ${err.message}`); expect().assertFail(); @@ -2590,12 +2587,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : FALSE: Ringtone : ENAME: failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: ENAME: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2614,16 +2611,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_014', 0, async function (done) { - await audioManager.mute(audio.AudioVolumeType.MEDIA,false).then(function () { + await audioManager.mute(audio.AudioVolumeType.MEDIA, false).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Media: ENAME: Promise: FALSE'); audioManager.isMute(audio.AudioVolumeType.MEDIA).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: ENAME: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2642,17 +2639,17 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_017', 0, async function (done) { - await audioManager.mute(audioMedia,true).then(function () { + await audioManager.mute(audioMedia, true).then(function () { console.log('AudioFrameworkTest: Set Stream Mute: Media: Promise: TRUE'); - audioManager.setVolume(audioMedia,lowVol); + audioManager.setVolume(audioMedia, lowVol); audioManager.isMute(audioMedia).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Media: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -2662,7 +2659,7 @@ describe('audioManger_audio2', function () { done(); }) - /* * + /* * * @tc.number : SUB_AUDIO_MANAGER_mute_018 * @tc.name : mute - Media - callback - SetVolume * @tc.desc : mute - Media - callback - Enable mute - SetVolume @@ -2671,27 +2668,27 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_018', 0, async function (done) { - audioManager.mute(audioMedia,true,async (err) => { - if (err) { - console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to set Mute Status ${err.message}`); - expect().assertFail(); - } - else{ + audioManager.mute(audioMedia, true, async (err) => { + if (err) { + console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to set Mute Status ${err.message}`); + expect().assertFail(); + } + else { console.log('AudioFrameworkTest: Set Stream Mute: Media: Callback : TRUE'); await sleep(100); - await audioManager.setVolume(audioMedia,highVol); + await audioManager.setVolume(audioMedia, highVol); await sleep(100); audioManager.isMute(audioMedia, (err, data) => { if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: Media : failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Media: SetVolume: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2701,7 +2698,7 @@ describe('audioManger_audio2', function () { }); }) - /* * + /* * * @tc.number : SUB_AUDIO_MANAGER_mute_019 * @tc.name : mute - Ringtone - Promise - SetVolume * @tc.desc : mute - Ringtone - Promise - Enable mute - SetVolume @@ -2710,19 +2707,19 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_019', 0, async function (done) { - await audioManager.mute(audioRingtone,true).then(async function () { + await audioManager.mute(audioRingtone, true).then(async function () { console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Promise: SetVolume'); - await audioManager.setVolume(audioRingtone,highVol); + await audioManager.setVolume(audioRingtone, highVol); await audioManager.isMute(audioRingtone).then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: FAIL: ' + data); + expect(false).assertTrue(); } - }); + }); }).catch((err) => { console.info('AudioFrameworkTest: Promise: Is Stream Mute Ringtone: SetVolume: ERROR:' + err.message); expect(false).assertTrue(); @@ -2730,7 +2727,7 @@ describe('audioManger_audio2', function () { done(); }) - /* * + /* * * @tc.number : SUB_AUDIO_MANAGER_mute_020 * @tc.name : mute - Ringtone - callback - SetVolume * @tc.desc : mute - Ringtone - callback - Enable mute - SetVolume @@ -2739,25 +2736,25 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_mute_020', 0, async function (done) { - audioManager.mute(audioRingtone,true, (err) => { - if (err) { + audioManager.mute(audioRingtone, true, (err) => { + if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to set Mute Status ${err.message}`); expect().assertFail(); } else { console.log('AudioFrameworkTest: Set Stream Mute: Ringtone: Callback : SetVolume'); - audioManager.setVolume(audioRingtone,lowVol); + audioManager.setVolume(audioRingtone, lowVol); audioManager.isMute(audioRingtone, (err, data) => { if (err) { console.error(`AudioFrameworkTest: Callback : SetVolume: Ringtone : failed to get Mute Status ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : Is Stream Mute Ringtone: SetVolume: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2779,12 +2776,12 @@ describe('audioManger_audio2', function () { console.log('AudioFrameworkTest: Promise : isActive Media: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); const promise = audioManager.isActive(audioMedia); promise.then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: PASS:'+data); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Promise: isActive: Media: TRUE: FAIL: ' + data); expect(false).assertTrue(); } }); @@ -2807,12 +2804,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : Media : isActive: failed ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: PASS:'+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback: isActive: Media: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2831,12 +2828,12 @@ describe('audioManger_audio2', function () { console.log('AudioFrameworkTest: Promise : isActive Ringtone: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); const promise = audioManager.isActive(audioRingtone); promise.then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: PASS:'+data); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Promise: isActive: Ringtone: TRUE: FAIL: ' + data); expect(false).assertTrue(); } }); @@ -2859,12 +2856,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : Ringtone : isActive: failed ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: PASS:'+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback: isActive: Ringtone: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2883,12 +2880,12 @@ describe('audioManger_audio2', function () { console.log('AudioFrameworkTest: Promise : isActive Media: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); const promise = audioManager.isActive(audio.AudioVolumeType.MEDIA); promise.then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: PASS:'+data); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Promise: isActive: Media: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } }); @@ -2911,12 +2908,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : Media : ENAME: isActive: failed ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: PASS:'+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback: isActive: Media: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2935,12 +2932,12 @@ describe('audioManger_audio2', function () { console.log('AudioFrameworkTest: Promise : isActive Ringtone: ENAME: NOTE: audio NOT PLAYING as MEDIA for the test case to PASS'); const promise = audioManager.isActive(audio.AudioVolumeType.RINGTONE); promise.then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: PASS:'+data); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Promise: isActive: Ringtone: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } }); @@ -2963,12 +2960,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : Ringtone : ENAME: isActive: failed ${err.message}`); expect().assertFail(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: PASS:'+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: PASS:' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback: isActive: Ringtone: ENAME: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -2987,13 +2984,13 @@ describe('audioManger_audio2', function () { await audioManager.setMicrophoneMute(true).then(function () { console.log('AudioFrameworkTest: setMicrophoneMute: Promise: TRUE'); audioManager.isMicrophoneMute().then(function (data) { - if(data==true){ - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: PASS:'+data); - expect(true).assertTrue(); + if (data == true) { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: TRUE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -3015,13 +3012,13 @@ describe('audioManger_audio2', function () { await audioManager.setMicrophoneMute(false).then(function () { console.log('AudioFrameworkTest: setMicrophoneMute: Promise: FALSE'); audioManager.isMicrophoneMute().then(function (data) { - if(data==false){ - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: PASS:'+data); - expect(true).assertTrue(); + if (data == false) { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: PASS:' + data); + expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: FAIL: '+data); - expect(false).assertTrue(); + else { + console.log('AudioFrameworkTest: Promise: isMicrophoneMute: FALSE: FAIL: ' + data); + expect(false).assertTrue(); } }); }).catch((err) => { @@ -3052,12 +3049,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : TRUE: isMicrophoneMute : Error ${err.message}`); expect(false).assertTrue(); } - else if(data==true){ - console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: PASS: '+data); + else if (data == true) { + console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : isMicrophoneMute: TRUE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -3088,12 +3085,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : FALSE: isMicrophoneMute : Error ${err.message}`); expect(false).assertTrue(); } - else if(data==false){ - console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: PASS: '+data); + else if (data == false) { + console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: PASS: ' + data); expect(true).assertTrue(); } - else{ - console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: FAIL: '+data); + else { + console.log('AudioFrameworkTest: Callback : isMicrophoneMute: FALSE: FAIL: ' + data); expect(false).assertTrue(); } done(); @@ -3112,15 +3109,15 @@ describe('audioManger_audio2', 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 (){ + 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); + 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); + else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : BLUETOOTH_SCO: Activate : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3140,22 +3137,22 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_002', 0, async function (done) { - await audioManager.setDeviceActive(2,false).then(function (){ + await audioManager.setDeviceActive(2, false).then(function () { // Setting device active ENUM 2 = SPEAKER - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate'); - audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value){ - if(value==false){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message); - expect(false).assertTrue(); + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Deactivate'); + audioManager.isDeviceActive(audio.ActiveDeviceType.SPEAKER).then(function (value) { + if (value == false) { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); + expect(false).assertTrue(); + } + }); + }).catch((err) => { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Deactivate : FAIL : Error :' + err.message); + expect(false).assertTrue(); }); done(); }) @@ -3169,21 +3166,21 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_003', 0, async function (done) { - await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true).then(function (){ - console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate'); - audioManager.isDeviceActive(2).then(function (value){ - if(value==true){ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' +value); - expect(true).assertTrue(); - } - else{ - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' +value); - expect(false).assertTrue(); - } - }); - }).catch((err) => { - console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message); - expect(false).assertTrue(); + await audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true).then(function () { + console.info('AudioFrameworkTest: Device Test: Promise : setDeviceActive : SPEAKER: Activate'); + audioManager.isDeviceActive(2).then(function (value) { + if (value == true) { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : PASS :' + value); + expect(true).assertTrue(); + } + else { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :' + value); + expect(false).assertTrue(); + } + }); + }).catch((err) => { + console.info('AudioFrameworkTest: Device Test: Promise : isDeviceActive : SPEAKER: Activate : FAIL :Error :' + err.message); + expect(false).assertTrue(); }); done(); }) @@ -3197,22 +3194,22 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_004', 0, async function (done) { - await audioManager.setDeviceActive(7,false).then(function (){ + 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(); + 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(); }) @@ -3226,24 +3223,24 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_005', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,true, (err) => { + 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) => { + 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); + 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); + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Active : FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3262,24 +3259,24 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_006', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,false, (err) => { + audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, false, (err) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); expect(false).assertTrue(); } else { console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - audioManager.isDeviceActive(2,(err, value) => { + audioManager.isDeviceActive(2, (err, value) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value==false){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' +value); + else if (value == false) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Deactivate : FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3298,24 +3295,24 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_007', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER,true, (err) => { + audioManager.setDeviceActive(audio.ActiveDeviceType.SPEAKER, true, (err) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active: Error: ${err.message}`); expect(false).assertTrue(); } else { console.info('AudioFrameworkTest: Device Test: Callback : setDeviceActive : SPEAKER: Active'); - audioManager.isDeviceActive(2,(err, value) => { + audioManager.isDeviceActive(2, (err, value) => { if (err) { console.error(`AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value==true){ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' +value); + else if (value == true) { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : SPEAKER: Active : FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3334,24 +3331,24 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setDeviceActive_008', 0, async function (done) { - audioManager.setDeviceActive(audio.ActiveDeviceType.BLUETOOTH_SCO,false, (err) => { + 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) => { + 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); + 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); + else { + console.info('AudioFrameworkTest: Device Test: Callback : isDeviceActive : BLUETOOTH_SCO: Deactivate : FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3373,13 +3370,13 @@ describe('audioManger_audio2', function () { const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '8 bit'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='8 bit'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == '8 bit') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: Bits per sample : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : Bits per sample : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3400,13 +3397,13 @@ describe('audioManger_audio2', function () { const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '4800'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='4800'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == '4800') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3424,16 +3421,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_setAudioParameter_003', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS',longValue); + const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', longValue); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value==longValue){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == longValue) { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3454,13 +3451,13 @@ describe('audioManger_audio2', function () { const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '10.000000234324324324'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='10.000000234324324324'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == '10.000000234324324324') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3469,25 +3466,25 @@ describe('audioManger_audio2', function () { done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_005 - * @tc.name : setAudioParameter - Promise - Parameter name Number - * @tc.desc : setAudioParameter - Promise - Parameter name Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_setAudioParameter_005', 0, async function (done) { + /* * + * @tc.number : SUB_AUDIO_MANAGER_setAudioParameter_005 + * @tc.name : setAudioParameter - Promise - Parameter name Number + * @tc.desc : setAudioParameter - Promise - Parameter name Number + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_setAudioParameter_005', 0, async function (done) { const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', 'PPNumber'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='PPNumber'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == 'PPNumber') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3508,13 +3505,13 @@ describe('audioManger_audio2', function () { const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '[]\:";<>?,./~!@#$%^*()_+-={}|'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='[]\:";<>?,./~!@#$%^*()_+-={}|'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == '[]\:";<>?,./~!@#$%^*()_+-={}|') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3538,18 +3535,18 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); } - else{ + else { audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='16 bit'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == '16 bit') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3574,18 +3571,18 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); } - else{ + else { audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParam: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='~!@#$%^*()_+-={}|[]\:";<>?,./'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == '~!@#$%^*()_+-={}|[]\:";<>?,./') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3610,18 +3607,18 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); } - else{ + else { audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback :getAudioParm: VOICE_PHONE_STATUS:Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='10000.21321432432432'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == '10000.21321432432432') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3646,18 +3643,18 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : setAudioParameter: VOICE_PHONE_STATUS : Error: ${err.message}`); expect(false).assertTrue(); } - else{ + else { audioManager.getAudioParameter('VOICE_PHONE_STATUS', (err, value) => { if (err) { console.error(`AudioFrameworkTest: Callback : getAudioParam: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='5454'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == '5454') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3687,12 +3684,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value==longValue){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == longValue) { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3721,12 +3718,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='xyza'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == 'xyza') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3744,16 +3741,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getAudioParameter_001', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '8 bit'); + const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '8 bit'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='8 bit'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == '8 bit') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3771,16 +3768,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getAudioParameter_002', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '4800'); + const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '4800'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='4800'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == '4800') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3798,16 +3795,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getAudioParameter_003', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', longValue); + const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', longValue); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value==longValue){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == longValue) { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3825,16 +3822,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getAudioParameter_004', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '10.0000000000234'); + const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '10.0000000000234'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='10.0000000000234'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == '10.0000000000234') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3843,25 +3840,25 @@ describe('audioManger_audio2', function () { done(); }) - /* * - * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_005 - * @tc.name : getAudioParameter - Promise - Parameter name Number - * @tc.desc : getAudioParameter - Promise - Parameter name Number - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('SUB_AUDIO_MANAGER_getAudioParameter_005', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', 'PPNumber'); + /* * + * @tc.number : SUB_AUDIO_MANAGER_getAudioParameter_005 + * @tc.name : getAudioParameter - Promise - Parameter name Number + * @tc.desc : getAudioParameter - Promise - Parameter name Number + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_getAudioParameter_005', 0, async function (done) { + const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', 'PPNumber'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='PPNumber'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == 'PPNumber') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3879,16 +3876,16 @@ describe('audioManger_audio2', function () { * @tc.level : Level 0 */ it('SUB_AUDIO_MANAGER_getAudioParameter_006', 0, async function (done) { - const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '[]\:";<>?,./~!@#$%^*()_+-={}|'); + const promise = audioManager.setAudioParameter('VOICE_PHONE_STATUS', '[]\:";<>?,./~!@#$%^*()_+-={}|'); promise.then(function () { console.info('AudioFrameworkTest: Audio Parameter Test: Promise : setAudioParameter'); - audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value){ - if(value=='[]\:";<>?,./~!@#$%^*()_+-={}|'){ - console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' +value); + audioManager.getAudioParameter('VOICE_PHONE_STATUS').then(function (value) { + if (value == '[]\:";<>?,./~!@#$%^*()_+-={}|') { + console.info('AudioFrameworkTest: Promise: getAudioParameter: VOICE_PHONE_STATUS : PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' +value); + else { + console.info('AudioFrameworkTest: Promise: getAudioParameter : VOICE_PHONE_STATUS : FAIL :' + value); expect(false).assertTrue(); } }); @@ -3917,12 +3914,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='16 bit'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == '16 bit') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3951,12 +3948,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='~!@#$%^*()_+-={}|[]\:";<>?,./'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == '~!@#$%^*()_+-={}|[]\:";<>?,./') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -3985,12 +3982,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='10000.21321432432432'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == '10000.21321432432432') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -4019,12 +4016,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='5454'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == '5454') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -4053,12 +4050,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value==longValue){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == longValue) { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -4087,12 +4084,12 @@ describe('audioManger_audio2', function () { console.error(`AudioFrameworkTest: Callback : getAudioParameter: VOICE_PHONE_STATUS: Error: ${err.message}`); expect(false).assertTrue(); } - else if(value=='xyza'){ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' +value); + else if (value == 'xyza') { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: PASS :' + value); expect(true).assertTrue(); } - else{ - console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' +value); + else { + console.info('AudioFrameworkTest: Callback: getAudioParameter: VOICE_PHONE_STATUS: FAIL :' + value); expect(false).assertTrue(); } done(); @@ -4100,4 +4097,125 @@ describe('audioManger_audio2', function () { done(); }); }) + + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_001 + * @tc.name : InterruptType - INTERRUPT_TYPE_BEGIN + * @tc.desc : InterruptType - INTERRUPT_TYPE_BEGIN + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_001', 0, async function (done) { + + expect(audio.InterruptType.INTERRUPT_TYPE_BEGIN).assertEqual(1); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_002 + * @tc.name : InterruptType - INTERRUPT_TYPE_END + * @tc.desc : InterruptType - INTERRUPT_TYPE_END + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_002', 0, async function (done) { + + expect(audio.InterruptType.INTERRUPT_TYPE_END).assertEqual(2); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_003 + * @tc.name : InterruptHint - INTERRUPT_HINT_NONE + * @tc.desc : InterruptHint - INTERRUPT_HINT_NONE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_003', 0, async function (done) { + + expect(audio.InterruptHint.INTERRUPT_HINT_NONE).assertEqual(0); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_004 + * @tc.name : InterruptHint - INTERRUPT_HINT_RESUME + * @tc.desc : InterruptHint - INTERRUPT_HINT_RESUME + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_004', 0, async function (done) { + + expect(audio.InterruptHint.INTERRUPT_HINT_RESUME).assertEqual(1); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_005 + * @tc.name : InterruptHint - INTERRUPT_HINT_PAUSE + * @tc.desc : InterruptHint - INTERRUPT_HINT_PAUSE + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_005', 0, async function (done) { + + expect(audio.InterruptHint.INTERRUPT_HINT_PAUSE).assertEqual(2); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_006 + * @tc.name : InterruptHint - INTERRUPT_HINT_STOP + * @tc.desc : InterruptHint - INTERRUPT_HINT_STOP + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_006', 0, async function (done) { + + expect(audio.InterruptHint.INTERRUPT_HINT_STOP).assertEqual(3); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_007 + * @tc.name : InterruptHint - INTERRUPT_HINT_DUCK + * @tc.desc : InterruptHint - INTERRUPT_HINT_DUCK + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_007', 0, async function (done) { + + expect(audio.InterruptHint.INTERRUPT_HINT_DUCK).assertEqual(4); + await sleep(50); + done(); + }) + + /* * + * @tc.number : SUB_AUDIO_MANAGER_interrupt_008 + * @tc.name : InterruptHint - INTERRUPT_HINT_UNDUCK + * @tc.desc : InterruptHint - INTERRUPT_HINT_UNDUCK + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('SUB_AUDIO_MANAGER_interrupt_008', 0, async function (done) { + + expect(audio.InterruptHint.INTERRUPT_HINT_UNDUCK).assertEqual(5); + await sleep(50); + done(); + }) + }) \ No newline at end of file diff --git a/multimedia/image/image_js_standard/Test.json b/multimedia/image/image_js_standard/Test.json index 9513562ba070d63d916c6d52d7539a38b1acb259..042701d211eb4563e5fba48c270d73d09cafd90b 100644 --- a/multimedia/image/image_js_standard/Test.json +++ b/multimedia/image/image_js_standard/Test.json @@ -1,45 +1,44 @@ { - "description": "Configuration for Image Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "480000", - "package": "ohos.acts.multimedia.image", - "shell-timeout": "120000" + "description": "Configuration for Image Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "480000", + "package": "ohos.acts.multimedia.image", + "shell-timeout": "120000" + }, + "kits": [ + { + "test-file-name": [ + "ActsImageJsTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true }, - "kits": [ - - { - "type": "ShellKit", - "run-command": [ - "mkdir /data/accounts/account_0/appdata/image", - "chmod -R 666 /data/accounts/account_0/appdata/image/*" - ], - "teardown-command":[ - - ] - }, - { - "type": "PushKit", - "pre-push": [ - ], - "push": [ - "./resource/image/test.tiff ->/data/accounts/account_0/appdata/image", - "./resource/image/test.123 ->/data/accounts/account_0/appdata/image", - "./resource/image/test.bmp ->/data/accounts/account_0/appdata/image", - "./resource/image/test.png ->/data/accounts/account_0/appdata/image", - "./resource/image/test.gif ->/data/accounts/account_0/appdata/image", - "./resource/image/test.jpg ->/data/accounts/account_0/appdata/image", - "./resource/image/test_exif.jpg ->/data/accounts/account_0/appdata/image", - "./resource/image/moving_test.gif ->/data/accounts/account_0/appdata/image" - ] - }, - { - "test-file-name": [ - "ActsImageJsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] - + { + "type": "ShellKit", + "run-command": [ + "mkdir /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":[ + + ] + }, + { + "type": "PushKit", + "pre-push": [ + ], + "push": [ + "./resource/image/test.tiff ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache", + "./resource/image/test.123 ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache", + "./resource/image/test.bmp ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache", + "./resource/image/test.png ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache", + "./resource/image/test.gif ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache", + "./resource/image/test.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache", + "./resource/image/test.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache", + "./resource/image/test_exif.jpg ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache", + "./resource/image/moving_test.gif ->/data/app/el2/100/base/ohos.acts.multimedia.image/haps/entry/cache" + ] + } + ] } diff --git a/multimedia/image/image_js_standard/src/main/js/test/image.test.js b/multimedia/image/image_js_standard/src/main/js/test/image.test.js index e3e9a2de27a9defcc4f9c4fcbbba8d2d35dbca4c..b7f82ffe5fe6dedf9ae62644871bb13dba4447bb 100644 --- a/multimedia/image/image_js_standard/src/main/js/test/image.test.js +++ b/multimedia/image/image_js_standard/src/main/js/test/image.test.js @@ -15,50 +15,65 @@ import image from '@ohos.multimedia.image' import fileio from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' -import {testPng, testJpg, tc_020buf, tc_020_1buf, tc_021buf, tc_021_1buf, tc_022buf} from './testImg' +import { tc_020buf, tc_020_1buf, tc_021buf, tc_021_1buf, tc_022buf } from './testImg' describe('Image', function () { - var pathJpg = '/data/accounts/account_0/appdata/image/test.jpg'; - var pathBmp = '/data/accounts/account_0/appdata/image/test.bmp'; - var pathGif = '/data/accounts/account_0/appdata/image/test.gif'; - var pathPng = '/data/accounts/account_0/appdata/image/test.png'; - var pathMovingGif = '/data/accounts/account_0/appdata/image/moving_test.gif'; - var pathExifJpg = '/data/accounts/account_0/appdata/image/test_exif.jpg'; - var pathTiff = '/data/accounts/account_0/appdata/image/test.tiff'; + let filePath; + let globalpixelmap; + async function getAbilityInfo(fileName) { + let context = await featureAbility.getContext(); + console.info("case0 context is " + context); + await context.getCacheDir().then((data) => { + console.info("case1 getCacheDir is path " + data); + filePath = data + '/' + fileName; + console.info('filePath is ' + filePath); + }) + } + async function releasePixelmap() { + if (globalpixelmap != undefined) { + globalpixelmap.release().then((data) => { + console.info('globalpixelmap release start' + data); + }) + .catch(error => { + console.info('globalpixelmap release fail' + error) + }) + } + } beforeAll(function () { console.info('beforeAll case'); }) beforeEach(function () { - isTimeOut = false; + filePath = ""; console.info('beforeEach case'); }) - afterEach(function () { + afterEach(async function () { + await releasePixelmap(); console.info('afterEach case'); }) afterAll(function () { console.info('afterAll case'); }) - /** - * @tc.number : TC_001 - * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer) - * @tc.desc : 1.create InitializationOptions object - * 2.set editable,pixeFormat,size - * 3.using color and opts create newPixelMap - * 4.return newpixelmap not empty - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ + * @tc.number : TC_001 + * @tc.name : create pixelmap-promise (editable: true, pixelFormat: RGBA_8888, size: { height: 4, width: 6 }, bytes = buffer) + * @tc.desc : 1.create InitializationOptions object + * 2.set editable,pixeFormat,size + * 3.using color and opts create newPixelMap + * 4.return newpixelmap not empty + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 0 + */ it('TC_001', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(Color, opts) - .then( pixelmap => { + .then(pixelmap => { expect(pixelmap != undefined).assertTrue(); console.info('TC_001 success'); done(); @@ -68,8 +83,8 @@ describe('Image', function () { expect().assertFail(); done(); }) - }) - + }) + /** * @tc.number : TC_001-1 * @tc.name : create pixelmap-callback (editable: false, pixelFormat: RGBA_8888, size: { height: 4, width: 6 },bytes = buffer) @@ -101,11 +116,11 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-2', 0, async function (done) { + it('TC_001-2', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } image.createPixelMap(Color, opts) - .then( pixelmap => { + .then(pixelmap => { expect(pixelmap != undefined).assertTrue(); console.info('TC_001-2 success'); done(); @@ -115,7 +130,7 @@ describe('Image', function () { expect().assertFail(); done(); }) - }) + }) /** * @tc.number : TC_001-3 @@ -135,7 +150,7 @@ describe('Image', function () { expect(pixelmap != undefined).assertTrue(); console.info('TC_001-3 success'); done(); - + }) }) /** @@ -149,11 +164,11 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-4', 0, async function (done) { + it('TC_001-4', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 0, size: { height: 6, width: 8 } } image.createPixelMap(Color, opts) - .then( pixelmap => { + .then(pixelmap => { expect(pixelmap != undefined).assertTrue(); console.info('TC_001-4 success'); done(); @@ -164,7 +179,7 @@ describe('Image', function () { done(); }) }) - + /** * @tc.number : TC_001-5 * @tc.name : create pixelmap-callback(editable: false, pixelFormat: unkonwn, size: { height: 6, width: 8 }) @@ -176,7 +191,7 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 0 */ - it('TC_001-5', 0, async function (done) { + it('TC_001-5', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: false, pixelFormat: 0, size: { height: 6, width: 8 } } image.createPixelMap(Color, opts, (err, pixelmap) => { @@ -199,7 +214,7 @@ describe('Image', function () { it('TC_001-6', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 6, width: 8 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { + image.createPixelMap(Color, opts, (err, pixelmap) => { expect(pixelmap != undefined).assertTrue(); console.info('TC_001-6 success'); done(); @@ -220,7 +235,7 @@ describe('Image', function () { it('TC_001-7', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 2, size: { height: 2, width: 3 } } - image.createPixelMap(Color, opts, (err, pixelmap) => { + image.createPixelMap(Color, opts, (err, pixelmap) => { expect(pixelmap != undefined).assertTrue(); console.info('TC_001-7 success'); done(); @@ -290,7 +305,7 @@ describe('Image', function () { let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts) - .then( pixelmap => { + .then(pixelmap => { if (pixelmap == undefined) { console.info('TC_020 createPixelMap failed'); expect(false).assertTrue() @@ -301,15 +316,15 @@ describe('Image', function () { var bufferArr2 = new Uint8Array(readBuffer); var res = true; for (var i = 0; i < bufferArr2.length; i++) { - if (bufferArr2[i] != tc_020buf[i]) { - res = false; - console.info('TC_20_buffer'+ bufferArr2[i]); - console.info('TC_020 failed'); - expect(false).assertTrue(); - done(); - break; - } + if (bufferArr2[i] != tc_020buf[i]) { + res = false; + console.info('TC_20_buffer' + bufferArr2[i]); + console.info('TC_020 failed'); + expect(false).assertTrue(); + done(); + break; } + } if (res) { console.info('TC_020 success'); expect(true).assertTrue() @@ -319,14 +334,14 @@ describe('Image', function () { console.log('TC_020 read error: ' + error); expect().assertFail(); done(); + }) + }).catch(error => { + console.log('TC_020 error: ' + error); + expect().assertFail(); + done(); }) - }).catch(error => { - console.log('TC_020 error: ' + error); - expect().assertFail(); - done(); - }) }) - + /** * @tc.number : TC_020-1 * @tc.name : readPixelsToBuffer-callback @@ -348,13 +363,13 @@ describe('Image', function () { let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts, (err, pixelmap) => { - if(pixelmap == undefined){ + if (pixelmap == undefined) { console.info('TC_020-1 createPixelMap failed'); expect(false).assertTrue(); done(); - }else{ + } else { const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer,() => { + pixelmap.readPixelsToBuffer(readBuffer, () => { var bufferArr = new Uint8Array(readBuffer); var res = true; for (var i = 0; i < bufferArr.length; i++) { @@ -396,14 +411,14 @@ describe('Image', function () { } let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { console.info('TC_020-2 createPixelMap failed'); expect(false).assertTrue(); done(); - }else{ + } else { const readBuffer = new ArrayBuffer(0); - pixelmap.readPixelsToBuffer(readBuffer,() => { + pixelmap.readPixelsToBuffer(readBuffer, () => { var bufferArr = new Uint8Array(readBuffer); var res = true; for (var i = 0; i < bufferArr.length; i++) { @@ -421,10 +436,10 @@ describe('Image', function () { done(); } }) - } - }) + } + }) }) - + /** * @tc.number : TC_021 * @tc.name : readPixels-promise @@ -444,13 +459,14 @@ describe('Image', function () { } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts) - .then( pixelmap => { + .then(pixelmap => { if (pixelmap == undefined) { console.info('TC_021 createPixelMap failed'); expect(false).assertTrue() done(); } - const area = { pixels: new ArrayBuffer(8), + const area = { + pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } @@ -459,7 +475,7 @@ describe('Image', function () { var bufferArr2 = new Uint8Array(area.pixels); var res = true; for (var i = 0; i < bufferArr2.length; i++) { - if (bufferArr2[i] != tc_021buf[i]) { + if (bufferArr2[i] != tc_021buf[i]) { res = false; console.info('TC_021 failed'); expect(false).assertTrue(); @@ -500,27 +516,29 @@ describe('Image', function () { } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts, (err, pixelmap) => { - if(pixelmap == undefined){ + if (pixelmap == undefined) { console.info('TC_020-1 createPixelMap failed'); expect(false).assertTrue(); done(); - }else{ - const area = { pixels: new ArrayBuffer(8), + } else { + const area = { + pixels: new ArrayBuffer(8), offset: 0, stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } pixelmap.readPixels(area, () => { var bufferArr = new Uint8Array(area.pixels); var res = true; for (var i = 0; i < bufferArr.length; i++) { console.info('TC_021-1 buffer ' + bufferArr[i]); - if(bufferArr[i] != tc_021_1buf[i]) { + if (bufferArr[i] != tc_021_1buf[i]) { res = false; console.info('TC_021-1 failed'); expect(false).assertTrue(); done(); break; - } + } } if (res) { console.info('TC_021-1 success'); @@ -550,27 +568,29 @@ describe('Image', function () { bufferArr[i] = i + 1; } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { expect(false).assertTrue(); console.info('TC_021-2 create pixelmap fail'); done(); - }else{ - const area = { pixels: new ArrayBuffer(20), + } else { + const area = { + pixels: new ArrayBuffer(20), offset: 0, stride: 8, - region: { size: { height: 1, width: 2 }, x: -1, y: -1 }} - pixelmap.readPixels(area).then(()=>{ + region: { size: { height: 1, width: 2 }, x: -1, y: -1 } + } + pixelmap.readPixels(area).then(() => { console.info('TC_021-2 failed'); expect(false).assertTrue(); done(); - }).catch(()=>{ + }).catch(() => { expect(true).assertTrue(); console.info('TC_021-2 success'); - done(); + done(); }) - } - }) + } + }) }) /** @@ -591,31 +611,34 @@ describe('Image', function () { bufferArr[i] = i + 1; } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { expect(false).assertTrue(); console.info('TC_021-3 create pixelmap failed'); - done(); - }else{ - const area = { pixels: new ArrayBuffer(0), + done(); + } else { + const area = { + pixels: new ArrayBuffer(0), offset: 0, stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area).then(()=>{ - console.info('TC_021-3 failed'); - expect(false).assertTrue(); - done(); - }).catch(()=>{ - expect(true).assertTrue(); - console.info('TC_021-3 success'); - done(); - }) - } + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelmap.readPixels(area).then(() => { + console.info('TC_021-3 failed'); + expect(false).assertTrue(); + done(); + }).catch(() => { + expect(true).assertTrue(); + console.info('TC_021-3 success'); + done(); + }) + } }) }) /** * @tc.number : TC_021-4 + * * @tc.name : readPixels-promise(offset > buffer) * @tc.desc : 1.create PixelMap * 2.call readPixels @@ -633,25 +656,27 @@ describe('Image', function () { } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts, (err, pixelmap) => { - if(pixelmap == undefined){ + if (pixelmap == undefined) { expect(false).assertTrue(); console.info('TC_021-4 createPixelMap success'); - done(); + done(); } - const area = { pixels: new ArrayBuffer(20), + const area = { + pixels: new ArrayBuffer(20), offset: 21, stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 }} - pixelmap.readPixels(area).then(()=>{ + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelmap.readPixels(area).then(() => { console.info('TC_021-4 failed'); expect(false).assertTrue(); done(); - }).catch(()=>{ + }).catch(() => { expect(true).assertTrue(); console.info('TC_021-4 success'); - done(); + done(); }) - }) + }) }) /** @@ -672,28 +697,30 @@ describe('Image', function () { bufferArr[i] = i + 1; } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { expect(false).assertTrue(); console.info('TC_021-5 createPixelMap success'); - done(); + done(); } - const area = { pixels: new ArrayBuffer(20), + const area = { + pixels: new ArrayBuffer(20), offset: 0, stride: 8, - region: { size: { height: -1, width:-1}, x: 0, y: 0 }} - pixelmap.readPixels(area).then(()=>{ + region: { size: { height: -1, width: -1 }, x: 0, y: 0 } + } + pixelmap.readPixels(area).then(() => { console.info('TC_021-5 failed'); expect(false).assertTrue(); done(); - }).catch(()=>{ + }).catch(() => { expect(true).assertTrue(); console.info('TC_021-5 success'); - done(); + done(); }) }) - }) - + }) + /** * @tc.number : TC_022 * @tc.name : writePixels-promise @@ -709,14 +736,15 @@ describe('Image', function () { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts) - .then( pixelmap => { + .then(pixelmap => { if (pixelmap == undefined) { console.info('TC_022 createPixelMap failed'); expect(false).assertTrue() done(); } - const area = { pixels: new ArrayBuffer(8), + const area = { + pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } @@ -727,7 +755,8 @@ describe('Image', function () { } pixelmap.writePixels(area).then(() => { - const readArea = { pixels: new ArrayBuffer(8), + const readArea = { + pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } @@ -742,7 +771,7 @@ describe('Image', function () { expect(false).assertTrue(); done(); break; - } + } } if (res) { console.info('TC_022 success'); @@ -779,7 +808,8 @@ describe('Image', function () { expect(false).assertTrue() done(); } - const area = { pixels: new ArrayBuffer(8), + const area = { + pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } @@ -789,12 +819,13 @@ describe('Image', function () { bufferArr[i] = i + 1; } pixelmap.writePixels(area, () => { - const readArea = { pixels: new ArrayBuffer(8), + const readArea = { + pixels: new ArrayBuffer(8), offset: 0, stride: 8, region: { size: { height: 1, width: 2 }, x: 0, y: 0 } } - pixelmap.readPixels(readArea,() => { + pixelmap.readPixels(readArea, () => { var readArr = new Uint8Array(readArea.pixels); var res = true; for (var i = 0; i < readArr.length; i++) { @@ -814,11 +845,11 @@ describe('Image', function () { }) }) }) - .catch(error => { - console.log('TC_022-1 error: ' + error); - expect().assertFail(); - done(); - }) + .catch(error => { + console.log('TC_022-1 error: ' + error); + expect().assertFail(); + done(); + }) }) /** @@ -834,9 +865,9 @@ describe('Image', function () { */ it('TC_023', 0, async function (done) { const color = new ArrayBuffer(96); - let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 }} + let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } image.createPixelMap(color, opts) - .then( pixelmap => { + .then(pixelmap => { if (pixelmap == undefined) { console.info('TC_023 createPixelMap failed'); expect(false).assertTrue() @@ -844,7 +875,7 @@ describe('Image', function () { } const writeColor = new ArrayBuffer(96); - var bufferArr = new Uint8Array(writeColor); + var bufferArr = new Uint8Array(writeColor); for (var i = 0; i < bufferArr.length; i++) { bufferArr[i] = i + 1; } @@ -895,20 +926,20 @@ describe('Image', function () { bufferArr[i] = i + 1; } let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts).then( pixelmap => { - if(pixelmap == undefined){ + image.createPixelMap(color, opts).then(pixelmap => { + if (pixelmap == undefined) { expect(false).assertTrue() console.info('TC_023-1 failed'); done(); } const writeColor = new ArrayBuffer(96); - pixelmap.writeBufferToPixels(writeColor,() => { + pixelmap.writeBufferToPixels(writeColor, () => { const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer,() => { + pixelmap.readPixelsToBuffer(readBuffer, () => { var bufferArr = new Uint8Array(readBuffer); var res = true; for (var i = 0; i < bufferArr.length; i++) { - if(res) { + if (res) { if (bufferArr[i] == 0) { res = false; console.info('TC_023-1 Success'); @@ -923,7 +954,7 @@ describe('Image', function () { expect(false).assertTrue(); done(); } - }) + }) }) }) }) @@ -943,36 +974,36 @@ describe('Image', function () { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 2, size: { height: 6, width: 8 } } image.createPixelMap(color, opts) - .then( pixelmap => { - if (pixelmap == undefined) { - console.info('TC_024 createPixelMap failed'); - expect(false).assertTrue() - done(); - } - pixelmap.getImageInfo().then( imageInfo => { - if (imageInfo == undefined) { - console.info('TC_024 imageInfo is empty'); + .then(pixelmap => { + if (pixelmap == undefined) { + console.info('TC_024 createPixelMap failed'); expect(false).assertTrue() done(); - } - if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ - console.info('TC_024 success '); - expect(true).assertTrue() + } + pixelmap.getImageInfo().then(imageInfo => { + if (imageInfo == undefined) { + console.info('TC_024 imageInfo is empty'); + expect(false).assertTrue() + done(); + } + if (imageInfo.size.height == 4 && imageInfo.size.width == 6) { + console.info('TC_024 success '); + expect(true).assertTrue() + done(); + } + done(); + }).catch(error => { + console.log('TC_024 getimageinfo error: ' + error); + expect().assertFail(); done(); - } + }) done(); - }).catch(error => { - console.log('TC_024 getimageinfo error: ' + error); + }) + .catch(error => { + console.log('TC_024 error: ' + error); expect().assertFail(); done(); }) - done(); - }) - .catch(error => { - console.log('TC_024 error: ' + error); - expect().assertFail(); - done(); - }) }) /** @@ -989,23 +1020,23 @@ describe('Image', function () { it('TC_024-1', 0, async function (done) { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { expect(false).assertTrue() console.info('TC_024-1 create pixelmap fail'); done(); } - pixelmap.getImageInfo( (err,imageInfo) => { + pixelmap.getImageInfo((err, imageInfo) => { if (imageInfo == undefined) { console.info('TC_024-1 imageInfo is empty'); expect(false).assertTrue() done(); - } - if(imageInfo.size.height == 4 && imageInfo.size.width == 6){ + } + if (imageInfo.size.height == 4 && imageInfo.size.width == 6) { console.info('TC_024-1 imageInfo success'); expect(true).assertTrue() done(); - } + } done(); }) }) @@ -1027,8 +1058,8 @@ describe('Image', function () { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } const expectNum = 4 * opts.size.width; - image.createPixelMap(color, opts, (err,pixelmap) => { - if(pixelmap == undefined){ + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { expect(false).assertTrue() console.info('TC_25-1 create pixelmap fail'); done(); @@ -1036,7 +1067,7 @@ describe('Image', function () { const num = pixelmap.getBytesNumberPerRow(); console.info('TC_025-1 num is ' + num); expect(num == expectNum).assertTrue(); - if(num == expectNum) { + if (num == expectNum) { console.info('TC_25-1 success'); } else { console.info('TC_25-1 fail'); @@ -1062,8 +1093,8 @@ describe('Image', function () { const color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } const expectNum = 4 * opts.size.width * opts.size.height; - image.createPixelMap(color, opts,(err,pixelmap) => { - if(pixelmap == undefined){ + image.createPixelMap(color, opts, (err, pixelmap) => { + if (pixelmap == undefined) { expect(false).assertTrue() console.info('TC_026-1 create pixelmap fail'); done(); @@ -1071,7 +1102,7 @@ describe('Image', function () { const num = pixelmap.getPixelBytesNumber(); console.info('TC_026-1 num is ' + num); expect(num == expectNum).assertTrue(); - if(num == expectNum) { + if (num == expectNum) { console.info('TC_026-1 success'); } else { console.info('TC_026-1 fail'); @@ -1137,12 +1168,12 @@ describe('Image', function () { expect(false).assertTrue() done(); } - pixelmap.release(()=>{ + pixelmap.release(() => { expect(true).assertTrue(); console.log('TC_027-1 success'); done(); - }) - }) + }) + }) }) /** @@ -1156,7 +1187,8 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); expect(imageSourceApi != undefined).assertTrue(); console.info('TC_041 success'); @@ -1174,7 +1206,8 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); expect(imageSourceApi != undefined).assertTrue(); console.info('TC_041-1 success'); @@ -1192,7 +1225,8 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041-2', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); expect(imageSourceApi != undefined).assertTrue(); console.info('TC_041-2 success'); @@ -1210,7 +1244,8 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_041-3', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); expect(imageSourceApi != undefined).assertTrue(); console.info('TC_041-3 success'); @@ -1262,14 +1297,15 @@ describe('Image', function () { * @tc.level : Level 0 */ it('TC_042', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_042 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo((err,imageInfo) => { + imageSourceApi.getImageInfo((err, imageInfo) => { console.info('TC_042 success'); expect(imageInfo != undefined).assertTrue(); done(); @@ -1294,51 +1330,6 @@ describe('Image', function () { done(); }) - /** - * @tc.number : TC_043 - * @tc.name : createImageSource(data) - * @tc.desc : 1.setdata - * 2.createImageSource - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_043', 0, async function (done) { - console.info('TC_043 start'); - const data = testJpg.buffer; - const imageSourceApi = image.createImageSource(data); - if (imageSourceApi == undefined) { - console.info('TC_043 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - imageSourceApi.getImageInfo((err,imageInfo) => { - console.info('TC_043 imageInfo'); - expect(imageInfo != undefined).assertTrue(); - done(); - }) - } - }) - - /** - * @tc.number : TC_043-1 - * @tc.name : createImageSource(data) buffer:0 - * @tc.desc : 1.setdata - * 2.createImageSource - * 3.return imagesource - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 0 - */ - it('TC_043-1', 0, async function (done) { - console.info('TC_043-1 start'); - const data = new ArrayBuffer(0); - const imageSourceApi = image.createImageSource(data); - expect(imageSourceApi == undefined).assertTrue(); - console.info('TC_043-1 success'); - done(); - }) /** * @tc.number : TC_044 @@ -1349,16 +1340,17 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_044', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_044 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.release().then(()=>{ + imageSourceApi.release().then(() => { console.info('TC_044 success'); expect(true).assertTrue(); done(); @@ -1379,9 +1371,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_044-1', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_044-1 create image source failed'); @@ -1405,19 +1398,20 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_045', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_045 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo((err,imageInfo) => { + imageSourceApi.getImageInfo((err, imageInfo) => { console.info('TC_045 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); expect(imageInfo != undefined).assertTrue(); done(); }) @@ -1433,20 +1427,21 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_045-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_045-1 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo((err,imageInfo) => { + imageSourceApi.getImageInfo((err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); console.info('TC_045-1 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }) } @@ -1461,20 +1456,21 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_045-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_045-2 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo((err,imageInfo) => { + imageSourceApi.getImageInfo((err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); console.info('TC_045-2 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }) } @@ -1489,21 +1485,22 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_045-3', 0, async function (done) { console.info('TC_045-3'); - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); if (imageSourceApi == undefined) { console.info('TC_045-3 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo((err,imageInfo) => { + imageSourceApi.getImageInfo((err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); console.info('TC_045-3 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }) } @@ -1518,9 +1515,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_046 create image source failed'); @@ -1530,8 +1528,8 @@ describe('Image', function () { imageSourceApi.getImageInfo(0, (err, imageInfo) => { console.info('TC_046 imageInfo'); expect(imageInfo != undefined).assertTrue(); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }) } @@ -1546,9 +1544,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_046-1 create image source failed'); @@ -1558,8 +1557,8 @@ describe('Image', function () { imageSourceApi.getImageInfo(0, (err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); console.info('TC_046-1 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }) } @@ -1574,9 +1573,10 @@ describe('Image', function () { * @tc.size : MEDIUM MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_046-2 create image source failed'); @@ -1586,8 +1586,8 @@ describe('Image', function () { imageSourceApi.getImageInfo(0, (err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); console.info('TC_046-2 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }) } @@ -1602,20 +1602,21 @@ describe('Image', function () { * @tc.size : MEDIUM MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-3', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); if (imageSourceApi == undefined) { console.info('TC_046-3 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageInfo(0,(err, imageInfo) => { + imageSourceApi.getImageInfo(0, (err, imageInfo) => { expect(imageInfo != undefined).assertTrue(); console.info('TC_046-3 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); done(); }) } @@ -1630,9 +1631,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-4', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); if (imageSourceApi == undefined) { console.info('TC_046-4 create image source failed'); @@ -1640,7 +1642,7 @@ describe('Image', function () { done(); } else { imageSourceApi.getImageInfo(1, (err, imageInfo) => { - if(imageInfo == undefined) { + if (imageInfo == undefined) { expect(true).assertTrue(); done(); } else { @@ -1660,9 +1662,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_046-5', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); if (imageSourceApi == undefined) { console.info('TC_046-5 create image source failed'); @@ -1685,9 +1688,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_047 create image source failed'); @@ -1695,17 +1699,17 @@ describe('Image', function () { done(); } else { imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { - console.log('TC_047 error: ' + error); - expect().assertFail(); - done(); - }) + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047 imageInfo'); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047 error: ' + error); + expect().assertFail(); + done(); + }) } }) @@ -1718,9 +1722,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_047-1 create image source failed'); @@ -1728,17 +1733,17 @@ describe('Image', function () { done(); } else { imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-1 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { - console.log('TC_047-1 error: ' + error); - expect().assertFail(); - done(); - }) + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047-1 imageInfo'); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047-1 error: ' + error); + expect().assertFail(); + done(); + }) } }) @@ -1751,9 +1756,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_047-2 create image source failed'); @@ -1761,17 +1767,17 @@ describe('Image', function () { done(); } else { imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-2 imageInfo'); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { - console.log('TC_047-2 error: ' + error); - expect().assertFail(); - done(); - }) + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047-2 imageInfo'); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047-2 error: ' + error); + expect().assertFail(); + done(); + }) } }) @@ -1784,9 +1790,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-3', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); if (imageSourceApi == undefined) { console.info('TC_047-3 create image source failed'); @@ -1794,17 +1801,17 @@ describe('Image', function () { done(); } else { imageSourceApi.getImageInfo(0) - .then(imageInfo => { - expect(imageInfo != undefined).assertTrue(); - console.info('TC_047-3 '); - console.info('imageInfo.size.height:'+imageInfo.size.height); - console.info('imageInfo.size.width:'+imageInfo.size.width); - done(); - }).catch(error => { - console.log('TC_047-3 error: ' + error); - expect().assertFail(); - done(); - }) + .then(imageInfo => { + expect(imageInfo != undefined).assertTrue(); + console.info('TC_047-3 '); + console.info('imageInfo.size.height:' + imageInfo.size.height); + console.info('imageInfo.size.width:' + imageInfo.size.width); + done(); + }).catch(error => { + console.log('TC_047-3 error: ' + error); + expect().assertFail(); + done(); + }) } }) @@ -1817,9 +1824,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-4', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); if (imageSourceApi == undefined) { console.info('TC_047-4 create image source failed'); @@ -1827,15 +1835,15 @@ describe('Image', function () { done(); } else { imageSourceApi.getImageInfo(1) - .then(() => { - console.log('TC_047-4 failed'); - expect().assertFail(); - done(); - }).catch(error => { - console.log('TC_047-4 success'); - expect(true).assertTrue(); - done(); - }) + .then(() => { + console.log('TC_047-4 failed'); + expect().assertFail(); + done(); + }).catch(error => { + console.log('TC_047-4 success'); + expect(true).assertTrue(); + done(); + }) } }) @@ -1848,9 +1856,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_047-5', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); if (imageSourceApi == undefined) { console.info('TC_047-5 create image source failed'); @@ -1858,18 +1867,18 @@ describe('Image', function () { done(); } else { imageSourceApi.getImageInfo(-1) - .then(() => { - console.log('TC_047-5 failed'); - expect().assertFail(); - done(); - }).catch(error => { - console.log('TC_047-5 success'); - expect(true).assertTrue(); - done(); - }) + .then(() => { + console.log('TC_047-5 failed'); + expect().assertFail(); + done(); + }).catch(error => { + console.log('TC_047-5 success'); + expect(true).assertTrue(); + done(); + }) } }) - + /** * @tc.number : TC_050 * @tc.name : createPixelMap(decodingOptions)-pixelformat:RGBA_8888-jpg @@ -1882,7 +1891,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050 create image source failed'); @@ -1890,20 +1900,21 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_050 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) - } + } }) /** * @tc.number : TC_050-1 @@ -1916,8 +1927,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-1', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + it('TC_050-1', 0, async function (done) { + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-1 create image source failed'); @@ -1925,20 +1937,21 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_050-1 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) - } + } }) /** * @tc.number : TC_050-2 @@ -1951,8 +1964,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-2', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + it('TC_050-2', 0, async function (done) { + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-2 create image source failed'); @@ -1960,20 +1974,21 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_050-2 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) - } + } }) /** * @tc.number : TC_050-3 @@ -1987,7 +2002,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-3', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-3 create image source failed'); @@ -1995,24 +2011,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index: 1 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - if(pixelmap == undefined){ + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_050-3 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -2028,7 +2045,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-4', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-4 create image source failed'); @@ -2036,23 +2054,24 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index: -1 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.error('TC_050-4 success'); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } + } }) } }) @@ -2069,7 +2088,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-5', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-5 create image source failed'); @@ -2077,24 +2097,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:-1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: -1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_050-5 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -2110,7 +2131,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-8', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-8 create image source failed'); @@ -2118,17 +2140,18 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: false, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_050-8 success'); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -2146,7 +2169,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-9', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-9 create image source failed'); @@ -2154,20 +2178,21 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:10000, height:10000}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 10000, height: 10000 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_050-9 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) - } + } }) /** @@ -2182,7 +2207,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-10', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-10 create image source failed'); @@ -2190,27 +2216,28 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_050-10 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) - + /** * @tc.number : TC_050-11 * @tc.name : createPixelMapdecodingOptions:x -1 y -1)-jpg @@ -2221,9 +2248,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_050-11', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-11 create image source failed'); @@ -2231,67 +2259,70 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_050-11 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) - /** - * @tc.number : TC_050-12 - * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-jpg - * @tc.desc : 1.create imagesource - * 2.set index and DecodeOptions - * 3.create PixelMap - * 4.callback return undefined - * @tc.size : MEDIUM - * @tc.type : Functional - * @tc.level : Level 1 - */ - it('TC_050-12', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); - const imageSourceApi = image.createImageSource(fdJpg); - if (imageSourceApi == undefined) { - console.info('TC_050-12 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, - desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, - index:0 - }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ - console.info('TC_050-12 success '); - expect(true).assertTrue(); - done(); - }else{ - expect(false).assertTrue(); - done(); - } - }) - } - }) + /** + * @tc.number : TC_050-12 + * @tc.name : createPixelMap(decodingOptions:x > image.height y > image.width)-jpg + * @tc.desc : 1.create imagesource + * 2.set index and DecodeOptions + * 3.create PixelMap + * 4.callback return undefined + * @tc.size : MEDIUM + * @tc.type : Functional + * @tc.level : Level 1 + */ + it('TC_050-12', 0, async function (done) { + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdJpg); + if (imageSourceApi == undefined) { + console.info('TC_050-12 create image source failed'); + expect(false).assertTrue(); + done(); + } else { + let decodingOptions = { + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, + desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, + index: 0 + }; + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { + console.info('TC_050-12 success '); + expect(true).assertTrue(); + done(); + } else { + expect(false).assertTrue(); + done(); + } + }) + } + }) /** * @tc.number : TC_050-14 @@ -2305,7 +2336,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_050-14', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-14 create image source failed'); @@ -2313,15 +2345,16 @@ describe('Image', function () { done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { + globalpixelmap = pixelmap; console.info('TC_050-14 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }).catch(error => { console.log('TC_050-14 error: ' + error); expect().assertFail(); done(); }) - } + } }) /** @@ -2335,8 +2368,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_050-15', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + it('TC_050-15', 0, async function (done) { + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_050-15 create image source failed'); @@ -2345,10 +2379,10 @@ describe('Image', function () { } else { imageSourceApi.createPixelMap((err, pixelmap) => { console.info('TC_050-15 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) - } + } }) /** @@ -2362,33 +2396,41 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_062', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); - if (imageSourceApi == undefined) { - console.info('TC_062 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062 create image packer failed'); + it('TC_062', 0, async function (done) { + try { + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdPng); + if (imageSourceApi == undefined) { + console.info('TC_062 create image source failed'); expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/jpeg"], quality:99 } - imagePackerApi.packing(imageSourceApi, packOpts) - .then( data => { - console.info('TC_062 success'); - expect(data != undefined).assertTrue(); - done(); - }).catch(error => { - console.log('TC_062 error: ' + error); - expect(false).assertFail(); + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062 create image packer failed'); + expect(false).assertTrue(); done(); - }) + } else { + let packOpts = { format: ["image/jpeg"], quality: 99 } + imagePackerApi.packing(imageSourceApi, packOpts) + .then(data => { + console.info('TC_062 success'); + expect(data != undefined).assertTrue(); + done(); + }).catch(error => { + console.log('TC_062 error: ' + error); + expect(false).assertFail(); + done(); + }) + } } + } catch (error) { + console.info('TC_062 error: ' + error); + expect(false).assertTrue(); + done(); } + }) /** @@ -2403,29 +2445,35 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-1', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); - if (imageSourceApi == undefined) { - console.info('TC_062-1 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-1 create image packer failed'); + try { + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdPng); + if (imageSourceApi == undefined) { + console.info('TC_062-1 create image source failed'); expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/jpeg"], quality:1 } - imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-1 success'); - expect(data != undefined).assertTrue(); + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-1 create image packer failed'); + expect(false).assertTrue(); done(); - }) + } else { + let packOpts = { format: ["image/jpeg"], quality: 1 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-1 success'); + expect(data != undefined).assertTrue(); + done(); + }) + } } + } catch (error) { + console.info('TC_062-1 error: ' + error); + expect(false).assertTrue(); + done(); } }) - /** * @tc.number : TC_062-2 * @tc.name : packing ImageSource - callback - wrong format @@ -2438,7 +2486,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_062-2 create image source failed'); @@ -2451,7 +2500,7 @@ describe('Image', function () { expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/gif"], quality:98 } + let packOpts = { format: "image/gif", quality: 98 } imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { console.info('TC_062-2 success'); expect(data == undefined).assertTrue(); @@ -2474,7 +2523,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-3', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_062-3 create image source failed'); @@ -2487,7 +2537,7 @@ describe('Image', function () { expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/jpg"], quality:101 } + let packOpts = { format: "image/jpg", quality: 101 } imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { console.info('TC_062-3 success'); expect(data == undefined).assertTrue(); @@ -2510,7 +2560,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-4', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_062-4 create image source failed'); @@ -2529,8 +2580,8 @@ describe('Image', function () { } } }) - - /** + + /** * @tc.number : TC_062-5 * @tc.name : packing ImageSource - promise - no quality * @tc.desc : 1.create ImageSource @@ -2542,7 +2593,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-5', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_062-5 create image source failed'); @@ -2555,23 +2607,23 @@ describe('Image', function () { expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/jpg"] } + let packOpts = { format: "image/jpg" } imagePackerApi.packing(imageSourceApi, packOpts) - .then( data => { - console.info('TC_062-5 failed'); - expect(data == undefined).assertTrue(); - done(); - }).catch(error => { - console.log('TC_062-5 error: ' + error); - console.log('TC_062-5 success'); - expect(true).assertTrue(); - done(); - }) + .then(data => { + console.info('TC_062-5 failed'); + expect(data == undefined).assertTrue(); + done(); + }).catch(error => { + console.log('TC_062-5 error: ' + error); + console.log('TC_062-5 success'); + expect(true).assertTrue(); + done(); + }) } } }) - - /** + + /** * @tc.number : TC_062-6 * @tc.name : packing ImageSource - promise - no format * @tc.desc : 1.create ImageSource @@ -2583,7 +2635,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-6', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_062-6 create image source failed'); @@ -2596,23 +2649,23 @@ describe('Image', function () { expect(false).assertTrue(); done(); } else { - let packOpts = { quality:50 } + let packOpts = { quality: 50 } imagePackerApi.packing(imageSourceApi, packOpts) - .then( data => { - console.info('TC_062-6 failed'); - expect(data == undefined).assertTrue(); - done(); - }).catch(error => { - console.log('TC_062-6 error: ' + error); - console.log('TC_062-6 success'); - expect(true).assertTrue(); - done(); - }) + .then(data => { + console.info('TC_062-6 failed'); + expect(data == undefined).assertTrue(); + done(); + }).catch(error => { + console.log('TC_062-6 error: ' + error); + console.log('TC_062-6 success'); + expect(true).assertTrue(); + done(); + }) } } }) - - /** + + /** * @tc.number : TC_062-7 * @tc.name : packing ImageSource - callback - quality 100 * @tc.desc : 1.create ImageSource @@ -2624,30 +2677,48 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-7', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); - if (imageSourceApi == undefined) { - console.info('TC_062-7 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-7 create image packer failed'); + try { + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdPng); + if (imageSourceApi == undefined) { + console.info('TC_062-7 create image source failed'); expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/jpeg"], quality:100 } - imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-7 success'); - expect(data != undefined).assertTrue(); + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-7 create image packer failed'); + expect(false).assertTrue(); done(); - }) + } else { + let packOpts = { format: ["image/jpeg"], quality: 100 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + if (err) { + expect(false).assertTrue(); + console.info('TC_062-7 error: ' + err); + done(); + return + } + if (data != undefined) { + console.info('TC_062-7 success'); + expect(true).assertTrue(); + done(); + } else { + except(false).assertTrue(); + console.info('TC_062-7 failed'); + done(); + } + }) + } } + } catch (error) { + console.info('TC_062-7 error: ' + error); + expect(false).assertTrue(); + done(); } }) - - /** + /** * @tc.number : TC_062-8 * @tc.name : packing ImageSource - callback - quality 0 * @tc.desc : 1.create ImageSource @@ -2659,30 +2730,36 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-8', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); - const imageSourceApi = image.createImageSource(fdPng); - if (imageSourceApi == undefined) { - console.info('TC_062-8 create image source failed'); - expect(false).assertTrue(); - done(); - } else { - const imagePackerApi = image.createImagePacker(); - if (imagePackerApi == undefined) { - console.info('TC_062-8 create image packer failed'); + try { + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdPng); + if (imageSourceApi == undefined) { + console.info('TC_062-8 create image source failed'); expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/jpeg"], quality:0 } - imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - console.info('TC_062-8 success'); - expect(data != undefined).assertTrue(); + const imagePackerApi = image.createImagePacker(); + if (imagePackerApi == undefined) { + console.info('TC_062-8 create image packer failed'); + expect(false).assertTrue(); done(); - }) + } else { + let packOpts = { format: ["image/jpeg"], quality: 0 } + imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { + console.info('TC_062-8 success'); + expect(data != undefined).assertTrue(); + done(); + }) + } } + } catch (error) { + console.info('TC_062-8 error: ' + error); + expect(false).assertTrue(); + done(); } }) - - /** + /** * @tc.number : TC_062-9 * @tc.name : packing ImageSource - callback - quality -1 * @tc.desc : 1.create ImageSource @@ -2694,7 +2771,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_062-9', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_062-9 create image source failed'); @@ -2707,7 +2785,7 @@ describe('Image', function () { expect(false).assertTrue(); done(); } else { - let packOpts = { format:["image/jpeg"], quality:-1 } + let packOpts = { format: ["image/jpeg"], quality: -1 } imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { console.info('TC_062-9 success'); expect(data == undefined).assertTrue(); @@ -2734,15 +2812,15 @@ describe('Image', function () { expect(false).assertTrue(); done(); } else { - imagePackerApi.release().then(()=>{ + imagePackerApi.release().then(() => { console.info('TC_063 success'); expect(true).assertTrue(); done(); - }).catch(()=>{ + }).catch(() => { console.log('TC_063 error: ' + error); expect(false).assertTrue(); done(); - }) + }) } }) @@ -2763,10 +2841,10 @@ describe('Image', function () { expect(false).assertTrue(); done(); } else { - imagePackerApi.release(()=>{ - console.info('TC_063-1 success'); - expect(true).assertTrue(); - done(); + imagePackerApi.release(() => { + console.info('TC_063-1 success'); + expect(true).assertTrue(); + done(); }) } }) @@ -2780,19 +2858,20 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_064', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_064 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.release().then(()=>{ + imageSourceApi.release().then(() => { console.info('TC_064 success'); expect(true).assertTrue(); - done(); + done(); }).catch(error => { console.log('TC_064 error: ' + error); expect().assertFail(); @@ -2810,9 +2889,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_064-1', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_064-1 create image source failed'); @@ -2836,19 +2916,20 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_065', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_065 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.release().then(()=>{ + imageSourceApi.release().then(() => { console.info('TC_065 success'); expect(true).assertTrue(); - done(); + done(); }).catch(error => { console.log('TC_065 error: ' + error); expect().assertFail(); @@ -2866,9 +2947,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_065-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_065-1 create image source failed'); @@ -2894,14 +2976,15 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_066', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); if (imageSourceApi == undefined) { console.info('TC_066 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.release().then(()=>{ + imageSourceApi.release().then(() => { console.info('TC_066 success'); expect(true).assertTrue(); done(); @@ -2912,7 +2995,7 @@ describe('Image', function () { }) } }) - + /** * @tc.number : TC_066-1 * @tc.name : release ImageSource - callback - gif @@ -2922,9 +3005,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_066-1', 0, async function (done) { - let fdGif = fileio.openSync(pathGif); + await getAbilityInfo('test.gif'); + let fdGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdGif); if (imageSourceApi == undefined) { console.info('TC_066-1 create image source failed'); @@ -2951,7 +3035,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_067', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067 create image source failed'); @@ -2959,17 +3044,18 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_067 createPixelMap '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -2985,8 +3071,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-1', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + it('TC_067-1', 0, async function (done) { + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-1 create image source failed'); @@ -2994,17 +3081,18 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_067-1 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -3020,8 +3108,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-2', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + it('TC_067-2', 0, async function (done) { + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-2 create image source failed'); @@ -3029,17 +3118,18 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions, (err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_067-2 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -3054,9 +3144,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-3', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-3 create image source failed'); @@ -3064,18 +3155,19 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index: 1 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_067-3 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); + expect(pixelmap != undefined).assertTrue(); + done(); }) } }) @@ -3092,7 +3184,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_067-4', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-4 create image source failed'); @@ -3100,24 +3193,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index: -1 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_067-4 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3133,7 +3227,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_067-5', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-5 create image source failed'); @@ -3141,24 +3236,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:-1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: -1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_067-5 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) /** @@ -3171,9 +3267,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-8', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-8 create image source failed'); @@ -3181,21 +3278,22 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: false, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_067-8 success'); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } - }) + }) /** * @tc.number : TC_067-9 @@ -3207,9 +3305,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-9', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-9 create image source failed'); @@ -3217,18 +3316,19 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:10000, height:10000}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 10000, height: 10000 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_067-9 success '); - expect(pixelmap != undefined ).assertTrue(); - done(); + expect(pixelmap != undefined).assertTrue(); + done(); }) } }) @@ -3243,9 +3343,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-10', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info(' TC_067-10 create image source failed'); @@ -3253,24 +3354,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_067-10 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3284,9 +3386,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-11', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-11 create image source failed'); @@ -3294,26 +3397,27 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_067-11 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_067-12 @@ -3325,9 +3429,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_067-12', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-12 create image source failed'); @@ -3335,26 +3440,27 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_067-12 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_067-14 * @tc.name : createPixelMap-promise-gif @@ -3366,8 +3472,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_067-14', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + it('TC_067-14', 0, async function (done) { + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-14 create image source failed'); @@ -3375,8 +3482,9 @@ describe('Image', function () { done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { + globalpixelmap = pixelmap; console.info('TC_067-14 success '); - expect(pixelmap !== undefined ).assertTrue(); + expect(pixelmap !== undefined).assertTrue(); done(); }).catch(error => { console.log('TC_067-14 error: ' + error); @@ -3398,7 +3506,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_067-15', 0, async function (done) { - let fdMovingGif = fileio.openSync(pathMovingGif); + await getAbilityInfo('moving_test.gif'); + let fdMovingGif = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdMovingGif); if (imageSourceApi == undefined) { console.info('TC_067-15 create image source failed'); @@ -3407,7 +3516,7 @@ describe('Image', function () { } else { imageSourceApi.createPixelMap((err, pixelmap) => { console.info('TC_067-15 success '); - expect(pixelmap !== undefined ).assertTrue(); + expect(pixelmap !== undefined).assertTrue(); done(); }) } @@ -3426,7 +3535,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_068', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068 create image source failed'); @@ -3434,17 +3544,18 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_068 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -3460,8 +3571,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-1', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + it('TC_068-1', 0, async function (done) { + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-1 create image source failed'); @@ -3469,17 +3581,18 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_068-1 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -3495,8 +3608,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_068-2', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + it('TC_068-2', 0, async function (done) { + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-2 create image source failed'); @@ -3504,17 +3618,18 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_068-2 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -3531,7 +3646,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_068-3', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-3 create image source failed'); @@ -3539,24 +3655,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index: 1 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_068-3 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3570,9 +3687,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-4', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-4 create image source failed'); @@ -3580,24 +3698,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index: -1 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_068-4 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -3611,9 +3730,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-5', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-5 create image source failed'); @@ -3621,26 +3741,27 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:-1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: -1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_068-5 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_068-8 * @tc.name : createPixelMap(decodingOptions:editable false})-bmp @@ -3651,9 +3772,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-8', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-8 create image source failed'); @@ -3661,21 +3783,22 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: false, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_068-8 success'); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } - }) + }) /** * @tc.number : TC_068-9 @@ -3687,9 +3810,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-9', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-9 create image source failed'); @@ -3697,21 +3821,22 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:10000, height:10000}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 10000, height: 10000 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_068-9 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } - }) + }) /** * @tc.number : TC_068-10 @@ -3723,9 +3848,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-10', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info(' TC_068-10 create image source failed'); @@ -3733,26 +3859,27 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_068-10 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_068-11 @@ -3764,9 +3891,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-11', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-11 create image source failed'); @@ -3774,26 +3902,27 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_068-11 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_068-12 @@ -3805,9 +3934,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_068-12', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-12 create image source failed'); @@ -3815,24 +3945,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_068-12 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) /** @@ -3847,7 +3978,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_068-14', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-14 create image source failed'); @@ -3855,8 +3987,9 @@ describe('Image', function () { done(); } else { imageSourceApi.createPixelMap().then(pixelmap => { + globalpixelmap = pixelmap; console.info('TC_068-14 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }).catch(error => { console.log('TC_068-14 error: ' + error); @@ -3878,7 +4011,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_068-15', 0, async function (done) { - let fdBmp = fileio.openSync(pathBmp); + await getAbilityInfo('test.bmp'); + let fdBmp = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdBmp); if (imageSourceApi == undefined) { console.info('TC_068-15 create image source failed'); @@ -3887,7 +4021,7 @@ describe('Image', function () { } else { imageSourceApi.createPixelMap((err, pixelmap) => { console.info('TC_068-15 success '); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -3904,25 +4038,27 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_163 success'); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -3938,26 +4074,28 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-1', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + it('TC_163-1', 0, async function (done) { + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-1 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_163-1 success'); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -3973,26 +4111,28 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_163-2', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + it('TC_163-2', 0, async function (done) { + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-2 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_163-2 success'); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -4009,7 +4149,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163-3', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-3 create image source failed'); @@ -4017,24 +4158,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:1 + index: 1 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_163-3 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -4051,7 +4193,8 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163-4', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-4 create image source failed'); @@ -4059,24 +4202,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:-1 + index: -1 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_163-4 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -4091,9 +4235,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-5', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-5 create image source failed'); @@ -4101,24 +4246,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:-1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:0, + sampleSize: -1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 0, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_163-5 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) /** @@ -4132,9 +4278,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-8', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-8 create image source failed'); @@ -4142,22 +4289,23 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: false, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: false, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_163-8 success'); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } }) - + /** * @tc.number : TC_163-10 * @tc.name : createPixelMap(decodingOptions:desiredRegion>imagesize)-png @@ -4169,9 +4317,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-10', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info(' TC_163-10 create image source failed'); @@ -4179,26 +4328,27 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 10000, width: 10000 }, x: 0, y: 0 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_163-10 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } - }) + }) /** * @tc.number : TC_163-11 @@ -4211,9 +4361,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-11', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-11 create image source failed'); @@ -4221,24 +4372,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: -1, y: -1 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_163-11 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) @@ -4253,9 +4405,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 1 - */ + */ it('TC_163-12', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-12 create image source failed'); @@ -4263,24 +4416,25 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:2, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 2, desiredRegion: { size: { height: 1, width: 2 }, x: 10000, y: 10000 }, - index:0 + index: 0 }; - imageSourceApi.createPixelMap(decodingOptions,(err,pixelmap) => { - if(pixelmap == undefined){ + imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; + if (pixelmap == undefined) { console.info('TC_163-12 success '); expect(true).assertTrue(); done(); - }else{ + } else { expect(false).assertTrue(); done(); - } - }) + } + }) } }) /** @@ -4295,16 +4449,18 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163-14', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-14 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { imageSourceApi.createPixelMap().then(pixelmap => { + globalpixelmap = pixelmap; console.info('TC_163-14 success'); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }).catch(error => { console.log('TC_163-14 error: ' + error); @@ -4326,16 +4482,17 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_163-15', 0, async function (done) { - let fdPng = fileio.openSync(pathPng); + await getAbilityInfo('test.png'); + let fdPng = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdPng); if (imageSourceApi == undefined) { console.info('TC_163-15 create image source failed'); expect(false).assertTrue(); done(); - } else { + } else { imageSourceApi.createPixelMap((err, pixelmap) => { console.info('TC_163-15 success'); - expect(pixelmap != undefined ).assertTrue(); + expect(pixelmap != undefined).assertTrue(); done(); }) } @@ -4348,9 +4505,10 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 - */ + */ it('TC_164', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_164 create image source failed'); @@ -4358,7 +4516,7 @@ describe('Image', function () { done(); } else { expect(imageSourceApi.supportedFormats != undefined).assertTrue(); - console.info(imageSourceApi.supportedFormats); + console.info(imageSourceApi.supportedFormats); console.info('TC_164 success '); done(); } @@ -4372,7 +4530,7 @@ describe('Image', function () { * @tc.size : MEDIUM * @tc.type : Functional * @tc.level : Level 0 - */ + */ it('TC_166', 0, async function (done) { const imagePackerApi = image.createImagePacker(); if (imagePackerApi == undefined) { @@ -4381,7 +4539,7 @@ describe('Image', function () { done(); } else { expect(imagePackerApi.supportedFormats != undefined).assertTrue(); - console.info(imagePackerApi.supportedFormats); + console.info(imagePackerApi.supportedFormats); console.info('TC_166 success '); done(); } @@ -4399,23 +4557,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_167', 0, async function (done) { - let fdTiff = fileio.openSync(pathTiff); + await getAbilityInfo('test.tiff'); + let fdTiff = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdTiff); let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:10, - desiredPixelFormat:3, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 10, + desiredPixelFormat: 3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { + globalpixelmap = pixelmap; console.info('TC_167 success '); - expect(pixelmap == undefined ).assertTrue(); + expect(pixelmap == undefined).assertTrue(); done(); }) - }) + }) /** * @tc.number : TC_168 @@ -4430,17 +4590,17 @@ describe('Image', function () { it('TC_168', 0, async function (done) { const Color = new ArrayBuffer(96); let opts = { editable: true, pixelFormat: 3, size: { height: 4, width: 6 } } - image.createPixelMap(Color, opts, (error,pixelmap) => { - if(pixelmap == undefined){ + image.createPixelMap(Color, opts, (error, pixelmap) => { + if (pixelmap == undefined) { console.info('TC_168 create pixelmap failed'); expect(false).assertTrue(); - done(); - }else { + done(); + } else { expect(pixelmap.isEditable == true).assertTrue(); console.info('TC_168 success '); done(); } - }) + }) }) /** @@ -4454,8 +4614,9 @@ describe('Image', function () { * @tc.type : Functional * @tc.level : Level 1 */ - it('TC_169', 0, async function (done) { - let fdJpg = fileio.openSync(pathJpg); + it('TC_169', 0, async function (done) { + await getAbilityInfo('test.jpg'); + let fdJpg = fileio.openSync(filePath); const imageSourceApi = image.createImageSource(fdJpg); if (imageSourceApi == undefined) { console.info('TC_169 create image source failed'); @@ -4463,22 +4624,23 @@ describe('Image', function () { done(); } else { let decodingOptions = { - sampleSize:1, - editable: true, - desiredSize:{ width:1, height:2}, - rotate:90, - desiredPixelFormat:3, + sampleSize: 1, + editable: true, + desiredSize: { width: 1, height: 2 }, + rotate: 90, + desiredPixelFormat: 3, desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, - index:0 + index: 0 }; imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - pixelmap.getImageInfo( (err,imageInfo) => { + globalpixelmap = pixelmap; + pixelmap.getImageInfo((err, imageInfo) => { if (imageInfo != undefined) { console.info('TC_169 success'); expect(imageInfo.size.height == 2).assertTrue(); expect(imageInfo.size.width == 1).assertTrue(); done(); - }else { + } else { console.info('TC_169 imageInfo is empty'); expect(false).assertTrue() done(); @@ -4499,24 +4661,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_171 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("BitsPerSample") - .then(data => { - console.info('TC_171 BitsPerSample ' + data); - expect(data != undefined).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171 BitsPerSample ' + data); + expect(data != undefined).assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -4532,24 +4695,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-1', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_171-1 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("Orientation") - .then(data => { - console.info('TC_171-1 Orientation ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-1 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-1 Orientation ' + data); + expect(data != undefined && data != '').assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-1 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -4565,24 +4729,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-2', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_171-2 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageLength") - .then(data => { - console.info('TC_171-2 ImageLength ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-2 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-2 ImageLength ' + data); + expect(data != undefined && data != '').assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-2 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -4598,24 +4763,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-3', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_171-3 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("ImageWidth") - .then(data => { - console.info('TC_171-3 ImageWidth ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-3 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-3 ImageWidth ' + data); + expect(data != undefined && data != '').assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-3 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -4631,24 +4797,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-4', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_171-4 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitude") - .then(data => { - console.info('TC_171-4 GPSLatitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-4 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-4 GPSLatitude ' + data); + expect(data != undefined && data != '').assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-4 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -4664,24 +4831,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-5', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_171-5 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitude") - .then(data => { - console.info('TC_171-5 GPSLongitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-5 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-5 GPSLongitude ' + data); + expect(data != undefined && data != '').assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-5 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -4697,24 +4865,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-6', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_171-6 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLatitudeRef") - .then(data => { - console.info('TC_171-6 GPSLatitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-6 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-6 GPSLatitudeRef ' + data); + expect(data != undefined && data != '').assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-6 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -4730,24 +4899,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-7', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_171-7 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("GPSLongitudeRef") - .then(data => { - console.info('TC_171-7 GPSLongitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-7 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-7 GPSLongitudeRef ' + data); + expect(data != undefined && data != '').assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-7 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -4763,24 +4933,25 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_171-8', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_171-8 create image source failed'); expect(false).assertTrue(); done(); } else { imageSourceApi.getImageProperty("DateTimeOriginal") - .then(data => { - console.info('TC_171-8 DateTimeOriginal ' + data); - expect(data != undefined && data != '' ).assertTrue(); - done(); - }) - .catch(error => { - console.log('TC_171-8 error: ' + error); - expect(false).assertFail(); - done(); - }) + .then(data => { + console.info('TC_171-8 DateTimeOriginal ' + data); + expect(data != undefined && data != '').assertTrue(); + done(); + }) + .catch(error => { + console.log('TC_171-8 error: ' + error); + expect(false).assertFail(); + done(); + }) } }) @@ -4795,19 +4966,20 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_172 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageProperty("BitsPerSample",(error,data) => { - if (error){ + imageSourceApi.getImageProperty("BitsPerSample", (error, data) => { + if (error) { console.info('TC_172 getImageProperty BitsPerSample error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_172 BitsPerSample ' + data); expect(data != undefined).assertTrue(); done(); @@ -4827,19 +4999,20 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-1', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_172-1 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageProperty("Orientation",(error,data) => { - if (error){ + imageSourceApi.getImageProperty("Orientation", (error, data) => { + if (error) { console.info('TC_172-1 getImageProperty Orientation error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_172-1 Orientation ' + data); expect(data != undefined && data != '').assertTrue(); done(); @@ -4859,21 +5032,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-2', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_172-2 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageProperty("ImageLength",(error,data) => { - if (error){ + imageSourceApi.getImageProperty("ImageLength", (error, data) => { + if (error) { console.info('TC_172-2 getImageProperty ImageLength error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_172-2 ImageLength ' + data); - expect(data != undefined && data != '' ).assertTrue(); + expect(data != undefined && data != '').assertTrue(); done(); } }) @@ -4891,21 +5065,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-3', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_172-3 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageProperty("ImageWidth",(error,data) => { - if (error){ + imageSourceApi.getImageProperty("ImageWidth", (error, data) => { + if (error) { console.info('TC_172-3 getImageProperty ImageWidth error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_172-3 ImageWidth ' + data); - expect(data != undefined && data != '' ).assertTrue(); + expect(data != undefined && data != '').assertTrue(); done(); } }) @@ -4923,21 +5098,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-4', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_172-4 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageProperty("GPSLatitude",(error,data) => { - if (error){ + imageSourceApi.getImageProperty("GPSLatitude", (error, data) => { + if (error) { console.info('TC_172-4 getImageProperty GPSLatitude error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_172-4 GPSLatitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); + expect(data != undefined && data != '').assertTrue(); done(); } }) @@ -4955,21 +5131,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-5', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_172-5 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageProperty("GPSLongitude",(error,data) => { - if (error){ + imageSourceApi.getImageProperty("GPSLongitude", (error, data) => { + if (error) { console.info('TC_172-5 getImageProperty GPSLongitude error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_172-5 GPSLongitude ' + data); - expect(data != undefined && data != '' ).assertTrue(); + expect(data != undefined && data != '').assertTrue(); done(); } }) @@ -4987,21 +5164,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-6', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_172-6 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageProperty("GPSLatitudeRef",(error,data) => { - if (error){ + imageSourceApi.getImageProperty("GPSLatitudeRef", (error, data) => { + if (error) { console.info('TC_172-6 getImageProperty GPSLatitudeRef error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_172-6 GPSLatitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); + expect(data != undefined && data != '').assertTrue(); done(); } }) @@ -5019,21 +5197,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-7', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_172-7 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageProperty("GPSLongitudeRef",(error,data) => { - if (error){ + imageSourceApi.getImageProperty("GPSLongitudeRef", (error, data) => { + if (error) { console.info('TC_172-7 getImageProperty GPSLongitudeRef error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_172-7 GPSLongitudeRef ' + data); - expect(data != undefined && data != '' ).assertTrue(); + expect(data != undefined && data != '').assertTrue(); done(); } }) @@ -5051,21 +5230,22 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_172-8', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_172-8 create image source failed'); expect(false).assertTrue(); done(); } else { - imageSourceApi.getImageProperty("DateTimeOriginal",(error,data) => { - if (error){ + imageSourceApi.getImageProperty("DateTimeOriginal", (error, data) => { + if (error) { console.info('TC_172-8 getImageProperty DateTimeOriginal error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_172-8 DateTimeOriginal ' + data); - expect(data != undefined && data != '' ).assertTrue(); + expect(data != undefined && data != '').assertTrue(); done(); } }) @@ -5084,20 +5264,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_173 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("BitsPerSample",property,(error,data) => { - if (error){ + let property = { index: 0, defaultValue: '9999' } + imageSourceApi.getImageProperty("BitsPerSample", property, (error, data) => { + if (error) { console.info('TC_173 getImageProperty BitsPerSample error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_173 BitsPerSample ' + data); expect(data != '9999' && data != undefined).assertTrue(); done(); @@ -5118,20 +5299,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-1', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_173-1 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("Orientation",property,(error,data) => { - if (error){ + let property = { index: 0, defaultValue: '9999' } + imageSourceApi.getImageProperty("Orientation", property, (error, data) => { + if (error) { console.info('TC_173-1 getImageProperty Orientation error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_173-1 Orientation ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); @@ -5152,20 +5334,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-2', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_173-2 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("ImageLength",property,(error,data) => { - if (error){ + let property = { index: 0, defaultValue: '9999' } + imageSourceApi.getImageProperty("ImageLength", property, (error, data) => { + if (error) { console.info('TC_173-2 getImageProperty ImageLength error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_173-2 ImageLength ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); @@ -5186,20 +5369,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-3', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_173-3 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("ImageWidth",property,(error,data) => { - if (error){ + let property = { index: 0, defaultValue: '9999' } + imageSourceApi.getImageProperty("ImageWidth", property, (error, data) => { + if (error) { console.info('TC_173-3 getImageProperty ImageWidth error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_173-3 ImageWidth ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); @@ -5220,20 +5404,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-4', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_173-4 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("GPSLatitude",property,(error,data) => { - if (error){ + let property = { index: 0, defaultValue: '9999' } + imageSourceApi.getImageProperty("GPSLatitude", property, (error, data) => { + if (error) { console.info('TC_173-4 getImageProperty GPSLatitude error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_173-4 GPSLatitude ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); @@ -5254,20 +5439,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-5', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_173-5 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("GPSLongitude",property,(error,data) => { - if (error){ + let property = { index: 0, defaultValue: '9999' } + imageSourceApi.getImageProperty("GPSLongitude", property, (error, data) => { + if (error) { console.info('TC_173-5 getImageProperty GPSLongitude error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_173-5 GPSLongitude ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); @@ -5288,20 +5474,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-6', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_173-6 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("GPSLatitudeRef",property,(error,data) => { - if (error){ + let property = { index: 0, defaultValue: '9999' } + imageSourceApi.getImageProperty("GPSLatitudeRef", property, (error, data) => { + if (error) { console.info('TC_173-6 getImageProperty GPSLatitudeRef error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_173-6 GPSLatitudeRef ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); @@ -5322,20 +5509,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-7', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_173-7 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("GPSLongitudeRef",property,(error,data) => { - if (error){ + let property = { index: 0, defaultValue: '9999' } + imageSourceApi.getImageProperty("GPSLongitudeRef", property, (error, data) => { + if (error) { console.info('TC_173-7 getImageProperty GPSLongitudeRef error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_173-7 GPSLongitudeRef ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done(); @@ -5356,20 +5544,21 @@ describe('Image', function () { * @tc.level : Level 1 */ it('TC_173-8', 0, async function (done) { - let fdExifJpg = fileio.openSync(pathExifJpg); - const imageSourceApi = image.createImageSource( fdExifJpg); + await getAbilityInfo('test_exif.jpg'); + let fdExifJpg = fileio.openSync(filePath); + const imageSourceApi = image.createImageSource(fdExifJpg); if (imageSourceApi == undefined) { console.info('TC_173-8 create image source failed'); expect(false).assertTrue(); done(); } else { - let property = {index:0,defaultValue:'9999'} - imageSourceApi.getImageProperty("DateTimeOriginal",property,(error,data) => { - if (error){ + let property = { index: 0, defaultValue: '9999' } + imageSourceApi.getImageProperty("DateTimeOriginal", property, (error, data) => { + if (error) { console.info('TC_173-8 getImageProperty DateTimeOriginal error'); expect(false).assertTrue(); done(); - }else{ + } else { console.info('TC_173-8 DateTimeOriginal ' + data); expect(data != '9999' && data != undefined && data != '').assertTrue(); done();