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

!6608 radiostatistic测试套整改

Merge pull request !6608 from zhangfuzhi/master
...@@ -12,9 +12,9 @@ ...@@ -12,9 +12,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import { Hypium } from 'hypium/index' import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test' import testsuite from '../test/List.test';
export default { export default {
onCreate() { onCreate() {
......
/** /**
* Copyright (C) 2021 Huawei Device Co., Ltd. * Copyright (C) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License") * Licensed under the Apache License, Version 2.0 (the "License")
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'hypium/index' import {describe, it, expect} from '@ohos/hypium';
import data from '@ohos.telephony.data'; import data from '@ohos.telephony.data';
...@@ -22,7 +22,7 @@ export function toString(data) { ...@@ -22,7 +22,7 @@ export function toString(data) {
} else { } else {
return data; return data;
} }
} };
export default function dataJsunit() { export default function dataJsunit() {
describe('dataTest', function () { describe('dataTest', function () {
...@@ -158,8 +158,6 @@ export default function dataJsunit() { ...@@ -158,8 +158,6 @@ export default function dataJsunit() {
console.log(`==========> ${caseName} Test end ==========>`); console.log(`==========> ${caseName} Test end ==========>`);
done(); done();
}); });
}); });
} }
......
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,16 +13,14 @@ ...@@ -13,16 +13,14 @@
* limitations under the License. * limitations under the License.
*/ */
//other import import convertOptionsJsunit from './ConvertOptionsJsunit.test';
import convertOptionsJsunit from './ConvertOptionsJsunit.test.ets' import radioJsunit from './RadioJsunit.test';
import radioJsunit from './RadioJsunit.test.ets' import radioSecondJsunit from './RadioSecondJsunit.test';
import radioSecondJsunit from './RadioSecondJsunit.test.ets' import smsUiJsunit from './SmsMmsJsunit.test';
import smsUiJsunit from './SmsMmsJsunit.test.ets'; import callJsunit from './CallJsunit.test';
import callJsunit from './CallJsunit.test.ets'; import dataJsunit from './DataJsunit.test';
import dataJsunit from './DataJsunit.test.ets';
export default function testsuite() { export default function testsuite() {
//other
dataJsunit(); dataJsunit();
smsUiJsunit(); smsUiJsunit();
convertOptionsJsunit(); convertOptionsJsunit();
......
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -14,37 +13,29 @@ ...@@ -14,37 +13,29 @@
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import { describe, expect, it } from '@ohos/hypium';
import radio from '@ohos.telephony.radio'; import radio from '@ohos.telephony.radio';
import utils from './Utils.ets'
export default function radioJsunit() { export default function radioJsunit() {
describe('ActsNetworkSearchTest',function () { describe('ActsNetworkSearchTest', function () {
const SLOT_2 = -1;
const SLOT_0 = 0; const SLOT_0 = 0;
/** /**
* @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0200 * @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0200
* @tc.name Test getPrimarySlotId(-1) to check the callback result * @tc.name Test getPrimarySlotId(-1) to check the callback result
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_NetworkSearch_getPrimarySlotId_Async_0200', 0, async function (done) { it('Telephony_NetworkSearch_getPrimarySlotId_Async_0200', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
radio.getPrimarySlotId((err, data) => { radio.getPrimarySlotId((err, data) => {
if (err) { if (err) {
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Async_0200 fail: ${err}`); console.log("Telephony_NetworkSearch_getPrimarySlotId_Async_0200 err:" + JSON.stringify(err));
expect(data === undefined).assertTrue(); expect(false).assertTrue();
done(); done();
return; return;
} }
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Async_0200 end data: ${data}`); console.log("Telephony_NetworkSearch_getPrimarySlotId_Async_0200 data:" + JSON.stringify(data));
expect(data === '').assertTrue(); expect(data == 0 || data == 1).assertTrue();
done(); done();
}); });
}); });
...@@ -55,22 +46,16 @@ export default function radioJsunit() { ...@@ -55,22 +46,16 @@ export default function radioJsunit() {
* @tc.desc Test getPrimarySlotId api by promise. * @tc.desc Test getPrimarySlotId api by promise.
*/ */
it('Telephony_NetworkSearch_getPrimarySlotId_Promise_0200', 0, async function (done) { it('Telephony_NetworkSearch_getPrimarySlotId_Promise_0200', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
try { try {
let data = await radio.getPrimarySlotId(); let data = await radio.getPrimarySlotId();
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 pass data: ${data}`); console.log("Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 data:" + JSON.stringify(data));
expect(true).assertTrue(); expect(data == 0 || data == 1).assertTrue();
done();
} catch (err) { } catch (err) {
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 fail err: ${err}`); console.log("Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 err:" + JSON.stringify(err));
expect().assertFail(); expect(false).assertTrue();
done(); done();
return;
} }
done();
}); });
/** /**
...@@ -79,163 +64,17 @@ export default function radioJsunit() { ...@@ -79,163 +64,17 @@ export default function radioJsunit() {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_NetworkSearch_isNrSupported_Promise_0400', 0, async function (done) { it('Telephony_NetworkSearch_isNrSupported_Promise_0400', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
try { try {
await radio.isNrSupported(SLOT_0); let result = radio.isNrSupported();
console.log('radio.isNrSupported(SLOT_0) = ' + radio.isNrSupported(SLOT_0)); console.log("Result: " + result);
console.log('Telephony_NetworkSearch_isNrSupported_Promise_0400 success'); let result0 = radio.isNrSupported(SLOT_0);
console.log("Result0: " + result0);
done(); done();
} catch (err) { } catch (err) {
console.log(`Telephony_NetworkSearch_isNrSupported_Promise_0400 fail ${err}`); console.log("Telephony_NetworkSearch_isNrSupported_Promise_0400 err" + JSON.stringify(err));
done(); expect(false).assertTrue();
}
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_0500
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_0500', 0, async function (done) {
console.info("Telephony_radio_PreferredNetworkMode_0500 start")
if(utils.notCheck){
done();
return;
}
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_WCDMA === 2).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE === 3).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_WCDMA === 4).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM === 5).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_WCDMA_GSM === 6).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0500 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_0600
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_0600', 0, async function (done) {
if(utils.notCheck){
done(); done();
return;
} }
console.info("Telephony_radio_PreferredNetworkMode_0600 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_CDMA === 7).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_EVDO === 8).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_EVDO_CDMA === 9).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_WCDMA_GSM_EVDO_CDMA === 10).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_EVDO_CDMA === 11).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0600 end")
done();
}); });
/**
* @tc.number Telephony_radio_PreferredNetworkMode_0700
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_0700', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
console.info("Telephony_radio_PreferredNetworkMode_0700 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_WCDMA_GSM_EVDO_CDMA === 12).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA === 13).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_GSM === 14).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA === 15).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM === 16).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0700 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_0800
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_0800', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
console.info("Telephony_radio_PreferredNetworkMode_0800 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA === 17).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM === 18).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA === 19).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM === 20).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA ===21).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0800 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_0900
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_0900', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
console.info("Telephony_radio_PreferredNetworkMode_0900 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA === 17).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_GSM === 18).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA === 19).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM === 20).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_TDSCDMA_WCDMA_GSM_EVDO_CDMA ===21).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_0900 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_1000
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_1000', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
console.info("Telephony_radio_PreferredNetworkMode_1000 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA === 22).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR === 31).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE === 32).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_WCDMA === 33).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM ===34).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_1000 end")
done();
});
/**
* @tc.number Telephony_radio_PreferredNetworkMode_1100
* @tc.name Test The PreferredNetworkMode enum
* @tc.desc Function test
*/
it('Telephony_radio_PreferredNetworkMode_1100', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
console.info("Telephony_radio_PreferredNetworkMode_1100 start")
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_EVDO_CDMA === 35).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_WCDMA_GSM_EVDO_CDMA === 36).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA === 37).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_GSM === 38).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA ===39).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM === 40).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_NR_LTE_TDSCDMA_WCDMA_GSM_EVDO_CDMA === 41).assertTrue();
expect(PreferredNetworkMode.PREFERRED_NETWORK_MODE_MAX_VALUE === 99).assertTrue();
console.info("Telephony_radio_PreferredNetworkMode_1100 end")
done();
});
}) })
} }
// @ts-nocheck
/** /**
* Copyright (c) 2021 Huawei Device Co., Ltd. * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
* You may obtain a copy of the License at * You may obtain a copy of the License at
...@@ -13,28 +12,16 @@ ...@@ -13,28 +12,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"; import { describe, expect, it } from '@ohos/hypium';
import mms from '@ohos.telephony.sms'; import sms from '@ohos.telephony.sms';
import utils from './Utils.ets'
export default function smsUiJsunit() {
describe('appInfoTest', function () {
const SMS_SEND_DST_NUMBER = ''; export default function smsUiJsunit() {
const TRUE_SLOT_ID = 0; describe('smsUiJsunit', function () {
const FALSE_SLOT_ID = 9;
const OTHER_SLOT_ID = 1;
const SECOND_SLOT_ID = 2;
const IDENTIFIER_MIN = 0;
const IDENTIFIER_MAX = 0xFFFF;
const RANTYPE_GSM = 1;
const RANTYPE_CDMA = 2;
const RANTYPE_ERROR = 3;
var rawArray = [ var rawArray = [
0x08, 0x91, 0x68, 0x31, 0x08, 0x20, 0x00, 0x75, 0xF4, 0x24, 0x0D, 0x91, 0x08, 0x91, 0x68, 0x31, 0x08, 0x20, 0x00, 0x75, 0xF4, 0x24, 0x0D, 0x91,
0x68, 0x81, 0x29, 0x56, 0x29, 0x83, 0xF6, 0x00, 0x00, 0x12, 0x40, 0x80, 0x68, 0x81, 0x29, 0x56, 0x29, 0x83, 0xF6, 0x00, 0x00, 0x12, 0x40, 0x80,
0x01, 0x02, 0x14, 0x23, 0x02, 0xC1, 0x30 0x01, 0x02, 0x14, 0x23, 0x02, 0xC1, 0x30
] ];
/* /*
...@@ -45,11 +32,6 @@ export default function smsUiJsunit() { ...@@ -45,11 +32,6 @@ export default function smsUiJsunit() {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_SmsMms_createMessage_Async_0100', 0, async function (done) { it('Telephony_SmsMms_createMessage_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp', (err, shortMessage) => { sms.createMessage(rawArray, '3gpp', (err, shortMessage) => {
if (err) { if (err) {
expect().assertFail(); expect().assertFail();
...@@ -57,18 +39,29 @@ export default function smsUiJsunit() { ...@@ -57,18 +39,29 @@ export default function smsUiJsunit() {
done(); done();
return; return;
} }
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue(); console.log("dxj fail shortMessage:" + JSON.stringify(shortMessage));
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue(); expect(shortMessage.visibleMessageBody == "Aa").assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue(); console.log("dxj fail visibleMessageBody:" + shortMessage.visibleMessageBody);
expect(shortMessage.protocolId === 0).assertTrue(); expect(shortMessage.visibleRawAddress.length !== 0).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue(); console.log("dxj fail visibleRawAddress:" + shortMessage.visibleRawAddress);
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue(); expect(shortMessage.messageClass !== -1).assertTrue();
console.log("dxj fail messageClass:" + shortMessage.messageClass);
expect(shortMessage.protocolId !== -1).assertTrue();
console.log("dxj fail protocolId:" + shortMessage.protocolId);
expect(shortMessage.scAddress.length !== 0).assertTrue();
console.log("dxj fail scAddress:" + shortMessage.scAddress);
expect(shortMessage.scTimestamp !== 0).assertTrue();
console.log("dxj fail scTimestamp:" + shortMessage.scTimestamp);
expect(shortMessage.isReplaceMessage).assertFalse(); expect(shortMessage.isReplaceMessage).assertFalse();
console.log("dxj fail isReplaceMessage:" + shortMessage.isReplaceMessage);
expect(shortMessage.hasReplyPath).assertFalse(); expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue(); console.log("dxj fail hasReplyPath:" + shortMessage.hasReplyPath);
expect(shortMessage.status === 0).assertTrue(); expect(shortMessage.pdu == undefined).assertFalse();
console.log("dxj fail pdu:" + shortMessage.pdu);
expect(shortMessage.status !== -1).assertTrue();
console.log("dxj fail status:" + shortMessage.status);
expect(shortMessage.isSmsStatusReportMessage).assertTrue(); expect(shortMessage.isSmsStatusReportMessage).assertTrue();
console.log('Telephony_SmsMms_createMessage_Async_0100 finish'); console.log("dxj fail isSmsStatusReportMessage:" + shortMessage.isSmsStatusReportMessage);
done(); done();
}); });
}); });
...@@ -81,50 +74,24 @@ export default function smsUiJsunit() { ...@@ -81,50 +74,24 @@ export default function smsUiJsunit() {
* shortMessage Don't empty * shortMessage Don't empty
*/ */
it('Telephony_SmsMms_createMessage_Promise_0100', 0, async function (done) { it('Telephony_SmsMms_createMessage_Promise_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp').then(shortMessage => { sms.createMessage(rawArray, '3gpp').then(shortMessage => {
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue(); expect(shortMessage.visibleMessageBody == "Aa").assertTrue();
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue(); expect(shortMessage.visibleRawAddress.length !== 0).assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue(); expect(shortMessage.messageClass !== -1).assertTrue();
expect(shortMessage.protocolId === 0).assertTrue(); expect(shortMessage.protocolId !== -1).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue(); expect(shortMessage.scAddress.length !== 0).assertTrue();
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue(); expect(shortMessage.scTimestamp !== 0).assertTrue();
expect(shortMessage.isReplaceMessage).assertFalse(); expect(shortMessage.isReplaceMessage).assertFalse();
expect(shortMessage.hasReplyPath).assertFalse(); expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue(); expect(shortMessage.pdu == undefined).assertFalse();
expect(shortMessage.status === 0).assertTrue(); expect(shortMessage.status !== -1).assertTrue();
expect(shortMessage.isSmsStatusReportMessage).assertTrue(); expect(shortMessage.isSmsStatusReportMessage).assertTrue();
console.log('Telephony_SmsMms_createMessage_Promise_0100 finish');
done(); done();
}).catch(err => { }).catch(err => {
expect().assertFail(); expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Promise_0100 fail'); console.log('Telephony_SmsMms_createMessage_Promise_0100 fail' + JSON.stringify(err));
done(); done();
return;
});
}); });
/*
* @tc.number Telephony_SmsMms_getSmsEncodingScheme_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSmsEncodingScheme_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.SMS_ENCODING_UNKNOWN == 0).assertTrue();
expect(sms.SMS_ENCODING_7BIT == 1).assertTrue();
expect(sms.SMS_ENCODING_8BIT == 2).assertTrue();
expect(sms.SMS_ENCODING_16BIT == 3).assertTrue();
done();
}); });
/* /*
...@@ -133,18 +100,10 @@ export default function smsUiJsunit() { ...@@ -133,18 +100,10 @@ export default function smsUiJsunit() {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_SmsMms_getSendSmsResult_Async_0100', 0, async function (done) { it('Telephony_SmsMms_getSendSmsResult_Async_0100', 0, async function (done) {
if (true) { expect(sms.SendSmsResult.SEND_SMS_SUCCESS == 0).assertTrue();
expect(true).assertTrue(); expect(sms.SendSmsResult.SEND_SMS_FAILURE_UNKNOWN == 1).assertTrue();
done(); expect(sms.SendSmsResult.SEND_SMS_FAILURE_RADIO_OFF == 2).assertTrue();
return; expect(sms.SendSmsResult.SEND_SMS_FAILURE_SERVICE_UNAVAILABLE == 3).assertTrue();
}
expect(sms.SEND_SMS_SUCCESS == 0).assertTrue();
expect(sms.SEND_SMS_FAILURE_UNKNOWN == 1).assertTrue();
expect(sms.SEND_SMS_FAILURE_RADIO_OFF == 2).assertTrue();
expect(sms.SEND_SMS_FAILURE_SERVICE_UNAVAILABLE == 3).assertTrue();
expect(sms.SIM_MESSAGE_STATUS_FREE == 0).assertTrue();
expect(sms.INSTANT_MESSAGE == 1).assertTrue();
expect(sms.OPTIONAL_MESSAGE == 2).assertTrue();
done(); done();
}); });
...@@ -154,41 +113,11 @@ export default function smsUiJsunit() { ...@@ -154,41 +113,11 @@ export default function smsUiJsunit() {
* @tc.desc Function test * @tc.desc Function test
*/ */
it('Telephony_SmsMms_ShortMessageClass_Async_0100', 0, async function (done) { it('Telephony_SmsMms_ShortMessageClass_Async_0100', 0, async function (done) {
if (true) { expect(sms.ShortMessageClass.UNKNOWN == 0).assertTrue();
expect(true).assertTrue(); expect(sms.ShortMessageClass.INSTANT_MESSAGE == 1).assertTrue();
done(); expect(sms.ShortMessageClass.OPTIONAL_MESSAGE == 2).assertTrue();
return; expect(sms.ShortMessageClass.SIM_MESSAGE == 3).assertTrue();
} expect(sms.ShortMessageClass.FORWARD_MESSAGE == 4).assertTrue();
expect(sms.SIM_MESSAGE_STATUS_FREE == 0).assertTrue();
expect(sms.INSTANT_MESSAGE == 1).assertTrue();
expect(sms.OPTIONAL_MESSAGE == 2).assertTrue();
done();
});
/*
* @tc.number Telephony_SmsMms_getMmsCharSets_Async_0100
* @tc.name
* @tc.desc Function test
*/
it('Telephony_SmsMms_getMmsCharSets_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
expect(sms.BIG5 == 0X07EA).assertTrue();
expect(sms.ISO_10646_UCS_2 == 0X03E8).assertTrue();
expect(sms.ISO_8859_1 == 0X04).assertTrue();
expect(sms.ISO_8859_2 == 0X05).assertTrue();
expect(sms.ISO_8859_3 == 0X06).assertTrue();
expect(sms.ISO_8859_4 == 0X07).assertTrue();
expect(sms.ISO_8859_5 == 0X08).assertTrue();
expect(sms.ISO_8859_6 == 0X09).assertTrue();
expect(sms.ISO_8859_7 == 0X10).assertTrue();
expect(sms.ISO_8859_8 == 0X12).assertTrue();
expect(sms.ISO_8859_9 == 0X13).assertTrue();
expect(sms.SHIFT_JIS == 0X11).assertTrue();
expect(sms.US_ASCII == 0X03).assertTrue();
expect(sms.UTF_8 == 0X6A).assertTrue();
done(); done();
}); });
}) })
......
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static notCheck = true;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
return this.rect_value = {
"left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
}
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
static async drags(downX, downY, upX, upY, steps, drag) {
var xStep;
var yStep;
var swipeSteps;
var ret;
xStep = 0;
yStep = 0;
ret = false;
swipeSteps = steps;
if (swipeSteps == 0) {
swipeSteps = 1;
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
if (drag) {
await this.sleep(500)
}
for (var i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
if (drag) {
await this.sleep(100)
}
var upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
}
/**
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// sim slot id
export const DEFAULT_SLOTID = 0;
export const SLOTID3 = 3;
export const SLOTID2 = 2;
export const SLOTID_MINUS1 = -1;
// sim correct password
export const CORRECT_PIN = '1234';
export const CORRECT_PIN2 = '18099014';
// sim incorrect password
export const INCORRECT_PIN = '134679';
export const INCORRECT_PIN_LEN3 = '123';
export const INCORRECT_PUK = '134679';
export const INCORRECT_PIN2 = '134679';
export const INCORRECT_PIN2_LEN3 = '123';
export const INCORRECT_PIN2_LEN9 = '123456789';
export const INCORRECT_PUK2 = '134679';
// lock status response
export const LOCK_RESULT = { SUCCESS: 0, FAILURE: -1, EXCEPTION: -2 };
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册