Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
b4f09263
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
b4f09263
编写于
10月 21, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 21, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5976 test: 新增变更接口用例合入monthly221018
Merge pull request !5976 from zhengpengyue/monthly_20221018
上级
247a3993
51659826
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
377 addition
and
38 deletion
+377
-38
powermgr/power_manager/src/main/js/test/power_manager_power.test.js
...ower_manager/src/main/js/test/power_manager_power.test.js
+181
-38
powermgr/power_manager/src/main/js/test/power_manager_running_lock.test.js
...nager/src/main/js/test/power_manager_running_lock.test.js
+114
-0
powermgr/thermal_manager/src/main/js/test/thermal_unittest.test.js
...thermal_manager/src/main/js/test/thermal_unittest.test.js
+82
-0
未找到文件。
powermgr/power_manager/src/main/js/test/power_manager_power.test.js
浏览文件 @
b4f09263
...
...
@@ -134,44 +134,6 @@ describe('PowerManagerPowerTest', function () {
},
2000
);
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0050
* @tc.name Power_Get_PowerMode_Callback_JSTest0050
* @tc.desc Get The mode the device
*/
it
(
'
Power_Get_PowerMode_Callback_JSTest0050
'
,
0
,
async
function
(
done
)
{
power
.
getPowerMode
()
.
then
(
powerMode
=>
{
console
.
info
(
'
Power_Get_PowerMode_Callback_JSTest0050 power mode is
'
+
powerMode
);
expect
(
powerMode
>=
600
&&
powerMode
<=
603
).
assertTrue
();
done
();
})
.
catch
(
error
=>
{
console
.
log
(
'
Power_Get_PowerMode_Callback_JSTest0050 error:
'
+
error
);
expect
().
assertFail
();
done
();
})
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0060
* @tc.name Power_Get_PowerMode_Promise_JSTest0060
* @tc.desc Get The mode the device
*/
it
(
'
Power_Get_PowerMode_Promise_JSTest0060
'
,
0
,
async
function
(
done
)
{
power
.
getPowerMode
((
error
,
powerMode
)
=>
{
if
(
typeof
error
===
"
undefined
"
)
{
console
.
info
(
'
Power_Get_PowerMode_Promise_JSTest0060 power mode is
'
+
powerMode
);
expect
(
powerMode
>=
600
&&
powerMode
<=
603
).
assertTrue
();
done
();
}
else
{
console
.
log
(
'
Power_Get_PowerMode_Promise_JSTest0060:
'
+
error
);
expect
().
assertFail
();
done
();
}
})
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0070
* @tc.name Power_Device_Power_Mode_MODENORMAL_JSTest0070
...
...
@@ -215,5 +177,186 @@ describe('PowerManagerPowerTest', function () {
console
.
info
(
'
MODE_EXTREME_POWER_SAVE =
'
+
devicePowerMode
);
expect
(
devicePowerMode
===
603
).
assertTrue
();
})
// New interface
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0110
* @tc.name Power_Get_Set_Mode_Promise_JSTest0110
* @tc.desc Gets and sets the power mode
*/
it
(
'
Power_Get_Set_Mode_Promise_JSTest0110
'
,
0
,
async
function
(
done
)
{
let
currentMode
=
power
.
getPowerMode
();
console
.
info
(
'
Power_Get_Set_Mode_Promise_JSTest0110 currentMode:
'
+
currentMode
);
expect
(
currentMode
>=
power
.
DevicePowerMode
.
MODE_NORMAL
&&
currentMode
<=
power
.
DevicePowerMode
.
MODE_EXTREME_POWER_SAVE
).
assertTrue
();
try
{
let
isExec
=
false
;
power
.
setPowerMode
(
power
.
DevicePowerMode
.
MODE_POWER_SAVE
)
.
then
((
error
)
=>
{
isExec
=
true
;
console
.
info
(
'
Power_Get_Set_Mode_Promise_JSTest0110 error:
'
+
(
typeof
error
));
expect
(
typeof
error
===
"
undefined
"
).
assertTrue
();
let
mode
=
power
.
getPowerMode
();
console
.
info
(
'
Power_Get_Set_Mode_Promise_JSTest0110 mode:
'
+
mode
);
expect
(
mode
===
power
.
DevicePowerMode
.
MODE_POWER_SAVE
).
assertTrue
();
}).
finally
(()
=>
{
expect
(
isExec
).
assertTrue
();
})
}
catch
(
e
)
{
console
.
info
(
'
Power_Get_Set_Mode_Promise_JSTest0110 error:
'
+
e
);
expect
().
assertFail
();
}
power
.
setPowerMode
(
currentMode
);
done
();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0120
* @tc.name Power_Get_Set_Mode_Promise_Invalid_JSTest0120
* @tc.desc Set the wrong power mode
*/
it
(
'
Power_Get_Set_Mode_Promise_Invalid_JSTest0120
'
,
0
,
async
function
(
done
)
{
try
{
// invalid mode
power
.
setPowerMode
(
''
).
then
(()
=>
{
console
.
info
(
'
Power_Get_Set_Mode_Promise_Invalid_JSTest0120 string failed
'
);
expect
().
assertFail
();
})
}
catch
(
e
)
{
console
.
info
(
'
Power_Get_Set_Mode_Promise_Invalid_JSTest0120 code:
'
+
e
.
code
+
'
msg:
'
+
e
.
message
);
// 401: Invalid input parameter
expect
(
e
.
code
===
401
).
assertTrue
();
}
try
{
// Number of invalid parameters
power
.
setPowerMode
(
''
,
''
,
0
).
then
(()
=>
{
console
.
info
(
'
Power_Get_Set_Mode_Promise_Invalid_JSTest0120 number failed
'
);
expect
().
assertFail
();
})
}
catch
(
e
)
{
console
.
info
(
'
Power_Get_Set_Mode_Promise_Invalid_JSTest0120 code:
'
+
e
.
code
+
'
msg:
'
+
e
.
message
);
// 401: Invalid input parameter
expect
(
e
.
code
===
401
).
assertTrue
();
}
done
();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0130
* @tc.name Power_Get_Set_Mode_Callback_JSTest0130
* @tc.desc Gets and sets the power mode
*/
it
(
'
Power_Get_Set_Mode_Callback_JSTest0130
'
,
0
,
async
function
(
done
)
{
let
currentMode
=
power
.
getPowerMode
();
console
.
info
(
'
Power_Get_Set_Mode_Callback_JSTest0130 currentMode:
'
+
currentMode
);
expect
(
currentMode
>=
power
.
DevicePowerMode
.
MODE_NORMAL
&&
currentMode
<=
power
.
DevicePowerMode
.
MODE_EXTREME_POWER_SAVE
).
assertTrue
();
try
{
power
.
setPowerMode
(
power
.
DevicePowerMode
.
MODE_PERFORMANCE
,
(
error
)
=>
{
console
.
info
(
'
Power_Get_Set_Mode_Callback_JSTest0130 error:
'
+
(
typeof
error
));
expect
(
typeof
error
===
"
undefined
"
).
assertTrue
();
let
mode
=
power
.
getPowerMode
();
console
.
info
(
'
Power_Get_Set_Mode_Callback_JSTest0130 mode:
'
+
mode
);
expect
(
mode
===
power
.
DevicePowerMode
.
MODE_PERFORMANCE
).
assertTrue
();
})
}
catch
(
e
)
{
console
.
info
(
'
Power_Get_Set_Mode_Callback_JSTest0130 error:
'
+
e
);
expect
().
assertFail
();
}
power
.
setPowerMode
(
currentMode
);
done
();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0140
* @tc.name Power_Get_Set_Mode_Callback_Invalid_JSTest0140
* @tc.desc Set the wrong power mode
*/
it
(
'
Power_Get_Set_Mode_Callback_Invalid_JSTest0140
'
,
0
,
async
function
(
done
)
{
try
{
// invalid mode
power
.
setPowerMode
(
''
,
(
error
)
=>
{
expect
().
assertFail
();
})
}
catch
(
e
)
{
console
.
info
(
'
Power_Get_Set_Mode_Callback_Invalid_JSTest0140 code:
'
+
e
.
code
+
'
msg:
'
+
e
.
message
);
// 401: Invalid input parameter
expect
(
e
.
code
===
401
).
assertTrue
();
}
try
{
// invalid callback
power
.
setPowerMode
(
power
.
DevicePowerMode
.
MODE_PERFORMANCE
,
''
)
}
catch
(
e
)
{
console
.
info
(
'
Power_Get_Set_Mode_Callback_Invalid_JSTest0140 code:
'
+
e
.
code
+
'
msg:
'
+
e
.
message
);
// 401: Invalid input parameter
expect
(
e
.
code
===
401
).
assertTrue
();
}
done
();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0150
* @tc.name Power_Reboot_JSTest0150
* @tc.desc reboot
*/
it
(
'
Power_Reboot_JSTest0150
'
,
0
,
function
()
{
// Reboot tests are not performed by default
if
(
false
)
{
try
{
power
.
reboot
(
'
Power_Reboot_JSTest0150
'
);
}
catch
(
e
)
{
console
.
info
(
'
Power_Reboot_JSTest0150 error:
'
+
e
);
expect
().
assertFail
();
}
}
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0160
* @tc.name Power_Wakeup_Suspend_IsActive_JSTest0160
* @tc.desc On and Off Screen and get the current screen on and off
*/
it
(
'
Power_Wakeup_Suspend_IsActive_JSTest0160
'
,
0
,
function
()
{
try
{
power
.
suspend
();
power
.
wakeup
(
'
wakeup_suspend_isPower_Wakeup_Suspend_IsActive_JSTest0160_active
'
);
let
on
=
power
.
isActive
();
console
.
info
(
'
Power_Wakeup_Suspend_IsActive_JSTest0160 on:
'
+
on
);
expect
(
on
).
assertTrue
();
power
.
suspend
();
let
off
=
power
.
isActive
();
console
.
info
(
'
Power_Wakeup_Suspend_IsActive_JSTest0160 off:
'
+
off
);
expect
(
off
).
assertFalse
();
}
catch
(
e
)
{
console
.
info
(
'
Power_Wakeup_Suspend_IsActive_JSTest0160:
'
+
e
);
expect
().
assertFail
();
}
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0170
* @tc.name Power_Wakeup_Invalid_JSTest0170
* @tc.desc wakeup Input invalid parameter
*/
it
(
'
Power_Wakeup_Invalid_JSTest0170
'
,
0
,
function
()
{
try
{
power
.
wakeup
(
0
)
}
catch
(
e
)
{
console
.
info
(
'
Power_Wakeup_Invalid_JSTest0170 code:
'
+
e
.
code
+
"
msg:
"
+
e
.
message
);
// 401: Invalid input parameter
expect
(
e
.
code
===
401
).
assertTrue
();
}
try
{
// The number of parameters does not match
power
.
wakeup
(
''
,
0
)
}
catch
(
e
)
{
console
.
info
(
'
Power_Wakeup_Invalid_JSTest0170 code:
'
+
e
.
code
+
"
msg:
"
+
e
.
message
);
// 401: Invalid input parameter
expect
(
e
.
code
===
401
).
assertTrue
();
}
})
})
}
powermgr/power_manager/src/main/js/test/power_manager_running_lock.test.js
浏览文件 @
b4f09263
...
...
@@ -229,5 +229,119 @@ describe('PowerManagerRunningLockTest', function () {
}
})
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0210
* @tc.name Create_Running_Lock_Promise_JSTest0210
* @tc.desc Create lock, hold lock, unlock
*/
it
(
'
Create_Running_Lock_Promise_JSTest0210
'
,
0
,
async
function
(
done
)
{
try
{
let
isExec
=
false
;
runningLock
.
create
(
"
Create_Running_Lock_Promise_JSTest0210
"
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
((
error
,
runninglock
)
=>
{
isExec
=
true
;
expect
(
typeof
error
===
"
undefined
"
).
assertTrue
();
expect
(
runninglock
!==
null
).
assertTrue
();
let
holding
=
runninglock
.
isHolding
();
console
.
info
(
'
Create_Running_Lock_Promise_JSTest0210 holding false:
'
+
holding
);
expect
(
holding
).
assertFalse
();
runninglock
.
hold
(
1000
);
// hold 1000ms
holding
=
runninglock
.
isHolding
();
console
.
info
(
'
Create_Running_Lock_Promise_JSTest0210 holding true:
'
+
holding
);
expect
(
holding
).
assertTrue
();
runninglock
.
unhold
();
expect
(
runninglock
.
isHolding
()).
assertFalse
();
}).
finally
(()
=>
{
expect
(
isExec
).
assertTrue
();
})
}
catch
(
e
)
{
console
.
info
(
'
Create_Running_Lock_Promise_JSTest0210 error:
'
+
e
);
expect
().
assertFail
();
}
done
();
})
// New interface
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0220
* @tc.name Create_Running_Lock_Promise_Invalid_JSTest0220
* @tc.desc Create lock input invalid value
*/
it
(
'
Create_Running_Lock_Promise_Invalid_JSTest0220
'
,
0
,
async
function
(
done
)
{
try
{
runningLock
.
create
(
0
,
runningLock
.
RunningLockType
.
BACKGROUND
)
.
then
((
error
,
runninglock
)
=>
{
expect
().
assertFail
();
})
}
catch
(
e
)
{
console
.
info
(
'
Create_Running_Lock_Promise_Invalid_JSTest0220 code:
'
+
e
.
code
+
"
msg:
"
+
e
.
message
);
// 401: Invalid input parameter
expect
(
e
.
code
===
401
).
assertTrue
();
}
done
();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0230
* @tc.name Create_Running_Lock_Callback_JSTest0230
* @tc.desc Create lock, hold lock, unlock
*/
it
(
'
Create_Running_Lock_Callback_JSTest0230
'
,
0
,
async
function
(
done
)
{
try
{
runningLock
.
create
(
"
Create_Running_Lock_Callback_JSTest0230
"
,
runningLock
.
RunningLockType
.
BACKGROUND
,
(
error
,
runninglock
)
=>
{
expect
(
typeof
error
===
"
undefined
"
).
assertTrue
();
expect
(
runninglock
!==
null
).
assertTrue
();
runninglock
.
hold
(
1000
);
// hold 1000ms
let
holding
=
runninglock
.
isHolding
();
console
.
info
(
'
Create_Running_Lock_Callback_JSTest0230 holding true:
'
+
holding
);
expect
(
holding
).
assertTrue
();
runninglock
.
unhold
();
holding
=
runninglock
.
isHolding
();
expect
(
holding
).
assertFalse
();
console
.
info
(
'
Create_Running_Lock_Callback_JSTest0230 holding false:
'
+
holding
);
});
}
catch
(
e
)
{
console
.
info
(
'
Create_Running_Lock_Callback_JSTest0230 error:
'
+
e
);
expect
().
assertFail
();
}
done
();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0240
* @tc.name Create_Running_Lock_Callback_Invalid_JSTest0240
* @tc.desc Create lock input invalid value
*/
it
(
'
Create_Running_Lock_Callback_Invalid_JSTest0240
'
,
0
,
async
function
(
done
)
{
try
{
runningLock
.
create
(
"
Create_Running_Lock_Callback_Invalid_JSTest0240
"
,
"
invalid
"
,
(
error
,
runninglock
)
=>
{
expect
().
assertFail
();
});
}
catch
(
e
)
{
console
.
info
(
'
Create_Running_Lock_Callback_Invalid_JSTest0240 code:
'
+
e
.
code
+
"
msg:
"
+
e
.
message
);
// 401: Invalid input parameter
expect
(
e
.
code
===
401
).
assertTrue
();
}
done
();
})
/**
* @tc.number SUB_PowerSystem_PowerManager_JSTest_0250
* @tc.name Is_Supported_JSTest0250
* @tc.desc Checks whether the specified RunningLockType is supported.
*/
it
(
'
Is_Supported_JSTest0250
'
,
0
,
async
function
(
done
)
{
try
{
let
background
=
runningLock
.
isSupported
(
runningLock
.
RunningLockType
.
BACKGROUND
)
expect
(
background
).
assertTrue
();
}
catch
(
e
)
{
console
.
info
(
'
Is_Supported_JSTest0250 code:
'
+
e
);
expect
().
assertFail
();
}
done
();
})
})
}
powermgr/thermal_manager/src/main/js/test/thermal_unittest.test.js
浏览文件 @
b4f09263
...
...
@@ -134,5 +134,87 @@ describe('ThermalUnitTest', function () {
console
.
info
(
'
ThermalLevel.EMERGENCY =
'
+
thermalLevel
);
expect
(
thermalLevel
===
6
).
assertTrue
();
})
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0100
* @tc.name Get_Level_JSTest0100
* @tc.desc Thermal acquisition kit
*/
it
(
'
Get_Level_JSTest0100
'
,
0
,
async
function
(
done
)
{
let
level
=
thermal
.
getLevel
();
console
.
info
(
"
Get_Level_JSTest0100 level is:
"
+
level
);
expect
(
level
>=
thermal
.
ThermalLevel
.
COOL
&&
level
<=
thermal
.
ThermalLevel
.
EMERGENCY
).
assertTrue
();
done
();
})
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0110
* @tc.name Register_Thermal_Level_Callback_JSTest0110
* @tc.desc Thermal acquisition kit
*/
it
(
'
Register_Thermal_Level_Callback_JSTest0110
'
,
0
,
async
function
(
done
)
{
try
{
thermal
.
registerThermalLevelCallback
((
value
)
=>
{
console
.
info
(
"
Register_Thermal_Level_Callback_JSTest0110 level is:
"
+
value
);
let
level
=
thermal
.
getLevel
();
expect
(
level
===
value
).
assertTrue
();
})
}
catch
(
error
)
{
console
.
info
(
'
Register_Thermal_Level_Callback_JSTest0110:
'
+
error
);
expect
().
assertFail
();
}
done
();
})
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0120
* @tc.name Register_Thermal_Level_Callback_JSTest0120
* @tc.desc Thermal acquisition kit
*/
it
(
'
Register_Thermal_Level_Callback_JSTest0120
'
,
0
,
async
function
(
done
)
{
try
{
thermal
.
registerThermalLevelCallback
(
''
)
}
catch
(
error
)
{
console
.
info
(
'
Register_Thermal_Level_Callback_JSTest0120 error:
'
+
error
);
// 401: Invalid input parameter
expect
(
error
.
code
===
401
).
assertTrue
();
}
done
();
})
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0130
* @tc.name UnRegister_Thermal_Level_Callback_JSTest0130
* @tc.desc Thermal acquisition kit
*/
it
(
'
UnRegister_Thermal_Level_Callback_JSTest0130
'
,
0
,
async
function
(
done
)
{
try
{
thermal
.
unregisterThermalLevelCallback
(
''
)
}
catch
(
error
)
{
console
.
info
(
'
UnRegister_Thermal_Level_Callback_JSTest0130 error:
'
+
error
);
// 401: Invalid input parameter
expect
(
error
.
code
===
401
).
assertTrue
();
}
done
();
})
/* @tc.number SUB_PowerSystem_ThermalManager_JSTest_0140
* @tc.name UnRegister_Thermal_Level_Callback_JSTest0140
* @tc.desc Thermal acquisition kit
*/
it
(
'
UnRegister_Thermal_Level_Callback_JSTest0140
'
,
0
,
async
function
(
done
)
{
try
{
thermal
.
unregisterThermalLevelCallback
()
}
catch
(
error
)
{
console
.
info
(
'
Thermal_020:
'
+
error
);
expect
().
assertFail
();
}
try
{
thermal
.
unregisterThermalLevelCallback
(()
=>
{
expect
(
ture
).
assertTrue
();
})
}
catch
(
error
)
{
console
.
info
(
'
Thermal_020:
'
+
error
);
expect
().
assertFail
();
}
done
();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录