From d01a18fb66e8c96bf8488f9b5903d0610cc06028 Mon Sep 17 00:00:00 2001 From: mahaifeng Date: Wed, 20 Nov 2024 11:28:55 +0800 Subject: [PATCH] =?UTF-8?q?[audio]=E6=B7=BB=E5=8A=A0audio=20asset=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../create-inner-audio-context.test.js | 13 ++++++++++++- .../create-inner-audio-context.uvue | 6 ++++++ .../get-file-system-manager.test.js | 18 ++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/pages/API/create-inner-audio-context/create-inner-audio-context.test.js b/pages/API/create-inner-audio-context/create-inner-audio-context.test.js index e465c28f..36e47f0c 100644 --- a/pages/API/create-inner-audio-context/create-inner-audio-context.test.js +++ b/pages/API/create-inner-audio-context/create-inner-audio-context.test.js @@ -75,5 +75,16 @@ describe('inner-audio', () => { await page.waitFor(3000); // expect(await page.data('isPlayEnd')).toBeTruthy(); }); - + it('onEnded-android', async () => { + if (!process.env.uniTestPlatformInfo.startsWith('android')) { + expect(1).toBe(1) + return + } + await page.setData({ + isPlayEnd: false + }) + await page.callMethod('setSrc','/static/uni-autoTest/alert2s.mp3') + await page.waitFor(3000); + expect(await page.data('isPlayEnd')).toBeTruthy(); + }); }); diff --git a/pages/API/create-inner-audio-context/create-inner-audio-context.uvue b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue index ac523f47..d1894fa4 100644 --- a/pages/API/create-inner-audio-context/create-inner-audio-context.uvue +++ b/pages/API/create-inner-audio-context/create-inner-audio-context.uvue @@ -280,6 +280,12 @@ this._audioContext!.playbackRate = parseFloat(e.detail.value) // } }, + //just for test + setSrc(src:string){ + if( this._audioContext!=null){ + this._audioContext!.src = src + } + } } } diff --git a/pages/API/get-file-system-manager/get-file-system-manager.test.js b/pages/API/get-file-system-manager/get-file-system-manager.test.js index 9b2ef897..b0f23a6a 100644 --- a/pages/API/get-file-system-manager/get-file-system-manager.test.js +++ b/pages/API/get-file-system-manager/get-file-system-manager.test.js @@ -1483,4 +1483,22 @@ describe('ExtApi-FileManagerTest', () => { let arrayBufferRes = await getData("arrayBufferRes") expect(arrayBufferRes).toEqual(1.2222222) }); + + it('testReadAssetFile', async () => { + if (!isAndroid()) { + return + } + + await page.setData({ + basePath: '/static/uni-app-x/version.json', + logAble: false, + readFileRet: "", + readFile: '/version.json' + }) + let btnReadFileButton = await page.$('#btn-read-file-sync') + await btnReadFileButton.tap() + await isDone() + let readFileRet = await getData('readFileRet') + expect(readFileRet.length>0).toBe(true) + }); }); -- GitLab