Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
ac1f9212
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看板
未验证
提交
ac1f9212
编写于
11月 04, 2022
作者:
O
openharmony_ci
提交者:
Gitee
11月 04, 2022
浏览文件
操作
浏览文件
下载
差异文件
!6383 【openharmony 3.2.8.3sp2】master分支电源服务子系统问题用例整改
Merge pull request !6383 from logic42/master
上级
e874b731
bef331e1
变更
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
浏览文件 @
ac1f9212
...
...
@@ -11,8 +11,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
*/
import
brightness
from
'
@system.brightness
'
;
import
{
describe
,
it
,
expect
}
from
'
@ohos/hypium
'
;
...
...
@@ -20,44 +19,25 @@ const INPUT_ERROR_CODE_CODE = 202;
const
SET_VALUE_MSG
=
"
value is not an available number
"
;
const
SET_MODE_MSG
=
"
value is not an available number
"
;
export
default
function
SystemDisplayTest
()
{
describe
(
'
SystemDisplayTest
'
,
function
()
{
console
.
log
(
"
*************System SystemDisplay Unit Test Begin*************
"
);
export
default
async
function
SystemDisplayTest
()
{
describe
(
'
SystemDisplayTest
'
,
async
function
()
{
console
.
log
(
"
System SystemDisplay Unit Test Begin
"
);
/**
* @tc.number system_display_js_0100
* @tc.name get_value_success
* @tc.desc Get brightness success
*/
it
(
'
get_value_success
'
,
0
,
function
(
)
{
it
(
'
get_value_success
'
,
0
,
async
function
(
done
)
{
let
currValue
=
100
;
let
setValue
=
120
;
brightness
.
getValue
({
success
:
(
data
)
=>
{
currValue
=
data
.
value
;
let
value
=
(
data
.
value
>
0
)
&&
(
data
.
value
<=
255
);
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
});
});
/**
...
...
@@ -65,14 +45,16 @@ describe('SystemDisplayTest', function () {
* @tc.name get_value_success_not_must_test
* @tc.desc Get brightness
*/
it
(
'
get_status_test_success_not_must
'
,
0
,
function
(
)
{
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
();
}
});
})
...
...
@@ -82,10 +64,11 @@ describe('SystemDisplayTest', function () {
* @tc.name get_value_fail_not_must_test
* @tc.desc Get brightness
*/
it
(
'
get_value_fail_not_must_test
'
,
0
,
function
(
)
{
it
(
'
get_value_fail_not_must_test
'
,
0
,
async
function
(
done
)
{
brightness
.
getValue
({
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
});
...
...
@@ -95,9 +78,10 @@ describe('SystemDisplayTest', function () {
* @tc.name get_value_null_test
* @tc.desc Get brightness
*/
it
(
'
get_status_test_fail_not_must
'
,
0
,
function
(
)
{
it
(
'
get_status_test_fail_not_must
'
,
0
,
async
function
(
done
)
{
brightness
.
getValue
();
expect
(
true
).
assertTrue
();
done
();
})
/**
...
...
@@ -105,7 +89,7 @@ describe('SystemDisplayTest', function () {
* @tc.name set_value_success_all
* @tc.desc Set brightness success
*/
it
(
'
set_value_success_all
'
,
0
,
function
(
)
{
it
(
'
set_value_success_all
'
,
0
,
async
function
(
done
)
{
let
setValue
=
200
;
let
currValue
=
100
;
brightness
.
getValue
({
...
...
@@ -120,21 +104,25 @@ describe('SystemDisplayTest', function () {
brightness
.
getValue
({
success
:
(
data
)
=>
{
expect
(
data
.
value
===
setValue
).
assertTrue
();
brightness
.
setValue
({
value
:
currValue
,
success
:
function
()
{
done
();
},
});
}
});
},
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
:
currValue
});
});
/**
...
...
@@ -142,31 +130,35 @@ describe('SystemDisplayTest', function () {
* @tc.name set_value_success_value
* @tc.desc Set brightness success
*/
it
(
'
set_value_success_value
'
,
0
,
function
()
{
let
setValue
=
50
;
let
currValue
=
100
;
brightness
.
getValue
({
success
:
(
data
)
=>
{
currValue
=
data
.
value
;
}
});
it
(
'
set_value_success_value
'
,
0
,
async
function
(
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
.
setValue
({
value
:
50
,
success
:
function
()
{
setTimeout
(()
=>
{
brightness
.
getValue
({
success
:
(
data
)
=>
{
console
.
log
(
"
set_value_success_value, brightness:
"
+
data
.
value
);
expect
(
data
.
value
===
setValue
).
assertTrue
();
expect
(
data
.
value
===
50
).
assertTrue
();
done
();
}
});
brightness
.
setValue
({
value
:
currValue
});
},
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
();
},
});
});
/**
...
...
@@ -174,18 +166,20 @@ describe('SystemDisplayTest', function () {
* @tc.name set_value_fail
* @tc.desc Set brightness fail
*/
it
(
'
set_value_fail
'
,
0
,
function
(
)
{
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
===
NPUT_ERROR
_CODE
).
assertTrue
();
expect
(
code
===
INPUT_ERROR_CODE
_CODE
).
assertTrue
();
expect
(
data
===
SET_VALUE_MSG
).
assertTrue
();
done
();
}
});
});
...
...
@@ -195,39 +189,14 @@ describe('SystemDisplayTest', function () {
* @tc.name get_mode_success
* @tc.desc Get mode success
*/
it
(
'
get_mode_success
'
,
0
,
function
()
{
let
modeVal
=
0
;
let
exec
=
true
;
it
(
'
get_mode_success
'
,
0
,
async
function
(
done
)
{
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
"
);
expect
(
data
.
mode
===
0
||
data
.
mode
===
1
).
assertTrue
();
done
();
}
});
brightness
.
setMode
({
mode
:
modeVal
});
})
/**
...
...
@@ -235,14 +204,16 @@ describe('SystemDisplayTest', function () {
* @tc.name get_mode_success_null
* @tc.desc Get mode success is null
*/
it
(
'
get_mode_success_null
'
,
0
,
function
(
)
{
it
(
'
get_mode_success_null
'
,
0
,
async
function
(
done
)
{
brightness
.
getMode
({
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
get_mode_success_null, data:
"
+
data
+
"
, code:
"
+
code
);
expect
().
assertFail
();
done
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
});
...
...
@@ -252,31 +223,24 @@ describe('SystemDisplayTest', function () {
* @tc.name set_mode_success
* @tc.desc set mode success
*/
it
(
'
set_mode_success
'
,
0
,
function
()
{
let
modeVal
=
0
;
brightness
.
getMode
({
success
:
(
data
)
=>
{
modeVal
=
data
.
mode
;
}
});
it
(
'
set_mode_success
'
,
0
,
async
function
(
done
)
{
brightness
.
setMode
({
mode
:
modeVal
?
0
:
1
,
mode
:
0
,
success
:
()
=>
{
console
.
log
(
"
set_mode_success success
"
);
brightness
.
getMode
({
success
:
(
data
)
=>
{
console
.
log
(
"
set_mode_success, data:
"
+
data
.
mode
);
expect
(
data
.
mode
===
(
modeVal
?
0
:
1
)).
assertTrue
();
expect
(
data
.
mode
===
0
).
assertTrue
();
done
();
}
});
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
brightness
.
setMode
({
mode
:
modeVal
});
});
/**
...
...
@@ -284,19 +248,22 @@ describe('SystemDisplayTest', function () {
* @tc.name set_mode_fail
* @tc.desc set mode fail
*/
it
(
'
set_mode_fail
'
,
0
,
function
(
)
{
it
(
'
set_mode_fail
'
,
0
,
async
function
(
done
)
{
brightness
.
setMode
({
mode
:
"
0
"
,
success
:
()
=>
{
expect
().
assertFail
();
done
();
},
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
();
}
});
});
...
...
@@ -306,18 +273,21 @@ describe('SystemDisplayTest', function () {
* @tc.name set_keep_screen_on_true
* @tc.desc set keep screen on true
*/
it
(
'
set_keep_screen_on_true
'
,
0
,
async
function
(
)
{
it
(
'
set_keep_screen_on_true
'
,
0
,
async
function
(
done
)
{
brightness
.
setKeepScreenOn
({
keepScreenOn
:
true
,
success
:
()
=>
{
expect
().
assertTrue
();
expect
(
true
).
assertTrue
();
done
();
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
set_keep_screen_on, data:
"
+
data
+
"
, code:
"
+
code
);
expect
().
assertFail
();
done
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
});
...
...
@@ -327,20 +297,23 @@ describe('SystemDisplayTest', function () {
* @tc.name set_keep_screen_on_false
* @tc.desc set keep screen on false
*/
it
(
'
set_keep_screen_on_false
'
,
0
,
async
function
(
)
{
it
(
'
set_keep_screen_on_false
'
,
0
,
async
function
(
done
)
{
brightness
.
setKeepScreenOn
({
keepScreenOn
:
false
,
success
:
()
=>
{
expect
().
assertTrue
();
expect
(
true
).
assertTrue
();
done
();
},
fail
:
(
data
,
code
)
=>
{
console
.
log
(
"
set_keep_screen_on_false, data:
"
+
data
+
"
, code:
"
+
code
);
expect
().
assertFail
();
done
();
},
complete
:
()
=>
{
console
.
log
(
"
The device information is obtained successfully. Procedure
"
);
done
();
}
});
});
})
})
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录