diff --git a/arkui/BUILD.gn b/arkui/BUILD.gn index c449cea578de50e7b3fb9418624ef5ea91dd4257..5aeb822b690aca06c433b76085de2f7e1f1b12f9 100644 --- a/arkui/BUILD.gn +++ b/arkui/BUILD.gn @@ -17,6 +17,7 @@ group("arkui") { "ace_ets_component:ActsAceEtsComponentTest", "ace_ets_component_apilack:ActsAceEtsApiLackTest", "ace_ets_component_attrlack:ActsAceEtsAttrLackTest", + "ace_ets_component_completion:componentCompletionTest", "ace_ets_component_five:ActsAceEtsComponentFiveTest", "ace_ets_component_four:ActsAceEtsComponentFourTest", "ace_ets_component_three:ActsAceEtsComponentThreeTest", diff --git a/arkui/ace_ets_component_completion/BUILD.gn b/arkui/ace_ets_component_completion/BUILD.gn index a2bd357d5825fd28d7e4825f77979fb544989c1c..1982ddffc822933a143569f6b62441421f7b9564 100644 --- a/arkui/ace_ets_component_completion/BUILD.gn +++ b/arkui/ace_ets_component_completion/BUILD.gn @@ -14,6 +14,6 @@ group("componentCompletionTest") { testonly = true if (is_standard_system) { - deps = [ "ace_ets_component_sidebarcontainertest:ActsSidebarTypeTest" ] + deps = [ "ace_ets_component_wholeCompletion:ActsAceEtsWholeCompletionTest" ] } } diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/AppScope/app.json b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/AppScope/app.json new file mode 100644 index 0000000000000000000000000000000000000000..60904c6a61645cca307c55abed901132c84b146b --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/AppScope/app.json @@ -0,0 +1,19 @@ +{ + "app": { + "bundleName": "com.example.wholeCompletion", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "keepAlive": true, + "singleUser": true, + "minAPIVersion": 10, + "targetAPIVersion": 10, + "car": { + "apiCompatibleVersion": 10, + "singleUser": false + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/AppScope/resources/base/element/string.json b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/AppScope/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..df28c917848f6b974a578bb1cdc3a40d0af261d9 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/AppScope/resources/base/element/string.json @@ -0,0 +1,8 @@ +{ + "string":[ + { + "name":"app_name", + "value":"MyApplication" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/AppScope/resources/base/media/app_icon.png b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/AppScope/resources/base/media/app_icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/AppScope/resources/base/media/app_icon.png differ diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/BUILD.gn b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..5ee575f2ad78d35d03f09f7ede6c7c3128ff27b7 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/BUILD.gn @@ -0,0 +1,43 @@ +# Copyright (c) 2023 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("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAceEtsWholeCompletionTest") { + hap_profile = "src/main/module.json" + js_build_mode = "debug" + deps = [ + ":ace_ets_component_wholeCompletion_js_assets", + ":ace_ets_component_wholeCompletion_resources", + ] + ets2abc = true + certificate_profile = "signature/openharmony_sx.p7b" + hap_name = "ActsAceEtsWholeCompletionTest" + part_name = "ace_engine" + subsystem_name = "arkui" +} + +ohos_app_scope("ace_ets_component_wholeCompletion_profile") { + app_profile = "AppScope/app.json" + sources = [ "AppScope/resources" ] +} + +ohos_js_assets("ace_ets_component_wholeCompletion_js_assets") { + source_dir = "src/main/ets" +} + +ohos_resources("ace_ets_component_wholeCompletion_resources") { + sources = [ "src/main/resources" ] + deps = [ ":ace_ets_component_wholeCompletion_profile" ] + hap_profile = "src/main/module.json" +} diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/Test.json b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..589dfda9bc5d5f1454490777dc0b04e5c3d5d4e8 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/Test.json @@ -0,0 +1,26 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.example.wholeCompletion", + "module-name": "phone", + "shell-timeout": "600000", + "testcase-timeout": 240000 + }, + "kits": [{ + "test-file-name": [ + "ActsAceEtsWholeCompletionTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "power-shell wakeup", + "power-shell setmode 602" + ] + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/signature/openharmony_sx.p7b b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..11a1904e69367646901b5f67e5f7a01f4dca810b Binary files /dev/null and b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/signature/openharmony_sx.p7b differ diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/TestAbility.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/TestAbility.ets new file mode 100644 index 0000000000000000000000000000000000000000..77f15258417e19c625f63e7e199a0e999c2f6061 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/TestAbility.ets @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import Ability from '@ohos.app.ability.UIAbility' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import testsuite from '../test/List.test' +import Window from '@ohos.window' + +export default class TestAbility extends Ability { + onCreate(want, launchParam) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onCreate'); + hilog.info(0x0000, 'testTag', '%{public}s', 'want param:' + JSON.stringify(want) ?? ''); + hilog.info(0x0000, 'testTag', '%{public}s', 'launchParam:'+ JSON.stringify(launchParam) ?? ''); + } + + onDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onDestroy'); + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageCreate'); + windowStage.loadContent('TestAbility/pages/Index', (err, data) => { + if (err.code) { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.ERROR); + hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? ''); + return; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Succeeded in loading the content. Data: %{public}s', + JSON.stringify(data) ?? ''); + }); + let windowClass = null; + windowStage.getMainWindow((err, data) => { + if (err.code) { + console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err)); + return; + } + windowClass = data; + + globalThis.uiContent = windowClass.getUIContext(); + console.info('Succeeded in obtaining the main window. Data: ' + JSON.stringify(data)); + }); + } + + onWindowStageDestroy() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onWindowStageDestroy'); + } + + onForeground() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onForeground'); + } + + onBackground() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility onBackground'); + } +} diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/Index.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/Index.ets new file mode 100644 index 0000000000000000000000000000000000000000..3412b3bb1bd15095916b318c3dd032f77cffc171 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/Index.ets @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from '@ohos/hypium' +import testsuite from '../../test/List.test' + +@Entry +@Component +struct Index { + aboutToAppear() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'TestAbility index aboutToAppear'); + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + hilog.info(0x0000, 'testTag', '%{public}s', 'start run testcase!!!'); + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + } + @State message: string = 'Stage XtsTest' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/animateto.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/animateto.ets new file mode 100644 index 0000000000000000000000000000000000000000..da02d668d3bcb211924324c19dc415338b2375c2 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/animateto.ets @@ -0,0 +1,622 @@ +/** + * Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter' +import {MessageManager,Callback} from '../utils/MessageManager'; + +@Entry +@Component +struct animateto { + @State show:string = "btShow" + @State btn1: boolean = false + @State duration: number = 100 + @State curve: string = 'Ease' + @State iteration: number = 1 + @State tempo: number= 1000 + @State playmode: PlayMode = PlayMode.Normal + + messageManager:MessageManager = new MessageManager() + onPageShow() { + globalThis.value = { + name:'messageManager',message:this.messageManager + } + let callback:Callback = (message:any) => { + console.error('message = ' + message.name + "--" + message.value) + if (message.name == 'duration') { + this.duration = message.value + } + if (message.name == 'curve') { + this.curve = message.value + } + if (message.name == 'iteration') { + this.iteration = message.value + } + if (message.name == 'tempo') { + this.tempo = message.value + } + if (message.name == 'playmode') { + this.playmode = message.value + } + } + this.messageManager.registerCallback(callback) + } + + build() { + Column(){ + Button(this.show) + .backgroundColor(0x317aff) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button1') + .onClick(() => { + try { + var backData = { + data: { + "duration": this.duration, + } + } + var backEvent = { + eventId: 51, + priority: events_emitter.EventPriority.LOW + } + console.info("button1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button1 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button1 animateTo START") + console.info("button1 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button1 duration test animateTo START") + }) + }) + Button(this.show) + .backgroundColor(0x317aff) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button11') + .onClick(() => { + try { + var backData = { + data: { + "duration": this.duration, + } + } + var backEvent = { + eventId: 151, + priority: events_emitter.EventPriority.LOW + } + console.info("button1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button1 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button1 animateTo START") + console.info("button1 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button1 duration test animateTo START") + }) + }) + Button(this.show) + .backgroundColor(0x317aff) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button12') + .onClick(() => { + try { + var backData = { + data: { + "curve": this.curve, + } + } + var backEvent = { + eventId: 152, + priority: events_emitter.EventPriority.LOW + } + console.info("button1 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button1 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button1 animateTo START") + console.info("button1 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button1 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button2') + .onClick(() => { + try { + var backDataOne = { + data: { + "curve": this.curve, + } + } + var backEventOne = { + eventId: 52, + priority: events_emitter.EventPriority.LOW + } + console.info("button2 start to emit action state") + events_emitter.emit(backEventOne, backDataOne) + } catch (err) { + console.info("button2 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button2 animateTo START") + console.info("button2 curve value is : " + this.curve) + globalThis.uiContent.animateTo({ curve: this.curve }, () => { + console.info("button2 curve test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button3') + .onClick(() => { + try { + var backDataTwo = { + data: { + "iterations": this.iteration, + } + } + var backEventTwo = { + eventId: 53, + priority: events_emitter.EventPriority.LOW + } + console.info("button3 start to emit action state") + events_emitter.emit(backEventTwo, backDataTwo) + } catch (err) { + console.info("button3 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button3 animateTo START") + console.info("button3 iteration value is : " + this.iteration) + globalThis.uiContent.animateTo({ iterations: this.iteration }, () => { + console.info("button3 iterations test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button13') + .onClick(() => { + try { + var backDataTwo = { + data: { + "iterations": this.iteration, + } + } + var backEventTwo = { + eventId: 153, + priority: events_emitter.EventPriority.LOW + } + console.info("button3 start to emit action state") + events_emitter.emit(backEventTwo, backDataTwo) + } catch (err) { + console.info("button3 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button3 animateTo START") + console.info("button3 iteration value is : " + this.iteration) + globalThis.uiContent.animateTo({ iterations: this.iteration }, () => { + console.info("button3 iterations test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button4') + .onClick(() => { + try { + var backDataThree = { + data: { + "tempo": this.tempo + } + } + var backEventThree = { + eventId: 54, + priority: events_emitter.EventPriority.LOW + } + console.info("button4 start to emit action state") + events_emitter.emit(backEventThree, backDataThree) + } catch (err) { + console.info("button4 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button4 animateTo START") + console.info("button4 tempo value is : " + this.duration) + globalThis.uiContent.animateTo({ tempo: this.tempo }, () => { + console.info("button4 tempo test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button14') + .onClick(() => { + try { + var backDataThree = { + data: { + "tempo": this.tempo + } + } + var backEventThree = { + eventId: 154, + priority: events_emitter.EventPriority.LOW + } + console.info("button4 start to emit action state") + events_emitter.emit(backEventThree, backDataThree) + } catch (err) { + console.info("button4 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button4 animateTo START") + console.info("button4 tempo value is : " + this.duration) + globalThis.uiContent.animateTo({ tempo: this.tempo }, () => { + console.info("button4 tempo test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button5') + .onClick(() => { + try { + var backDataFour = { + data: { + "playmode": this.playmode, + } + } + var backEventFour = { + eventId: 55, + priority: events_emitter.EventPriority.LOW + } + console.info("button5 start to emit action state") + events_emitter.emit(backEventFour, backDataFour) + } catch (err) { + console.info("button5 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button5 animateTo START") + console.info("button5 playmode value is : " + this.playmode) + globalThis.uiContent.animateTo({playMode:PlayMode.Normal}, () => { + console.info("button5 playMode test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button15') + .onClick(() => { + try { + var backDataFour = { + data: { + "playmode": this.playmode, + } + } + var backEventFour = { + eventId: 155, + priority: events_emitter.EventPriority.LOW + } + console.info("button5 start to emit action state") + events_emitter.emit(backEventFour, backDataFour) + } catch (err) { + console.info("button5 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button5 animateTo START") + console.info("button5 playmode value is : " + this.playmode) + globalThis.uiContent.animateTo({playMode:PlayMode.Normal}, () => { + console.info("button5 playMode test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button6') + .onClick(() => { + try { + var backData = { + data: { + "duration": this.duration, + } + } + var backEvent = { + eventId: 1001, + priority: events_emitter.EventPriority.LOW + } + console.info("button6 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button6 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button6 animateTo START") + console.info("button6 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button6 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button7') + .onClick(() => { + try { + var backData = { + data: { + "duration": this.duration, + } + } + var backEvent = { + eventId: 1002, + priority: events_emitter.EventPriority.LOW + } + console.info("button7 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button7 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button7 animateTo START") + console.info("button7 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button7 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button8') + .onClick(() => { + try { + var backData = { + data: { + "curve": this.curve, + } + } + var backEvent = { + eventId: 1003, + priority: events_emitter.EventPriority.LOW + } + console.info("button8 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button8 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button8 animateTo START") + console.info("button8 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button8 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button9') + .onClick(() => { + try { + var backData = { + data: { + "curve": this.curve, + } + } + var backEvent = { + eventId: 1004, + priority: events_emitter.EventPriority.LOW + } + console.info("button9 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button9 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button9 animateTo START") + console.info("button9 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button9 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button10') + .onClick(() => { + try { + var backData = { + data: { + "iteration": this.iteration, + } + } + var backEvent = { + eventId: 1005, + priority: events_emitter.EventPriority.LOW + } + console.info("button10 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button10 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button10 animateTo START") + console.info("button10 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button10 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button111') + .onClick(() => { + try { + var backData = { + data: { + "iteration": this.iteration, + } + } + var backEvent = { + eventId: 1006, + priority: events_emitter.EventPriority.LOW + } + console.info("button11 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button11 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button11 animateTo START") + console.info("button11 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button11 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button121') + .onClick(() => { + try { + var backData = { + data: { + "tempo": this.tempo, + } + } + var backEvent = { + eventId: 1007, + priority: events_emitter.EventPriority.LOW + } + console.info("button12 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button12 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button12 animateTo START") + console.info("button12 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button12 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button131') + .onClick(() => { + try { + var backData = { + data: { + "tempo": this.tempo, + } + } + var backEvent = { + eventId: 1008, + priority: events_emitter.EventPriority.LOW + } + console.info("button13 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button13 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button13 animateTo START") + console.info("button13 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button13 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button141') + .onClick(() => { + try { + var backData = { + data: { + "playmode": this.playmode, + } + } + var backEvent = { + eventId: 1009, + priority: events_emitter.EventPriority.LOW + } + console.info("button14 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button14 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button14 animateTo START") + console.info("button14 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button14 duration test animateTo START") + }) + }) + Button(this.show) + .width(80) + .height(30) + .backgroundColor(0x317aff) + .margin({ bottom: 20 }) + .key('button151') + .onClick(() => { + try { + var backData = { + data: { + "playmode": this.playmode, + } + } + var backEvent = { + eventId: 1010, + priority: events_emitter.EventPriority.LOW + } + console.info("button15 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("button15 emit action state err: " + JSON.stringify(err.message)) + } + console.info("button15 animateTo START") + console.info("button15 duration value is : " + this.duration) + globalThis.uiContent.animateTo({ duration: this.duration }, () => { + console.info("button15 duration test animateTo START") + }) + }) + }.height("%100").width("100%") + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/animationCurve.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/animationCurve.ets new file mode 100644 index 0000000000000000000000000000000000000000..9edd21948d46a50469f90ed26d8056f5015985cd --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/animationCurve.ets @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2023 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 Curves from '@ohos.curves' +@Entry +@Component +struct animationCurve { + @State widthSize: number = 50 + @State heightSize: number = 50 + onFinish() {} + interpolate(fraction) { + return fraction; + } + build() { + Column() { + Text() + .key("curvesText") + .margin({top:100}) + .width(this.widthSize) + .height(this.heightSize) + .backgroundColor(Color.Red) + .onClick(()=> { + globalThis.fraction = Curves.customCurve(this.interpolate).interpolate(0.1) + this.widthSize = 2*this.widthSize; + this.heightSize = 2*this.heightSize; + }) + .animation({ duration: 2000 , curve: Curves.customCurve(this.interpolate) ,onFinish:this.onFinish }) + }.width("100%").height("100%") + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/bindPopupOffset.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/bindPopupOffset.ets new file mode 100644 index 0000000000000000000000000000000000000000..81a7c699d72e58d12c4cb3c017f4c9212e49e60e --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/bindPopupOffset.ets @@ -0,0 +1,399 @@ +/* + * Copyright (c) 2023 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. + */ +//@ts-nocheck +import events_emitter from '@ohos.events.emitter'; + +@Entry +@Component +struct bindPopupOffset { + @State handlePopup: boolean = false + @State handlePopup01: boolean = false + @State handlePopup02: boolean = false + @State handlePopup03: boolean = false + @State handlePopup04: boolean = false + @State customPopup: boolean = false + @State customPopup01: boolean = false + @State customPopup02: boolean = false + @State customPopup03: boolean = false + @State customPopup04: boolean = false + @State offset: any = { x: 10, y:10 } + @State offset10: any = { x:-10, y:-10} + @State offset00: any = { x: 0, y:0 } + @State offset050: any = { x: 0, y:50 } + @State offsetnull: any = null + + @Builder popupBuilder() { + Row({ space: 2 }) { + Text('Custom Popup').fontSize(12).key('text') + }.width(100).height(50).backgroundColor(Color.White) + } + + build(){ + Scroll(){ + Flex({ direction: FlexDirection.Column }) { + Button('PopupOptions') + .width(200) + .key('PopupOptions') + .margin({top:100}) + .onClick(() => { + this.handlePopup = !this.handlePopup + try { + var backData = { + data: { + "offset": this.offset, + } + } + var backEvent = { + eventId: 12065, + priority: events_emitter.EventPriority.LOW + } + console.info("PopupOptions start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("PopupOptions emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.handlePopup, { + message: 'This is a popup with PopupOptions', + placementOnTop: true, + showInSubWindow:false, + onStateChange: (e) => { + console.info(JSON.stringify(e.isVisible)) + if (!e.isVisible) { + this.handlePopup = false + } + }, + offset: this.offset + }) + + Button('PopupOptions00') + .width(200) + .key('PopupOptions00') + .margin({top:100}) + .onClick(() => { + this.handlePopup01 = !this.handlePopup01 + try { + var backData = { + data: { + "offset": this.offset00, + } + } + var backEvent = { + eventId: 12067, + priority: events_emitter.EventPriority.LOW + } + console.info("PopupOptions00 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("PopupOptions00 emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.handlePopup01, { + message: 'This is a popup with PopupOptions', + placementOnTop: true, + showInSubWindow:false, + onStateChange: (e) => { + console.info(JSON.stringify(e.isVisible)) + if (!e.isVisible) { + this.handlePopup01 = false + } + }, + offset: this.offset00 + }) + + Button('PopupOptions050') + .width(200) + .key('PopupOptions050') + .margin({top:100}) + .onClick(() => { + this.handlePopup02 = !this.handlePopup02 + try { + var backData = { + data: { + "offset": this.offset050, + } + } + var backEvent = { + eventId: 12068, + priority: events_emitter.EventPriority.LOW + } + console.info("PopupOptions050 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("PopupOptions050 emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.handlePopup01, { + message: 'This is a popup with PopupOptions', + placementOnTop: true, + showInSubWindow:false, + onStateChange: (e) => { + console.info(JSON.stringify(e.isVisible)) + if (!e.isVisible) { + this.handlePopup02 = false + } + }, + offset: this.offset050 + }) + Button('PopupOptionsnull') + .width(200) + .key('PopupOptionsnull') + .margin({top:100}) + .onClick(() => { + this.handlePopup03 = !this.handlePopup03 + try { + var backData = { + data: { + "offset": this.offsetnull, + } + } + var backEvent = { + eventId: 12069, + priority: events_emitter.EventPriority.LOW + } + console.info("PopupOptionsnull start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("PopupOptionsnull emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.handlePopup03, { + message: 'This is a popup with PopupOptions', + placementOnTop: true, + showInSubWindow:false, + onStateChange: (e) => { + console.info(JSON.stringify(e.isVisible)) + if (!e.isVisible) { + this.handlePopup03 = false + } + }, + offset: this.offsetnull + }) + Button('PopupOptions10') + .width(200) + .key('PopupOptions10') + .margin({top:100}) + .onClick(() => { + this.handlePopup04 = !this.handlePopup04 + try { + var backData = { + data: { + "offset": this.offset10, + } + } + var backEvent = { + eventId: 12070, + priority: events_emitter.EventPriority.LOW + } + console.info("PopupOptions10 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("PopupOptions10 emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.handlePopup04, { + message: 'This is a popup with PopupOptions', + placementOnTop: true, + showInSubWindow:false, + onStateChange: (e) => { + console.info(JSON.stringify(e.isVisible)) + if (!e.isVisible) { + this.handlePopup04 = false + } + }, + offset: this.offset10 + }) + + + Button('customPopup') + .key('customPopup') + .margin({top:100}) + .onClick(() => { + this.customPopup = !this.customPopup + try { + var backData = { + data: { + "offset": this.offset, + } + } + var backEvent = { + eventId: 12066, + priority: events_emitter.EventPriority.LOW + } + console.info("customPopup start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("customPopup emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.customPopup, { + builder: this.popupBuilder, + placement: Placement.Top, + mask: {color:'0x33000000'}, + popupColor: Color.Yellow, + enableArrow: true, + showInSubWindow: false, + onStateChange: (e) => { + if (!e.isVisible) { + this.customPopup = false + } + }, + offset: this.offset + }) + Button('customPopup10') + .key('customPopup10') + .margin({top:100}) + .onClick(() => { + this.customPopup01 = !this.customPopup01 + try { + var backData = { + data: { + "offset": this.offset10, + } + } + var backEvent = { + eventId: 12071, + priority: events_emitter.EventPriority.LOW + } + console.info("customPopup10 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("customPopup10 emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.customPopup01, { + builder: this.popupBuilder, + placement: Placement.Top, + mask: {color:'0x33000000'}, + popupColor: Color.Yellow, + enableArrow: true, + showInSubWindow: false, + onStateChange: (e) => { + if (!e.isVisible) { + this.customPopup01 = false + } + }, + offset: this.offset10 + }) + Button('customPopup00') + .key('customPopup00') + .margin({top:100}) + .onClick(() => { + this.customPopup02 = !this.customPopup02 + try { + var backData = { + data: { + "offset": this.offset00, + } + } + var backEvent = { + eventId: 12072, + priority: events_emitter.EventPriority.LOW + } + console.info("customPopup00 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("customPopup00 emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.customPopup02, { + builder: this.popupBuilder, + placement: Placement.Top, + mask: {color:'0x33000000'}, + popupColor: Color.Yellow, + enableArrow: true, + showInSubWindow: false, + onStateChange: (e) => { + if (!e.isVisible) { + this.customPopup02 = false + } + }, + offset: this.offset00 + }) + Button('customPopup050') + .key('customPopup050') + .margin({top:100}) + .onClick(() => { + this.customPopup03 = !this.customPopup03 + try { + var backData = { + data: { + "offset": this.offset050, + } + } + var backEvent = { + eventId: 12073, + priority: events_emitter.EventPriority.LOW + } + console.info("customPopup050 start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("customPopup050 emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.customPopup03, { + builder: this.popupBuilder, + placement: Placement.Top, + mask: {color:'0x33000000'}, + popupColor: Color.Yellow, + enableArrow: true, + showInSubWindow: false, + onStateChange: (e) => { + if (!e.isVisible) { + this.customPopup03 = false + } + }, + offset: this.offset050 + }) + Button('customPopupnull') + .key('customPopupnull') + .margin({top:100}) + .onClick(() => { + this.customPopup04 = !this.customPopup04 + try { + var backData = { + data: { + "offset": this.offsetnull, + } + } + var backEvent = { + eventId: 12074, + priority: events_emitter.EventPriority.LOW + } + console.info("customPopupnull start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("customPopupnull emit action state err: " + JSON.stringify(err.message)) + } + }) + .bindPopup(this.customPopup04, { + builder: this.popupBuilder, + placement: Placement.Top, + mask: {color:'0x33000000'}, + popupColor: Color.Yellow, + enableArrow: true, + showInSubWindow: false, + onStateChange: (e) => { + if (!e.isVisible) { + this.customPopup04 = false + } + }, + offset: this.offsetnull + }) + }.width('100%').padding({ top: 5 }) + }.width('100%').height("85%") + + } + } diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/hover.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/hover.ets new file mode 100644 index 0000000000000000000000000000000000000000..241607d3386c81d66b2fdfb87a6e5266d592c378 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/hover.ets @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2023 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. + */ + +@Entry +@Component +struct hover { + @State message: string = 'Hello World' + build() { + Column({ space: 5 }) { + Flex() { + Button("button一") + .width(200) + .height(100) + .backgroundColor(0xAFEEF) + .onHover((isHover: boolean, event: HoverEvent) => { + console.log('button 一' + isHover + '') + }) + Button("button二") + .width(100) + .height(50) + .backgroundColor(0xAFEE) + .margin({ top: 25, left: -150 }) + .onHover((isHover: boolean, event: HoverEvent) => { + event.stopPropagation() + console.log('button 二' + isHover + '') + }).key("ArkUX_Hover_stoppropagation_0100") + } + .padding(10) + + Flex() { + Button("button一") + .width(100) + .height(50) + .backgroundColor(0xAFEEF) + .margin({ top: 25, left: 40 }) + .onHover((isHover: boolean, event: HoverEvent) => { + console.log('button 一' + isHover + '') + }) + Button("button二") + .width(200) + .height(100) + .backgroundColor(0xAFEE) + .margin({ top: 20, left: -140 }) + .onHover((isHover: boolean, event: HoverEvent) => { + event.stopPropagation() + console.log('button 二' + isHover + '') + }) + } + .padding(10) + Flex() { + Button("button一") + .width(200) + .height(100) + .backgroundColor(0xAFEEF) + .onHover((isHover: boolean, event: HoverEvent) => { + console.log('button 一' + isHover + '') + }) + Button("button二") + .width(100) + .height(50) + .backgroundColor(0xAFEE) + .margin({ top: 25, left: -100 }) + .onHover((isHover: boolean, event: HoverEvent) => { + event.stopPropagation() + console.log('button 二' + isHover + '') + }) + } + .padding(10) + Flex() { + Button("button一") + .width(200) + .height(100) + .backgroundColor(0xAFEEF) + .onHover((isHover: boolean, event: HoverEvent) => { + console.log('button 一' + isHover + '') + }) + Button("button二") + .width(100) + .height(50) + .backgroundColor(0xAFEE) + .margin({ top: 20, left: -80 }) + .onHover((isHover: boolean, event: HoverEvent) => { + event.stopPropagation() + console.log('button 二' + isHover + '') + }) + } + .padding(10) + } + .width('100%') + .margin({ top: 10 }) + } + } \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/imageObscuredTest.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/imageObscuredTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..232ab3caf9f56c28526db8e2385423cc4b6587bf --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/imageObscuredTest.ets @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2023 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. + */ + +@Entry +@Component +struct imageObscuredTest { + private scroller: Scroller = new Scroller() + + build() { + Column() { + Stack({ alignContent: Alignment.End }) { + Scroll(this.scroller) { + Flex({ direction: FlexDirection.Column }) { + + Row() { + Image($r('app.media.icon')).width('400px').height('400px') + .obscured([ObscuredReasons.PLACEHOLDER]).borderRadius('20vp') + .key('ArkUX_Redacted_Image_0150') + }.margin({bottom: 50}) + + Row() { + Image($r('app.media.icon')) + .obscured(null) + .key('ArkUX_Redacted_Image_0160') + }.margin({bottom: 50}) + + + Row() { + Image($r('app.media.icon')).width('700px').height('200px') + .obscured([ObscuredReasons.PLACEHOLDER]).borderRadius(null) + .key('ArkUX_Redacted_Image_0170') + }.margin({bottom: 50}) + + Row() { + Image($r('app.media.play')).width(30).height(40) + .obscured([ObscuredReasons.PLACEHOLDER]).borderRadius(null) + .key('ArkUX_Redacted_Image_0180') + }.margin({bottom: 50}) + + Row() { + Image($r('app.media.play')).width(30).height(40) + .obscured([ObscuredReasons.PLACEHOLDER]) + .borderRadius('20vp') + .key('ArkUX_Redacted_Image_0190') + }.margin({bottom: 50}) + + }.margin({ left: 52 }) + } + .scrollBar(BarState.Off) + .scrollable(ScrollDirection.Vertical) + ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }) { + Text() + .width(30) + .height(100) + .borderRadius(10) + .backgroundColor('#C0C0C0') + }.width(30).backgroundColor('#ededed') + } + } + } +} + diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/pushUrl.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/pushUrl.ets new file mode 100644 index 0000000000000000000000000000000000000000..08d1741cecbdfdb5669894d8719cae19cbc366a5 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/pushUrl.ets @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2023 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. + */ +@Entry +@Component +struct pushUrl { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageActionSheet.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageActionSheet.ets new file mode 100644 index 0000000000000000000000000000000000000000..f9e07ff52a3fb5b5d15fec267061a273858dc5ec --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageActionSheet.ets @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2023 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. + */ +//@ts-nocheck +import events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct stageActionSheet { + build() { + Row() { + Column() { + Text("showActionSheet1") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("showActionSheet1") + .onClick(() => { + try { + globalThis.uiContent.showActionSheet({ + title: 'ActionSheet title', + message: 'message', + autoCancel: true, + confirm: { + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + cancel: () => { + console.log('actionSheet canceled') + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + }, + { + title: 'pears', + action: () => { + console.log('pears') + } + } + ] + }) + var backData = { + data: { + "STATUS": true + } + } + let backEvent = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + console.info("showDialog start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (error) { + console.error("showToast emit action state err:" + JSON.stringify(error.message)); + }; + }) + + Text("showActionSheet2") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("showActionSheet2") + .onClick(() => { + try { + globalThis.uiContent.showActionSheet({ + title: 'ActionSheet title', + message: 'message', + autoCancel: true, + confirm: { + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + cancel: () => { + console.log('actionSheet canceled') + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + }, + { + title: 'pears', + action: () => { + console.log('pears') + } + } + ] + }) + var backData1 = { + data: { + "STATUS": 10 + } + } + let backEvent1 = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (error) { + + }; + }) + + Text("showActionSheet3") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("showActionSheet3") + .onClick(() => { + try { + globalThis.uiContent.showActionSheet({ + title: 'ActionSheet title', + message: 'message', + autoCancel: true, + confirm: { + value: 'Confirm button', + action: () => { + console.log('Get Alert Dialog handled') + } + }, + cancel: () => { + console.log('actionSheet canceled') + }, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -10 }, + sheets: [ + { + title: 'apples', + action: () => { + console.log('apples') + } + }, + { + title: 'bananas', + action: () => { + console.log('bananas') + } + }, + { + title: 'pears', + action: () => { + console.log('pears') + } + } + ] + }) + var backData2 = { + data: { + "STATUS": "STATUS" + } + } + let backEvent2 = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (error) { + console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`); + }; + }) + + } + .height('100%') + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageAlertDialog.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageAlertDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..229241d46d1cb01f978585453cadfe8818631dbc --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageAlertDialog.ets @@ -0,0 +1,176 @@ +/* + * Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct stageAlertDialog { + build() { + Row() { + Column() { + Text("AlertDialog1") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("AlertDialog1") + .onClick(() => { + try { + globalThis.uiContent.showAlertDialog( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 3, + confirm: { + value: 'button', + action: () => { + console.info('Button-clicking callback') + } + }, + cancel: () => { + console.info('Closed callbacks') + } + } + ) + var backData = { + data: { + "STATUS": true + } + } + let backEvent = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + console.info("showDialog start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (error) { + console.error("showToast emit action state err:" + JSON.stringify(error.message)); + }; + }) + + Text("AlertDialog2") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("AlertDialog2") + .onClick(() => { + try { + globalThis.uiContent.showAlertDialog( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 3, + confirm: { + value: 'button', + action: () => { + console.info('Button-clicking callback') + } + }, + cancel: () => { + console.info('Closed callbacks') + } + } + ) + var backData1 = { + data: { + "STATUS": 10 + } + } + let backEvent1 = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (error) { + + }; + }) + + Text("AlertDialog3") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("AlertDialog3") + .onClick(() => { + try { + globalThis.uiContent.showAlertDialog( + { + title: 'title', + message: 'text', + autoCancel: true, + alignment: DialogAlignment.Bottom, + offset: { dx: 0, dy: -20 }, + gridCount: 3, + confirm: { + value: 'button', + action: () => { + console.info('Button-clicking callback') + } + }, + cancel: () => { + console.info('Closed callbacks') + } + } + ) + var backData2 = { + data: { + "STATUS": "STATUS" + } + } + let backEvent2 = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (error) { + console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`); + }; + }) + + } + .height('100%') + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageDatePickerDialog.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageDatePickerDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..4cc13e6e8bfb0bc1c216df8460c2cec00c8db361 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageDatePickerDialog.ets @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct stageDatePickerDialog { + selectedDate: Date = new Date("2010-1-1") + build() { + Row() { + Column() { + Text("DatePickerDialog1") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("DatePickerDialog1") + .onClick(() => { + try { + globalThis.uiContent.showDatePickerDialog({ + start: new Date("2000-1-1"), + end: new Date("2100-12-31"), + selected: this.selectedDate, + onAccept: (value: DatePickerResult) => { + this.selectedDate.setFullYear(value.year, value.month, value.day) + console.info("DatePickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("DatePickerDialog:onCancel()") + }, + onChange: (value: DatePickerResult) => { + console.info("DatePickerDialog:onChange()" + JSON.stringify(value)) + } + }) + var backData = { + data: { + "STATUS": true + } + } + let backEvent = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + console.info("showDialog start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (error) { + console.error("showToast emit action state err:" + JSON.stringify(error.message)); + }; + }) + + Text("DatePickerDialog2") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("DatePickerDialog2") + .onClick(() => { + try { + globalThis.uiContent.showDatePickerDialog({ + start: new Date("2000-1-1"), + end: new Date("2100-12-31"), + selected: this.selectedDate, + onAccept: (value: DatePickerResult) => { + this.selectedDate.setFullYear(value.year, value.month, value.day) + console.info("DatePickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("DatePickerDialog:onCancel()") + }, + onChange: (value: DatePickerResult) => { + console.info("DatePickerDialog:onChange()" + JSON.stringify(value)) + } + }) + var backData1 = { + data: { + "STATUS": 10 + } + } + let backEvent1 = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (error) { + + }; + }) + + Text("DatePickerDialog3") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("DatePickerDialog3") + .onClick(() => { + try { + globalThis.uiContent.showDatePickerDialog({ + start: new Date("2000-1-1"), + end: new Date("2100-12-31"), + selected: this.selectedDate, + onAccept: (value: DatePickerResult) => { + this.selectedDate.setFullYear(value.year, value.month, value.day) + console.info("DatePickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("DatePickerDialog:onCancel()") + }, + onChange: (value: DatePickerResult) => { + console.info("DatePickerDialog:onChange()" + JSON.stringify(value)) + } + }) + var backData2 = { + data: { + "STATUS": "STATUS" + } + } + let backEvent2 = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (error) { + console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`); + }; + }) + + } + .height('100%') + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageFont.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageFont.ets new file mode 100644 index 0000000000000000000000000000000000000000..32ad60d80973427501ac8a8b76a2cbefefcea12b --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageFont.ets @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2023 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. + */ + +@Entry +@Component +struct StageFont { + @State message: string = 'Hello World' + @State text: string = '' + controller: TextAreaController = new TextAreaController() + + aboutToAppear(){ + let fontRegister = globalThis.uiContent.getFont(); + console.info(fontRegister); + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Button('按钮Buttonå—体') + .labelStyle({ + font: { family: 'fontCustom' } + }) + .key("button") + Text('文本Textå—体') + .fontSize(24) + .fontFamily('fontCustom') + .key("text") + TextArea({ + text: this.text, + placeholder: 'TextAreaå—体', + controller: this.controller + }) + .placeholderFont({ size: 24, weight: 400 }) + .fontSize(24) + .fontFamily('fontCustom') + .onChange((value: string) => { + this.text = value + }) + .key('textArea') + TextInput({ placeholder: 'TextInputå—体' }) + .fontFamily('fontCustom') + .fontSize(24) + .key('textInput') + Text() { + Span('TextSpanå—体') + .fontFamily('fontCustom') + .fontSize(24) + .key('textSpan') + } + }.width("100%").height("100%") + } + } diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageMediaquery.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageMediaquery.ets new file mode 100644 index 0000000000000000000000000000000000000000..5296fb55d2d3aa746449cefd19c5da075f53bee1 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageMediaquery.ets @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct stageMediaquery { + @State color: string = '#000' + @State text: string = 'Test' + listener = globalThis.uiContent.getMediaquery().matchMediaSync('(orientation: landscape)') + aboutToAppear() { + this.listener.on('change', (mediaQueryResult) => { + if (mediaQueryResult.matches) { + this.color = '#FFD700' + this.text = 'Landscape' + } else { + this.color = '#DB7093' + this.text = 'Portrait' + } + }) + } + aboutToDisappear() { + } + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text("mediaQuery-Off") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("offText") + .onClick(() => { + this.listener.off('change', (mediaQueryResult) => { + console.log(JSON.stringify(mediaQueryResult)) + var result=true + try { + var backData = { + data: { + "STATUS": result + } + } + let backEvent = { + eventId: 60218, + priority: events_emitter.EventPriority.LOW + } + console.info("onSelect start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onSelect emit action state err: " + JSON.stringify(err.message)) + } + }) + }) + Text("mediaQuery-MatchMediaSync") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("matchMediaSyncText") + .onClick(() => { + console.log('mediaQuery-MatchMediaSync: ' + JSON.stringify(this.listener)) + var result=(this.listener!=null) + try { + var backData = { + data: { + "STATUS": result + } + } + let backEvent = { + eventId: 60219, + priority: events_emitter.EventPriority.LOW + } + console.info("onSelect start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (err) { + console.info("onSelect emit action state err: " + JSON.stringify(err.message)) + } + + }) + Text(this.text) + .fontSize(50) + .fontColor(this.color) + }.width("100%").height("100%") + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stagePrompt.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stagePrompt.ets new file mode 100644 index 0000000000000000000000000000000000000000..7937a43bda6a873ba1508f5f1f81c7e123783b81 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stagePrompt.ets @@ -0,0 +1,260 @@ +/* + * Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct stagePrompt { + build() { + Row() { + Column() { + Text("promptAction-showToast") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("showToastText") + .onClick(() => { + try { + globalThis.uiContent.getPromptAction().showToast({ + message: 'Message Info', + duration: 2000, + }); + var backData = { + data: { + "STATUS": true + } + } + let backEvent = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + console.info("showDialog start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (error) { + console.error("showToast emit action state err:" + JSON.stringify(error.message)); + }; + }) + + Text("promptAction-showDialog") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("showDialogText") + .onClick(() => { + try { + globalThis.uiContent.getPromptAction().showDialog({ + title: 'Title Info', + message: 'Message Info', + buttons: [ + { + text: 'button1', + color: '#000000', + }, + { + text: 'button2', + color: '#000000', + } + ], + }) + .then(data => { + console.info('showDialog success, click button: ' + data.index); + }) + .catch(err => { + console.info('showDialog error: ' + err); + }) + var backData1 = { + data: { + "STATUS": true + } + } + let backEvent1 = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (error) { + console.error("showDialog emit action state err:" + JSON.stringify(error.message)); + }; + }) + + Text("promptAction-showActionMenu") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("showActionMenuText") + .onClick(() => { + try { + globalThis.uiContent.getPromptAction().showActionMenu({ + title: 'showActionMenu Title Info', + buttons: [ + { + text: 'item1', + color: '#666666', + }, + { + text: 'item2', + color: '#000000', + }, + ] + }) + .then(data => { + console.info('showActionMenu success, click button: ' + data.index); + }) + .catch(err => { + console.info('showActionMenu error: ' + err); + }) + var backData2 = { + data: { + "STATUS": true + } + } + let backEvent2 = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (error) { + console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`); + }; + }) + Text("promptAction-showDialogTwo") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("showDialogTextTwo") + .onClick(() => { + try { + globalThis.uiContent.getPromptAction().showDialog({ + title: 'showDialog Title Info', + message: 'Message Info', + buttons: [ + { + text: 'button1', + color: '#000000', + }, + { + text: 'button2', + color: '#000000', + } + ] + }, (err, data) => { + if (err) { + console.info('showDialog err: ' + err); + return; + } + console.info('showDialog success callback, click button: ' + data.index); + }); + var backData3 = { + data: { + "STATUS": true + } + } + let backEvent3 = { + eventId: 60223, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent3, backData3) + } catch (error) { + console.error("showDialog emit action state err:" + JSON.stringify(error.message)); + }; + }) + Text("promptAction-showActionMenuTwo") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("showActionMenuTextTwo") + .onClick(() => { + try { + globalThis.uiContent.getPromptAction().showActionMenu({ + title: 'Title Info', + buttons: [ + { + text: 'item1', + color: '#666666', + }, + { + text: 'item2', + color: '#000000', + }, + ] + }, (err, data) => { + if (err) { + console.info('showActionMenu err: ' + err); + return; + } + console.info('showActionMenu success callback, click button: ' + data.index); + }) + var backData4 = { + data: { + "STATUS": true + } + } + let backEvent4 = { + eventId: 60224, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent4, backData4) + } catch (error) { + console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`); + }; + }) + } + .height('100%') + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageRouter.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageRouter.ets new file mode 100644 index 0000000000000000000000000000000000000000..1546f59af4882b6a2d324646d60d4ab37d6c0738 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageRouter.ets @@ -0,0 +1,48 @@ +/* + * Copyright (c) 2023 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. + */ + +@Entry +@Component +struct stageRouter { + private TAG: string = '[AnimatorTest]' + private backAnimator: any = undefined + private flag: boolean = false + @State wid: number = 100 + @State hei: number = 100 + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Button('router-pushUrl') + .width(100) + .height(70) + .fontSize(30) + .fontColor(Color.Black) + .onClick(() => { + globalThis.uiContent.getRouter().pushUrl({ + url: 'pages/Animator', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }) + }) + .key("routerPushUrl") + + }.width("100%").height("100%") + } + } diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageTextPickerDialog.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageTextPickerDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..e982e6f23c527eea578da5e17fde9ff59fd3bc21 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageTextPickerDialog.ets @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct stageTextPickerDialog { + private fruits: string[] = ['apple1', 'orange2', 'peach3', 'grape4', 'banana5'] + build() { + Row() { + Column() { + Text("TextPickerDialog1") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("TextPickerDialog1") + .onClick(() => { + try { + globalThis.uiContent.showTextPickerDialog({ + range: this.fruits, + onAccept: (value: TextPickerResult) => { + console.info("TextPickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("TextPickerDialog:onCancel()") + }, + onChange: (value: TextPickerResult) => { + console.info("TextPickerDialog:onChange()" + JSON.stringify(value)) + } + }) + var backData = { + data: { + "STATUS": true + } + } + let backEvent = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + console.info("showDialog start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (error) { + console.error("showToast emit action state err:" + JSON.stringify(error.message)); + }; + }) + + Text("TextPickerDialog2") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("TextPickerDialog2") + .onClick(() => { + try { + globalThis.uiContent.showTextPickerDialog({ + range: this.fruits, + onAccept: (value: TextPickerResult) => { + console.info("TextPickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("TextPickerDialog:onCancel()") + }, + onChange: (value: TextPickerResult) => { + console.info("TextPickerDialog:onChange()" + JSON.stringify(value)) + } + }) + var backData1 = { + data: { + "STATUS": 10 + } + } + let backEvent1 = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (error) { + + }; + }) + + Text("TextPickerDialog3") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("TextPickerDialog3") + .onClick(() => { + try { + globalThis.uiContent.showTextPickerDialog({ + range: this.fruits, + onAccept: (value: TextPickerResult) => { + console.info("TextPickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("TextPickerDialog:onCancel()") + }, + onChange: (value: TextPickerResult) => { + console.info("TextPickerDialog:onChange()" + JSON.stringify(value)) + } + }) + var backData2 = { + data: { + "STATUS": "STATUS" + } + } + let backEvent2 = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (error) { + console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`); + }; + }) + + } + .height('100%') + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageTimePickerDialog.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageTimePickerDialog.ets new file mode 100644 index 0000000000000000000000000000000000000000..3f9e6856902c7276d7755b18b3abd3d0eb0d6b6d --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/stageTimePickerDialog.ets @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2023 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 events_emitter from '@ohos.events.emitter'; +@Entry +@Component +struct stageTimePickerDialog { + private selectTime: Date = new Date('2020-12-25T08:30:00') + build() { + Row() { + Column() { + Text("TimePickerDialog1") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("TimePickerDialog1") + .onClick(() => { + try { + globalThis.uiContent.showTimePickerDialog({ + selected: this.selectTime, + onAccept: (value: TimePickerResult) => { + this.selectTime.setHours(value.hour, value.minute) + console.info("TimePickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("TimePickerDialog:onCancel()") + }, + onChange: (value: TimePickerResult) => { + console.info("TimePickerDialog:onChange()" + JSON.stringify(value)) + } + }) + var backData = { + data: { + "STATUS": true + } + } + let backEvent = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + console.info("showDialog start to emit action state") + events_emitter.emit(backEvent, backData) + } catch (error) { + console.error("showToast emit action state err:" + JSON.stringify(error.message)); + }; + }) + + Text("TimePickerDialog2") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("TimePickerDialog2") + .onClick(() => { + try { + globalThis.uiContent.showTimePickerDialog({ + selected: this.selectTime, + onAccept: (value: TimePickerResult) => { + this.selectTime.setHours(value.hour, value.minute) + console.info("TimePickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("TimePickerDialog:onCancel()") + }, + onChange: (value: TimePickerResult) => { + console.info("TimePickerDialog:onChange()" + JSON.stringify(value)) + } + }) + var backData1 = { + data: { + "STATUS": 10 + } + } + let backEvent1 = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent1, backData1) + } catch (error) { + + }; + }) + + Text("TimePickerDialog3") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("TimePickerDialog3") + .onClick(() => { + try { + globalThis.uiContent.showTimePickerDialog({ + selected: this.selectTime, + onAccept: (value: TimePickerResult) => { + this.selectTime.setHours(value.hour, value.minute) + console.info("TimePickerDialog:onAccept()" + JSON.stringify(value)) + }, + onCancel: () => { + console.info("TimePickerDialog:onCancel()") + }, + onChange: (value: TimePickerResult) => { + console.info("TimePickerDialog:onChange()" + JSON.stringify(value)) + } + }) + var backData2 = { + data: { + "STATUS": "STATUS" + } + } + let backEvent2 = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + console.info("showActionMenu start to emit action state") + events_emitter.emit(backEvent2, backData2) + } catch (error) { + console.error(`showActionMenu args error code is ${error.code}, message is ${error.message}`); + }; + }) + + } + .height('100%') + } + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/textObscured.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/textObscured.ets new file mode 100644 index 0000000000000000000000000000000000000000..9aa6ac51f1af09c3f350e1973d393840606efd7c --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/pages/textObscured.ets @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2023 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. + */ + +@Entry +@Component +struct Index { + private scroller: Scroller = new Scroller() + @State message: string = 'Hello World' + + + build() { + Column() { + Stack({ alignContent: Alignment.End }) { + Scroll(this.scroller) { + Flex({ direction: FlexDirection.Column }) { + + Row() { + Text(this.message) + .fontSize(30) + .fontColor("#FF0000FF") + .obscured([ObscuredReasons.PLACEHOLDER]) + .textAlign(TextAlign.Start) + .baselineOffset(30) + .key('ArkUX_Redacted_Text_0090') + }.margin({bottom: 50}) + + Row() { + Text(this.message) + .fontSize(10) + .fontColor("#FF0000FE") + .obscured(null) + .textAlign(null) + .baselineOffset(null) + .key('ArkUX_Redacted_Text_0100') + }.margin({bottom: 50}) + + Row() { + Text(this.message) + .fontSize(100) + .fontColor("#FF0000FD") + .obscured([ObscuredReasons.PLACEHOLDER]) + .textAlign(TextAlign.End) + .baselineOffset(100) + .key('ArkUX_Redacted_Text_0110') + }.margin({bottom: 50}) + + Row() { + Text(this.message) + .fontSize(1000) + .fontColor("#FF0000FC") + .obscured([ObscuredReasons.PLACEHOLDER]) + .textAlign(TextAlign.Center) + .baselineOffset(1000) + .key('ArkUX_Redacted_Text_0120') + }.margin({bottom: 50}) + + Row() { + Text(this.message) + .fontSize(1) + .fontColor("#FF0000FB") + .obscured([ObscuredReasons.PLACEHOLDER]) + .textAlign(TextAlign.Start) + .baselineOffset(1) + .key('ArkUX_Redacted_Text_0130') + }.margin({bottom: 50}) + + + + + }.margin({ left: 52 }) + } + .scrollBar(BarState.Off) + .scrollable(ScrollDirection.Vertical) + ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }) { + Text() + .width(30) + .height(100) + .borderRadius(10) + .backgroundColor('#C0C0C0') + }.width(30).backgroundColor('#ededed') + } + } + } +} diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/utils/Common.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/utils/Common.ets new file mode 100644 index 0000000000000000000000000000000000000000..a67880c93d98eb600808e0b1bb4d2052e3f9f35f --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/utils/Common.ets @@ -0,0 +1,51 @@ +/** + * Copyright (c) 2023 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 CommonFunc { + static rect_left; + static rect_top; + static rect_right; + static rect_bottom; + static rect_value; + + static sleep(time){ + return new Promise((resolve,reject)=>{ + setTimeout(()=>{ + resolve("ok") + },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 + } + } +} + + + + diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/utils/Constants.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/utils/Constants.ets new file mode 100644 index 0000000000000000000000000000000000000000..da195cf946ea0eae3f6332833c4a5adf40dc124f --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/utils/Constants.ets @@ -0,0 +1,112 @@ +// @ts-nocheck +/** + * Copyright (c) 2023 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. + */ +const TYPE = '$type' +const ID = '$ID' +const Z_INDEX = '$z-index' +const RECT = '$rect' +const DEBUGLINE = '$debugLine' +const ATTRS = '$attrs' +const ATTRS_SEPIA = 'sepia' +const ATTRS_ASPECTRATIO = 'aspectRatio' +const ATTRS_CONTRAST = 'contrast' +const ATTRS_SATURATE = 'saturate' +const ATTRS_HUEROTATE = 'hueRotate' +const ATTRS_INVERT = 'invert' +const ATTRS_BRIGHTNESS = 'brightness' +const ATTRS_BACKDROPBLUR = 'backdropBlur' +const ATTRS_GRAYSCALE = 'grayscale' +const ATTRS_BLUR = 'blur' +const ATTRS_GRIDOFFSET = 'gridOffset' +const ATTRS_FLEXSHRINK = 'flexShrink' +const ATTRS_FLEXGROW = 'flexGrow' +const ATTRS_OPACITY = 'opacity' +const ATTRS_DIRECTION = 'direction' +const ATTRS_ALIGN = 'align' +const ATTRS_HEIGHT = 'height' +const ATTRS_BACKGROUNDCOLOR = 'backgroundColor' +const ATTRS_ALIGNSELF = 'alignSelf' +const ATTRS_BORDERWIDTH = 'borderWidth' +const ATTRS_WIDTH = 'width' +const ATTRS_BORDERCOLOR = 'borderColor' +const ATTRS_MARGIN_BOTTOM = 'margin-bottom' +const ATTRS_BORDERSTYLE = 'borderStyle' +const ATTRS_MARGIN_RIGHT = 'margin-right' +const ATTRS_CONSTRAINTSIZE = 'constraintSize' +const ATTRS_NARGIN_LEFT = 'margin-left' +const ATTRS_BACKGROUNDIMAGE = 'backgroundImage' +const ATTRS_MARGIN_TOP = 'margin-top' +const ATTRS_BORDERRADIUS = 'borderRadius' +const ATTRS_FLEXBASIC = 'flexBasis' +const ATTRS_VISIBILITY = 'visibility' +const ATTRS_PASSWORD = 'password' +const ATTRS_CHECKED = 'checked' +const ATTRS_SELECTED = 'selected' +const ATTRS_LONG_CLICKABLE = 'long-clickable' +const ATTRS_FOCUSED = 'focused' +const ATTRS_SCROLLABLE = 'scrollable' +const ATTRS_CLICKABLE = 'clickable' +const ATTRS_FOCUSABLE = 'focusable' +const ATTRS_CHECKABLE = 'checkable' +const ATTRS_CLIP = 'clip' +const ATTRS_ENABLE = 'enabled' +const ATTRS_DISPLAYPRIORITY = 'displayPriority' +const ATTRS_LAYOUTWEIGHT = 'layoutWeight' +const ATTRS_LAYOUTPRIORITY = 'layoutPriority' +const ATTRS_GRIDSPAN = 'gridSpan' +const ATTRS_ZINDEX = 'zIndex' +const ATTRS_USEALIGN = 'useAlign' +const ATTRS_USEALIGN_EDGE = 'edge' +const ATTRS_USEALIGN_OFFSET = 'offset' +const ATTRS_MASK = 'mask' +const ATTRS_MARKANCHOR = 'markAnchor' +const ATTRS_MARKANCHOR_X = 'x' +const ATTRS_MARKANCHOR_Y = 'y' +const ATTRS_PADDING = 'padding' +const ATTRS_POSITION = 'position' +const ATTRS_POSITION_X = 'x' +const ATTRS_POSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGEPOSITION = 'backgroundImagePosition' +const ATTRS_BACKGROUNDIMAGEPOSITION_X = 'x' +const ATTRS_BACKGROUNDIMAGEPOSITION_Y = 'y' +const ATTRS_BACKGROUNDIMAGESIZE = 'backgroundImageSize' +const ATTRS_OFFSET = 'offset' +const ATTRS_OFFSET_X = 'x' +const ATTRS_OFFSET_Y = 'y' +const ATTRS_SHADOW = 'shadow' +const ATTRS_SHADOW_RADIUS = 'radius' +const ATTRS_SHADOW_COLOR = 'color' +const ATTRS_SHADOW_OFFSETX = 'offsetX' +const ATTRS_SHADOW_OFFSETY = 'offsetY' +const ATTRS_WINDOWBLUR = 'windowBlur' +const ATTRS_WINDOWBLUR_PERCENT = 'percent' +const ATTRS_WINDOWBLUR_STYLE = 'style' +const ATTRS_FONTFAMILY = 'fontFamily' +const ATTRS_FONTWEIGHT = 'fontWeight' +const ATTRS_FONTSTYLE = 'fontStyle' +const ATTRS_FONTSIZE = 'fontSize' +const ATTRS_TEXTCASE = 'textCase' +const ATTRS_MAXLINES = 'maxLines' +const ATTRS_DECORATION = 'decoration' +const ATTRS_BASELINEOFFSET = 'baselineOffset' +const ATTRS_TEXTOVERFLOW = 'textOverflow' +const ATTRS_LINEHEIGHT = 'lineHeight' +const ATTRS_FONTCOLOR = 'fontColor' +const ATTRS_TEXTALIGN = 'textAlign' +const ATTRS_CONTENT = 'content' + + + + diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/utils/MessageManager.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/utils/MessageManager.ets new file mode 100644 index 0000000000000000000000000000000000000000..7ed176cc91fc16252ccf70be4fcd2775501b576b --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestAbility/utils/MessageManager.ets @@ -0,0 +1,54 @@ +/** + * Copyright (c) 2023 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 interface Callback { + (message:any):void +} + +export class MessageManager { + callback:Callback + callbacks:Map<string,Callback> = new Map() + + constructor() { + + } + + registerCallback(callback:Callback , type?:string) { + if (type == undefined) { + console.error('registerCallback callback set') + this.callback = callback + return + } + this.callbacks.set(type,callback) + } + + notify(message:any, type?:string) { + if (type == undefined) { + this.callback(message) + return + } + + let tmpCallback:Callback = this.callbacks.get(type) + if (tmpCallback === undefined) { + console.error('callbacks has no callback for type ' + type) + return + } + tmpCallback(message) + } + + clear() { + this.callbacks.clear() + this.callback = null + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..992a94580cb5640c6d042948aee2e49e515c135d --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s it', + '-s level', '-s testType', '-s size', '-s timeout', + '-s dryRun' + ]); + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams = `${targetParams} ${key} ${parameters[key]}`; + } + } + return targetParams.trim(); +} + +async function onAbilityCreateCallback() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err): Promise<void> { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'addAbilityMonitorCallback : %{public}s', JSON.stringify(err) ?? ''); +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner OnPrepare '); + } + + async onRun() { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun run'); + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments(); + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); + let testAbilityName = abilityDelegatorArguments.bundleName + '.TestAbility'; + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback); + let cmd = 'aa start -d 0 -a TestAbility' + ' -b ' + abilityDelegatorArguments.bundleName; + cmd += ' ' + translateParamsToString(abilityDelegatorArguments.parameters); + let debug = abilityDelegatorArguments.parameters['-D']; + if (debug == 'true') { + cmd += ' -D'; + } + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'cmd : %{public}s', cmd); + abilityDelegator.executeShellCommand(cmd, + (err, d) => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'executeShellCommand : err : %{public}s', JSON.stringify(err) ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.stdResult ?? ''); + hilog.info(0x0000, 'testTag', 'executeShellCommand : data : %{public}s', d.exitCode ?? ''); + }); + hilog.info(0x0000, 'testTag', '%{public}s', 'OpenHarmonyTestRunner onRun end'); + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..58e684d0a057dd1932c03f98a20343bc1056f3ab --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/List.test.ets @@ -0,0 +1,48 @@ +/** + * Copyright (c) 2023 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 stageFontTest from './stageFont.test'; +import stageRouterTest from './stageRouter.test'; +import animateToTest from './animateto.test'; +import stageActionSheet from './stageActionSheet.test'; +import stageAlertDialog from './stageAlertDialog.test'; +import stageDatePickerDialog from './stageDatePickerDialog.test'; +import stageMediaquery from './stageMediaquery.test'; +import stagePrompt from './stagePrompt.test'; +import stageTextPickerDialog from './stageTextPickerDialog.test'; +import stageTimePickerDialog from './stageTimePickerDialog.test'; +import bindPopupOffsetTest from './bindPopupOffset.test'; +import animationCurveTest from './animationCurve.test'; +import hoverTest from './hover.test'; +import textObscuredTest from './textObscuredTest.test'; +import imageObscuredTest from './imageObscuredTest.test' + +export default function testsuite() { + stageFontTest() + stageRouterTest() + animateToTest() + stageActionSheet() + stageAlertDialog() + stageDatePickerDialog() + stageMediaquery() + stagePrompt() + stageTextPickerDialog() + stageTimePickerDialog() + bindPopupOffsetTest() + animationCurveTest() + hoverTest() + textObscuredTest() + imageObscuredTest() +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/animateto.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/animateto.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..aab6d46163387fa53463cb8a7ed897079f5749b5 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/animateto.test.ets @@ -0,0 +1,554 @@ +/** + * Copyright (c) 2023 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 router from '@system.router'; +import events_emitter from '@ohos.events.emitter' +import CommonFunc from '../TestAbility/utils/Common'; +import {MessageManager,Callback} from '../TestAbility/utils/MessageManager'; +const waitUiReadyMs = 1000; + +export default function animateToTest() { + describe('animateToTest', function () { + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/animateto', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get animateto state success " + JSON.stringify(pages)); + if (!("animateto" == pages.name)) { + console.info("get animateto state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push animateto page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push animateto page error: " + err); + } + done() + }); + + afterEach(async function () { + console.info("animate after each called"); + }); + + it('animateTest_0100', 0, async function (done) { + console.info('animateTest_0100 START'); + let indexEvent = { + eventId: 51, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_0100 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.duration == 100).assertTrue(); + } catch (err) { + console.info("animateTest_0100 get state result is err: " + JSON.stringify(err)); + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0100 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0100 click result is: " + JSON.stringify(sendEventByKey('button1', 10, ""))); + console.info('animateTest_0100 END'); + done(); + }); + + it('animateTest_0200', 0, async function (done) { + console.info('animateTest_0200 START'); + let indexEvent = { + eventId: 52, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_0200 get state result is: " + JSON.stringify(indexEvent)) + expect(indexEvent.data.curve).assertEqual('Ease') + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0200 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0200 click result is: " + JSON.stringify(sendEventByKey('button2', 10, ""))); + console.info('animateTest_0200 END'); + done(); + }); + + it('animateTest_0300', 0, async function (done) { + console.info('animateTest_0300 START'); + let indexEvent = { + eventId: 53, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_0300 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.iterations == 1).assertTrue(); + } catch (err) { + console.info("animateTest_0300 get state result err is: " + JSON.stringify(err)) + } + + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0300 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0300 click result is: " + JSON.stringify(sendEventByKey('button3', 10, ""))); + console.info('animateTest_0300 END'); + done(); + }); + + it('animateTest_0400', 0, async function (done) { + console.info('animateTest_0400 START'); + let indexEvent = { + eventId: 54, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_0400 get state result is: " + JSON.stringify(indexEvent)) + expect(indexEvent.data.tempo).assertEqual(1000) + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0400 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0400 click result is: " + JSON.stringify(sendEventByKey('button4', 10, ""))); + console.info('animateTest_0400 END'); + done(); + }); + + it('animateTest_0500', 0, async function (done) { + console.info('animateTest_0500 START'); + let indexEvent = { + eventId: 55, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_0500 get state result is: " + JSON.stringify(indexEvent)) + expect(indexEvent.data.playmode).assertEqual('normal') + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0500 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0500 click result is: " + JSON.stringify(sendEventByKey('button5', 10, ""))); + console.info('animateTest_0500 END'); + done(); + }); + + it('animateTest_0600', 0, async function (done) { + await CommonFunc.sleep(10); + globalThis.value.message.notify({name:'duration', value:2000}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 151, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_0600 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.duration == 2000).assertTrue(); + } catch (err) { + console.info("animateTest_0600 get state result err is: " + JSON.stringify(err)); + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0600 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0600 click result is: " + JSON.stringify(sendEventByKey('button11', 10, ""))); + console.info('animateTest_0600 END'); + done(); + }); + + it('animateTest_0700', 0, async function (done) { + console.info('animateTest_0700 START'); + globalThis.value.message.notify({name:'curve', value:'Linear'}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 152, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_0700 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.curve).assertEqual('Linear'); + } catch (err) { + console.info("animateTest_0700 get state result err is: " + JSON.stringify(err)) + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0700 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0700 click result is: " + JSON.stringify(sendEventByKey('button12', 10, ""))); + console.info('animateTest_0700 END'); + done(); + }); + + it('animateTest_0800', 0, async function (done) { + console.info('animateTest_0800 START'); + globalThis.value.message.notify({name:'iteration', value:2}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 153, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_0800 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.iterations).assertEqual(2) + } catch (err) { + console.info("animateTest_0800 get state result err is: " + JSON.stringify(err)) + } + + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0800 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0800 click result is: " + JSON.stringify(sendEventByKey('button13', 10, ""))); + console.info('animateTest_0800 END'); + done(); + }); + + it('animateTest_0900', 0, async function (done) { + console.info('animateTest_0900 START'); + globalThis.value.message.notify({name:'tempo', value:"20000"}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 154, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_0900 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.tempo).assertEqual('20000'); + } catch (err) { + console.info("animateTest_0900 get state result err is: " + JSON.stringify(err)) + } + + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_0900 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_0900 click result is: " + JSON.stringify(sendEventByKey('button14', 10, ""))); + console.info('animateTest_0900 END'); + done(); + }); + + it('animateTest_1000', 0, async function (done) { + console.info('animateTest_1000 START'); + globalThis.value.message.notify({name:'playmode', value:PlayMode.Alternate}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 155, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1000 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.playmode).assertEqual('alternate'); + } catch (err) { + console.info("animateTest_1000 get state result err is: " + JSON.stringify(err)) + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1000 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1000 click result is: " + JSON.stringify(sendEventByKey('button15', 10, ""))); + console.info('animateTest_1000 END'); + done(); + }); + + it('animateTest_1100', 0, async function (done) { + console.info('animateTest_1100 START'); + globalThis.value.message.notify({name:'duration', value:-1000}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 1001, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1100 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.duration).assertEqual(-1000); + } catch (err) { + console.info("animateTest_1100 get state result err is: " + JSON.stringify(err)) + } + + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1100 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1100 click result is: " + JSON.stringify(sendEventByKey('button6', 10, ""))); + console.info('animateTest_1100 END'); + done(); + }); + + it('animateTest_1200', 0, async function (done) { + console.info('animateTest_1200 START'); + globalThis.value.message.notify({name:'duration', value:100000000}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 1002, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1200 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.duration).assertEqual(100000000); + } catch (err) { + console.info("animateTest_1200 get state result err is: " + JSON.stringify(err)) + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1200 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1200 click result is: " + JSON.stringify(sendEventByKey('button7', 10, ""))); + console.info('animateTest_1200 END'); + done(); + }); + + it('animateTest_1300', 0, async function (done) { + console.info('animateTest_1300 START'); + globalThis.value.message.notify({name:'curve', value:'123'}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 1003, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1300 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.curve).assertEqual('123'); + } catch (err) { + console.info("animateTest_1300 get state result err is: " + JSON.stringify(err)) + } + + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1300 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1300 click result is: " + JSON.stringify(sendEventByKey('button8', 10, ""))); + console.info('animateTest_1300 END'); + done(); + }); + + it('animateTest_1400', 0, async function (done) { + console.info('animateTest_1400 START'); + globalThis.value.message.notify({name:'curve', value:'abc'}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 1004, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1400 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.curve).assertEqual('abc') + } catch (err) { + console.info("animateTest_1400 get state result err is: " + JSON.stringify(err)) + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1400 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1400 click result is: " + JSON.stringify(sendEventByKey('button9', 10, ""))); + console.info('animateTest_1400 END'); + done(); + }); + + it('animateTest_1500', 0, async function (done) { + console.info('animateTest_1500 START'); + globalThis.value.message.notify({name:'iteration', value:121}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 1005, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1500 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.iteration).assertEqual(121); + } catch (err) { + console.info("animateTest_1500 get state result err is: " + JSON.stringify(err)) + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1500 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1500 click result is: " + JSON.stringify(sendEventByKey('button10', 10, ""))); + console.info('animateTest_1500 END'); + done(); + }); + + it('animateTest_1600', 0, async function (done) { + console.info('animateTest_1600 START'); + globalThis.value.message.notify({name:'iteration', value:-5}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 1006, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1600 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.iteration).assertEqual(-5); + } catch (err) { + console.info("animateTest_1600 get state result err is: " + JSON.stringify(err)) + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1600 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1600 click result is: " + JSON.stringify(sendEventByKey('button111', 10, ""))); + console.info('animateTest_1600 END'); + done(); + }); + + it('animateTest_1700', 0, async function (done) { + console.info('animateTest_1700 START'); + globalThis.value.message.notify({name:'tempo', value:"12121212121212"}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 1007, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1700 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.tempo).assertEqual('12121212121212'); + } catch (err) { + console.info("animateTest_1700 get state result err is: " + JSON.stringify(err)) + } + + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1700 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1700 click result is: " + JSON.stringify(sendEventByKey('button121', 10, ""))); + console.info('animateTest_1700 END'); + done(); + }); + + it('animateTest_1800', 0, async function (done) { + console.info('animateTest_1800 START'); + globalThis.value.message.notify({name:'tempo', value:"-5"}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 1008, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1800 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.tempo).assertEqual('-5') + } catch (err) { + console.info("animateTest_1800 get state result err is: " + JSON.stringify(err)) + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1800 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1800 click result is: " + JSON.stringify(sendEventByKey('button131', 10, ""))); + console.info('animateTest_1800 END'); + done(); + }); + + it('animateTest_1900', 0, async function (done) { + console.info('animateTest_1900 START'); + globalThis.value.message.notify({name:'playmode', value:-6}); + await CommonFunc.sleep(2); + let indexEvent = { + eventId: 1009, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_1900 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.playmode).assertEqual(-6); + } catch (err) { + console.info("animateTest_1900 get state result err is: " + JSON.stringify(err)) + } + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_1900 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_1900 click result is: " + JSON.stringify(sendEventByKey('button141', 10, ""))); + console.info('animateTest_1900 END'); + done(); + }); + + it('animateTest_2000', 0, async function (done) { + console.info('animateTest_2000 START'); + globalThis.value.message.notify({name:'playmode', value:123456}); + await CommonFunc.sleep(2); + + let indexEvent = { + eventId: 1010, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("animateTest_2000 get state result is: " + JSON.stringify(indexEvent)) + try { + expect(indexEvent.data.playmode).assertEqual(123456); + } catch (err) { + console.info("animateTest_2000 get state result err is: " + JSON.stringify(err)); + } + + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("animateTest_2000 on events_emitter err : " + JSON.stringify(err)); + } + console.info("animateTest_2000 click result is: " + JSON.stringify(sendEventByKey('button151', 10, ""))); + console.info('animateTest_2000 END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/animationCurve.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/animationCurve.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e61558593c78c0acc754c2ac21f0432937361485 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/animationCurve.test.ets @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2023 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 Curves from '@ohos.curves' +import router from '@system.router'; +export default function animationCurveTest() { + + describe('animationCurveTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/animationCurve', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get animationCurve state success " + JSON.stringify(pages)); + if (!("animationCurve" == pages.name)) { + console.info("get animationCurve state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push animationCurve page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push animationCurve page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('ArkUX_ohos.curves_customCurve_1000', 0, async function (done) { + console.info('ArkUX_ohos.curves_customCurve_1000 START'); + var fraction + + setTimeout(()=>{ + try{ + fraction = Curves.customCurve((fraction:number)=>{return fraction }).interpolate(0.1).toFixed(4) + + var finalRes + if(fraction==0.1000 ){ + finalRes = true; + }else{ + finalRes = false; + } + expect(finalRes).assertEqual(true); + } catch(err) { + } + done(); + },500) + }); + it('ArkUX_ohos.curves_customCurve_1100', 0, async function (done) { + console.info('ArkUX_ohos.curves_customCurve_1000 START'); + + var fraction1 + + setTimeout(()=>{ + try{ + fraction1 = Curves.customCurve((fraction:number)=>{return 2*fraction }).interpolate(0.1).toFixed(4) + console.info( "curves_customCurve_1100",fraction1) + var finalRes1 + if(fraction1==0.2000){ + finalRes1 = true; + }else{ + finalRes1 = false; + } + expect(finalRes1).assertEqual(true); + } catch(err) { + } + done(); + },500) + }); + it('ArkUX_ohos.curves_customCurve_1200', 0, async function (done) { + console.info('ArkUX_ohos.curves_customCurve_1200 START'); + var fraction2 + setTimeout(()=>{ + try{ + fraction2 = Curves.customCurve((fraction:number)=>{return fraction*fraction }).interpolate(0.1).toFixed(4) + console.info( "curves_customCurve_1200",fraction2) + var finalRes2 + if(fraction2==0.0100){ + finalRes2 = true; + }else{ + finalRes2 = false; + } + expect(finalRes2).assertEqual(true); + } catch(err) { + } + done(); + },500) + }); + it('ArkUX_ohos.curves_customCurve_1300', 0, async function (done) { + console.info('ArkUX_ohos.curves_customCurve_1300 START'); + var fraction3 + var fraction4 + setTimeout(()=>{ + try{ + fraction3 = Curves.customCurve((fraction:number)=>{return fraction*fraction }).interpolate(0.1).toFixed(4) + fraction4 = Curves.customCurve((fraction:number)=>{return fraction*fraction }).interpolate(0.1).toFixed(4) + console.info( "curves_customCurve_1300",fraction3) + var finalRes3 + if(fraction3==0.0100&&fraction4==0.0100){ + finalRes3 = true; + }else{ + finalRes3 = false; + } + expect(finalRes3).assertEqual(true); + } catch(err) { + } + done(); + },500) + }); + it('ArkUX_ohos.curves_customCurve_1400', 0, async function (done) { + console.info('ArkUX_ohos.curves_customCurve_1400 START'); + var fraction5 + var abc + function interpolate3(fraction) { + interpolate4(fraction) + return abc + } + function interpolate4(fraction){ + abc=fraction + } + setTimeout(()=>{ + try{ + fraction5 = Curves.customCurve(interpolate3('fraction')).interpolate(0.1).toFixed(4) + console.info('ArkUX_ohos.curves_customCurve_14005 '+ fraction5); + var finalRes5 + if(fraction5==0.1000){ + finalRes5 = true; + + }else{ + finalRes5 = false; + } + expect(finalRes5).assertEqual(true); + } catch(err) { + } + done(); + },1000) + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/bindPopupOffset.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/bindPopupOffset.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3fb979ff9557d86b764590ceff8a1fb68ad85d78 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/bindPopupOffset.test.ets @@ -0,0 +1,327 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; + +export default function bindPopupOffsetTest() { + describe('bindPopupOffsetTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/bindPopupOffset', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get bindPopupOffset state success " + JSON.stringify(pages)); + if (!("bindPopupOffset" == pages.name)) { + console.info("get bindPopupOffset state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push bindPopupOffset page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push bindPopupOffset page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('bindPopupOffsetTest_0100', 0, async function (done) { + console.info('bindPopupOffsetTest_0100 START'); + try { + let indexEvent = { + eventId: 12065, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_0100 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual({ x: 10, y: 10 }); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_0100 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('PopupOptions', 10, "") + console.info("bindPopupOffsetTest_0100 click result is: " + JSON.stringify(sendEventByKey('PopupOptions', 10, ""))); + console.info('bindPopupOffsetTest_0100 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_0100 ERR ' + JSON.stringify(err)); + } + done(); + }); + + it('bindPopupOffsetTest_0200', 0, async function (done) { + console.info('bindPopupOffsetTest_0200 START'); + try { + let indexEvent = { + eventId: 12066, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_0200 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual({ x: 10, y: 10 }); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_0200 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('customPopup', 10, "") + console.info("bindPopupOffsetTest_0200 click result is: " + JSON.stringify(sendEventByKey('customPopup', 10, ""))); + console.info('bindPopupOffsetTest_0200 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_0200 ERR ' + JSON.stringify(err)); + } + done(); + }); + + it('bindPopupOffsetTest_0300', 0, async function (done) { + console.info('bindPopupOffsetTest_0300 START'); + try { + let indexEvent = { + eventId: 12067, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_0300 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual({ x: 0, y: 0 }); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_0300 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('PopupOptions00', 10, "") + console.info("bindPopupOffsetTest_0300 click result is: " + JSON.stringify(sendEventByKey('PopupOptions00', 10, ""))); + console.info('bindPopupOffsetTest_0300 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_0300 ERR ' + JSON.stringify(err)); + } + done(); + }); + + it('bindPopupOffsetTest_0400', 0, async function (done) { + console.info('bindPopupOffsetTest_0400 START'); + try { + let indexEvent = { + eventId: 12068, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_0400 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual({ x: 0, y: 50 }); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_0400 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('PopupOptions050', 10, "") + console.info("bindPopupOffsetTest_0400 click result is: " + JSON.stringify(sendEventByKey('PopupOptions050', 10, ""))); + console.info('bindPopupOffsetTest_0400 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_0400 ERR ' + JSON.stringify(err)); + } + done(); + }); + + it('bindPopupOffsetTest_0500', 0, async function (done) { + console.info('bindPopupOffsetTest_0500 START'); + try { + let indexEvent = { + eventId: 12069, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_0500 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual(null); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_0500 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('PopupOptionsnull', 10, "") + console.info("bindPopupOffsetTest_0500 click result is: " + JSON.stringify(sendEventByKey('PopupOptionsnull', 10, ""))); + console.info('bindPopupOffsetTest_0500 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_0500 ERR ' + JSON.stringify(err)); + } + done(); + }); + it('bindPopupOffsetTest_0600', 0, async function (done) { + console.info('bindPopupOffsetTest_0600 START'); + try { + let indexEvent = { + eventId: 12070, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_0600 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual({ x: -10, y: -10 }); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_0600 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('PopupOptions10', 10, "") + console.info("bindPopupOffsetTest_0600 click result is: " + JSON.stringify(sendEventByKey('PopupOptions10', 10, ""))); + console.info('bindPopupOffsetTest_0600 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_0600 ERR ' + JSON.stringify(err)); + } + done(); + }); + + it('bindPopupOffsetTest_0700', 0, async function (done) { + console.info('bindPopupOffsetTest_0700 START'); + try { + let indexEvent = { + eventId: 12071, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_0700 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual({ x: -10, y: -10 }); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_0700 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('customPopup10', 10, "") + console.info("bindPopupOffsetTest_0700 click result is: " + JSON.stringify(sendEventByKey('customPopup10', 10, ""))); + console.info('bindPopupOffsetTest_0700 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_0700 ERR ' + JSON.stringify(err)); + } + done(); + }); + + it('bindPopupOffsetTest_0800', 0, async function (done) { + console.info('bindPopupOffsetTest_0800 START'); + try { + let indexEvent = { + eventId: 12072, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_0800 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual({ x: 0, y: 0 }); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_0800 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('customPopup00', 10, "") + console.info("bindPopupOffsetTest_0800 click result is: " + JSON.stringify(sendEventByKey('customPopup00', 10, ""))); + console.info('bindPopupOffsetTest_0800 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_0800 ERR ' + JSON.stringify(err)); + } + done(); + }); + + it('bbindPopupOffsetTest_0900', 0, async function (done) { + console.info('bindPopupOffsetTest_0900 START'); + try { + let indexEvent = { + eventId: 12073, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_0900 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual({ x: 0, y: 50 }); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_0900 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('customPopup050', 10, "") + console.info("bindPopupOffsetTest_0900 click result is: " + JSON.stringify(sendEventByKey('customPopup050', 10, ""))); + console.info('bindPopupOffsetTest_0900 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_0900 ERR ' + JSON.stringify(err)); + } + done(); + }); + + it('bindPopupOffsetTest_1000', 0, async function (done) { + console.info('bindPopupOffsetTest_1000 START'); + try { + let indexEvent = { + eventId: 12074, + priority: events_emitter.EventPriority.LOW + } + let callback = (indexEvent) => { + console.info("bindPopupOffsetTest_1000 get state result is: " + JSON.stringify(indexEvent)); + expect(indexEvent.data.offset).assertEqual(null); + done(); + } + try { + events_emitter.on(indexEvent, callback); + } catch (err) { + console.info("bindPopupOffsetTest_1000 on events_emitter err : " + JSON.stringify(err)); + } + sendEventByKey('PopupOptionsnull', 10, "") + console.info("bindPopupOffsetTest_1000 click result is: " + JSON.stringify(sendEventByKey('PopupOptionsnull', 10, ""))); + console.info('bindPopupOffsetTest_1000 END '); + } catch (err) { + expect().assertFail() + console.info('bindPopupOffsetTest_1000 ERR ' + JSON.stringify(err)); + } + done(); + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/hover.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/hover.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b9cafcb7fbe83811fd7fac2d4422bafe4da8a1f2 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/hover.test.ets @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import router from '@system.router'; + +export default function hoverTest() { + describe('hoverTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/hover', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get hover state success " + JSON.stringify(pages)); + if (!("hover" == pages.name)) { + console.info("get hover state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push hover page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push hover page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('ArkUX_Hover_stoppropagation_0100', 0, async function (done) { + console.info('ArkUX_Hover_stoppropagation_0100 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Hover_stoppropagation_0100'); + console.info('ArkUX_Hover_stoppropagation_0100 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Button'); + console.info('ArkUX_Hover_stoppropagation_0100 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Hover_stoppropagation_0100 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/imageObscuredTest.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/imageObscuredTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..381c433e308fc67001fec0dabf8f9dc7e9054fac --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/imageObscuredTest.test.ets @@ -0,0 +1,167 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import router from '@system.router'; +export default function imageObscuredTest() { + describe('imageObscuredTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/imageObscuredTest', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get imageObscuredTest state success " + JSON.stringify(pages)); + if (!("imageObscuredTest" == pages.name)) { + console.info("get imageObscuredTest state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push imageObscuredTest page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push imageObscuredTest page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('ArkUX_Redacted_Image_0150', 0, async function (done) { + console.info('ArkUX_Redacted_Image_0150 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Image_0150'); + console.info('ArkUX_Redacted_Image_0150 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Image_0150 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Image_0150 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(attr.width).assertEqual("400.00px"); + expect(attr.height).assertEqual("400.00px"); + expect(attr.borderRadius).assertEqual("20.00vp"); + expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER)); + console.info('ArkUX_Redacted_Image_0150 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Image_0150 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + + it('ArkUX_Redacted_Image_0160', 0, async function (done) { + console.info('ArkUX_Redacted_Image_0160 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Image_0160'); + console.info('ArkUX_Redacted_Image_0160 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Image_0160 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Image_0160 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(attr.obscured.length).assertEqual(0); + console.info('ArkUX_Redacted_Image_0020 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Image_0160 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + + it('ArkUX_Redacted_Image_0170', 0, async function (done) { + console.info('ArkUX_Redacted_Image_0170 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Image_0170'); + console.info('ArkUX_Redacted_Image_0170 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Image_0170 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Image_0170 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(attr.width).assertEqual("700.00px"); + expect(attr.height).assertEqual("200.00px"); + expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER)); + console.info('ArkUX_Redacted_Image_0170 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Image_0170 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('ArkUX_Redacted_Image_0180', 0, async function (done) { + console.info('ArkUX_Redacted_Image_0180 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Image_0180'); + console.info('ArkUX_Redacted_Image_0180 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Image_0180 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Image_0180 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER)); + console.info('ArkUX_Redacted_Image_0180 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Image_0180 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('ArkUX_Redacted_Image_0190', 0, async function (done) { + console.info('ArkUX_Redacted_Image_0190 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Image_0190'); + console.info('ArkUX_Redacted_Image_0190 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Image_0190 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Image_0190 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER)); + console.info('ArkUX_Redacted_Image_0190 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Image_0190 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageActionSheet.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageActionSheet.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8891cb0f61818b5cf4686bbc17c3dfce98b9b81c --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageActionSheet.test.ets @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; +export default function stageActionSheet() { + describe('stageActionSheet', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/stageActionSheet', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stageActionSheet state success " + JSON.stringify(pages)); + if (!("stageActionSheet" == pages.name)) { + console.info("get stageActionSheet state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push stageActionSheet page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stageActionSheet page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('testShowActionShee001', 0, async function (done) { + console.info('testShowActionShee001 START'); + setTimeout(()=>{ + try{ + var innerEventOne = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testShowActionShee001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testShowActionShee001 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showToastText', 10, ""))); + console.info('testShowActionShee001 END '); + } catch(err) { + expect().assertFail() + console.info('testShowActionShee001 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('testShowActionShee002', 0, async function (done) { + console.info('testShowActionShee002 START'); + setTimeout(()=>{ + try{ + var innerEventTwo = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testShowActionShee002 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(10); + done(); + } + try { + events_emitter.on(innerEventTwo, callback1); + } catch (err) { + console.info("testShowActionShee002 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testShowActionShee002 END '); + } catch(err) { + expect().assertFail() + console.info('testShowActionShee002 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + it('testShowActionShee003', 0, async function (done) { + console.info('testShowActionShee003 START'); + setTimeout(()=>{ + try{ + var innerEventThree = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testShowActionShee003 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual("STATUS"); + done(); + } + try { + events_emitter.on(innerEventThree, callback1); + } catch (err) { + console.info("testShowActionShee003 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testShowActionShee003 END '); + } catch(err) { + expect().assertFail() + console.info('testShowActionShee003 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageAlertDialog.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageAlertDialog.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..7f8e1904c369550a3e0aa1ff767efffc552b2ad4 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageAlertDialog.test.ets @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; +export default function stageAlertDialog() { + describe('stageAlertDialog', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/stageAlertDialog', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stageAlertDialog state success " + JSON.stringify(pages)); + if (!("stageAlertDialog" == pages.name)) { + console.info("get stageAlertDialog state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push stageAlertDialog page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stageAlertDialog page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('stageAlertDialog001', 0, async function (done) { + console.info('stageAlertDialog001 START'); + setTimeout(()=>{ + try{ + var innerEventOne = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("stageAlertDialog001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("stageAlertDialog001 on events_emitter err : " + JSON.stringify(err)); + } + console.info("stageAlertDialog001 click result is: " + JSON.stringify(sendEventByKey('showToastText', 10, ""))); + console.info('stageAlertDialog001 END '); + } catch(err) { + expect().assertFail() + console.info('stageAlertDialog001 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + it('stageAlertDialog002', 0, async function (done) { + console.info('stageAlertDialog002 START'); + setTimeout(()=>{ + try{ + var innerEventTwo = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("stageAlertDialog002 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(10); + done(); + } + try { + events_emitter.on(innerEventTwo, callback1); + } catch (err) { + console.info("stageAlertDialog002 on events_emitter err : " + JSON.stringify(err)); + } + console.info("stageAlertDialog002 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('TstageAlertDialog002 END '); + } catch(err) { + expect().assertFail() + console.info('stageAlertDialog002 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + it('stageAlertDialog003', 0, async function (done) { + console.info('stageAlertDialog003 START'); + setTimeout(()=>{ + try{ + var innerEventThree = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("stageAlertDialog003 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual("STATUS"); + done(); + } + try { + events_emitter.on(innerEventThree, callback1); + } catch (err) { + console.info("stageAlertDialog003 on events_emitter err : " + JSON.stringify(err)); + } + console.info("stageAlertDialog003 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('TstageAlertDialog003 END '); + } catch(err) { + expect().assertFail() + console.info('stageAlertDialog003 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageDatePickerDialog.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageDatePickerDialog.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..593558f90159ec6ba98254e425f0912250e03006 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageDatePickerDialog.test.ets @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; +export default function stageDatePickerDialog() { + describe('stageDatePickerDialog', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/stageDatePickerDialog', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stageDatePickerDialog state success " + JSON.stringify(pages)); + if (!("stageDatePickerDialog" == pages.name)) { + console.info("get stageDatePickerDialog state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push stageDatePickerDialog page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stageDatePickerDialog page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('testDatePickerDialog001', 0, async function (done) { + console.info('testDatePickerDialog001 START'); + setTimeout(()=>{ + try{ + var innerEventOne = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testDatePickerDialog001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testDatePickerDialog001 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showToastText', 10, ""))); + console.info('testDatePickerDialog001 END '); + } catch(err) { + expect().assertFail() + console.info('testDatePickerDialog001 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('testDatePickerDialog002', 0, async function (done) { + console.info('testDatePickerDialog002 START'); + setTimeout(()=>{ + try{ + var innerEventTwo = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testDatePickerDialog002 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(10); + done(); + } + try { + events_emitter.on(innerEventTwo, callback1); + } catch (err) { + console.info("testDatePickerDialog002 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testDatePickerDialog002 END '); + } catch(err) { + expect().assertFail() + console.info('testDatePickerDialog002 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + it('testDatePickerDialog003', 0, async function (done) { + console.info('testDatePickerDialog003 START'); + setTimeout(()=>{ + try{ + var innerEventThree = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testDatePickerDialog003 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual("STATUS"); + done(); + } + try { + events_emitter.on(innerEventThree, callback1); + } catch (err) { + console.info("testDatePickerDialog003 on events_emitter err : " + JSON.stringify(err)); + } + console.info("testDatePickerDialog003 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testDatePickerDialog003 END '); + } catch(err) { + expect().assertFail() + console.info('testDatePickerDialog003 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageFont.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageFont.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..22f8f645e5330f88bee4a4286ce7e5d10be87e78 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageFont.test.ets @@ -0,0 +1,195 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import router from '@system.router'; + +export default function stageFontTest() { + describe('TestAbility', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/stageFont', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stageFont state success " + JSON.stringify(pages)); + if (!("stageFont" == pages.name)) { + console.info("get stageFont state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push stageFont page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stageFont page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('Stage_Font_0100', 0, async function (done) { + console.info('Stage_Font_0100 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('button'); + console.info('Stage_Font_0100 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("Stage_Font_0100 obj.$attrs.labelStyle is: " + + JSON.stringify(obj.$attrs.labelStyle)); + let labelStyle = JSON.parse(obj.$attrs.labelStyle) + console.info("Stage_Font_0100 fontFamily is: " + + JSON.stringify(labelStyle)); + let font = JSON.parse(labelStyle.font) + expect(font.family).assertEqual("fontCustom"); + console.info('Stage_Font_0100 END '); + } catch(err) { + expect().assertFail() + console.info('Stage_Font_0100 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + it('Stage_Font_0200', 0, async function (done) { + console.info('Stage_Font_0200 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('text'); + console.info('Stage_Font_0200 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("Stage_Font_0200 obj.$attrs.fontFamily is: " + + JSON.stringify(obj.$attrs.fontFamily)); + expect(obj.$attrs.fontFamily).assertEqual("fontCustom"); + console.info('Stage_Font_0200 END '); + } catch(err) { + expect().assertFail() + console.info('Stage_Font_0200 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('Stage_Font_0300', 0, async function (done) { + console.info('Stage_Font_0300 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('textArea'); + console.info('Stage_Font_0300 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("Stage_Font_0300 obj.$attrs.fontFamily is: " + + JSON.stringify(obj.$attrs.fontFamily)); + expect(obj.$attrs.fontFamily).assertEqual("fontCustom"); + console.info('Stage_Font_0300 END '); + } catch(err) { + expect().assertFail() + console.info('Stage_Font_0300 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('Stage_Font_0400', 0, async function (done) { + console.info('Stage_Font_0400 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('textInput'); + console.info('Stage_Font_0400 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("Stage_Font_0400 obj.$attrs.fontFamily is: " + + JSON.stringify(obj.$attrs.fontFamily)); + expect(obj.$attrs.fontFamily).assertEqual("fontCustom"); + console.info('Stage_Font_0400 END '); + } catch(err) { + expect().assertFail() + console.info('Stage_Font_0400 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('Stage_Font_0500', 0, async function (done) { + console.info('Stage_Font_0500 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('textSpan'); + console.info('Stage_Font_0500 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("Stage_Font_0500 obj.$attrs.fontFamily is: " + + JSON.stringify(obj.$attrs.fontFamily)); + expect(obj.$attrs.fontFamily).assertEqual("fontCustom"); + console.info('Stage_Font_0500 END '); + } catch(err) { + expect().assertFail() + console.info('Stage_Font_0500 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('Stage_Font_0600', 0, async function (done) { + let fontRegister = globalThis.uiContent.getFont(); + console.info('Stage_Font_0600 START'); + try { + let font = fontRegister.registerFont(undefined) + expect(font).assertUndefined(); + } catch (err) { + console.error("push button page error " + JSON.stringify(err)); + } + console.info('Stage_Font_0600 END'); + done(); + }); + + it('Stage_Font_0700', 0, async function (done) { + let fontRegister = globalThis.uiContent.getFont(); + console.info('Stage_Font_0700 START'); + try { + let font = fontRegister.registerFont() + expect(font).assertUndefined(); + } catch (err) { + console.error("push button page error " + JSON.stringify(err)); + } + console.info('Stage_Font_0700 END'); + done(); + }); + + it('Stage_Font_0800', 0, async function (done) { + let fontRegister = globalThis.uiContent.getFont(); + console.info('Stage_Font_0800 START'); + try { + let font = fontRegister.registerFont(null) + expect(font).assertUndefined(); + } catch (err) { + console.error("push button page error " + JSON.stringify(err)); + } + console.info('Stage_Font_0800 END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageMediaquery.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageMediaquery.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..c52ef256334ddcd9a988646731c6f738c1588b39 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageMediaquery.test.ets @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; +export default function stageMediaquery() { + describe('stageMediaquery', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/stageMediaquery', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stageMediaquery state success " + JSON.stringify(pages)); + if (!("stageMediaquery" == pages.name)) { + console.info("get stageMediaquery state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push stageMediaquery page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stageMediaquery page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('testmediaQueryOff0001', 0, async function (done) { + setTimeout(()=>{ + try{ + console.info('mediaQueryOff testmediaQueryOff0001 START'); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testmediaQueryOff0001] width value :" + obj.$attrs.width); + } catch(err) { + } + done(); + },500) + }); + it('testmediaQueryOff0002', 0, async function (done) { + setTimeout(()=>{ + try{ + console.info('mediaQueryOff testmediaQueryOff0002 START'); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testmediaQueryOff0002] height value :" + obj.$attrs.height); + } catch(err) { + } + done(); + },500) + }); + it('testmediaQueryOff0003', 0, async function (done) { + setTimeout(()=>{ + try{ + console.info('mediaQueryOff testmediaQueryOff0003 START'); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testmediaQueryOff0003] fontSize value :" + obj.$attrs.fontSize); + } catch(err) { + } + done(); + },500) + }); + it('testmediaQueryOff0004', 0, async function (done) { + setTimeout(()=>{ + try{ + console.info('mediaQueryOff testmediaQueryOff0004 START'); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testmediaQueryOff0004] opacity value :" + obj.$attrs.opacity); + } catch(err) { + } + done(); + },500) + }); + it('testmediaQueryOff0005', 0, async function (done) { + setTimeout(()=>{ + try{ + console.info('mediaQueryOff testmediaQueryOff0005 START'); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testmediaQueryOff0005] align value :" + obj.$attrs.align); + } catch(err) { + } + done(); + },500) + }); + it('testmediaQueryOff0006', 0, async function (done) { + setTimeout(()=>{ + try{ + console.info('mediaQueryOff testmediaQueryOff0006 START'); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testmediaQueryOff0006] fontColor value :" + obj.$attrs.fontColor); + } catch(err) { + } + done(); + },500) + }); + it('testmediaQueryOff0007', 0, async function (done) { + setTimeout(()=>{ + try{ + console.info('mediaQueryOff testmediaQueryOff0007 START'); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testmediaQueryOff0007] lineHeight value :" + obj.$attrs.lineHeight); + } catch(err) { + } + done(); + },500) + }); + it('testmediaQueryOff0009', 0, async function (done) { + setTimeout(()=>{ + try{ + console.info('mediaQueryOff testmediaQueryOff009 START'); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testmediaQueryOff0009] padding value :" + obj.$attrs.padding); + } catch(err) { + } + done(); + },500) + }); + it('testmediaQueryOff0010', 0, async function (done) { + setTimeout(()=>{ + try{ + console.info('mediaQueryOff testmediaQueryOff0010 START'); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Center"); + console.info("[testmediaQueryOff0010] textAlign value :" + obj.$attrs.textAlign); + } catch(err) { + } + done(); + },500) + }); + it('testmediaQueryOff0011', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0011 START'); + try { + var innerEventOne = { + eventId: 60218, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testmediaQueryOff0011 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + } + console.info("testmediaQueryOff0011 click result is: " + JSON.stringify(sendEventByKey('offText', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testmediaQueryOff0011 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testmediaQueryOff0011 END'); + done(); + }); + it('testmediaQueryOff0012', 0, async function (done) { + console.info('matchMediaSync testmediaQueryOff0012 START'); + try { + var innerEventOne = { + eventId: 60219, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testmediaQueryOff0012 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + } + console.info("testmediaQueryOff0012 click result is: " + JSON.stringify(sendEventByKey('matchMediaSyncText', 10, ""))); + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testmediaQueryOff0012 on events_emitter err : " + JSON.stringify(err)); + } + console.info('testmediaQueryOff0012 END'); + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stagePrompt.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stagePrompt.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..219491b3ad576fce6ed67f4d49612c44dd16e039 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stagePrompt.test.ets @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; + +export default function stagePrompt() { + describe('stagePrompt', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/stagePrompt', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stagePrompt state success " + JSON.stringify(pages)); + if (!("stagePrompt" == pages.name)) { + console.info("get stagePrompt state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push stagePrompt page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stagePrompt page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + it('testPromptActionShowToast001', 0, async function (done) { + console.info('testPromptActionShowToast001 START'); + try{ + var innerEventOne = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testPromptActionShowToast001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testPromptActionShowToast001 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showToastText', 10, ""))); + console.info('testPromptActionShowToast001 END '); + } catch(err) { + expect().assertFail() + console.info('testPromptActionShowToast001 ERR '+ JSON.stringify(err)); + } + done(); + }); + + it('testPromptActionShowToast002', 0, async function (done) { + console.info('testPromptActionShowToast002 START'); + try{ + var innerEventTwo = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testPromptActionShowToast002 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventTwo, callback1); + } catch (err) { + console.info("testPromptActionShowToast002 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testPromptActionShowToast002 END '); + } catch(err) { + expect().assertFail() + console.info('testPromptActionShowToast002 ERR '+ JSON.stringify(err)); + } + done(); + }); + it('testPromptActionShowToast003', 0, async function (done) { + console.info('testPromptActionShowToast003 START'); + try{ + var innerEventThree = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testPromptActionShowToast003 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventThree, callback1); + } catch (err) { + console.info("testPromptActionShowToast003 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testPromptActionShowToast003 END '); + } catch(err) { + expect().assertFail() + console.info('testPromptActionShowToast003 ERR '+ JSON.stringify(err)); + } + done(); + }); + it('testPromptActionShowToast004', 0, async function (done) { + console.info('testPromptActionShowToast004 START'); + try{ + var innerEventFour = { + eventId: 60223, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testPromptActionShowToast004 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventFour, callback1); + } catch (err) { + console.info("testPromptActionShowToast004 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testPromptActionShowToast004 END '); + } catch(err) { + expect().assertFail() + console.info('testPromptActionShowToast004 ERR '+ JSON.stringify(err)); + } + done(); + }); + it('testPromptActionShowToast005', 0, async function (done) { + console.info('testPromptActionShowToast005 START'); + try{ + var innerEventFive = { + eventId: 60224, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testPromptActionShowToast005 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventFive, callback1); + } catch (err) { + console.info("testPromptActionShowToast005 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testPromptActionShowToast005 END '); + } catch(err) { + expect().assertFail() + console.info('testPromptActionShowToast005 ERR '+ JSON.stringify(err)); + } + done(); + }); + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageRouter.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageRouter.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..3df4991ae071cd7d39088ae729b96a5c7792ae5f --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageRouter.test.ets @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import router from '@system.router'; + +export default function stageRouterTest() { + describe('stageRouterTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/stageRouter', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stageRouter state success " + JSON.stringify(pages)); + if (!("stageRouter" == pages.name)) { + console.info("get stageRouter state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push stageRouter page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stageRouter page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('testrouterstage0001', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0001 START'); + let result; + let options = { + url: '../TestAbility/pages/pushUrl.ets', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + } + try { + result = router.pushUrl(options) + expect(typeof(result)).assertEqual('object'); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0001 END'); + done(); + }); + + it('testrouterstage0002', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0002 START'); + let result; + try { + result = router.pushUrl({ + url: '../TestAbility/pages/pushUrl.ets', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }, (err) => { + if (err) { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('pushUrl success'); + }); + expect(result).assertUndefined(); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0002 END'); + done(); + }); + + + it('testrouterstage0003', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0003 START'); + let result; + try { + result = router.pushUrl({ + url: '../TestAbility/pages/pushUrl.ets', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }, router.RouterMode.Standard) + .then(() => {}) + .catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + expect(typeof(result)).assertEqual('object'); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0003 END'); + done(); + }); + + it('testrouterstage0004', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0004 START'); + let result; + try { + result = router.pushUrl({ + url: '../TestAbility/pages/pushUrl.ets', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }, router.RouterMode.Standard) + expect(result).assertUndefined(); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0004 END'); + done(); + }); + + it('testrouterstage0005', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0005 START'); + let result; + try { + result = router.replaceUrl({ + url: '../TestAbility/pages/pushUrl.ets', + params: { + data1: 'message' + } + }) + .then(() => {}) + .catch(err => { + console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); + }) + expect(typeof(result)).assertEqual('object'); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0005 END'); + done(); + }); + + it('testrouterstage0006', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0006 START'); + let result; + try { + result = router.replaceUrl({ + url: '../TestAbility/pages/pushUrl.ets', + params: { + data1: 'message' + } + }, (err) => { + if (err) { + console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('replaceUrl success'); + }); + expect(result).assertUndefined(); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0006 END'); + done(); + }); + + it('testrouterstage0007', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0007 START'); + let result; + try { + result = router.replaceUrl({ + url: '../TestAbility/pages/pushUrl.ets', + params: { + data1: 'message' + } + }, router.RouterMode.Standard) + .then(() => {}) + .catch(err => { + console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); + }) + expect(typeof(result)).assertEqual('object'); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0007 END'); + done(); + }); + + it('testrouterstage0008', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0008 START'); + let result; + try { + result = router.replaceUrl({ + url: '../TestAbility/pages/pushUrl.ets', + params: { + data1: 'message' + } + }, router.RouterMode.Standard, (err) => { + if (err) { + console.error(`replaceUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('replaceUrl success'); + }); + expect(result).assertUndefined(); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0008 END'); + done(); + }); + + it('testrouterstage0009', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0009 START'); + let result; + try { + result = router.back({ url: '../TestAbility/pages/pushUrl.ets' }) + expect(result).assertUndefined(); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0009 END'); + done(); + }); + + it('testrouterstage0010', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0010 START'); + let result; + try { + result = router.clear() + expect(result).assertUndefined(); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0010 END'); + done(); + }); + + it('testrouterstage0011', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0011 START'); + let result; + try { + result = router.getLength() + expect(typeof(result)).assertEqual('string'); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0011 END'); + done(); + }); + + it('testrouterstage0012', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0012 START'); + let result; + try { + result = router.getState() + expect(typeof(result)).assertEqual('object'); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0012 END'); + done(); + }); + + it('testrouterstage0013', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0013 START'); + let result; + try { + result = router.showAlertBeforeBackPage({ + message: 'Message Info' + }); + expect(result).assertUndefined(); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0013 END'); + done(); + }); + + it('testrouterstage0014', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0014 START'); + let result; + try { + result = router.hideAlertBeforeBackPage() + expect(result).assertUndefined(); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0014 END'); + done(); + }); + + it('testrouterstage0015', 0, async function (done) { + let router = globalThis.uiContent.getRouter(); + console.info('testrouterstage0015 START'); + let result; + try { + result = router.getParams() + expect(result).assertUndefined(); + console.info("push button page success " + JSON.stringify(result)); + } catch (err) { + console.error("push button page error " + JSON.stringify(result)); + } + console.info('testrouterstage0015 END'); + done(); + }); + + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageTextPickerDialog.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageTextPickerDialog.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..6a227d1a5c409951ceffdd2fa35ab47c03f42d50 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageTextPickerDialog.test.ets @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; + +export default function stageTextPickerDialog() { + describe('stageTextPickerDialog', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/stageTextPickerDialog', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stageTextPickerDialog state success " + JSON.stringify(pages)); + if (!("stageTextPickerDialog" == pages.name)) { + console.info("get stageTextPickerDialog state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push stageTextPickerDialog page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stageTextPickerDialog page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('testTextPickerDialog001', 0, async function (done) { + console.info('testTextPickerDialog001 START'); + setTimeout(()=>{ + try{ + var innerEventOne = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testTextPickerDialog001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("testTextPickerDialog001 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showToastText', 10, ""))); + console.info('testTextPickerDialog001 END '); + } catch(err) { + expect().assertFail() + console.info('testTextPickerDialog001 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('testTextPickerDialog002', 0, async function (done) { + console.info('testTextPickerDialog002 START'); + setTimeout(()=>{ + try{ + var innerEventTwo = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testTextPickerDialog002 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(10); + done(); + } + try { + events_emitter.on(innerEventTwo, callback1); + } catch (err) { + console.info("testTextPickerDialog002 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testTextPickerDialog002 END '); + } catch(err) { + expect().assertFail() + console.info('testTextPickerDialog002 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + it('testTextPickerDialog003', 0, async function (done) { + console.info('testTextPickerDialog003 START'); + setTimeout(()=>{ + try{ + var innerEventThree = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("testTextPickerDialog003 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual("STATUS"); + done(); + } + try { + events_emitter.on(innerEventThree, callback1); + } catch (err) { + console.info("testTextPickerDialog003 on events_emitter err : " + JSON.stringify(err)); + } + console.info("testTextPickerDialog003 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('testTextPickerDialog003 END '); + } catch(err) { + expect().assertFail() + console.info('testTextPickerDialog003 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageTimePickerDialog.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageTimePickerDialog.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..52c738f3d5b15208d69ba9df2abd08ee28f210bf --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/stageTimePickerDialog.test.ets @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import events_emitter from '@ohos.events.emitter'; +import router from '@system.router'; + +export default function stageTimePickerDialog() { + describe('stageTimePickerDialog', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/stageTimePickerDialog', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get stageTimePickerDialog state success " + JSON.stringify(pages)); + if (!("stageTimePickerDialog" == pages.name)) { + console.info("get stageTimePickerDialog state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push stageTimePickerDialog page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push stageTimePickerDialog page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('TimePickerDialog001', 0, async function (done) { + console.info('TimePickerDialog001 START'); + setTimeout(()=>{ + try{ + var innerEventOne = { + eventId: 60220, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("TimePickerDialog001 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(true); + done(); + } + try { + events_emitter.on(innerEventOne, callback1); + } catch (err) { + console.info("TimePickerDialog001 on events_emitter err : " + JSON.stringify(err)); + } + console.info("onSelect_001 click result is: " + JSON.stringify(sendEventByKey('showToastText', 10, ""))); + console.info('TimePickerDialog001 END '); + } catch(err) { + expect().assertFail() + console.info('TimePickerDialog001 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('TimePickerDialog002', 0, async function (done) { + console.info('TimePickerDialog002 START'); + setTimeout(()=>{ + try{ + var innerEventTwo = { + eventId: 60221, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("TimePickerDialog002 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual(10); + done(); + } + try { + events_emitter.on(innerEventTwo, callback1); + } catch (err) { + console.info("TimePickerDialog002 on events_emitter err : " + JSON.stringify(err)); + } + console.info("TimePickerDialog002 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('TimePickerDialog002 END '); + } catch(err) { + expect().assertFail() + console.info('tTimePickerDialog002 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + it('TimePickerDialog003', 0, async function (done) { + console.info('TimePickerDialog003 START'); + setTimeout(()=>{ + try{ + var innerEventThree = { + eventId: 60222, + priority: events_emitter.EventPriority.LOW + } + var callback1 = (eventData) => { + console.info("TimePickerDialog003 get event state result is: " + JSON.stringify(eventData)); + expect(eventData.data.STATUS).assertEqual("STATUS"); + done(); + } + try { + events_emitter.on(innerEventThree, callback1); + } catch (err) { + console.info("TimePickerDialog003 on events_emitter err : " + JSON.stringify(err)); + } + console.info("TimePickerDialog003 click result is: " + JSON.stringify(sendEventByKey('showDialogText', 10, ""))); + console.info('TimePickerDialog003 END '); + } catch(err) { + expect().assertFail() + console.info('TimePickerDialog003 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/textObscuredTest.test.ets b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/textObscuredTest.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..16b7356a4721713342dc55176c8b1018304ebd03 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/ets/test/textObscuredTest.test.ets @@ -0,0 +1,181 @@ +/* + * Copyright (c) 2023 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 hilog from '@ohos.hilog'; +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium' +import router from '@system.router'; + +export default function textObscuredTest() { + describe('textObscuredTest', function () { + // Defines a test suite. Two parameters are supported: test suite name and test suite function. + beforeAll(function () { + // Presets an action, which is performed only once before all test cases of the test suite start. + // This API supports only one parameter: preset action function. + }) + beforeEach(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'TestAbility/pages/textObscured', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textObscured state success " + JSON.stringify(pages)); + if (!("textObscured" == pages.name)) { + console.info("get textObscured state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + console.info("push textObscured page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push textObscured page error: " + err); + } + done() + }); + afterEach(function () { + // Presets a clear action, which is performed after each unit test case ends. + // The number of execution times is the same as the number of test cases defined by **it**. + // This API supports only one parameter: clear action function. + }) + afterAll(function () { + // Presets a clear action, which is performed after all test cases of the test suite end. + // This API supports only one parameter: clear action function. + }) + + it('ArkUX_Redacted_Text_0090', 0, async function (done) { + console.info('ArkUX_Redacted_Text_0090 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Text_0090'); + console.info('ArkUX_Redacted_Text_0090 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Text_0090 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Text_0090 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(attr.fontSize).assertEqual("30.00fp"); + expect(attr.fontColor).assertEqual("#FF0000FF"); + expect(attr.textAlign).assertEqual("TextAlign.Start"); + expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER)); + expect(attr.baselineOffset).assertEqual("30"); + console.info('ArkUX_Redacted_Text_0090 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Text_0090 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('ArkUX_Redacted_Text_0100', 0, async function (done) { + console.info('ArkUX_Redacted_Text_0100 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Text_0100'); + console.info('ArkUX_Redacted_Text_0100 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Text_0100 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Text_0100 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(attr.fontSize).assertEqual("10.00fp"); + expect(attr.fontColor).assertEqual("#FF0000FE"); + expect(attr.textAlign).assertEqual("TextAlign.Start"); + expect(attr.obscured.length).assertEqual(0); + expect(attr.baselineOffset).assertEqual("0"); + console.info('ArkUX_Redacted_Text_0100 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Text_0100 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('ArkUX_Redacted_Text_0110', 0, async function (done) { + console.info('ArkUX_Redacted_Text_0110 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Text_0110'); + console.info('ArkUX_Redacted_Text_0110 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Text_0110 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Text_0110 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(attr.fontSize).assertEqual("100.00fp"); + expect(attr.fontColor).assertEqual("#FF0000FD"); + expect(attr.textAlign).assertEqual("TextAlign.End"); + expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER)); + expect(attr.baselineOffset).assertEqual("100"); + console.info('ArkUX_Redacted_Text_0110 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Text_0110 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('ArkUX_Redacted_Text_0120', 0, async function (done) { + console.info('ArkUX_Redacted_Text_0120 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Text_0120'); + console.info('ArkUX_Redacted_Text_0120 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Text_0120 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Text_0120 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(attr.fontSize).assertEqual("1000.00fp"); + expect(attr.fontColor).assertEqual("#FF0000FC"); + expect(attr.textAlign).assertEqual("TextAlign.Center"); + expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER)); + expect(attr.baselineOffset).assertEqual("1000"); + console.info('ArkUX_Redacted_Text_0120 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Text_0120 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + it('ArkUX_Redacted_Text_0130', 0, async function (done) { + console.info('ArkUX_Redacted_Text_0130 START'); + setTimeout(()=>{ + try{ + let strJson = getInspectorByKey('ArkUX_Redacted_Text_0130'); + console.info('ArkUX_Redacted_Text_0130 START :'+ JSON.stringify(strJson)); + let obj = JSON.parse(strJson); + console.info("ArkUX_Redacted_Text_0130 obj is: " + JSON.stringify(obj)); + console.info("ArkUX_Redacted_Text_0130 obj.$attrs is: " + + JSON.stringify(obj.$attrs)); + let attr = obj.$attrs + expect(attr.fontSize).assertEqual("1.00fp"); + expect(attr.fontColor).assertEqual("#FF0000FB"); + expect(attr.textAlign).assertEqual("TextAlign.Start"); + expect(Number(attr.obscured[0])).assertEqual(Number(ObscuredReasons.PLACEHOLDER)); + expect(attr.baselineOffset).assertEqual("1"); + console.info('ArkUX_Redacted_Text_0130 END '); + } catch(err) { + expect().assertFail() + console.info('ArkUX_Redacted_Text_0130 ERR '+ JSON.stringify(err)); + } + done(); + },500) + }); + + }) +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/module.json b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/module.json new file mode 100644 index 0000000000000000000000000000000000000000..f0fdd554305ff33174c0285bada7b26b6628d741 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/module.json @@ -0,0 +1,41 @@ +{ + "module": { + "name": "phone", + "type": "feature", + "description": "$string:module_test_desc", + "mainElement": "TestAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": false, + "pages": "$profile:test_pages", + "metadata": [{ + "name": "ArkTSPartialUpdate", + "value": "true" + }], + "abilities": [ + { + "name": "TestAbility", + "srcEntrance": "./ets/TestAbility/TestAbility.ets", + "description": "$string:TestAbility_desc", + "icon": "$media:icon", + "label": "$string:TestAbility_label", + "visible": true, + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:start_window_background", + "skills": [ + { + "actions": [ + "action.system.home" + ], + "entities": [ + "entity.system.home" + ] + } + ] + } + ] + } +} diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/element/color.json b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/element/color.json new file mode 100644 index 0000000000000000000000000000000000000000..33b5a05bcb3fa146ae58af80e572c8a34718fadf --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/element/color.json @@ -0,0 +1,16 @@ +{ + "color": [ + { + "name": "start_window_background", + "value": "#FFFFFF" + }, + { + "name": "Divider_color", + "value": "#000000" + }, + { + "name": "checkbox_Color", + "value": "#FFFD0000" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/element/string.json b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..f9a034064cc527b3c81e2da6e66b1d0bde87be5a --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/element/string.json @@ -0,0 +1,32 @@ +{ + "string": [ + { + "name": "module_test_desc", + "value": "test ability description" + }, + { + "name": "TestAbility_desc", + "value": "the test ability" + }, + { + "name": "TestAbility_label", + "value": "test label" + }, + { + "name": "Divider_width", + "value": "10px" + }, + { + "name": "Divider_startMargin", + "value": "5px" + }, + { + "name": "Divider_endMargin", + "value": "5px" + }, + { + "name": "Check_Mark_Size_test", + "value": "50vp" + } + ] +} \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/media/icon.png b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/media/icon.png differ diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/media/play.svg b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/media/play.svg new file mode 100644 index 0000000000000000000000000000000000000000..abc05717090538cf90ed037a67c9a3c0a604aaed --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/media/play.svg @@ -0,0 +1 @@ +<svg id="图层_2" data-name="图层 2" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 96 96"><defs><style>.cls-1{fill:#1a1a1a;}</style></defs><title>ic</title><path d="M36,63v-30a4,4,0,0,1,6-3.47l26,15A4,4,0,0,1,69.46,50,4.09,4.09,0,0,1,68,51.44l-26,15A4,4,0,0,1,36,63ZM48,86A38,38,0,1,0,10,48,38,38,0,0,0,48,86Zm0,6A44,44,0,1,1,92,48,44,44,0,0,1,48,92Z" fill="#61E4BD"/></svg> \ No newline at end of file diff --git a/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/profile/test_pages.json b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/profile/test_pages.json new file mode 100644 index 0000000000000000000000000000000000000000..e829937eea0197f98fcc969c1bb7ff0216acb2d4 --- /dev/null +++ b/arkui/ace_ets_component_completion/ace_ets_component_wholeCompletion/src/main/resources/base/profile/test_pages.json @@ -0,0 +1,21 @@ +{ + "src": [ + "TestAbility/pages/Index", + "TestAbility/pages/stageFont", + "TestAbility/pages/stageRouter", + "TestAbility/pages/pushUrl", + "TestAbility/pages/animateto", + "TestAbility/pages/stageActionSheet", + "TestAbility/pages/stageAlertDialog", + "TestAbility/pages/stageDatePickerDialog", + "TestAbility/pages/stageMediaquery", + "TestAbility/pages/stagePrompt", + "TestAbility/pages/stageTextPickerDialog", + "TestAbility/pages/stageTimePickerDialog", + "TestAbility/pages/bindPopupOffset", + "TestAbility/pages/animationCurve", + "TestAbility/pages/hover", + "TestAbility/pages/textObscured", + "TestAbility/pages/imageObscuredTest" + ] +} \ No newline at end of file