未验证 提交 13d4e6b0 编写于 作者: O openharmony_ci 提交者: Gitee

!6520 feat: 电池广播支持BatteryCapacityLevel和定制

Merge pull request !6520 from 万洋/master
...@@ -280,30 +280,19 @@ describe('BatteryUnitTest', function () { ...@@ -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.name batterylevel_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
it('batterylevel_JSTest', 0, function () { it('batterylevel_JSTest', 0, function () {
let batteryLevel = batteryInfo.batteryCapacityLevel; let batteryLevel = batteryInfo.batteryCapacityLevel;
console.info('batteryLevel = ' + batteryLevel); console.info('batteryLevel = ' + batteryLevel);
expect(batteryLevel >= batteryInfo.BatteryCapacityLevel.LEVEL_NONE && expect(batteryLevel >= batteryInfo.BatteryCapacityLevel.LEVEL_FULL &&
batteryLevel <= batteryInfo.BatteryCapacityLevel.LEVEL_CRITICAL).assertTrue(); batteryLevel <= batteryInfo.BatteryCapacityLevel.LEVEL_SHUTDOWN).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();
}) })
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1800 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_1750
* @tc.name enum_level_state_JSTest_full * @tc.name enum_level_state_JSTest_full
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -314,7 +303,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name enum_level_state_JSTest_high
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -325,7 +314,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name enum_level_state_JSTest_normal
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -336,7 +325,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name enum_level_state_JSTest_low
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -347,19 +336,41 @@ describe('BatteryUnitTest', function () { ...@@ -347,19 +336,41 @@ describe('BatteryUnitTest', function () {
}) })
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1840 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_1790
* @tc.name enum_level_state_JSTest_emergency * @tc.name enum_level_state_JSTest_warning
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
it('enum_level_state_JSTest_emergency', 0, function () { it('enum_level_state_JSTest_warning', 0, function () {
let batteryLevelState = batteryInfo.BatteryCapacityLevel.LEVEL_CRITICAL; let batteryLevelState = batteryInfo.BatteryCapacityLevel.LEVEL_WARNING;
console.info('batteryLevelState = ' + batteryLevelState); console.info('batteryLevelState = ' + batteryLevelState);
expect(batteryLevelState == 5).assertTrue(); expect(batteryLevelState == 5).assertTrue();
}) })
/** /**
* @tc.number SUB_PowerSystem_BatteryManager_JSTest_1850 * @tc.number SUB_PowerSystem_BatteryManager_JSTest_1800
* @tc.name SUB_PowerSystem_BatteryManager_JSTest_3400 * @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 * @tc.desc Battry Present Interface Test
*/ */
it('remainingChargeTime_JSTest', 0, function () { it('remainingChargeTime_JSTest', 0, function () {
...@@ -369,7 +380,7 @@ describe('BatteryUnitTest', 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.name CommonEventBatteryChangedCode_EXTRA_SOC_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -380,7 +391,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_VOLTAGE_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -391,7 +402,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_TEMPERATURE_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -402,7 +413,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_HEALTH_STATE_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -413,7 +424,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_PLUGGED_TYPE_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -424,7 +435,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_MAX_CURRENT_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -435,7 +446,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_MAX_VOLTAGE_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -446,7 +457,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_CHARGE_STATE_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -457,7 +468,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_CHARGE_COUNTER_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -468,7 +479,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_PRESENT_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -479,7 +490,7 @@ describe('BatteryUnitTest', function () { ...@@ -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.name CommonEventBatteryChangedCode_EXTRA_TECHNOLOGY_JSTest
* @tc.desc Battry Present Interface Test * @tc.desc Battry Present Interface Test
*/ */
...@@ -488,5 +499,16 @@ describe('BatteryUnitTest', function () { ...@@ -488,5 +499,16 @@ describe('BatteryUnitTest', function () {
+ batteryInfo.CommonEventBatteryChangedCode.EXTRA_TECHNOLOGY); + batteryInfo.CommonEventBatteryChangedCode.EXTRA_TECHNOLOGY);
expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_TECHNOLOGY == 10).assertTrue(); 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.
先完成此消息的编辑!
想要评论请 注册