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

!10001 【杂散】【输入法框架】【时间时区】新增input和time同步几口用例,优化beforall函数

Merge pull request !10001 from 张育帅/master
...@@ -25,6 +25,5 @@ export default class InputDemoService extends InputMethodExtensionAbility { ...@@ -25,6 +25,5 @@ export default class InputDemoService extends InputMethodExtensionAbility {
onDestroy() { onDestroy() {
console.log("onDestroy inputStageService**"); console.log("onDestroy inputStageService**");
this.keyboardDelegate.onDestroy();
} }
} }
\ No newline at end of file
...@@ -925,7 +925,7 @@ export class KeyboardController { ...@@ -925,7 +925,7 @@ export class KeyboardController {
} }
commoneventmanager.publish("inputMethodEngine_test_074", commonEventPublishData, this.publishCallback); commoneventmanager.publish("inputMethodEngine_test_074", commonEventPublishData, this.publishCallback);
clearTimeout(t); clearTimeout(t);
},500); },700);
} }
private inputMethodEngine_test_076(): void{ private inputMethodEngine_test_076(): void{
......
...@@ -27,6 +27,5 @@ export default class InputKeyService extends InputMethodExtensionAbility { ...@@ -27,6 +27,5 @@ export default class InputKeyService extends InputMethodExtensionAbility {
onDestroy() { onDestroy() {
console.log("onDestroy InputKeyService**"); console.log("onDestroy InputKeyService**");
this.context.destroy();
} }
} }
\ No newline at end of file
...@@ -24,8 +24,15 @@ struct Index { ...@@ -24,8 +24,15 @@ struct Index {
@State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' + @State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' +
'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' + 'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' +
'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' + 'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' +
'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21'; 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20input' +
'MethodEngine21inputMethodEngine22inputMethodEngine23inputMethodEngine24inputMethodEngine25inputMethodEngine26inp' +
'utMethodEngine27inputMethodEngine28inputMethodEngine29inputMethodEngine30inputMethodEngine31inputMethodEngine32i' +
'nputMethodEngine33inputMethodEngine34inputMethodEngine35inputMethodEngine36inputMethodEngine37inputMethodEngine3' +
'8inputMethodEngine39inputMethodEngine40inputMethodEngine41inputMethodEngine42inputMethodEngine43inputMethodEngine' +
'44inputMethodEngine45inputMethodEngine46inputMethodEngine47inputMethodEngine48inputMethodEngine49inputMethodEngi' +
'ne50inputMethodEngine51inputMethodEngine52inputMethodEngine53inputMethodEngine54inputMethodEngine55inputMethodEngi' +
'ne5inputMethodEngine57inputMethodEngine58inputMethodEngine59inputMethodEngine60inputMethodEngine61inputMethodEn' +
'gine62inputMethodEngine63inputMethodEngine64inputMethodEngine65inputMethodEngine66';
build() { build() {
Row() { Row() {
Column() { Column() {
...@@ -34,6 +41,7 @@ struct Index { ...@@ -34,6 +41,7 @@ struct Index {
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
.defaultFocus(true) .defaultFocus(true)
TextArea({ text: this.inputValue }) TextArea({ text: this.inputValue })
.height('80%')
.onChange((value: string) => { .onChange((value: string) => {
this.inputValue = value; this.inputValue = value;
}) })
......
...@@ -79,8 +79,8 @@ export default function inputMethodEngineJSUnit() { ...@@ -79,8 +79,8 @@ export default function inputMethodEngineJSUnit() {
}) })
let dis = display.getDefaultDisplaySync(); let dis = display.getDefaultDisplaySync();
let w = dis.width / 2; let w = dis.width * 0.5;
let h = dis.height /2; let h = Math.round(dis.height * 0.4);
let getFocusCmd = `uinput -T -c ${w} ${h}`; let getFocusCmd = `uinput -T -c ${w} ${h}`;
let abilityDelegator; let abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
......
...@@ -79,8 +79,8 @@ export default function inputMethodEngineKeyJSUnit() { ...@@ -79,8 +79,8 @@ export default function inputMethodEngineKeyJSUnit() {
}) })
let dis = display.getDefaultDisplaySync(); let dis = display.getDefaultDisplaySync();
let w = dis.width / 2; let w = dis.width * 0.5;
let h = dis.height /2; let h = Math.round(dis.height * 0.4);
let getFocusCmd = `uinput -T -c ${w} ${h}` let getFocusCmd = `uinput -T -c ${w} ${h}`
let abilityDelegator; let abilityDelegator;
abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
......
...@@ -28,25 +28,28 @@ export default function imeAbilityTest(abilityContext) { ...@@ -28,25 +28,28 @@ export default function imeAbilityTest(abilityContext) {
/** /**
* beforeEach: Prerequisites at the test case level, which are executed before each test case is executed. * beforeEach: Prerequisites at the test case level, which are executed before each test case is executed.
*/ */
beforeAll(function () { beforeAll(function (done) {
let inputM = inputMethod.getCurrentInputMethod() let inputM = inputMethod.getCurrentInputMethod()
console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM)); console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM));
prop.packageName = inputM.packageName; prop.packageName = inputM.packageName;
prop.methodId = inputM.methodId; prop.methodId = inputM.methodId;
prop.name = inputM.packageName; prop.name = inputM.packageName;
prop.id = inputM.methodId; prop.id = inputM.methodId;
done();
}); });
/** /**
* afterEach: Test case-level clearance conditions, which are executed after each test case is executed. * afterEach: Test case-level clearance conditions, which are executed after each test case is executed.
*/ */
afterAll(async function () { afterAll(async function (done) {
console.info('====>afterAll: switchInputMethod to origionInput.' + JSON.stringify(prop)); console.info('====>afterAll: switchInputMethod to origionInput.' + JSON.stringify(prop));
await inputMethod.switchInputMethod(prop).then((data)=>{ await inputMethod.switchInputMethod(prop).then((data)=>{
console.info('====>afterAll switchInputMethod to origionInput :' + data); console.info('====>afterAll switchInputMethod to origionInput :' + data);
expect(data == true).assertTrue(); expect(data == true).assertTrue();
done();
}).catch(err =>{ }).catch(err =>{
console.info('====>afterAll switchInputMethod to origionInput error: ' + err); console.info('====>afterAll switchInputMethod to origionInput error: ' + err);
done();
}) })
}); });
......
...@@ -24,7 +24,15 @@ struct Index { ...@@ -24,7 +24,15 @@ struct Index {
@State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' + @State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' +
'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' + 'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' +
'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' + 'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' +
'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21'; 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20input' +
'MethodEngine21inputMethodEngine22inputMethodEngine23inputMethodEngine24inputMethodEngine25inputMethodEngine26inp' +
'utMethodEngine27inputMethodEngine28inputMethodEngine29inputMethodEngine30inputMethodEngine31inputMethodEngine32i' +
'nputMethodEngine33inputMethodEngine34inputMethodEngine35inputMethodEngine36inputMethodEngine37inputMethodEngine3' +
'8inputMethodEngine39inputMethodEngine40inputMethodEngine41inputMethodEngine42inputMethodEngine43inputMethodEngine' +
'44inputMethodEngine45inputMethodEngine46inputMethodEngine47inputMethodEngine48inputMethodEngine49inputMethodEngi' +
'ne50inputMethodEngine51inputMethodEngine52inputMethodEngine53inputMethodEngine54inputMethodEngine55inputMethodEngi' +
'ne5inputMethodEngine57inputMethodEngine58inputMethodEngine59inputMethodEngine60inputMethodEngine61inputMethodEn' +
'gine62inputMethodEngine63inputMethodEngine64inputMethodEngine65inputMethodEngine66';
build() { build() {
Row() { Row() {
...@@ -34,6 +42,7 @@ struct Index { ...@@ -34,6 +42,7 @@ struct Index {
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
.defaultFocus(true) .defaultFocus(true)
TextArea({ text: this.inputValue }) TextArea({ text: this.inputValue })
.height('80%')
.onChange((value: string) => { .onChange((value: string) => {
this.inputValue = value; this.inputValue = value;
}) })
......
...@@ -26,9 +26,10 @@ export default function inputMethodNormalJSUnit() { ...@@ -26,9 +26,10 @@ export default function inputMethodNormalJSUnit() {
let getFocusCmd = ''; let getFocusCmd = '';
let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
display_info = display.getDefaultDisplaySync(); display_info = display.getDefaultDisplaySync();
getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${display_info.height*0.5}`; getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${ Math.round(display_info.height*0.4) }`;
console.debug('====>runCmd info:' + getFocusCmd); console.debug('====>runCmd info:' + getFocusCmd);
await abilityDelegator.executeShellCommand(getFocusCmd); await abilityDelegator.executeShellCommand(getFocusCmd);
done();
}) })
/* /*
......
...@@ -26,6 +26,5 @@ export default class inputMethodWindService extends InputMethodExtensionAbility ...@@ -26,6 +26,5 @@ export default class inputMethodWindService extends InputMethodExtensionAbility
onDestroy() { onDestroy() {
console.log("onDestroy inputMethodEngine**"); console.log("onDestroy inputMethodEngine**");
this.context.destroy();
} }
} }
\ No newline at end of file
...@@ -24,7 +24,15 @@ struct Index { ...@@ -24,7 +24,15 @@ struct Index {
@State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' + @State inputValue: string = 'inputMethodEngine1inputMethodEngine2inputMethodEngine3inputMethodEngine' +
'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' + 'inputMethodEngine4inputMethodEngine5inputMethodEngine6inputMethodEngine7inputMethodEngine8inputMethodEn' +
'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' + 'gine9inputMethodEngine10inputMethodEngine11inputMethodEngine12inputMethodEngine13inputMethodEngine14inputMet' +
'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20inputMethodEngine21'; 'hodEngine15inputMethodEngine16inputMethodEngine17inputMethodEngine18inputMethodEngine19inputMethodEngine20input' +
'MethodEngine21inputMethodEngine22inputMethodEngine23inputMethodEngine24inputMethodEngine25inputMethodEngine26inp' +
'utMethodEngine27inputMethodEngine28inputMethodEngine29inputMethodEngine30inputMethodEngine31inputMethodEngine32i' +
'nputMethodEngine33inputMethodEngine34inputMethodEngine35inputMethodEngine36inputMethodEngine37inputMethodEngine3' +
'8inputMethodEngine39inputMethodEngine40inputMethodEngine41inputMethodEngine42inputMethodEngine43inputMethodEngine' +
'44inputMethodEngine45inputMethodEngine46inputMethodEngine47inputMethodEngine48inputMethodEngine49inputMethodEngi' +
'ne50inputMethodEngine51inputMethodEngine52inputMethodEngine53inputMethodEngine54inputMethodEngine55inputMethodEngi' +
'ne5inputMethodEngine57inputMethodEngine58inputMethodEngine59inputMethodEngine60inputMethodEngine61inputMethodEn' +
'gine62inputMethodEngine63inputMethodEngine64inputMethodEngine65inputMethodEngine66';
build() { build() {
Row() { Row() {
...@@ -34,6 +42,7 @@ struct Index { ...@@ -34,6 +42,7 @@ struct Index {
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
.defaultFocus(true) .defaultFocus(true)
TextArea({ text: this.inputValue }) TextArea({ text: this.inputValue })
.height('80%')
.onChange((value: string) => { .onChange((value: string) => {
this.inputValue = value; this.inputValue = value;
}) })
......
...@@ -40,7 +40,7 @@ export default function inputMethodWindManageAbility() { ...@@ -40,7 +40,7 @@ export default function inputMethodWindManageAbility() {
beforeAll(async (done)=>{ beforeAll(async (done)=>{
display_info = display.getDefaultDisplaySync() display_info = display.getDefaultDisplaySync()
getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${display_info.height*0.5}` getFocusCmd = `uinput -T -c ${display_info.width*0.5} ${ Math.round(display_info.height*0.4) }`
let inputM = inputMethod.getCurrentInputMethod() let inputM = inputMethod.getCurrentInputMethod()
console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM)); console.info("====>beforeAll: switchInputMethod to: " + JSON.stringify(inputM));
inputServer.packageName = inputM.packageName; inputServer.packageName = inputM.packageName;
......
...@@ -768,7 +768,7 @@ export default function requestUploadOnetJSUnitTest() { ...@@ -768,7 +768,7 @@ export default function requestUploadOnetJSUnitTest() {
* @tc.level : Level 2 * @tc.level : Level 2
*/ */
it('SUB_Misc_REQUEST_Off_Upload_Completed_0010', 0, async function (done) { it('SUB_Misc_REQUEST_Off_Upload_Completed_0010', 0, async function (done) {
console.info("====>-----------------------SUB_Misc_REQUEST_Off_Upload_Completed_0040 is starting-----------------------"); console.info("====>-----------------------SUB_Misc_REQUEST_Off_Upload_Completed_0010 is starting-----------------------");
let config_ = config let config_ = config
config_.mode = request.agent.Mode.FOREGROUND; config_.mode = request.agent.Mode.FOREGROUND;
try { try {
...@@ -776,11 +776,11 @@ export default function requestUploadOnetJSUnitTest() { ...@@ -776,11 +776,11 @@ export default function requestUploadOnetJSUnitTest() {
request.agent.create(globalThis.abilityContext, config_, async (err, task) => { request.agent.create(globalThis.abilityContext, config_, async (err, task) => {
let on_offCompletedCallback = (pro) => { let on_offCompletedCallback = (pro) => {
flag = false; flag = false;
console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 on_offCompletedCallback flag: " + flag); console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 on_offCompletedCallback flag: " + flag);
} }
try { try {
if(err){ if(err){
console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 create err: " + JSON.stringify(err)); console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 create err: " + JSON.stringify(err));
expect().assertFail(); expect().assertFail();
} }
task.on('completed', on_offCompletedCallback); task.on('completed', on_offCompletedCallback);
...@@ -789,22 +789,22 @@ export default function requestUploadOnetJSUnitTest() { ...@@ -789,22 +789,22 @@ export default function requestUploadOnetJSUnitTest() {
await task.start(); await task.start();
let t = setTimeout(async () => { let t = setTimeout(async () => {
try { try {
console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 offCompleted success flag: " + flag); console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 offCompleted success flag: " + flag);
clearTimeout(t); clearTimeout(t);
expect(flag).assertTrue(); expect(flag).assertTrue();
} catch (err) { } catch (err) {
console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 offCompleted fail err: " + JSON.stringify(err)); console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 offCompleted fail err: " + JSON.stringify(err));
} }
done(); done();
}, 100) }, 100)
} catch (err) { } catch (err) {
console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 catch err: " + JSON.stringify(err)); console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 catch err: " + JSON.stringify(err));
await sleep(10); await sleep(10);
done(); done();
} }
}); });
} catch (err) { } catch (err) {
console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0040 create catch err: " + JSON.stringify(err)); console.info("====>SUB_Misc_REQUEST_Off_Upload_Completed_0010 create catch err: " + JSON.stringify(err));
await sleep(10); await sleep(10);
done(); done();
} }
......
...@@ -13,7 +13,9 @@ ...@@ -13,7 +13,9 @@
* limitations under the License. * limitations under the License.
*/ */
import systemDateTimeJsunit from './systemDateTimeJsunit.test'; import systemDateTimeJsunit from './systemDateTimeJsunit.test';
import systemDateTimeSync from './systemDateTimeSync.test';
export default function testsuite() { export default function testsuite() {
systemDateTimeJsunit(); systemDateTimeJsunit();
systemDateTimeSync();
} }
\ No newline at end of file
/*
* Copyright (c) 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
*
* 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.
*/
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
import systemDateTime from "@ohos.systemDateTime";
export default function systemDateTimeSyncJsunit() {
describe('systemDateSyncTimeTest', function () {
console.info('====>---------------systemDateTimeTest start-----------------------');
/**
* @tc.number SUB_systemDateTime_getTime_sync_0010
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getTime_sync_0010", 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getTime_sync_0010 start----------------");
let currentTime = systemDateTime.getTime(true);
console.info("====>SUB_systemDateTime_getTime_sync_0010 currentTime: " + JSON.stringify(currentTime));
expect(typeof(currentTime) === 'number').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getTime_sync_0010 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getTime_sync_0020
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getTime_sync_0020", 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getTime_sync_0020 start----------------");
let currentTime = systemDateTime.getTime(false);
console.info("====>SUB_systemDateTime_getTime_sync_0020 currentTime: " + JSON.stringify(currentTime));
expect(typeof(currentTime) === 'number').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getTime_sync_0020 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getTime_sync_0030
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getTime_sync_0030", 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getTime_sync_0030 start----------------");
let currentTime = systemDateTime.getTime();
console.info("====>SUB_systemDateTime_getTime_sync_0030 currentTime: " + JSON.stringify(currentTime));
expect(typeof(currentTime) === 'number').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getTime_sync_0030 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getTime_sync_0040
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds that have elapsed since the Unix epoch.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getTime_sync_0040", 0, async function (done) {
console.info("====>-----SUB_systemDateTime_getTime_sync_0040 start----------------");
try {
console.info("====>SUB_systemDateTime_getTime_sync_0040 into parameters");
// @ts-ignore
systemDateTime.getTime(123);
console.info("====>SUB_systemDateTime_getTime_sync_0040 getTime Success");
} catch (err) {
console.info("====>SUB_systemDateTime_getTime_sync_0040 Invalid parameters: " + JSON.stringify(err));
expect().assertFail();
}
done();
console.info("====>-----SUB_systemDateTime_getTime_sync_0040 end------------");
});
/**
* @tc.number SUB_systemDateTime_getUptime_sync_0050
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getUptime_sync_0050", 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getUptime_sync_0050 start----------------");
let realActiveTime = systemDateTime.getUptime(systemDateTime.TimeType.ACTIVE, true);
console.info("====>SUB_systemDateTime_getUptime_sync_0050 currentTime: " + JSON.stringify(realActiveTime));
expect(typeof(realActiveTime) === 'number').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getUptime_sync_0050 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getUptime_sync_0060
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getUptime_sync_0060", 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getUptime_sync_0060 start----------------");
let realActiveTime = systemDateTime.getUptime(systemDateTime.TimeType.ACTIVE, false);
console.info("====>SUB_systemDateTime_getUptime_sync_0060 currentTime: " + JSON.stringify(realActiveTime));
expect(typeof(realActiveTime) === 'number').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getUptime_sync_0060 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getUptime_sync_0070
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getUptime_sync_0070", 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getUptime_sync_0070 start----------------");
let realActiveTime = systemDateTime.getUptime(systemDateTime.TimeType.ACTIVE);
console.info("====>SUB_systemDateTime_getUptime_sync_0070 currentTime: " + JSON.stringify(realActiveTime));
expect(typeof(realActiveTime) === 'number').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getUptime_sync_0070 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getUptime_sync_0080
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getUptime_sync_0080", 0, async function (done) {
console.info("====>-----SUB_systemDateTime_getUptime_sync_0080 start----------------");
try {
console.info("====>SUB_systemDateTime_getUptime_sync_0080 into parameters");
// @ts-ignore
systemDateTime.getUptime("123");
expect().assertFail();
} catch (err) {
console.info("====>SUB_systemDateTime_getUptime_sync_0080 Invalid parameters: " + JSON.stringify(err));
expect(err.code).assertEqual(401);
}
done();
console.info("====>-----SUB_systemDateTime_getUptime_sync_0080 end------------");
});
/**
* @tc.number SUB_systemDateTime_getUptime_sync_0090
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds elapsed since the system was booted, including deep sleep time.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getUptime_sync_0090", 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getUptime_sync_0090 start----------------");
let realTime = systemDateTime.getUptime(systemDateTime.TimeType.STARTUP, true);
console.info("====>SUB_systemDateTime_getUptime_sync_0090 currentTime: " + JSON.stringify(realTime));
expect(typeof(realTime) === 'number').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getUptime_sync_0090 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getUptime_sync_0100
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getUptime_sync_0100", 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getUptime_sync_0100 start----------------");
let realTime = systemDateTime.getUptime(systemDateTime.TimeType.STARTUP, false);
console.info("====>SUB_systemDateTime_getUptime_sync_0100 currentTime: " + JSON.stringify(realTime));
expect(typeof(realTime) === 'number').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getUptime_sync_0100 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getUptime_sync_0110
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds elapsed since the system was booted, not including deep sleep time.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getUptime_sync_0110", 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getUptime_sync_0110 start----------------");
let realTime = systemDateTime.getUptime(systemDateTime.TimeType.STARTUP);
console.info("====>SUB_systemDateTime_getUptime_sync_0110 currentTime: " + JSON.stringify(realTime));
expect(typeof(realTime) === 'number').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getUptime_sync_0110 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getUptime_sync_0120
* @tc.name Test systemTimeDate.getCurrentTime
* @tc.desc Obtains the number of milliseconds elapsed since the system was booted, including deep sleep time.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 1
*/
it("SUB_systemDateTime_getUptime_sync_0120", 0, async function (done) {
console.info("====>-----SUB_systemDateTime_getUptime_sync_0120 start----------------");
try {
console.info("====>SUB_systemDateTime_getUptime_sync_0120 into parameters");
// @ts-ignore
systemDateTime.getUptime(systemDateTime.TimeType.STARTUP, "123");
console.info("====>SUB_systemDateTime_getUptime_sync_0120 getUptime Success");
} catch (err) {
console.info("====>SUB_systemDateTime_getUptime_sync_0120 Invalid parameters: " + JSON.stringify(err));
expect().assertFail();
}
done();
console.info("====>-----SUB_systemDateTime_getUptime_sync_0120 end------------");
});
/**
* @tc.number SUB_systemDateTime_getTimezoneSync_sync_0130
* @tc.name Test systemTime.SUB_systemDateTime_getTimezone_sync_0130 true value
* @tc.desc Test systemTimeDate_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_systemDateTime_getTimezoneSync_sync_0130', 0, async function (done) {
console.info("====>----------SUB_systemDateTime_getTimezoneSync_sync_0130 start----------------");
let timeZone = systemDateTime.getTimezoneSync();
console.info("====>SUB_systemDateTime_getTimezoneSync_sync_0130 currentTime: " + JSON.stringify(timeZone));
expect(typeof(timeZone) === 'string').assertEqual(true);
done();
console.info("====>----------SUB_systemDateTime_getTimezoneSync_sync_0130 end-----------------");
});
/**
* @tc.number SUB_systemDateTime_getTimezoneSync_sync_0140
* @tc.name Test systemTimeDate.setTimezone true value
* @tc.desc Test systemTimeDate_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it('SUB_systemDateTime_getTimezoneSync_sync_0140', 0, async function (done) {
console.info("====>-----SUB_systemDateTime_getTimezoneSync_sync_0140 start----------------");
try {
console.info("====>SUB_systemDateTime_getTimezoneSync_sync_0140 into parameters");
// @ts-ignore
systemDateTime.getTimezoneSync("123");
console.info("====>SUB_systemDateTime_getTimezoneSync_sync_0140 getTimezoneSync Success");
} catch (err) {
console.info("====>SUB_systemDateTime_getTimezoneSync_sync_0140 Invalid parameters: " + JSON.stringify(err));
expect().assertFail();
}
done();
console.info("====>-----SUB_systemDateTime_getTimezoneSync_sync_0140 end------------");
});
});
};
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册