提交 a476ac58 编写于 作者: W waaaaanyang

feat: Battery broadcast supports BatteryCapacityLevel and customization

Signed-off-by: Nwaaaaanyang <757303947@qq.com>
上级 efce960c
......@@ -280,30 +280,19 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1780
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1740
* @tc.name batterylevel_JSTest
* @tc.desc Battry Present Interface Test
*/
it('batterylevel_JSTest', 0, function () {
let batteryLevel = batteryInfo.batteryCapacityLevel;
console.info('batteryLevel = ' + batteryLevel);
expect(batteryLevel >= batteryInfo.BatteryCapacityLevel.LEVEL_NONE &&
batteryLevel <= batteryInfo.BatteryCapacityLevel.LEVEL_CRITICAL).assertTrue();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1790
* @tc.name enum_level_state_JSTest_none
* @tc.desc Battry Present Interface Test
*/
it('enum_level_state_JSTest_none', 0, function () {
let batterylevelState = batteryInfo.BatteryCapacityLevel.LEVEL_NONE;
console.info('batterylevelState = ' + batterylevelState);
expect(batterylevelState == 0).assertTrue();
expect(batteryLevel >= batteryInfo.BatteryCapacityLevel.LEVEL_FULL &&
batteryLevel <= batteryInfo.BatteryCapacityLevel.LEVEL_SHUTDOWN).assertTrue();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1800
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1750
* @tc.name enum_level_state_JSTest_full
* @tc.desc Battry Present Interface Test
*/
......@@ -314,7 +303,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1810
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1760
* @tc.name enum_level_state_JSTest_high
* @tc.desc Battry Present Interface Test
*/
......@@ -325,7 +314,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1820
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1770
* @tc.name enum_level_state_JSTest_normal
* @tc.desc Battry Present Interface Test
*/
......@@ -336,7 +325,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1830
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1780
* @tc.name enum_level_state_JSTest_low
* @tc.desc Battry Present Interface Test
*/
......@@ -347,19 +336,41 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1840
* @tc.name enum_level_state_JSTest_emergency
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1790
* @tc.name enum_level_state_JSTest_warning
* @tc.desc Battry Present Interface Test
*/
it('enum_level_state_JSTest_emergency', 0, function () {
let batteryLevelState = batteryInfo.BatteryCapacityLevel.LEVEL_CRITICAL;
it('enum_level_state_JSTest_warning', 0, function () {
let batteryLevelState = batteryInfo.BatteryCapacityLevel.LEVEL_WARNING;
console.info('batteryLevelState = ' + batteryLevelState);
expect(batteryLevelState == 5).assertTrue();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1850
* @tc.name SUB_PowerSystem_BatteryManager_JSTest_3400
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1800
* @tc.name enum_level_state_JSTest_critical
* @tc.desc Battry Present Interface Test
*/
it('enum_level_state_JSTest_critical', 0, function () {
let batteryLevelState = batteryInfo.BatteryCapacityLevel.LEVEL_CRITICAL;
console.info('batteryLevelState = ' + batteryLevelState);
expect(batteryLevelState == 6).assertTrue();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1810
* @tc.name enum_level_state_JSTest_shutdown
* @tc.desc Battry Present Interface Test
*/
it('enum_level_state_JSTest_shutdown', 0, function () {
let batteryLevelState = batteryInfo.BatteryCapacityLevel.LEVEL_SHUTDOWN;
console.info('batteryLevelState = ' + batteryLevelState);
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 () {
......@@ -369,7 +380,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1860
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1830
* @tc.name CommonEventBatteryChangedCode_EXTRA_SOC_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -380,7 +391,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1870
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1840
* @tc.name CommonEventBatteryChangedCode_EXTRA_VOLTAGE_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -391,7 +402,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1880
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1850
* @tc.name CommonEventBatteryChangedCode_EXTRA_TEMPERATURE_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -402,7 +413,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1890
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1860
* @tc.name CommonEventBatteryChangedCode_EXTRA_HEALTH_STATE_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -413,7 +424,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1900
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1870
* @tc.name CommonEventBatteryChangedCode_EXTRA_PLUGGED_TYPE_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -424,7 +435,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1910
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1880
* @tc.name CommonEventBatteryChangedCode_EXTRA_MAX_CURRENT_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -435,7 +446,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1920
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1890
* @tc.name CommonEventBatteryChangedCode_EXTRA_MAX_VOLTAGE_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -446,7 +457,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1930
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1900
* @tc.name CommonEventBatteryChangedCode_EXTRA_CHARGE_STATE_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -457,7 +468,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1940
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1910
* @tc.name CommonEventBatteryChangedCode_EXTRA_CHARGE_COUNTER_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -468,7 +479,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1950
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1920
* @tc.name CommonEventBatteryChangedCode_EXTRA_PRESENT_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -479,7 +490,7 @@ describe('BatteryUnitTest', function () {
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1960
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1930
* @tc.name CommonEventBatteryChangedCode_EXTRA_TECHNOLOGY_JSTest
* @tc.desc Battry Present Interface Test
*/
......@@ -488,5 +499,16 @@ describe('BatteryUnitTest', function () {
+ batteryInfo.CommonEventBatteryChangedCode.EXTRA_TECHNOLOGY);
expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_TECHNOLOGY == 10).assertTrue();
})
/**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1940
* @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.CommonEventBatteryChangedCode.EXTRA_CAPACITY_LEVEL);
expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_CAPACITY_LEVEL == 11).assertTrue();
})
})
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册