Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
bef331e1
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
bef331e1
编写于
11月 04, 2022
作者:
L
logic42
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
change power testcase
Signed-off-by:
N
logic42
<
wanglong108@huawei.com
>
上级
8cec131e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
276 addition
and
303 deletion
+276
-303
powermgr/display_manager/src/main/js/test/system_display.test.js
...r/display_manager/src/main/js/test/system_display.test.js
+276
-303
未找到文件。
powermgr/display_manager/src/main/js/test/system_display.test.js
浏览文件 @
bef331e1
...
@@ -3,16 +3,15 @@
...
@@ -3,16 +3,15 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
*
*
*
http://www.apache.org/licenses/LICENSE-2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* See the License for the specific language governing permissions and
* limitations under the License.
* limitations under the License.
*/
*/
import
brightness
from
'
@system.brightness
'
;
import
brightness
from
'
@system.brightness
'
;
import
{
describe
,
it
,
expect
}
from
'
@ohos/hypium
'
;
import
{
describe
,
it
,
expect
}
from
'
@ohos/hypium
'
;
...
@@ -20,327 +19,301 @@ const INPUT_ERROR_CODE_CODE = 202;
...
@@ -20,327 +19,301 @@ const INPUT_ERROR_CODE_CODE = 202;
const
SET_VALUE_MSG
=
"
value is not an available number
"
;
const
SET_VALUE_MSG
=
"
value is not an available number
"
;
const
SET_MODE_MSG
=
"
value is not an available number
"
;
const
SET_MODE_MSG
=
"
value is not an available number
"
;
export
default
function
SystemDisplayTest
()
{
export
default
async
function
SystemDisplayTest
()
{
describe
(
'
SystemDisplayTest
'
,
function
()
{
describe
(
'
SystemDisplayTest
'
,
async
function
()
{
console
.
log
(
"
*************System SystemDisplay Unit Test Begin*************
"
);
console
.
log
(
"
System SystemDisplay Unit Test Begin
"
);
/**
/**
* @tc.number system_display_js_0100
* @tc.number system_display_js_0100
* @tc.name get_value_success
* @tc.name get_value_success
* @tc.desc Get brightness success
* @tc.desc Get brightness success
*/
*/
it
(
'
get_value_success
'
,
0
,
function
()
{
it
(
'
get_value_success
'
,
0
,
async
function
(
done
)
{
let
currValue
=
100
;
let
currValue
=
100
;
let
setValue
=
120
;
brightness
.
getValue
({
brightness
.
getValue
({
success
:
(
data
)
=>
{
success
:
(
data
)
=>
{
currValue
=
data
.
value
;
currValue
=
data
.
value
;
let
value
=
(
data
.
value
>
0
)
&&
(
data
.
value
<=
255
);
let
value
=
(
data
.
value
>
0
)
&&
(
data
.
value
<=
255
);
expect
(
value
).
assertTrue
();
expect
(
value
).
assertTrue
();
done
();
}
}
});
});
brightness
.
setValue
({
value
:
setValue
});
brightness
.
getValue
({
success
:
(
data
)
=>
{
expect
(
setValue
===
data
.
value
).
assertTrue
();
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
get_value_success, data:
"
+
data
+
"
, code:
"
+
code
);
expect
().
assertFail
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
}
});
});
brightness
.
setValue
({
/**
value
:
currValue
* @tc.number system_display_js_0101
});
* @tc.name get_value_success_not_must_test
});
* @tc.desc Get brightness
*/
it
(
'
get_status_test_success_not_must
'
,
0
,
async
function
(
done
)
{
brightness
.
getValue
({
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
get_status_test_success_not_must, data:
"
+
data
+
"
, code:
"
+
code
);
expect
().
assertFail
();
done
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
})
/**
/**
* @tc.number system_display_js_0101
* @tc.number system_display_js_0102
* @tc.name get_value_success_not_must_test
* @tc.name get_value_fail_not_must_test
* @tc.desc Get brightness
* @tc.desc Get brightness
*/
*/
it
(
'
get_status_test_success_not_must
'
,
0
,
function
()
{
it
(
'
get_value_fail_not_must_test
'
,
0
,
async
function
(
done
)
{
brightness
.
getValue
({
brightness
.
getValue
({
fail
:
(
data
,
code
)
=>
{
complete
:
()
=>
{
console
.
log
(
"
get_status_test_success_not_must, data:
"
+
data
+
"
, code:
"
+
code
);
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
expect
().
assertFail
();
done
();
},
}
complete
:
()
=>
{
});
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
}
});
});
})
/**
/**
* @tc.number system_display_js_0102
* @tc.number system_display_js_0103
* @tc.name get_value_fail_not_must_test
* @tc.name get_value_null_test
* @tc.desc Get brightness
* @tc.desc Get brightness
*/
*/
it
(
'
get_value_fail_not_must_test
'
,
0
,
function
()
{
it
(
'
get_status_test_fail_not_must
'
,
0
,
async
function
(
done
)
{
brightness
.
getValue
({
brightness
.
getValue
();
complete
:
()
=>
{
expect
(
true
).
assertTrue
();
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
})
});
});
/**
/**
* @tc.number system_display_js_0103
* @tc.number system_display_js_0200
* @tc.name get_value_null_test
* @tc.name set_value_success_all
* @tc.desc Get brightness
* @tc.desc Set brightness success
*/
*/
it
(
'
get_status_test_fail_not_must
'
,
0
,
function
()
{
it
(
'
set_value_success_all
'
,
0
,
async
function
(
done
)
{
brightness
.
getValue
();
let
setValue
=
200
;
expect
(
true
).
assertTrue
();
let
currValue
=
100
;
})
brightness
.
getValue
({
success
:
(
data
)
=>
{
currValue
=
data
.
value
;
}
});
/**
brightness
.
setValue
({
* @tc.number system_display_js_0200
value
:
setValue
,
* @tc.name set_value_success_all
success
:
()
=>
{
* @tc.desc Set brightness success
brightness
.
getValue
({
*/
success
:
(
data
)
=>
{
it
(
'
set_value_success_all
'
,
0
,
function
()
{
expect
(
data
.
value
===
setValue
).
assertTrue
();
let
setValue
=
200
;
brightness
.
setValue
({
let
currValue
=
100
;
value
:
currValue
,
brightness
.
getValue
({
success
:
function
()
{
success
:
(
data
)
=>
{
done
();
currValue
=
data
.
value
;
},
}
});
}
});
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
set_value_success_all, data:
"
+
data
+
"
, code:
"
+
code
);
expect
().
assertFail
();
done
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
});
});
brightness
.
setValue
({
/**
value
:
setValue
,
* @tc.number system_display_js_0201
success
:
()
=>
{
* @tc.name set_value_success_value
brightness
.
getValue
({
* @tc.desc Set brightness success
success
:
(
data
)
=>
{
*/
expect
(
data
.
value
===
setValue
).
assertTrue
();
it
(
'
set_value_success_value
'
,
0
,
async
function
(
done
)
{
}
brightness
.
setKeepScreenOn
({
});
keepScreenOn
:
true
,
},
success
:
function
()
{
fail
:
(
data
,
code
)
=>
{
console
.
log
(
'
handling set keep screen on success.
'
);
console
.
log
(
"
set_value_success_all, data:
"
+
data
+
"
, code:
"
+
code
);
brightness
.
setValue
({
expect
().
assertFail
();
value
:
50
,
},
success
:
function
()
{
complete
:
()
=>
{
setTimeout
(()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
brightness
.
getValue
({
}
success
:
(
data
)
=>
{
console
.
log
(
"
set_value_success_value, brightness:
"
+
data
.
value
);
expect
(
data
.
value
===
50
).
assertTrue
();
done
();
}
});
},
1000
);
},
});
},
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
handling set keep screen on fail, code:
'
+
code
+
'
, data:
'
+
data
);
done
();
},
complete
:
function
()
{
console
.
error
(
'
handling set keep screen on complete.
'
);
done
();
},
});
});
});
brightness
.
setValue
({
/**
value
:
currValue
* @tc.number system_display_js_0202
* @tc.name set_value_fail
* @tc.desc Set brightness fail
*/
it
(
'
set_value_fail
'
,
0
,
async
function
(
done
)
{
let
setValue
=
"
50
"
;
brightness
.
setValue
({
value
:
setValue
,
success
:
()
=>
{
console
.
log
(
"
set_value_fail success
"
);
expect
().
assertFail
();
done
();
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
set_value_fail, data:
"
+
data
+
"
, code:
"
+
code
);
expect
(
code
===
INPUT_ERROR_CODE_CODE
).
assertTrue
();
expect
(
data
===
SET_VALUE_MSG
).
assertTrue
();
done
();
}
});
});
});
});
/**
/**
* @tc.number system_display_js_0201
* @tc.number system_display_js_0300
* @tc.name set_value_success_value
* @tc.name get_mode_success
* @tc.desc Set brightness success
* @tc.desc Get mode success
*/
*/
it
(
'
set_value_success_value
'
,
0
,
function
()
{
it
(
'
get_mode_success
'
,
0
,
async
function
(
done
)
{
let
setValue
=
50
;
brightness
.
getMode
({
let
currValue
=
100
;
success
:
(
data
)
=>
{
brightness
.
getValue
({
console
.
log
(
"
get_mode_success: get mode:
"
+
data
.
mode
);
success
:
(
data
)
=>
{
expect
(
data
.
mode
===
0
||
data
.
mode
===
1
).
assertTrue
();
currValue
=
data
.
value
;
done
();
}
}
});
});
brightness
.
setKeepScreenOn
({
keepScreenOn
:
true
,
success
:
function
()
{
console
.
log
(
'
handling set keep screen on success.
'
);
brightness
.
setValue
({
value
:
setValue
});
},
fail
:
function
(
data
,
code
)
{
console
.
error
(
'
handling set keep screen on fail, code:
'
+
code
+
'
, data:
'
+
data
);
}
});
brightness
.
getValue
({
success
:
(
data
)
=>
{
console
.
log
(
"
set_value_success_value, brightness:
"
+
data
.
value
);
expect
(
data
.
value
===
setValue
).
assertTrue
();
}
});
brightness
.
setValue
({
value
:
currValue
});
});
/**
* @tc.number system_display_js_0202
* @tc.name set_value_fail
* @tc.desc Set brightness fail
*/
it
(
'
set_value_fail
'
,
0
,
function
()
{
let
setValue
=
"
50
"
;
brightness
.
setValue
({
value
:
setValue
,
success
:
()
=>
{
console
.
log
(
"
set_value_fail success
"
);
expect
().
assertFail
();
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
set_value_fail, data:
"
+
data
+
"
, code:
"
+
code
);
expect
(
code
===
NPUT_ERROR_CODE
).
assertTrue
();
expect
(
data
===
SET_VALUE_MSG
).
assertTrue
();
}
});
});
/**
* @tc.number system_display_js_0300
* @tc.name get_mode_success
* @tc.desc Get mode success
*/
it
(
'
get_mode_success
'
,
0
,
function
()
{
let
modeVal
=
0
;
let
exec
=
true
;
brightness
.
getMode
({
success
:
(
data
)
=>
{
console
.
log
(
"
get_mode_success: get mode:
"
+
data
.
mode
);
modeVal
=
data
.
mode
;
}
});
brightness
.
setMode
({
mode
:
modeVal
?
0
:
1
,
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
get_mode_success, data:
"
+
data
+
"
, code:
"
+
code
);
exec
=
false
;
}
})
})
if
(
!
exec
)
{
return
;
}
brightness
.
getMode
({
success
:
(
data
)
=>
{
expect
(
data
.
mode
===
(
modeVal
?
0
:
1
)).
assertTrue
();
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
get_mode_success, data:
"
+
data
+
"
, code:
"
+
code
);
expect
().
assertFail
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
}
});
brightness
.
setMode
({
mode
:
modeVal
});
/**
})
* @tc.number system_display_js_0301
* @tc.name get_mode_success_null
/**
* @tc.desc Get mode success is null
* @tc.number system_display_js_0301
*/
* @tc.name get_mode_success_null
it
(
'
get_mode_success_null
'
,
0
,
async
function
(
done
)
{
* @tc.desc Get mode success is null
brightness
.
getMode
({
*/
fail
:
(
data
,
code
)
=>
{
it
(
'
get_mode_success_null
'
,
0
,
function
()
{
console
.
log
(
"
get_mode_success_null, data:
"
+
data
+
"
, code:
"
+
code
);
brightness
.
getMode
({
expect
().
assertFail
();
fail
:
(
data
,
code
)
=>
{
done
();
console
.
log
(
"
get_mode_success_null, data:
"
+
data
+
"
, code:
"
+
code
);
},
expect
().
assertFail
();
complete
:
()
=>
{
},
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
complete
:
()
=>
{
done
();
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
}
}
}
);
});
});
});
/**
/**
* @tc.number system_display_js_0400
* @tc.number system_display_js_0400
* @tc.name set_mode_success
* @tc.name set_mode_success
* @tc.desc set mode success
* @tc.desc set mode success
*/
*/
it
(
'
set_mode_success
'
,
0
,
function
()
{
it
(
'
set_mode_success
'
,
0
,
async
function
(
done
)
{
let
modeVal
=
0
;
brightness
.
setMode
({
brightness
.
getMode
({
mode
:
0
,
success
:
(
data
)
=>
{
success
:
()
=>
{
modeVal
=
data
.
mode
;
console
.
log
(
"
set_mode_success success
"
);
}
brightness
.
getMode
({
success
:
(
data
)
=>
{
console
.
log
(
"
set_mode_success, data:
"
+
data
.
mode
);
expect
(
data
.
mode
===
0
).
assertTrue
();
done
();
}
});
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
});
});
brightness
.
setMode
({
/**
mode
:
modeVal
?
0
:
1
,
* @tc.number system_display_js_0401
success
:
()
=>
{
* @tc.name set_mode_fail
console
.
log
(
"
set_mode_success success
"
);
* @tc.desc set mode fail
brightness
.
getMode
({
*/
success
:
(
data
)
=>
{
it
(
'
set_mode_fail
'
,
0
,
async
function
(
done
)
{
console
.
log
(
"
set_mode_success, data:
"
+
data
.
mode
);
brightness
.
setMode
({
expect
(
data
.
mode
===
(
modeVal
?
0
:
1
)).
assertTrue
();
mode
:
"
0
"
,
}
success
:
()
=>
{
});
expect
().
assertFail
();
},
done
();
complete
:
()
=>
{
},
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
fail
:
(
data
,
code
)
=>
{
}
console
.
log
(
"
set_mode_fail, data:
"
+
data
+
"
, code:
"
+
code
);
expect
(
code
===
INPUT_ERROR_CODE_CODE
).
assertTrue
();
expect
(
data
===
SET_MODE_MSG
).
assertTrue
();
done
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
});
});
brightness
.
setMode
({
mode
:
modeVal
});
/**
});
* @tc.number system_display_js_0500
* @tc.name set_keep_screen_on_true
/**
* @tc.desc set keep screen on true
* @tc.number system_display_js_0401
*/
* @tc.name set_mode_fail
it
(
'
set_keep_screen_on_true
'
,
0
,
async
function
(
done
)
{
* @tc.desc set mode fail
brightness
.
setKeepScreenOn
({
*/
keepScreenOn
:
true
,
it
(
'
set_mode_fail
'
,
0
,
function
()
{
success
:
()
=>
{
brightness
.
setMode
({
expect
(
true
).
assertTrue
();
mode
:
"
0
"
,
done
();
success
:
()
=>
{
},
expect
().
assertFail
();
fail
:
(
data
,
code
)
=>
{
},
console
.
log
(
"
set_keep_screen_on, data:
"
+
data
+
"
, code:
"
+
code
);
fail
:
(
data
,
code
)
=>
{
expect
().
assertFail
();
console
.
log
(
"
set_mode_fail, data:
"
+
data
+
"
, code:
"
+
code
);
done
(
);
expect
(
code
===
INPUT_ERROR_CODE_CODE
).
assertTrue
();
},
expect
(
data
===
SET_MODE_MSG
).
assertTrue
();
complete
:
()
=>
{
},
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
complete
:
()
=>
{
done
();
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
}
}
}
);
});
});
});
/**
/**
* @tc.number system_display_js_0500
* @tc.number system_display_js_0501
* @tc.name set_keep_screen_on_true
* @tc.name set_keep_screen_on_false
* @tc.desc set keep screen on true
* @tc.desc set keep screen on false
*/
*/
it
(
'
set_keep_screen_on_true
'
,
0
,
async
function
()
{
it
(
'
set_keep_screen_on_false
'
,
0
,
async
function
(
done
)
{
brightness
.
setKeepScreenOn
({
brightness
.
setKeepScreenOn
({
keepScreenOn
:
true
,
keepScreenOn
:
false
,
success
:
()
=>
{
success
:
()
=>
{
expect
().
assertTrue
();
expect
(
true
).
assertTrue
();
},
done
();
fail
:
(
data
,
code
)
=>
{
},
console
.
log
(
"
set_keep_screen_on, data:
"
+
data
+
"
, code:
"
+
code
);
fail
:
(
data
,
code
)
=>
{
expect
().
assertFail
();
console
.
log
(
"
set_keep_screen_on_false, data:
"
+
data
+
"
, code:
"
+
code
);
},
expect
().
assertFail
();
complete
:
()
=>
{
done
();
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
},
}
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
});
});
});
})
/**
* @tc.number system_display_js_0501
* @tc.name set_keep_screen_on_false
* @tc.desc set keep screen on false
*/
it
(
'
set_keep_screen_on_false
'
,
0
,
async
function
()
{
brightness
.
setKeepScreenOn
({
keepScreenOn
:
false
,
success
:
()
=>
{
expect
().
assertTrue
();
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
set_keep_screen_on_false, data:
"
+
data
+
"
, code:
"
+
code
);
expect
().
assertFail
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
}
});
});
})
}
}
\ No newline at end of file
鸿蒙社区
@harmonycommunity
mentioned in commit
bdc5f022
·
11月 07, 2022
mentioned in commit
bdc5f022
mentioned in commit bdc5f02208c4b84ee70bb4dd9a59fd94eb28f968
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录