From 4a7e13a05b07ea574e5180cac64ed2958fd75695 Mon Sep 17 00:00:00 2001 From: bayanxing Date: Mon, 20 Mar 2023 10:09:39 +0800 Subject: [PATCH] =?UTF-8?q?avRecorder=E5=A4=9A=E5=9C=BA=E6=99=AF=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E7=94=A8=E4=BE=8B=20codecheck?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: bayanxing --- .../media_js_standard/AVRecorderTestBase.js | 18 ++++++++++++++++++ .../main/js/test/AVRecorderFuncTest.test.js | 18 +++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/multimedia/media/media_js_standard/AVRecorderTestBase.js b/multimedia/media/media_js_standard/AVRecorderTestBase.js index 0afaf395c..cea7d9f23 100644 --- a/multimedia/media/media_js_standard/AVRecorderTestBase.js +++ b/multimedia/media/media_js_standard/AVRecorderTestBase.js @@ -387,5 +387,23 @@ export async function avRecorderReliabilitTest03(avConfig, avRecorder, recorderT await avRecorder.prepare(avConfig) } +export async function avRecorderReliabilitTest04(avConfig, avRecorder, recorderTime, done) { + avRecorder = await idle(avRecorder); + + await avRecorder.prepare(avConfig).then(() => { + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.PREPARED); + console.info('avRecorderReliabilitTest04 prepare success'); + }).catch((err) => { + console.info('avRecorderReliabilitTest04 prepare failed and catch error is ' + err.message); + }); + await avRecorder.release().then(() => { + console.info('avRecorderReliabilitTest04 release AVRecorder success'); + expect(avRecorder.state).assertEqual(AV_RECORDER_STATE.RELEASED); + done(); + }).catch((err) => { + console.info('avRecorderReliabilitTest04 release AVRecorder failed and catch error is ' + err.message); + }); +} + diff --git a/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js b/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js index 3b56e132d..9505293cf 100644 --- a/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js +++ b/multimedia/media/media_js_standard/avRecorder/src/main/js/test/AVRecorderFuncTest.test.js @@ -17,7 +17,6 @@ import media from '@ohos.multimedia.media' import * as mediaTestBase from '../../../../../MediaTestBase.js'; import * as avRecorderTestBase from '../../../../../AVRecorderTestBase.js'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'; -import { UiDriver, BY, PointerMatrix } from '@ohos.uitest' export default function avRecorderTest() { describe('avRecorderTest', function () { @@ -154,6 +153,23 @@ export default function avRecorderTest() { avRecorderTestBase.avRecorderReliabilitTest03(avConfig, avRecorder, RECORDER_TIME, done); console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0300 end') }) + + /* * + * @tc.number : SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400 + * @tc.name : 001.test resume->prepare + * @tc.desc : Local audio resume->prepare + * @tc.size : MediumTest + * @tc.type : Function test + * @tc.level : Level2 + */ + it('SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400', 0, async function (done) { + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400 start') + fdObject = await mediaTestBase.getAvRecorderFd(AV_SOURCES[4], "audio"); + fdPath = "fd://" + fdObject.fdNumber; + avConfig.url = fdPath; + avRecorderTestBase.avRecorderReliabilitTest03(avConfig, avRecorder, RECORDER_TIME, done); + console.info(TAG + 'SUB_MULTIMEDIA_MEDIA_AVRECORDER_PREPARE_API_0400 end') + }) }) } -- GitLab