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

!3060 feat: 支持电源模式管理接口的XTS用例

Merge pull request !3060 from qiuxiangdong/master
...@@ -25,7 +25,7 @@ describe('appInfoTest', function () { ...@@ -25,7 +25,7 @@ describe('appInfoTest', function () {
* @tc.name power_is_screen_on_promise_test * @tc.name power_is_screen_on_promise_test
* @tc.desc Checks whether the screen of a device is on or off * @tc.desc Checks whether the screen of a device is on or off
*/ */
it('power_is_screen_on_promise_test', 0, async function (done) {//isScreenOn(): Promise<boolean> it('power_is_screen_on_promise_test', 0, async function (done) {
power.wakeupDevice("power_is_screen_on_promise_test"); power.wakeupDevice("power_is_screen_on_promise_test");
power.isScreenOn() power.isScreenOn()
.then(screenOn => { .then(screenOn => {
...@@ -46,7 +46,7 @@ describe('appInfoTest', function () { ...@@ -46,7 +46,7 @@ describe('appInfoTest', function () {
* @tc.name power_is_screen_on_callback_test * @tc.name power_is_screen_on_callback_test
* @tc.desc Checks whether the screen of a device is on or off * @tc.desc Checks whether the screen of a device is on or off
*/ */
it('power_is_screen_on_callback_test', 0, async function (done) {//isScreenOn(callback: AsyncCallback<boolean>) it('power_is_screen_on_callback_test', 0, async function (done) {
power.wakeupDevice("power_is_screen_on_callback_test"); power.wakeupDevice("power_is_screen_on_callback_test");
power.isScreenOn((error, screenOn) => { power.isScreenOn((error, screenOn) => {
if (typeof error === "undefined") { if (typeof error === "undefined") {
...@@ -67,7 +67,7 @@ describe('appInfoTest', function () { ...@@ -67,7 +67,7 @@ describe('appInfoTest', function () {
* @tc.name power_wakeupDevice_test_string * @tc.name power_wakeupDevice_test_string
* @tc.desc Try to wakeup the device and let screen on * @tc.desc Try to wakeup the device and let screen on
*/ */
it('power_wakeupDevice_test_string', 0, async function (done) {//wakeupDevice(detail: string): void it('power_wakeupDevice_test_string', 0, async function (done) {
power.isScreenOn() power.isScreenOn()
.then(screenOn => { .then(screenOn => {
console.info('power_wakeupDevice_test_string: The current screenOn is ' + screenOn); console.info('power_wakeupDevice_test_string: The current screenOn is ' + screenOn);
...@@ -98,11 +98,11 @@ describe('appInfoTest', function () { ...@@ -98,11 +98,11 @@ describe('appInfoTest', function () {
}) })
/** /**
* @tc.number power_js_003 * @tc.number power_js_004
* @tc.name power_suspendDevice_test * @tc.name power_suspendDevice_test
* @tc.desc Try to suspend the device and let screen off * @tc.desc Try to suspend the device and let screen off
*/ */
it('power_suspendDevice_test', 0, async function (done) {//function suspendDevice(): void; it('power_suspendDevice_test', 0, async function (done) {
power.isScreenOn() power.isScreenOn()
.then(screenOn => { .then(screenOn => {
console.info('power_suspendDevice_test: The current screenOn is ' + screenOn); console.info('power_suspendDevice_test: The current screenOn is ' + screenOn);
...@@ -132,4 +132,86 @@ describe('appInfoTest', function () { ...@@ -132,4 +132,86 @@ describe('appInfoTest', function () {
}) })
}, 2000); }, 2000);
}) })
/**
* @tc.number power_js_005
* @tc.name power_set_power_mode_promise
* @tc.desc Get The mode the device
*/
it('power_get_power_mode_promise', 0, async function (done) {
power.getPowerMode()
.then(powerMode => {
console.info('power_get_set_power_mode_promise power mode is ' + powerMode);
expect(powerMode >= 600 && powerMode <= 603).assertTrue();
done();
})
.catch(error => {
console.log('power_get_set_power_mode_promise error: ' + error);
expect().assertFail();
done();
})
})
/**
* @tc.number power_js_006
* @tc.name power_get_power_mode_callback
* @tc.desc Get The mode the device
*/
it('power_get_power_mode_callback', 0, async function (done) {
power.getPowerMode((error, powerMode) => {
if (typeof error === "undefined") {
console.info('power_power_mode_callback power mode is ' + powerMode);
expect(powerMode >= 600 && powerMode <= 603).assertTrue();
done();
} else {
console.log('power_get_power_mode_callback: ' + error);
expect().assertFail();
done();
}
})
})
/**
* @tc.number power_js_007
* @tc.name power_device_power_mode_MODE_NORMAL
* @tc.desc Get device power mode MODE_NORMAL
*/
it('power_device_power_mode_normal', 0, function () {
let devicePowerMode = power.DevicePowerMode.MODE_NORMAL;
console.info('MODE_NORMAL = ' + devicePowerMode);
expect(devicePowerMode === 600).assertTrue();
})
/**
* @tc.number power_js_008
* @tc.name power_device_power_mode_MODE_POWER_SAVE
* @tc.desc Get device power mode MODE_POWER_SAVE
*/
it('power_device_power_mode_power_save', 0, function () {
let devicePowerMode = power.DevicePowerMode.MODE_POWER_SAVE;
console.info('MODE_POWER_SAVE = ' + devicePowerMode);
expect(devicePowerMode === 601).assertTrue();
})
/**
* @tc.number power_js_009
* @tc.name power_device_power_mode_MODE_PERFORMANCE
* @tc.desc Get device power mode MODE_PERFORMANCE
*/
it('power_device_power_mode_performance', 0, function () {
let devicePowerMode = power.DevicePowerMode.MODE_PERFORMANCE;
console.info('MODE_PERFORMANCE = ' + devicePowerMode);
expect(devicePowerMode === 602).assertTrue();
})
/**
* @tc.number power_js_010
* @tc.name power_device_power_mode_MODE_EXTREME_POWER_SAVE
* @tc.desc Get device power mode MODE_EXTREME_POWER_SAVE
*/
it('power_device_power_mode_extreme_power_save', 0, function () {
let devicePowerMode = power.DevicePowerMode.MODE_EXTREME_POWER_SAVE;
console.info('MODE_EXTREME_POWER_SAVE = ' + devicePowerMode);
expect(devicePowerMode === 603).assertTrue();
})
}) })
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册