From 1f9009b838858e5165529d4bc59d97f00d64652a Mon Sep 17 00:00:00 2001 From: 15829070344 Date: Thu, 10 Nov 2022 19:53:48 +0800 Subject: [PATCH] =?UTF-8?q?fixed=2061d9081=20from=20https://gitee.com/murp?= =?UTF-8?q?hy1984/acts/pulls/6464=20=E3=80=90=E4=B8=BB=E9=A2=98=E3=80=91?= =?UTF-8?q?=E9=94=81=E5=B1=8F=E6=9C=8D=E5=8A=A1=E9=81=97=E7=95=99=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 15829070344 Change-Id: Icb3e4824f2f7c73ecff5412fe0a32cd86a14da2f --- .../main/ets/test/screenLockPromiseTest.ets | 30 +++++++++++++ .../src/main/ets/test/screenLockTest.ets | 43 +++++++++++++++++-- 2 files changed, 69 insertions(+), 4 deletions(-) diff --git a/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets b/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets index 6b3297e67..ad6c49af3 100755 --- a/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets +++ b/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets @@ -101,5 +101,35 @@ export default function ScreenLockPromiseTest(){ done(); } }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_Promise_004 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_Promise_004", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_Promise_004-------------------"); + try { + screenLock.unlockScreen().then((data) => { + let currentResult = screenLock.isLocked() + expect(currentResult).assertEqual(false) + console.info("====>SUB_MISC_THEME_screenLock_API_Promise_004 success."); + console.info('====>-------------SUB_MISC_THEME_screenLock_API_Promise_004 end----------------------'); + done(); + }).catch( err => { + console.info("====>SUB_MISC_THEME_screenLock_API_Promise_004 failed because: " + JSON.stringify(err)); + expect().assertFail(); + done(); + }); + } catch (error) { + console.info("====>SUB_MISC_THEME_screenLock_API_Promise_004: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end SUB_MISC_THEME_screenLock_API_Promise_004-------------------"); + done(); + }); }) } diff --git a/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets b/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets index bf83b9aa1..c4f6a9db7 100755 --- a/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets +++ b/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets @@ -36,7 +36,7 @@ export default function screenLockJSUnit() { * @tc.level 0 */ it('SUB_MISC_THEME_screenLock_API_0012', 0, async function (done) { - console.info('====>-------------SUB_MISC_THEME_screenLock_API_0012 start----------------------'); + console.info('====>-------------SUB_MISC_THEME_screenLock_API_0012 start----------------------'); try{ screenLock.unlock((err, data) => { try{ @@ -177,15 +177,50 @@ export default function screenLockJSUnit() { console.info("====>logMessage SUB_MISC_THEME_screenLock_API_0003 throw_err = " + err); expect().assertFail(); done(); - } - + } }); } catch (err) { console.info("====>logMessage SUB_MISC_THEME_screenLock_API_0003: err = " + err); expect().assertFail(); done(); + } + }); + + /* + * @tc.number SUB_MISC_THEME_screenLock_API_0004 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Test ScreenLock API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it("SUB_MISC_THEME_screenLock_API_0004", 0, async function (done) { + console.info("------------------start SUB_MISC_THEME_screenLock_API_0004-------------------"); + try { + screenLock.unlockScreen((err) => { + console.info("SUB_MISC_THEME_screenLock_API_0004: send unlockScreen issue success"); + try{ + if (err) { + console.info("====>SUB_MISC_THEME_screenLock_API_0004 failed because: " + JSON.stringify(err)); + expect().assertFail(); + done(); + } + let currentResult = screenLock.isLocked() + expect(currentResult).assertEqual(false) + console.info("====>SUB_MISC_THEME_screenLock_API_0004 success."); + console.info('====>-------------SUB_MISC_THEME_screenLock_API_0004 end----------------------'); + done(); + }catch(err){ + console.info('====>SUB_MISC_THEME_screenLock_API_0004 throw_err : ' + JSON.stringify(err)); + expect().assertFail(); + done(); + } + }); + } catch (error) { + console.info("SUB_MISC_THEME_screenLock_API_0004: error = " + error); + expect().assertFail(); + done(); } - }); /* -- GitLab