From 51ca365b4e463edb5da34763ccf80aa604c4b859 Mon Sep 17 00:00:00 2001 From: logic42 Date: Sat, 25 Jun 2022 14:57:56 +0000 Subject: [PATCH] change multimodalinput and powermgr testcase Signed-off-by: logic42 --- .../main/js/default/test/InputDevice.test.js | 64 +++++++++ .../default/test/ListMultimodalinput.test.js | 2 +- .../main/js/default/test/battery_unit.test.js | 134 ++++++++++++++++-- .../test/batterymanager_performance.test.js | 2 +- .../test/power_manager_running_lock.test.js | 2 +- .../js/default/test/power_performance_test.js | 2 +- 6 files changed, 193 insertions(+), 13 deletions(-) diff --git a/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js index a1b03ac1d..18e489b03 100755 --- a/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js +++ b/multimodalinput/input_js_standard/src/main/js/default/test/InputDevice.test.js @@ -189,4 +189,68 @@ describe('MultimodalInput_test', function () { console.log(`inputDevice::getKeyboardType_test-03 exit`); }); }) + + /** + * @tc.number MultimodalInputDevice_js_0010 + * @tc.name remainingChargeTime_test + * @tc.desc Battry Present Interface Test + */ + it('MultimodalInputDevice_KeyboardType_NONE_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_NONE_test = ' + inputDevice.KeyboardType.NONE); + expect(inputDevice.KeyboardType.NONE == 0).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0020 + * @tc.name remainingChargeTime_test + * @tc.desc Battry Present Interface Test + */ + it('MultimodalInputDevice_KeyboardType_UNKNOWN_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_UNKNOWN_test = ' + inputDevice.KeyboardType.UNKNOWN); + expect(inputDevice.KeyboardType.UNKNOWN == 1).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0030 + * @tc.name remainingChargeTime_test + * @tc.desc Battry Present Interface Test + */ + it('MultimodalInputDevice_KeyboardType_ALPHABETIC_KEYBOARD_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_KEYBOARD_test = ' + + inputDevice.KeyboardType.ALPHABETIC_KEYBOARD); + expect(inputDevice.KeyboardType.ALPHABETIC_KEYBOARD == 2).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0040 + * @tc.name remainingChargeTime_test + * @tc.desc Battry Present Interface Test + */ + it('MultimodalInputDevice_KeyboardType_ALPHABETIC_DIGITAL_KEYBOARD_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_DIGITAL_KEYBOARD_test = ' + + inputDevice.KeyboardType.DIGITAL_KEYBOARD); + expect(inputDevice.KeyboardType.DIGITAL_KEYBOARD == 3).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0040 + * @tc.name remainingChargeTime_test + * @tc.desc Battry Present Interface Test + */ + it('MultimodalInputDevice_KeyboardType_ALPHABETIC_HANDWRITING_PEN_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_HANDWRITING_PEN_test = ' + + inputDevice.KeyboardType.HANDWRITING_PEN); + expect(inputDevice.KeyboardType.HANDWRITING_PEN == 4).assertTrue(); + }) + + /** + * @tc.number MultimodalInputDevice_js_0040 + * @tc.name remainingChargeTime_test + * @tc.desc Battry Present Interface Test + */ + it('MultimodalInputDevice_KeyboardType_ALPHABETIC_REMOTE_CONTROL_test', 0, function () { + console.info('MultimodalInputDevice_KeyboardType_ALPHABETIC_REMOTE_CONTROL_test = ' + + inputDevice.KeyboardType.REMOTE_CONTROL); + expect(inputDevice.KeyboardType.REMOTE_CONTROL == 5).assertTrue(); + }) }) diff --git a/multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js b/multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js index 4a1855528..820c3badb 100644 --- a/multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js +++ b/multimodalinput/input_js_standard/src/main/js/default/test/ListMultimodalinput.test.js @@ -15,4 +15,4 @@ require('./InputDevice.test.js') - +require('./MultimodalInputKey_Code.test.js') diff --git a/powermgr/battery_manager/src/main/js/default/test/battery_unit.test.js b/powermgr/battery_manager/src/main/js/default/test/battery_unit.test.js index d9a8d25e3..e42c7c7b6 100644 --- a/powermgr/battery_manager/src/main/js/default/test/battery_unit.test.js +++ b/powermgr/battery_manager/src/main/js/default/test/battery_unit.test.js @@ -14,8 +14,7 @@ */ import app from '@system.app' -import Context from '@ohos.napi_context' -import batteryInfo from '@ohos.batteryInfo'; +import batteryInfo from '@ohos.batteryinfo'; import brightness from '@ohos.brightness'; import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' @@ -322,7 +321,7 @@ describe('appInfoTest', function () { let batteryLevel = batteryInfo.batteryCapacityLevel; console.info('batteryLevel = ' + batteryLevel); expect(batteryLevel >= batteryInfo.BatteryCapacityLevel.LEVEL_NONE && - batteryLevel <= batteryInfo.BatteryCapacityLevel.LEVEL_CRITICAL).assertTrue(); + batteryLevel <= batteryInfo.BatteryCapacityLevel.LEVEL_CRITICAL).assertTrue(); }) /** @@ -393,16 +392,133 @@ describe('appInfoTest', function () { /** * @tc.number battery_manager_js_3400 - * @tc.name remainingChargeTime_test + * @tc.name battery_manager_js_3400 * @tc.desc Battry Present Interface Test */ it('remainingChargeTime_test', 0, function () { let remainingChargeTime = batteryInfo.estimatedRemainingChargeTime; console.info('remainingChargeTime = ' + remainingChargeTime); expect(remainingChargeTime >= 0).assertTrue(); - }) - - - - + }) + + /** + * @tc.number battery_manager_js_3500 + * @tc.name battery_manager_js_3500 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_SOC_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_SOC = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_SOC); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_SOC == 0).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_3600 + * @tc.name battery_manager_js_3600 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_VOLTAGE_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_VOLTAGE = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_VOLTAGE); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_VOLTAGE == 1).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_3700 + * @tc.name battery_manager_js_3700 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_TEMPERATURE_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_TEMPERATURE = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_TEMPERATURE); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_TEMPERATURE == 2).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_3800 + * @tc.name battery_manager_js_3800 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_HEALTH_STATE_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_HEALTH_STATE = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_HEALTH_STATE); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_HEALTH_STATE == 3).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_3900 + * @tc.name battery_manager_js_3900 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_PLUGGED_TYPE_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_PLUGGED_TYPE = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_PLUGGED_TYPE); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_PLUGGED_TYPE == 4).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_4000 + * @tc.name battery_manager_js_4000 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_MAX_CURRENT_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_MAX_CURRENT = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_MAX_CURRENT); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_MAX_CURRENT == 5).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_4100 + * @tc.name battery_manager_js_4100 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_MAX_VOLTAGE_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_MAX_VOLTAGE = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_MAX_VOLTAGE); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_MAX_VOLTAGE == 6).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_4200 + * @tc.name battery_manager_js_4200 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_CHARGE_STATE_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_CHARGE_STATE = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_CHARGE_STATE); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_CHARGE_STATE == 7).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_4300 + * @tc.name battery_manager_js_4300 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_CHARGE_COUNTER_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_CHARGE_COUNTER = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_CHARGE_COUNTER); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_CHARGE_COUNTER == 8).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_4400 + * @tc.name battery_manager_js_4400 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_PRESENT_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_PRESENT = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_PRESENT); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_PRESENT == 9).assertTrue(); + }) + + /** + * @tc.number battery_manager_js_4500 + * @tc.name battery_manager_js_4500 + * @tc.desc Battry Present Interface Test + */ + it('CommonEventBatteryChangedCode_EXTRA_TECHNOLOGY_test', 0, function () { + console.info('CommonEventBatteryChangedCode_EXTRA_TECHNOLOGY = ' + + batteryInfo.CommonEventBatteryChangedCode.EXTRA_TECHNOLOGY); + expect(batteryInfo.CommonEventBatteryChangedCode.EXTRA_TECHNOLOGY == 10).assertTrue(); + }) }) diff --git a/powermgr/battery_manager/src/main/js/default/test/batterymanager_performance.test.js b/powermgr/battery_manager/src/main/js/default/test/batterymanager_performance.test.js index 1ed8f670c..f64f9ed61 100644 --- a/powermgr/battery_manager/src/main/js/default/test/batterymanager_performance.test.js +++ b/powermgr/battery_manager/src/main/js/default/test/batterymanager_performance.test.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import batteryInfo from '@ohos.batteryInfo'; +import batteryInfo from '@ohos.batteryinfo'; import { describe, it, expect } from 'deccjsunit/index'; describe('appInfoTest', function () { diff --git a/powermgr/power_manager/src/main/js/default/test/power_manager_running_lock.test.js b/powermgr/power_manager/src/main/js/default/test/power_manager_running_lock.test.js index dc4a1bdbf..782bf0d8c 100644 --- a/powermgr/power_manager/src/main/js/default/test/power_manager_running_lock.test.js +++ b/powermgr/power_manager/src/main/js/default/test/power_manager_running_lock.test.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import runningLock from '@ohos.runningLock'; +import runningLock from '@ohos.runninglock'; import '@ohos.permission.RUNNING_LOCK' import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' diff --git a/powermgr/power_manager/src/main/js/default/test/power_performance_test.js b/powermgr/power_manager/src/main/js/default/test/power_performance_test.js index 837ea95e2..56f6492f3 100644 --- a/powermgr/power_manager/src/main/js/default/test/power_performance_test.js +++ b/powermgr/power_manager/src/main/js/default/test/power_performance_test.js @@ -13,7 +13,7 @@ * limitations under the License. */ -import runningLock from '@ohos.runningLock'; +import runningLock from '@ohos.runninglock'; import power from '@ohos.power'; import brightness from '@ohos.brightness'; import { describe, it, expect } from 'deccjsunit/index'; -- GitLab