提交 bf2b22ba 编写于 作者: S ShiJie

test: system_display.test Change bit asynchronous

Signed-off-by: NShiJie <shijie20@huawei.com>
Change-Id: I43ca6457fdd0c4cb6911b39b49e08cbb8f96b57e
上级 034ffdfa
...@@ -37,8 +37,6 @@ describe('appInfoTest', function () { ...@@ -37,8 +37,6 @@ describe('appInfoTest', function () {
* @tc.desc Get brightness success * @tc.desc Get brightness success
*/ */
it('get_value_success', 0, function () { it('get_value_success', 0, function () {
let execSucc = false;
let execComplete = false;
let currValue = 100; let currValue = 100;
let setValue = 120; let setValue = 120;
brightness.getValue({ brightness.getValue({
...@@ -53,7 +51,6 @@ describe('appInfoTest', function () { ...@@ -53,7 +51,6 @@ describe('appInfoTest', function () {
}); });
brightness.getValue({ brightness.getValue({
success: (data) => { success: (data) => {
execSucc = true;
expect(setValue === data.value).assertTrue(); expect(setValue === data.value).assertTrue();
}, },
fail: (data, code) => { fail: (data, code) => {
...@@ -61,12 +58,9 @@ describe('appInfoTest', function () { ...@@ -61,12 +58,9 @@ describe('appInfoTest', function () {
expect().assertFail(); expect().assertFail();
}, },
complete: () => { complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execSucc).assertTrue();
expect(execComplete).assertTrue();
brightness.setValue({ brightness.setValue({
value: currValue value: currValue
...@@ -79,18 +73,15 @@ describe('appInfoTest', function () { ...@@ -79,18 +73,15 @@ describe('appInfoTest', function () {
* @tc.desc Get brightness * @tc.desc Get brightness
*/ */
it('get_status_test_success_not_must', 0, function () { it('get_status_test_success_not_must', 0, function () {
let execComplete = false;
brightness.getValue({ brightness.getValue({
fail: (data, code) => { fail: (data, code) => {
console.log("get_status_test_success_not_must, data: " + data + ", code: " + code); console.log("get_status_test_success_not_must, data: " + data + ", code: " + code);
expect().assertFail(); expect().assertFail();
}, },
complete: () => { complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execComplete).assertTrue();
}) })
/** /**
...@@ -99,14 +90,11 @@ describe('appInfoTest', function () { ...@@ -99,14 +90,11 @@ describe('appInfoTest', function () {
* @tc.desc Get brightness * @tc.desc Get brightness
*/ */
it('get_value_fail_not_must_test', 0, function () { it('get_value_fail_not_must_test', 0, function () {
let execComplete = false;
brightness.getValue({ brightness.getValue({
complete: () => { complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execComplete).assertTrue();
}); });
/** /**
...@@ -125,8 +113,6 @@ describe('appInfoTest', function () { ...@@ -125,8 +113,6 @@ describe('appInfoTest', function () {
* @tc.desc Set brightness success * @tc.desc Set brightness success
*/ */
it('set_value_success_all', 0, function () { it('set_value_success_all', 0, function () {
let execSucc = false;
let execComplete = false;
let setValue = 200; let setValue = 200;
let currValue = 100; let currValue = 100;
brightness.getValue({ brightness.getValue({
...@@ -138,7 +124,6 @@ describe('appInfoTest', function () { ...@@ -138,7 +124,6 @@ describe('appInfoTest', function () {
brightness.setValue({ brightness.setValue({
value: setValue, value: setValue,
success: () => { success: () => {
execSucc = true;
brightness.getValue({ brightness.getValue({
success: (data) => { success: (data) => {
expect(data.value === setValue).assertTrue(); expect(data.value === setValue).assertTrue();
...@@ -150,12 +135,9 @@ describe('appInfoTest', function () { ...@@ -150,12 +135,9 @@ describe('appInfoTest', function () {
expect().assertFail(); expect().assertFail();
}, },
complete: () => { complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execSucc).assertTrue();
expect(execComplete).assertTrue();
brightness.setValue({ brightness.setValue({
value: currValue value: currValue
...@@ -212,8 +194,6 @@ describe('appInfoTest', function () { ...@@ -212,8 +194,6 @@ describe('appInfoTest', function () {
* @tc.desc Get mode success * @tc.desc Get mode success
*/ */
it('get_mode_success', 0, function () { it('get_mode_success', 0, function () {
let execSucc = false;
let execComplete = false;
let modeVal = 0; let modeVal = 0;
let exec = true; let exec = true;
brightness.getMode({ brightness.getMode({
...@@ -234,7 +214,6 @@ describe('appInfoTest', function () { ...@@ -234,7 +214,6 @@ describe('appInfoTest', function () {
} }
brightness.getMode({ brightness.getMode({
success: (data) => { success: (data) => {
execSucc = true;
expect(data.mode === (modeVal ? 0 : 1)).assertTrue(); expect(data.mode === (modeVal ? 0 : 1)).assertTrue();
}, },
fail: (data, code) => { fail: (data, code) => {
...@@ -242,12 +221,9 @@ describe('appInfoTest', function () { ...@@ -242,12 +221,9 @@ describe('appInfoTest', function () {
expect().assertFail(); expect().assertFail();
}, },
complete: () => { complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execSucc).assertTrue();
expect(execComplete).assertTrue();
brightness.setMode({ mode: modeVal }); brightness.setMode({ mode: modeVal });
}) })
...@@ -258,18 +234,15 @@ describe('appInfoTest', function () { ...@@ -258,18 +234,15 @@ describe('appInfoTest', function () {
* @tc.desc Get mode success is null * @tc.desc Get mode success is null
*/ */
it('get_mode_success_null', 0, function () { it('get_mode_success_null', 0, function () {
let execComplete = false;
brightness.getMode({ brightness.getMode({
fail: (data, code) => { fail: (data, code) => {
console.log("get_mode_success_null, data: " + data + ", code: " + code); console.log("get_mode_success_null, data: " + data + ", code: " + code);
expect().assertFail(); expect().assertFail();
}, },
complete: () => { complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execComplete).assertTrue();
}); });
/** /**
...@@ -278,8 +251,6 @@ describe('appInfoTest', function () { ...@@ -278,8 +251,6 @@ describe('appInfoTest', function () {
* @tc.desc set mode success * @tc.desc set mode success
*/ */
it('set_mode_success', 0, function () { it('set_mode_success', 0, function () {
let execSucc = false;
let execComplete = false;
let modeVal = 0; let modeVal = 0;
brightness.getMode({ brightness.getMode({
success: (data) => { success: (data) => {
...@@ -290,7 +261,6 @@ describe('appInfoTest', function () { ...@@ -290,7 +261,6 @@ describe('appInfoTest', function () {
brightness.setMode({ brightness.setMode({
mode: modeVal ? 0 : 1, mode: modeVal ? 0 : 1,
success: () => { success: () => {
execSucc = true;
console.log("set_mode_success success"); console.log("set_mode_success success");
brightness.getMode({ brightness.getMode({
success: (data) => { success: (data) => {
...@@ -305,17 +275,13 @@ describe('appInfoTest', function () { ...@@ -305,17 +275,13 @@ describe('appInfoTest', function () {
expect().assertFail(); expect().assertFail();
} else { } else {
console.log("set_mode_success not supported"); console.log("set_mode_success not supported");
execSucc = true;
expect(isNotSupported(data)).assertTrue(); expect(isNotSupported(data)).assertTrue();
} }
}, },
complete: () => { complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execSucc).assertTrue();
expect(execComplete).assertTrue();
brightness.setMode({ mode: modeVal }); brightness.setMode({ mode: modeVal });
}); });
...@@ -326,7 +292,6 @@ describe('appInfoTest', function () { ...@@ -326,7 +292,6 @@ describe('appInfoTest', function () {
* @tc.desc set mode fail * @tc.desc set mode fail
*/ */
it('set_mode_fail', 0, function () { it('set_mode_fail', 0, function () {
let execComplete = false;
brightness.setMode({ brightness.setMode({
mode: "0", mode: "0",
success: () => { success: () => {
...@@ -338,11 +303,9 @@ describe('appInfoTest', function () { ...@@ -338,11 +303,9 @@ describe('appInfoTest', function () {
expect(data === SET_MODE_MSG).assertTrue(); expect(data === SET_MODE_MSG).assertTrue();
}, },
complete: () => { complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execComplete).assertTrue();
}); });
/** /**
...@@ -351,25 +314,17 @@ describe('appInfoTest', function () { ...@@ -351,25 +314,17 @@ describe('appInfoTest', function () {
* @tc.desc set keep screen on true * @tc.desc set keep screen on true
*/ */
it('set_keep_screen_on_true', 0, async function () { it('set_keep_screen_on_true', 0, async function () {
let execSucc = false;
let execComplete = false;
let sleepTime = 35 * 1000; let sleepTime = 35 * 1000;
brightness.setKeepScreenOn({ brightness.setKeepScreenOn({
keepScreenOn: true, keepScreenOn: true,
success: () => {
execSucc = true;
},
fail: (data, code) => { fail: (data, code) => {
console.log("set_keep_screen_on, data: " + data + ", code: " + code); console.log("set_keep_screen_on, data: " + data + ", code: " + code);
expect().assertFail(); expect().assertFail();
}, },
complete: () => { complete: () => {
execComplete = true;
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execSucc).assertTrue();
expect(execComplete).assertTrue();
await sleep(sleepTime); await sleep(sleepTime);
power.isScreenOn().then(screenOn => { power.isScreenOn().then(screenOn => {
...@@ -386,14 +341,9 @@ describe('appInfoTest', function () { ...@@ -386,14 +341,9 @@ describe('appInfoTest', function () {
* @tc.desc set keep screen on false * @tc.desc set keep screen on false
*/ */
it('set_keep_screen_on_false', 0, async function () { it('set_keep_screen_on_false', 0, async function () {
let execSucc = false;
let execComplete = false;
let sleepTime = 35 * 1000; let sleepTime = 35 * 1000;
brightness.setKeepScreenOn({ brightness.setKeepScreenOn({
keepScreenOn: false, keepScreenOn: false,
success: () => {
execSucc = true;
},
fail: (data, code) => { fail: (data, code) => {
console.log("set_keep_screen_on_false, data: " + data + ", code: " + code); console.log("set_keep_screen_on_false, data: " + data + ", code: " + code);
expect().assertFail(); expect().assertFail();
...@@ -403,8 +353,6 @@ describe('appInfoTest', function () { ...@@ -403,8 +353,6 @@ describe('appInfoTest', function () {
console.log("The device information is obtained successfully. Procedure"); console.log("The device information is obtained successfully. Procedure");
} }
}); });
expect(execSucc).assertTrue();
expect(execComplete).assertTrue();
await sleep(sleepTime); await sleep(sleepTime);
power.isScreenOn().then(screenOn => { power.isScreenOn().then(screenOn => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册