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

!6610 radiostatistic测试套整改

Merge pull request !6610 from zhangfuzhi/monthly_20221018
......@@ -12,9 +12,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
import { Hypium } from 'hypium/index'
import testsuite from '../test/List.test'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry';
import { Hypium } from '@ohos/hypium';
import testsuite from '../test/List.test';
export default {
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")
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -12,7 +12,7 @@
* See the License for the specific language governing permissions and
* 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';
......@@ -22,7 +22,7 @@ export function toString(data) {
} else {
return data;
}
}
};
export default function dataJsunit() {
describe('dataTest', function () {
......@@ -158,8 +158,6 @@ export default function dataJsunit() {
console.log(`==========> ${caseName} Test end ==========>`);
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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -13,16 +13,14 @@
* limitations under the License.
*/
//other import
import convertOptionsJsunit from './ConvertOptionsJsunit.test.ets'
import radioJsunit from './RadioJsunit.test.ets'
import radioSecondJsunit from './RadioSecondJsunit.test.ets'
import smsUiJsunit from './SmsMmsJsunit.test.ets';
import callJsunit from './CallJsunit.test.ets';
import dataJsunit from './DataJsunit.test.ets';
import convertOptionsJsunit from './ConvertOptionsJsunit.test';
import radioJsunit from './RadioJsunit.test';
import radioSecondJsunit from './RadioSecondJsunit.test';
import smsUiJsunit from './SmsMmsJsunit.test';
import callJsunit from './CallJsunit.test';
import dataJsunit from './DataJsunit.test';
export default function testsuite() {
//other
dataJsunit();
smsUiJsunit();
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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -14,228 +13,68 @@
* 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 utils from './Utils.ets'
export default function radioJsunit() {
describe('ActsNetworkSearchTest',function () {
describe('ActsNetworkSearchTest', function () {
const SLOT_2 = -1;
const SLOT_0 = 0;
/**
* @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0200
* @tc.name Test getPrimarySlotId(-1) to check the callback result
* @tc.desc Function test
* @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0200
* @tc.name Test getPrimarySlotId(-1) to check the callback result
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_getPrimarySlotId_Async_0200', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
radio.getPrimarySlotId((err, data) => {
if (err) {
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Async_0200 fail: ${err}`);
expect(data === undefined).assertTrue();
console.log("Telephony_NetworkSearch_getPrimarySlotId_Async_0200 err:" + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Async_0200 end data: ${data}`);
expect(data === '').assertTrue();
console.log("Telephony_NetworkSearch_getPrimarySlotId_Async_0200 data:" + JSON.stringify(data));
expect(data == 0 || data == 1).assertTrue();
done();
});
});
/**
* @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0300
* @tc.name testGetPrimarySlotId_0300
* @tc.desc Test getPrimarySlotId api by promise.
* @tc.number Telephony_NetworkSearch_getPrimarySlotId_Async_0300
* @tc.name testGetPrimarySlotId_0300
* @tc.desc Test getPrimarySlotId api by promise.
*/
it('Telephony_NetworkSearch_getPrimarySlotId_Promise_0200', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
try {
let data = await radio.getPrimarySlotId();
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 pass data: ${data}`);
expect(true).assertTrue();
} catch (err) {
console.log(`Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 fail err: ${err}`);
expect().assertFail();
done();
return;
}
done();
});
/**
* @tc.number Telephony_NetworkSearch_isNrSupported_Promise_0400
* @tc.name Test The function setPrimarySlotId(0)
* @tc.desc Function test
*/
it('Telephony_NetworkSearch_isNrSupported_Promise_0400', 0, async function (done) {
if(utils.notCheck){
done();
return;
}
try {
await radio.isNrSupported(SLOT_0);
console.log('radio.isNrSupported(SLOT_0) = ' + radio.isNrSupported(SLOT_0));
console.log('Telephony_NetworkSearch_isNrSupported_Promise_0400 success');
let data = await radio.getPrimarySlotId();
console.log("Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 data:" + JSON.stringify(data));
expect(data == 0 || data == 1).assertTrue();
done();
} catch (err) {
console.log(`Telephony_NetworkSearch_isNrSupported_Promise_0400 fail ${err}`);
done();
}
});
/**
* @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){
console.log("Telephony_NetworkSearch_getPrimarySlotId_Promise_0200 err:" + JSON.stringify(err));
expect(false).assertTrue();
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
* @tc.number Telephony_NetworkSearch_isNrSupported_Promise_0400
* @tc.name Test The function setPrimarySlotId(0)
* @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){
it('Telephony_NetworkSearch_isNrSupported_Promise_0400', 0, async function (done) {
try {
let result = radio.isNrSupported();
console.log("Result: " + result);
let result0 = radio.isNrSupported(SLOT_0);
console.log("Result0: " + result0);
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){
} catch (err) {
console.log("Telephony_NetworkSearch_isNrSupported_Promise_0400 err" + JSON.stringify(err));
expect(false).assertTrue();
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");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
......@@ -13,30 +12,18 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import mms from '@ohos.telephony.sms';
import utils from './Utils.ets'
import { describe, expect, it } from '@ohos/hypium';
import sms from '@ohos.telephony.sms';
export default function smsUiJsunit() {
describe('appInfoTest', function () {
const SMS_SEND_DST_NUMBER = '';
const TRUE_SLOT_ID = 0;
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;
describe('smsUiJsunit', function () {
var rawArray = [
0x08, 0x91, 0x68, 0x31, 0x08, 0x20, 0x00, 0x75, 0xF4, 0x24, 0x0D, 0x91,
0x68, 0x81, 0x29, 0x56, 0x29, 0x83, 0xF6, 0x00, 0x00, 0x12, 0x40, 0x80,
0x01, 0x02, 0x14, 0x23, 0x02, 0xC1, 0x30
]
];
/*
* @tc.number Telephony_SmsMms_createMessage_Async_0100
* @tc.name Call interface CreateMessage,
......@@ -45,11 +32,6 @@ export default function smsUiJsunit() {
* @tc.desc Function test
*/
it('Telephony_SmsMms_createMessage_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp', (err, shortMessage) => {
if (err) {
expect().assertFail();
......@@ -57,74 +39,59 @@ export default function smsUiJsunit() {
done();
return;
}
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue();
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue();
expect(shortMessage.protocolId === 0).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue();
console.log("dxj fail shortMessage:" + JSON.stringify(shortMessage));
expect(shortMessage.visibleMessageBody == "Aa").assertTrue();
console.log("dxj fail visibleMessageBody:" + shortMessage.visibleMessageBody);
expect(shortMessage.visibleRawAddress.length !== 0).assertTrue();
console.log("dxj fail visibleRawAddress:" + shortMessage.visibleRawAddress);
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();
console.log("dxj fail isReplaceMessage:" + shortMessage.isReplaceMessage);
expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue();
expect(shortMessage.status === 0).assertTrue();
console.log("dxj fail hasReplyPath:" + shortMessage.hasReplyPath);
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();
console.log('Telephony_SmsMms_createMessage_Async_0100 finish');
console.log("dxj fail isSmsStatusReportMessage:" + shortMessage.isSmsStatusReportMessage);
done();
});
});
/*
* @tc.number Telephony_SmsMms_createMessage_Async_0300
* @tc.name testCreateMessage_0300
* @tc.desc Call interface CreateMessage,
* pass in the PDU(rawArray) in line with the coding specification, the specification is 3GPP,
* shortMessage Don't empty
*/
/*
* @tc.number Telephony_SmsMms_createMessage_Async_0300
* @tc.name testCreateMessage_0300
* @tc.desc Call interface CreateMessage,
* pass in the PDU(rawArray) in line with the coding specification, the specification is 3GPP,
* shortMessage Don't empty
*/
it('Telephony_SmsMms_createMessage_Promise_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
sms.createMessage(rawArray, '3gpp').then(shortMessage => {
expect(shortMessage.visibleMessageBody === MESSAGEBODY).assertTrue();
expect(shortMessage.visibleRawAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.messageClass === sms.FORWARD_MESSAGE).assertTrue();
expect(shortMessage.protocolId === 0).assertTrue();
expect(shortMessage.scAddress.length === ADDR_LENGTH).assertTrue();
expect(shortMessage.scTimestamp === SC_TIMESTAMP).assertTrue();
expect(shortMessage.visibleMessageBody == "Aa").assertTrue();
expect(shortMessage.visibleRawAddress.length !== 0).assertTrue();
expect(shortMessage.messageClass !== -1).assertTrue();
expect(shortMessage.protocolId !== -1).assertTrue();
expect(shortMessage.scAddress.length !== 0).assertTrue();
expect(shortMessage.scTimestamp !== 0).assertTrue();
expect(shortMessage.isReplaceMessage).assertFalse();
expect(shortMessage.hasReplyPath).assertFalse();
expect(shortMessage.pdu.length > 0).assertTrue();
expect(shortMessage.status === 0).assertTrue();
expect(shortMessage.pdu == undefined).assertFalse();
expect(shortMessage.status !== -1).assertTrue();
expect(shortMessage.isSmsStatusReportMessage).assertTrue();
console.log('Telephony_SmsMms_createMessage_Promise_0100 finish');
done();
}).catch(err => {
expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Promise_0100 fail');
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();
expect().assertFail();
console.log('Telephony_SmsMms_createMessage_Promise_0100 fail' + JSON.stringify(err));
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() {
* @tc.desc Function test
*/
it('Telephony_SmsMms_getSendSmsResult_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
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();
expect(sms.SendSmsResult.SEND_SMS_SUCCESS == 0).assertTrue();
expect(sms.SendSmsResult.SEND_SMS_FAILURE_UNKNOWN == 1).assertTrue();
expect(sms.SendSmsResult.SEND_SMS_FAILURE_RADIO_OFF == 2).assertTrue();
expect(sms.SendSmsResult.SEND_SMS_FAILURE_SERVICE_UNAVAILABLE == 3).assertTrue();
done();
});
......@@ -154,41 +113,11 @@ export default function smsUiJsunit() {
* @tc.desc Function test
*/
it('Telephony_SmsMms_ShortMessageClass_Async_0100', 0, async function (done) {
if (true) {
expect(true).assertTrue();
done();
return;
}
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();
expect(sms.ShortMessageClass.UNKNOWN == 0).assertTrue();
expect(sms.ShortMessageClass.INSTANT_MESSAGE == 1).assertTrue();
expect(sms.ShortMessageClass.OPTIONAL_MESSAGE == 2).assertTrue();
expect(sms.ShortMessageClass.SIM_MESSAGE == 3).assertTrue();
expect(sms.ShortMessageClass.FORWARD_MESSAGE == 4).assertTrue();
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.
先完成此消息的编辑!
想要评论请 注册