From 373bce5925e5800c0529f9d20954c9704dd479ee Mon Sep 17 00:00:00 2001 From: yangziyong Date: Wed, 24 May 2023 17:29:22 +0800 Subject: [PATCH] fix: accpet undefined input Signed-off-by: yangziyong --- .../src/main/js/test/system_display.test.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/powermgr/display_manager/src/main/js/test/system_display.test.js b/powermgr/display_manager/src/main/js/test/system_display.test.js index c387d48b0..52d0d72ca 100644 --- a/powermgr/display_manager/src/main/js/test/system_display.test.js +++ b/powermgr/display_manager/src/main/js/test/system_display.test.js @@ -142,6 +142,31 @@ export default async function SystemDisplayTest() { }); }); + /** + * @tc.number system_display_js_0203 + * @tc.name set_value_success_value + * @tc.desc Check undefined as input of setValue + */ + it('set_value_success_value', 0, async function (done) { + brightness.setKeepScreenOn({ + keepScreenOn: true, + success: function () { + console.log('undefined: original:handling set keep screen on success.'); + let value = brightness.getValue(); + brightness.setValue(undefined); + expect(value == brightness.getValue()).assertTrue(); + done(); + }, + fail: function (data, code) { + console.error('undefined: original:handling set keep screen on fail, code:' + code + ', data: ' + data); + done(); + }, + complete: function () { + console.error('undefined: original:handling set keep screen on complete.'); + } + }); + }); + /** * @tc.number system_display_js_0300 * @tc.name get_mode_success -- GitLab