Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
0027449c
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看板
未验证
提交
0027449c
编写于
2月 13, 2023
作者:
O
openharmony_ci
提交者:
Gitee
2月 13, 2023
浏览文件
操作
浏览文件
下载
差异文件
!7534 fix: 更新电池广播查询枚举为字符串
Merge pull request !7534 from ShiJie/master
上级
56715398
102c72b4
变更
2
显示空白变更内容
内联
并排
Showing
2 changed file
with
42 addition
and
84 deletion
+42
-84
powermgr/battery_manager/src/main/js/test/battery_common_event.test.js
...ery_manager/src/main/js/test/battery_common_event.test.js
+4
-2
powermgr/battery_manager/src/main/js/test/battery_unit.test.js
...mgr/battery_manager/src/main/js/test/battery_unit.test.js
+38
-82
未找到文件。
powermgr/battery_manager/src/main/js/test/battery_common_event.test.js
浏览文件 @
0027449c
...
...
@@ -13,6 +13,7 @@
* limitations under the License.
*/
import
commonEvent
from
'
@ohos.commonEvent
'
;
import
batteryInfo
from
'
@ohos.batteryInfo
'
;
import
{
describe
,
it
,
expect
}
from
'
@ohos/hypium
'
export
default
function
BatteryCommonEventTest
()
{
...
...
@@ -7444,8 +7445,9 @@ function createBatteryChangedSubscriber() {
console
.
info
(
"
commonEventData event:
"
+
commonEventData
.
event
);
console
.
info
(
"
commonEventData bundleName:
"
+
commonEventData
.
bundleName
);
console
.
info
(
"
commonEventData data:
"
+
commonEventData
.
data
);
console
.
info
(
"
commonEventData parameter:
"
+
commonEventData
.
parameters
[
0
]);
var
capacity
=
commonEventData
.
parameters
[
'
0
'
];
let
socKey
=
batteryInfo
.
CommonEventBatteryChangedKey
.
EXTRA_SOC
;
console
.
info
(
"
commonEventData parameter:
"
+
commonEventData
.
parameters
[
socKey
]);
var
capacity
=
commonEventData
.
parameters
[
socKey
];
console
.
info
(
"
capacity is:
"
+
capacity
);
expect
(
capacity
>=
0
&&
capacity
<=
100
).
assertTrue
();
});
...
...
powermgr/battery_manager/src/main/js/test/battery_unit.test.js
浏览文件 @
0027449c
...
...
@@ -368,17 +368,6 @@ describe('BatteryUnitTest', function () {
expect
(
batteryLevelState
==
7
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1820
* @tc.name remainingChargeTime_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
remainingChargeTime_JSTest
'
,
0
,
function
()
{
let
remainingChargeTime
=
batteryInfo
.
estimatedRemainingChargeTime
;
console
.
info
(
'
remainingChargeTime =
'
+
remainingChargeTime
);
expect
(
remainingChargeTime
>=
-
1
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1830
* @tc.name CommonEventBatteryChangedCode_EXTRA_SOC_JSTest
...
...
@@ -386,129 +375,96 @@ describe('BatteryUnitTest', function () {
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_SOC_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_SOC =
'
+
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_SOC
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_SOC
==
0
).
assertTrue
();
+
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_SOC
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_SOC
==
'
soc
'
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1
8
40
* @tc.name CommonEventBatteryChangedCode_EXTRA_
VOLTAG
E_JSTest
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1
9
40
* @tc.name CommonEventBatteryChangedCode_EXTRA_
CHARGE_STAT
E_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_
VOLTAG
E_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_
VOLTAG
E =
'
+
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_VOLTAG
E
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_VOLTAGE
==
1
).
assertTrue
();
it
(
'
CommonEventBatteryChangedCode_EXTRA_
CHARGE_STAT
E_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_
CHARGE_STAT
E =
'
+
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_CHARGE_STAT
E
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_CHARGE_STATE
==
'
chargeState
'
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1850
* @tc.name CommonEventBatteryChangedCode_EXTRA_TEMPERATURE_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_TEMPERATURE_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_TEMPERATURE =
'
+
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_TEMPERATURE
);
expect
(
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_TEMPERATURE
==
2
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1860
* @tc.name CommonEventBatteryChangedCode_EXTRA_HEALTH_STATE_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_HEALTH_STATE_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_HEALTH_STATE =
'
+
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_HEALTH_STATE
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_HEALTH_STATE
==
3
).
assertTrue
();
+
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_HEALTH_STATE
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_HEALTH_STATE
==
'
healthState
'
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_18
7
0
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_18
6
0
* @tc.name CommonEventBatteryChangedCode_EXTRA_PLUGGED_TYPE_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_PLUGGED_TYPE_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_PLUGGED_TYPE =
'
+
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_PLUGGED_TYPE
);
expect
(
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_PLUGGED_TYPE
==
4
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1880
* @tc.name CommonEventBatteryChangedCode_EXTRA_MAX_CURRENT_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_MAX_CURRENT_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_MAX_CURRENT =
'
+
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_MAX_CURRENT
);
expect
(
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_MAX_CURRENT
==
5
).
assertTrue
();
+
batteryInfo
.
CommonEventBatteryChangedKey
.
EXTRA_PLUGGED_TYPE
);
expect
(
batteryInfo
.
CommonEventBatteryChangedKey
.
EXTRA_PLUGGED_TYPE
==
'
pluggedType
'
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_18
9
0
* @tc.name CommonEventBatteryChangedCode_EXTRA_
MAX_
VOLTAGE_JSTest
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_18
7
0
* @tc.name CommonEventBatteryChangedCode_EXTRA_VOLTAGE_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_
MAX_
VOLTAGE_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_
MAX_
VOLTAGE =
'
+
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_MAX
_VOLTAGE
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_MAX_VOLTAGE
==
6
).
assertTrue
();
it
(
'
CommonEventBatteryChangedCode_EXTRA_VOLTAGE_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_VOLTAGE =
'
+
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA
_VOLTAGE
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_VOLTAGE
==
'
voltage
'
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1
90
0
* @tc.name CommonEventBatteryChangedCode_EXTRA_
CHARGE_STATE
_JSTest
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1
88
0
* @tc.name CommonEventBatteryChangedCode_EXTRA_
TECHNOLOGY
_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_
CHARGE_STATE
_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_
CHARGE_STATE
=
'
+
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_CHARGE_STATE
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_CHARGE_STATE
==
7
).
assertTrue
();
it
(
'
CommonEventBatteryChangedCode_EXTRA_
TECHNOLOGY
_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_
TECHNOLOGY
=
'
+
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_TECHNOLOGY
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_TECHNOLOGY
==
'
technology
'
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1
91
0
* @tc.name CommonEventBatteryChangedCode_EXTRA_
CHARGE_COUNTER
_JSTest
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1
89
0
* @tc.name CommonEventBatteryChangedCode_EXTRA_
TEMPERATURE
_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_
CHARGE_COUNTER
_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_
CHARGE_COUNTER
=
'
+
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_CHARGE_COUNTER
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_CHARGE_COUNTER
==
8
).
assertTrue
();
it
(
'
CommonEventBatteryChangedCode_EXTRA_
TEMPERATURE
_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_
TEMPERATURE
=
'
+
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_TEMPERATURE
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_TEMPERATURE
==
'
temperature
'
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_19
2
0
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_19
0
0
* @tc.name CommonEventBatteryChangedCode_EXTRA_PRESENT_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_PRESENT_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_PRESENT =
'
+
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_PRESENT
);
expect
(
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_PRESENT
==
9
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1930
* @tc.name CommonEventBatteryChangedCode_EXTRA_TECHNOLOGY_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_EXTRA_TECHNOLOGY_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_EXTRA_TECHNOLOGY =
'
+
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_TECHNOLOGY
);
expect
(
batteryInfo
.
CommonEventBatteryChangedCode
.
EXTRA_TECHNOLOGY
==
10
).
assertTrue
();
+
batteryInfo
.
CommonEventBatteryChangedKey
.
EXTRA_PRESENT
);
expect
(
batteryInfo
.
CommonEventBatteryChangedKey
.
EXTRA_PRESENT
==
'
present
'
).
assertTrue
();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_19
4
0
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_19
1
0
* @tc.name CommonEventBatteryChangedCode_CAPACITY_LEVEL_JSTest
* @tc.desc Battry Present Interface Test
*/
it
(
'
CommonEventBatteryChangedCode_CAPACITY_LEVEL_JSTest
'
,
0
,
function
()
{
console
.
info
(
'
CommonEventBatteryChangedCode_CAPACITY_LEVEL =
'
+
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_CAPACITY_LEVEL
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Code
.
EXTRA_CAPACITY_LEVEL
==
11
).
assertTrue
();
+
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_CAPACITY_LEVEL
);
expect
(
batteryInfo
.
CommonEventBatteryChanged
Key
.
EXTRA_CAPACITY_LEVEL
==
'
capacityLevel
'
).
assertTrue
();
})
})
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录