diff --git a/ace/BUILD.gn b/ace/BUILD.gn index d2e4c02075c084e68abaeee137311ed9c6d0f9d9..3eb3f2f1b2724ad094ed053cfcacfef63db1e6ae 100755 --- a/ace/BUILD.gn +++ b/ace/BUILD.gn @@ -16,6 +16,7 @@ group("ace") { deps = [ "ace_ets_standard:ActsAceEtsStTest", "ace_ets_test:ActsAceEtsTest", + "ace_ets_third_test:ActsAceEtsThirdTest", "ace_standard:ace_standard_test", ] } diff --git a/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/TabJsunit.test.ets b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/TabJsunit.test.ets index 924763dd43090c79b191189a8016dfe8c66a07bd..c3b1b2239ec7db0ce076508c1e126940e3392e8f 100644 --- a/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/TabJsunit.test.ets +++ b/ace/ace_ets_test/entry/src/main/ets/MainAbility/test/TabJsunit.test.ets @@ -67,11 +67,13 @@ export default function tabJsunit() { let obj = JSON.parse(strJson); console.info("get inspector value is: " + JSON.stringify(obj)); console.log(JSON.stringify(obj.$type)) + console.log('obj.$attrs.scrollable' + typeof (obj.$attrs.scrollable)) + console.log('obj.$attrs.vertical' + typeof (obj.$attrs.vertical)) expect(obj.$type).assertEqual('Tabs') expect(obj.$attrs.barPosition).assertEqual('BarPosition.Start') expect(obj.$attrs.index).assertEqual('1') - expect(obj.$attrs.vertical).assertEqual("true") - expect(obj.$attrs.scrollable).assertEqual("true") + expect(obj.$attrs.vertical).assertEqual('true') + expect(obj.$attrs.scrollable).assertTrue() expect(obj.$attrs.barMode).assertEqual('BarMode.Fixed') expect(obj.$attrs.barWidth).assertEqual(70.000000.toFixed(6)) expect(obj.$attrs.barHeight).assertEqual(150.000000.toFixed(6)) @@ -111,8 +113,8 @@ export default function tabJsunit() { expect(obj.$type).assertEqual('Tabs') expect(obj.$attrs.barPosition).assertEqual('BarPosition.End') expect(obj.$attrs.barMode).assertEqual('BarMode.Scrollable') - expect(obj.$attrs.vertical).assertEqual("false") - expect(obj.$attrs.scrollable).assertEqual("false") + expect(obj.$attrs.vertical).assertEqual('false') + expect(obj.$attrs.scrollable).assertFalse() console.info('++++++++++++++++ Tab TestCase 3 End ++++++++++++++++'); done(); }); diff --git a/ace/ace_ets_third_test/BUILD.gn b/ace/ace_ets_third_test/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..ca31f77b041d604eb8f2d5bff0404bb0e634f47a --- /dev/null +++ b/ace/ace_ets_third_test/BUILD.gn @@ -0,0 +1,32 @@ +# Copyright (c) 2021 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//test/xts/tools/build/suite.gni") + +ohos_js_hap_suite("ActsAceEtsThirdTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":ace_third_ets_assets", + ":ace_third_ets_resources", + ] + ets2abc = true + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsAceEtsThirdTest" +} +ohos_js_assets("ace_third_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_resources("ace_third_ets_resources") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/ace/ace_ets_third_test/Test.json b/ace/ace_ets_third_test/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..a75af8ed2e2edbeb37638238904e9a6ec3b4792f --- /dev/null +++ b/ace/ace_ets_third_test/Test.json @@ -0,0 +1,18 @@ +{ + "description": "Configuration for hjunit demo Tests", + "driver": { + "type": "JSUnitTest", + "test-timeout": "600000", + "package": "com.example.actsaceetstest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": [ + "ActsAceEtsThirdTest.hap" + ], + "type": "AppInstallKit", + "cleanup-apps": true + } + ] +} diff --git a/ace/ace_ets_third_test/entry/src/main/config.json b/ace/ace_ets_third_test/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..adf37625eecf4a40a7039c134c328855465879c8 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/config.json @@ -0,0 +1,78 @@ +{ + "app": { + "bundleName": "com.example.actsaceetstest", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 7 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.example.actsaceetstest", + "name": ".MyApplication", + "mainAbility": ".MainAbility", + "srcPath": "MainAbility", + "deviceType": [ + "phone" + ], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": false + }, + "abilities": [ + { + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ], + "orientation": "unspecified", + "visible": true, + "srcPath": "MainAbility", + "name": ".MainAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:description_mainability", + "formsEnabled": false, + "label": "$string:entry_MainAbility", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index", + "pages/TextArea", + "pages/TextInput", + "pages/Toggle", + "pages/ScrollBar", + "pages/Stepper", + "pages/Navigation" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/app.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..261fadca29ff0ea310a8bc105ddd1af65e2dd2f6 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +export default { + onCreate() { + console.info('Application onCreate') + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/Navigation.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/Navigation.ets new file mode 100644 index 0000000000000000000000000000000000000000..065430cec7d0c80703be945bb2aa1afd69919823 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/Navigation.ets @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct NavigationExample { + private arr: number[]= [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State hideBar: boolean = true + + onPageShow() { + console.info('navigation page show called'); + } + + onBuildDone() { + console.info('navigation build done called'); + } + + @Builder NavigationMenus1() { + Image('common/icon.png') + .width(25) + .height(25) + .margin({ left: 30 }) + } + + build() { + Column() { + Navigation() { + Search({ value: '', placeholder: '' }).width('90%').margin(0) + List({ space: 5, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('90%') + .height(40) + .backgroundColor('#3366CC') + .fontSize(15) + .textAlign(TextAlign.Center) + }.editable(true) + }, item => item) + } + .listDirection(Axis.Vertical) + .height(200) + .margin({ top: 10, left: 20 }) + .width('100%') + } + .key('navigation1') + .height('50%') + .title('title') + .subTitle('subtitle') + .menus(this.NavigationMenus1) + .titleMode(NavigationTitleMode.Full) + .hideTitleBar(false) + .hideToolBar(false) + .hideBackButton(false) + .toolBar({ items: [ + { value: 'app' }, + { value: 'add' }, + { value: 'collect' } + ] }) + + Navigation() { + Search({ value: '', placeholder: '' }).width('90%').margin(0) + List({ space: 5, initialIndex: 0 }) { + ListItem() { + Text('Navigation1') + .width('90%') + .height(50) + .backgroundColor('#3366CC') + .fontSize(15) + .textAlign(TextAlign.Center) + } + } + .listDirection(Axis.Vertical) + .height(50) + .margin({ top: 10, left: 20 }) + .width('100%') + } + .height('10%') + .key('navigation2') + .hideTitleBar(true) + .hideBackButton(true) + .titleMode(NavigationTitleMode.Mini) + + Navigation() { + Search({ value: '', placeholder: '' }).width('90%').margin(25) + List({ space: 5, initialIndex: 0 }) { + ListItem() { + Text('Navigation2') + .width('90%') + .height(50) + .backgroundColor('#3366CC') + .fontSize(15) + .textAlign(TextAlign.Center) + } + } + .listDirection(Axis.Vertical) + .height(50) + .margin({ top: 10, left: 20 }) + .width('100%') + } + .key('navigation3') + .height('10%') + .titleMode(NavigationTitleMode.Free) + } + } +} + + diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/ScrollBar.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/ScrollBar.ets new file mode 100644 index 0000000000000000000000000000000000000000..80bc6906c0b315beb50ac67417f92e41fb07d624 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/ScrollBar.ets @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ScrollBarExample { + private scroller1: Scroller = new Scroller(); + private scroller2: Scroller = new Scroller(); + private scroller3: Scroller = new Scroller(); + private arr1: number[] = [1, 2, 3, 4, 5, 6, 7] + private arr2: string[] = ['a', 'b', 'c', 'd', 'e', 'f', 'g'] + private arr3: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G'] + private content: string = "Scroll Page"; + + onPageShow() { + console.info('stepper page show called'); + } + + onBuildDone() { + console.info('stepper page build done called'); + } + + build() { + Column({ space: 10 }) { + Text(`${this.content}`) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Flex({ direction: FlexDirection.Row }) { + Scroll(this.scroller1) { + Flex({ direction: FlexDirection.Column }) { + ForEach(this.arr1, (item) => { + Row() { + Text(item.toString()) + .width('90%') + .height(50) + .backgroundColor('#3366CC') + .fontSize(16) + .textAlign(TextAlign.Center) + .margin(5) + } + }, item => item) + }.margin({ left: 50 }) + } + .scrollable(ScrollDirection.Vertical) + + ScrollBar({ scroller: this.scroller1, direction: ScrollBarDirection.Vertical, state: BarState.Auto }) { + Text() + .width(30) + .height(100) + .borderRadius(10) + .backgroundColor('#C0C0C0') + }.width(30).backgroundColor('#ededed').key('scrollbar1') + + ScrollBar({ scroller: this.scroller1, direction: ScrollBarDirection.Vertical, state: BarState.On }) { + Text() + .width(30) + .height(100) + .borderRadius(10) + .backgroundColor('#C0C0C0') + }.width(30).backgroundColor('#ededed').key('scrollbar2') + + ScrollBar({ scroller: this.scroller1, direction: ScrollBarDirection.Vertical, state: BarState.Off }) { + Text() + .width(30) + .height(100) + .borderRadius(10) + .backgroundColor('#C0C0C0') + }.width(30).backgroundColor('#ededed').key('scrollbar3') + }.height('45%') + + Flex({ direction: FlexDirection.Column }) { + Scroll(this.scroller2) { + Flex({ direction: FlexDirection.Row }) { + ForEach(this.arr2, (item) => { + Row() { + Text(item.toString()) + .width('10%') + .height(150) + .backgroundColor(0xfff5deb3) + .fontSize(16) + .textAlign(TextAlign.Center) + .margin(5) + } + }, item => item) + }.margin({ left: 15 }) + } + .scrollable(ScrollDirection.Horizontal) + + ScrollBar({ scroller: this.scroller2, direction: ScrollBarDirection.Horizontal, state: BarState.Auto }) { + Text() + .width('90%') + .height(20) + .borderRadius(10) + .backgroundColor('#C0C0C0') + }.height(20).backgroundColor('#ededed').key('scrollbar4').margin({top:30}) + + ScrollBar({ scroller: this.scroller2, direction: ScrollBarDirection.Horizontal, state: BarState.On }) { + Text() + .width('90%') + .height(20) + .borderRadius(10) + .backgroundColor('#C0C0C0') + }.width(30).backgroundColor('#ededed').key('scrollbar5').margin({top:30}) + + ScrollBar({ scroller: this.scroller2, direction: ScrollBarDirection.Horizontal, state: BarState.Off }) { + Text() + .width('90%') + .height(20) + .borderRadius(10) + .backgroundColor('#C0C0C0') + }.width(30).backgroundColor('#ededed').key('scrollbar6').margin({top:30}) + }.height('45%').width('90%').margin({top:30}) + } + } +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/Stepper.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/Stepper.ets new file mode 100644 index 0000000000000000000000000000000000000000..f3f99498154176c33ab65a7d24e845db02c15852 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/Stepper.ets @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct StepperExample { + @State currentIndex: number= 0; + @State firstState: ItemState = ItemState.Normal + @State secondState: ItemState = ItemState.Normal + + build() { + Stepper({ + index: this.currentIndex + }) { + StepperItem() { + Text('Stepper Page One') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({ top: 200 }) + } + .nextLabel('') + .position({ x: '35%', y: 0 }) + + StepperItem() { + Text('Stepper Page Two') + .fontSize(35) + .fontColor(Color.Blue) + .width(200) + .lineHeight(50) + .margin({ top: 200 }) + .onClick(() => { + this.firstState = this.firstState === ItemState.Skip ? ItemState.Normal : ItemState.Skip + }) + } + .nextLabel('Next') + .prevLabel('Previous') + .status(this.firstState) + .position({ x: '35%,y:0' }) + } + .key('stepper') + .onFinish(() => { + console.info('onFinish') + }) + .onSkip(() => { + console.info('onSkip') + }) + .onChange((prevIndex: number, index: number) => { + this.currentIndex = index + }) + .align(Alignment.Center) + } +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/TextArea.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/TextArea.ets new file mode 100644 index 0000000000000000000000000000000000000000..b8e5a9353ef8bce194968c6b48412db00466bae4 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/TextArea.ets @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextAreaExample { + @State text: string = '' + @State text1: string = 'TextArea1' + @State text2: string = 'TextArea2' + @State text3: string = 'TextArea3' + + onPageShow() { + console.info('textArea page show called'); + } + + onBuildDone() { + console.info('textArea page build done called'); + } + + build() { + Column() { + Text(this.text1).width('90%').height(60).fontSize(40) + TextArea({ placeholder: 'Please entry keywords', text: this.text }) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .textAlign(TextAlign.Start) + .caretColor('#FF000000') + .height(60) + .fontSize(40) + .fontWeight(FontWeight.Bold) + .fontFamily('cursive') + .fontStyle(FontStyle.Italic) + .fontColor('#FFFF0000') + .onChange((value: string) => { + this.text1 = value + }) + .key('textArea1') + + Text(this.text2).width('90%').height(60).fontSize(40) + TextArea({ placeholder: 'Please entry keywords', text: this.text }) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .textAlign(TextAlign.Center) + .caretColor('#FF000000') + .height(60) + .fontSize(40) + .fontWeight(FontWeight.Bold) + .fontFamily('cursive') + .fontStyle(FontStyle.Italic) + .fontColor('#FFFF0000') + .onChange((value: string) => { + this.text2 = value + }) + .key('textArea2') + + Text(this.text3).width('90%').height(60).fontSize(40) + TextArea({ placeholder: 'Please entry keywords', text: this.text }) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .textAlign(TextAlign.End) + .caretColor('#FF000000') + .height(60) + .fontSize(40) + .fontWeight(FontWeight.Bold) + .fontFamily('cursive') + .fontStyle(FontStyle.Italic) + .fontColor('#FFFF0000') + .onChange((value: string) => { + this.text3 = value + }) + .key('textArea3') + } + .width('100%') + .height('100%') + } +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/TextInput.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/TextInput.ets new file mode 100644 index 0000000000000000000000000000000000000000..220765c59268671c7c3d534570afeec878c8a365 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/TextInput.ets @@ -0,0 +1,203 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct TextInputExample { + @State text: string = '' + @State textNew: string = '' + + onPageShow() { + console.info('textInput page show called'); + } + + onBuildDone() { + console.info('textInput page build done called'); + } + + build() { + Column({ space: 10 }) { + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 1', text: this.text }) + .type(InputType.Normal) + .enterKeyType(EnterKeyType.Go) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .caretColor('#FF000000') + .height(60) + .fontSize(40) + .fontWeight(FontWeight.Bold) + .fontFamily('cursive') + .fontStyle(FontStyle.Italic) + .fontColor('#FFFF0000') + .maxLength(10) + .onChange((value: string) => { + this.textNew = value + }) + .key('textInput1') + + TextInput({ placeholder: 'textInput 2', text: this.text }) + .type(InputType.Normal) + .enterKeyType(EnterKeyType.Search) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput2') + } + + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 3', text: this.text }) + .type(InputType.Normal) + .enterKeyType(EnterKeyType.Send) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput3') + + TextInput({ placeholder: 'textInput 4', text: this.text }) + .type(InputType.Normal) + .enterKeyType(EnterKeyType.Next) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput4') + } + + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 5', text: this.text }) + .type(InputType.Normal) + .enterKeyType(EnterKeyType.Done) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput5') + + TextInput({ placeholder: 'textInput 6', text: this.text }) + .type(InputType.Password) + .enterKeyType(EnterKeyType.Go) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput6') + } + + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 7', text: this.text }) + .type(InputType.Password) + .enterKeyType(EnterKeyType.Search) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput7') + + TextInput({ placeholder: 'textInput 8', text: this.text }) + .type(InputType.Password) + .enterKeyType(EnterKeyType.Send) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput8') + } + + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 9', text: this.text }) + .type(InputType.Password) + .enterKeyType(EnterKeyType.Next) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput9') + + TextInput({ placeholder: 'textInput 10', text: this.text }) + .type(InputType.Password) + .enterKeyType(EnterKeyType.Done) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput10') + } + + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 11', text: this.text }) + .type(InputType.Email) + .enterKeyType(EnterKeyType.Go) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput11') + TextInput({ placeholder: 'textInput 12', text: this.text }) + .type(InputType.Email) + .enterKeyType(EnterKeyType.Search) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput12') + } + + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 13', text: this.text }) + .type(InputType.Email) + .enterKeyType(EnterKeyType.Send) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput13') + + TextInput({ placeholder: 'textInput 14', text: this.text }) + .type(InputType.Email) + .enterKeyType(EnterKeyType.Next) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput14') + } + + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 15', text: this.text }) + .type(InputType.Email) + .enterKeyType(EnterKeyType.Done) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput15') + + TextInput({ placeholder: 'textInput 16', text: this.text }) + .type(InputType.Number) + .enterKeyType(EnterKeyType.Go) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput16') + } + + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 17', text: this.text }) + .type(InputType.Number) + .enterKeyType(EnterKeyType.Search) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput17') + TextInput({ placeholder: 'textInput 18', text: this.text }) + .type(InputType.Number) + .enterKeyType(EnterKeyType.Send) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput18') + } + + Flex({ direction: FlexDirection.Row }) { + TextInput({ placeholder: 'textInput 19', text: this.text }) + .type(InputType.Number) + .enterKeyType(EnterKeyType.Next) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput19') + TextInput({ placeholder: 'textInput 20', text: this.text }) + .type(InputType.Number) + .enterKeyType(EnterKeyType.Done) + .placeholderColor('#FFC0C0C0') + .placeholderFont({ size: 30, weight: 400, family: 'Microsoft YaHei', style: FontStyle.Normal }) + .key('textInput20') + } + } + .width('100%') + .height('100%') + } +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/Toggle.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/Toggle.ets new file mode 100644 index 0000000000000000000000000000000000000000..2ecf91fe6ebc9cd004856d26628f702900d41110 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/Toggle.ets @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct ToggleExample { + @State text: string = '' + @State textNew: string = '' + + onPageShow() { + console.info('toggle page show called'); + } + + onBuildDone() { + console.info('toggle page build done called'); + } + + build() { + Column({ space: 10 }) { + Text('type:Switch').fontSize(30).fontColor(Color.Blue).width('90%') + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Toggle({ type: ToggleType.Switch, isOn: false }) + .selectedColor('#FFFF0000') + .size({ width: 50, height: 50 }) + .switchPointColor('#FF808080') + .key('toggle1') + .onChange((isOn: boolean) => { + console.info("status changed " + isOn) + }) + Toggle({ type: ToggleType.Switch, isOn: true }) + .selectedColor('#FFFF0000') + .size({ width: 50, height: 50 }) + .switchPointColor('#FF808080') + .key('toggle2') + .onChange((isOn: boolean) => { + console.info("status changed " + isOn) + }) + } + + Text('type:CheckBox').fontSize(30).fontColor(Color.Blue).width('90%') + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Toggle({ type: ToggleType.Checkbox, isOn: false }) + .size({ width: 50, height: 50 }) + .selectedColor('#FFFF0000') + .key('toggle3') + .onChange((isOn: boolean) => { + console.info("status changed " + isOn) + }) + Toggle({ type: ToggleType.Checkbox, isOn: true }) + .selectedColor('#FFFF0000') + .size({ width: 50, height: 50 }) + .key('toggle4') + .onChange((isOn: boolean) => { + console.info("status changed " + isOn) + }) + } + + Text('type:Button').fontSize(30).fontColor(Color.Blue).width('90%') + Flex({ justifyContent: FlexAlign.SpaceEvenly, alignItems: ItemAlign.Center }) { + Toggle({ type: ToggleType.Button, isOn: false }) { + Text('status button').padding({ left: 12, right: 12 }) + }.key('toggle5') + .size({ width: 100, height: 50 }) + .switchPointColor('#FF808080') + .onChange((isOn: boolean) => { + console.info("status changed " + isOn) + }) + + Toggle({ type: ToggleType.Button, isOn: true }) { + Text('status button').padding({ left: 12, right: 12 }) + }.key('toggle6') + .size({ width: 100, height: 50 }) + .switchPointColor('#FF808080') + .onChange((isOn: boolean) => { + console.info("status changed " + isOn) + }) + } + } + .width('100%').padding(24) + } +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/index.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..9e471f090bb3ae664e01bec4b29feeb6f05a2f19 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import file from '@system.file'; +import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets" +import testsuite from "../test/List.test.ets" +import featureAbility from "@ohos.ability.featureAbility" + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + console.info("start run testcase!!!!") + featureAbility.getWant() + .then((Want) => { + const core = Core.getInstance() + const expectExtend = new ExpectExtend({ + 'id': 'extend' + }) + core.addService('expect', expectExtend) + const reportExtend = new ReportExtend(file) + + core.addService('report', reportExtend) + core.init() + core.subscribeEvent('task', reportExtend) + const configService = core.getDefaultService('config') + const timeout = 10000 + configService.setConfig(timeout) + console.info('parameters---->' + JSON.stringify(Want.parameters)) + configService.setConfig(Want.parameters) + testsuite() + core.execute() + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + console.info('Operation successful. Data: ' + JSON.stringify(Want)); + }) + .catch((error) => { + console.error('Operation failed. Cause: ' + JSON.stringify(error)); + }) + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('ccc World') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/List.test.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/List.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..17776ae7452f112cddd7a5ee853fbd4b4b7138d8 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/List.test.ets @@ -0,0 +1,29 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import navigationTest from './NavigationJsunit.test.ets'; +import scrollbarTest from './ScrollerBarJsunit.test.ets'; +import stepperTest from './StepperJsunit.test.ets'; +import textAreaTest from './TextAreaJsunit.test.ets'; +import textInputTest from './TextInputJsunit.test.ets'; +import toggleTest from './ToggleJsunit.test.ets'; + +export default function testsuite() { + navigationTest() + scrollbarTest() + stepperTest() + textAreaTest() + textInputTest() + toggleTest() +} \ No newline at end of file diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bdf7ec9a5980fe981f5fd6ac284fd6bfefcc6089 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/NavigationJsunit.test.ets @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; + +export default function navigationJsunit() { + + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + describe('navigationTest', function () { + + /** + * run before testcase + */ + beforeEach(async function (done) { + console.info('[navigationTest] before each called') + let options = { + uri: 'pages/Navigation', + } + try { + let result = router.push(options) + console.info("push navigation page success " + JSON.stringify(result)); + } catch (err) { + console.info("push navigation page error " + JSON.stringify(result)); + } + await sleep(1) + done() + }); + + /** + * run after testcase + */ + afterEach(async function () { + console.info('[navigationTest] after each called') + router.clear(); + await sleep(1) + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1310 + * @tc.name testNavigation010 + * @tc.desc aceEtsTest + */ + it('testNavigation010', 0, async function (done) { + console.info('testNavigation010 START'); + let strJson = getInspectorByKey('navigation1'); + let obj = JSON.parse(strJson); + console.info("[navigation1] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Navigation') + expect(obj.$attrs.navigationTitle).assertEqual('title') + expect(obj.$attrs.navigationSubTitle).assertEqual('subtitle') + expect(obj.$attrs.hideNavigationBackButton).assertFalse() + expect(obj.$attrs.hideNavigationBar).assertFalse() + console.info('testNavigation010 End'); + done(); + }); + + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1320 + * @tc.name testNavigation020 + * @tc.desc aceEtsTest + */ + it('testNavigation020', 0, async function (done) { + console.info('testNavigation020 START'); + let strJson = getInspectorByKey('navigation2'); + let obj = JSON.parse(strJson); + console.info("[navigation2] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Navigation') + expect(obj.$attrs.hideNavigationBar).assertTrue() + expect(obj.$attrs.hideNavigationBackButton).assertTrue() + console.info('testNavigation020 End'); + done(); + }); + }) +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/ScrollerBarJsunit.test.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/ScrollerBarJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..20a41945af30cbc4af7b00c6022cccf50f2cd7f4 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/ScrollerBarJsunit.test.ets @@ -0,0 +1,170 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; + +export default function scrollbarJsunit() { + + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + describe('scrollbarTest', function () { + + /** + * run before testcase + */ + beforeEach(async function (done) { + console.info('[scrollbarTest] before each called') + let options = { + uri: 'pages/ScrollBar', + } + try { + let pages = router.getState() + console.info("[scrollbarTest] current page is: " + JSON.stringify(pages.name)); + if (!('ScrollBar' == pages.name)) { + let result = await router.push(options) + console.info("push scrollBar page success " + JSON.stringify(result)); + } + } catch (err) { + console.info("push scrollBar page error " + JSON.stringify(result)); + } + await sleep(2) + done() + }); + + /** + * run after testcase + */ + afterEach(async function () { + console.info('[scrollbarTest] after each called') + router.clear(); + await sleep(1) + }); + + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1340 + * @tc.name testScrollbar010 + * @tc.desc aceEtsTest + */ + it('testScrollbar010', 0, async function (done) { + console.info('testScrollbar010 START'); + let strJson = getInspectorByKey('scrollbar1'); + let obj = JSON.parse(strJson); + console.info("[scrollbar1] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('ScrollBar') + expect(obj.$attrs.direction).assertEqual('ScrollBarDirection.Vertical') + expect(obj.$attrs.state).assertEqual('BarState.Auto') + console.info('testScrollbar010 End'); + done(); + }); + + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1350 + * @tc.name testScrollbar020 + * @tc.desc aceEtsTest + */ + it('testScrollbar020', 0, async function (done) { + console.info('testScrollbar020 START'); + let strJson = getInspectorByKey('scrollbar2'); + let obj = JSON.parse(strJson); + console.info("[scrollbar2] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('ScrollBar') + expect(obj.$attrs.direction).assertEqual('ScrollBarDirection.Vertical') + expect(obj.$attrs.state).assertEqual('BarState.On') + console.info('testScrollbar020 End'); + done(); + }); + + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1360 + * @tc.name testScrollbar030 + * @tc.desc aceEtsTest + */ + it('testScrollbar030', 0, async function (done) { + console.info('testScrollbar030 START'); + let strJson = getInspectorByKey('scrollbar3'); + let obj = JSON.parse(strJson); + console.info("[scrollbar3] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('ScrollBar') + expect(obj.$attrs.direction).assertEqual('ScrollBarDirection.Vertical') + expect(obj.$attrs.state).assertEqual('BarState.Off') + console.info('testScrollbar030 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1370 + * @tc.name testScrollbar040 + * @tc.desc aceEtsTest + */ + it('testScrollbar040', 0, async function (done) { + console.info('testScrollbar040 START'); + let strJson = getInspectorByKey('scrollbar4'); + let obj = JSON.parse(strJson); + console.info("[scrollbar4] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('ScrollBar') + expect(obj.$attrs.direction).assertEqual('ScrollBarDirection.Horizontal') + expect(obj.$attrs.state).assertEqual('BarState.Auto') + console.info('testScrollbar040 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1380 + * @tc.name testScrollbar050 + * @tc.desc aceEtsTest + */ + it('testScrollbar050', 0, async function (done) { + console.info('testScrollbar050 START'); + let strJson = getInspectorByKey('scrollbar5'); + let obj = JSON.parse(strJson); + console.info("[scrollbar5] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('ScrollBar') + expect(obj.$attrs.direction).assertEqual('ScrollBarDirection.Horizontal') + expect(obj.$attrs.state).assertEqual('BarState.On') + console.info('testScrollbar050 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1390 + * @tc.name testScrollbar060 + * @tc.desc aceEtsTest + */ + it('testScrollbar060', 0, async function (done) { + console.info('testScrollbar060 START'); + let strJson = getInspectorByKey('scrollbar6'); + let obj = JSON.parse(strJson); + console.info("[scrollbar6] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('ScrollBar') + expect(obj.$attrs.direction).assertEqual('ScrollBarDirection.Horizontal') + expect(obj.$attrs.state).assertEqual('BarState.Off') + console.info('testScrollbar060 End'); + done(); + }); + }) +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/StepperJsunit.test.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/StepperJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d01a6863ee1cfdbab124b53803988219501d3aa --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/StepperJsunit.test.ets @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; + +export default function stepperJsunit() { + + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + describe('stepperTest', function () { + + /** + * run after testcase + */ + afterEach(async function () { + console.info('[stepperTest] after each called') + router.clear(); + await sleep(1) + }); + + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1400 + * @tc.name testStepper010 + * @tc.desc aceEtsTest + */ + it('testStepper010', 0, async function (done) { + console.info('testStepper010 START'); + let options = { + uri: 'pages/Stepper', + } + try { + let result = await router.push(options) + console.info("push stepper page success " + JSON.stringify(result)); + } catch (err) { + console.error("push stepper page error " + JSON.stringify(result)); + } + await sleep(1) + let strJson = getInspectorByKey('stepper'); + let obj = JSON.parse(strJson); + console.info("[stepper] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Stepper') + expect(obj.$attrs.index).assertEqual('0') + console.info('testStepper010 End'); + done(); + }); + }) +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/TextAreaJsunit.test.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/TextAreaJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..269eb9d4bdb1cca422500466e97ace9c24b7d989 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/TextAreaJsunit.test.ets @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; + +export default function textAreaJsunit() { + + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + describe('textAreaTest', function () { + + /** + * run before testcase + */ + beforeEach(async function (done) { + console.info('[textAreaTest] before each called') + let options = { + uri: 'pages/TextArea', + } + try { + let result = await router.push(options) + console.info("push TextArea page success " + JSON.stringify(result)); + } catch (err) { + console.info("push TextArea page error " + JSON.stringify(result)); + } + await sleep(2) + done() + }); + + /** + * run after testcase + */ + afterEach(async function () { + console.info('[textAreaTest] after each called') + router.clear(); + await sleep(1) + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1410 + * @tc.name testTextArea010 + * @tc.desc aceEtsTest + */ + it('testTextArea010', 0, async function (done) { + console.info('testTextArea010 START'); + let strJson = getInspectorByKey('textArea1'); + let obj = JSON.parse(strJson); + console.info("[textArea1] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Textarea') + expect(obj.$attrs.placeholderColor).assertEqual('#FFC0C0C0') + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Start') + expect(obj.$attrs.caretColor).assertEqual('#FF000000') + expect(obj.$attrs.fontSize).assertEqual('40.000000fp') + expect(obj.$attrs.fontWeight).assertEqual('FontWeight.Bold') + expect(obj.$attrs.fontColor).assertEqual('#FFFF0000') + expect(obj.$attrs.fontFamily).assertEqual('cursive') + expect(obj.$attrs.fontStyle).assertEqual('FontStyle.Italic') + console.info('testTextArea010 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1420 + * @tc.name testTextArea020 + * @tc.desc aceEtsTest + */ + it('testTextArea020', 0, async function (done) { + console.info('testTextArea020 START'); + let strJson = getInspectorByKey('textArea2'); + let obj = JSON.parse(strJson); + console.info("[textArea2] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Textarea') + expect(obj.$attrs.textAlign).assertEqual('TextAlign.Center') + console.info('testTextArea020 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1430 + * @tc.name testTextArea030 + * @tc.desc aceEtsTest + */ + it('testTextArea030', 0, async function (done) { + console.info('testTextArea030 START'); + let strJson = getInspectorByKey('textArea3'); + let obj = JSON.parse(strJson); + console.info("[textArea3] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Textarea') + expect(obj.$attrs.textAlign).assertEqual('TextAlign.End') + console.info('testTextArea030 End'); + done(); + }); + }) +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/TextInputJsunit.test.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/TextInputJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..bf56067b1a4a84226ba9422fa96697e38ee8187b --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/TextInputJsunit.test.ets @@ -0,0 +1,400 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; + +export default function textInputJsunit() { + + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + describe('textInputTest', function () { + /** + * run before testcase + */ + beforeEach(async function (done) { + console.info('[textInputTest] before each called') + let options = { + uri: 'pages/TextInput', + } + try { + let pages = router.getState() + console.info("[textInputTest] current page is: " + JSON.stringify(pages.name)); + if (!('TextInput' == pages.name)) { + let result = await router.push(options) + console.info("push TextInput page success " + JSON.stringify(result)); + } + } catch (err) { + console.info("push TextInput page error " + JSON.stringify(result)); + } + await sleep(2) + done() + }); + + /** + * run after testcase + */ + afterEach(async function () { + console.info('[textInputTest] after each called') + router.clear(); + await sleep(1) + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1440 + * @tc.name testTextInput010 + * @tc.desc aceEtsTest + */ + it('testTextInput010', 0, async function (done) { + console.info('testTextInput010 START'); + let strJson = getInspectorByKey('textInput1'); + let obj = JSON.parse(strJson); + console.info("[textInput1] get inspector value is: " + JSON.stringify(obj)); + console.info("[textInput1] get inspector value is: " + JSON.stringify(obj.$attrs.type)); + console.info("[textInput1] get inspector value is: " + JSON.stringify(obj.$attrs.enterKeyType)); + console.info("[textInput1] get inspector value is: " + obj.$attrs.placeholderFont); + console.info("[textInput1] get inspector value is: " + obj.$attrs.placeholderFont.size); + console.info("[textInput1] get inspector value is: " + JSON.stringify(obj.$attrs.fontSize)); + console.info("[textInput1] get inspector value is: " + JSON.stringify(obj.$attrs.height)); + expect(obj.$type).assertEqual('TextInput') + expect(obj.$attrs.type).assertEqual('InputType.Normal') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Go') + expect(obj.$attrs.caretColor).assertEqual('#FF000000') + expect(obj.$attrs.placeholderColor).assertEqual('#FFC0C0C0') + expect(obj.$attrs.fontColor).assertEqual('#FFFF0000') + expect(obj.$attrs.fontWeight).assertEqual('FontWeight.Bold') + expect(obj.$attrs.fontFamily).assertEqual('cursive') + expect(obj.$attrs.fontStyle).assertEqual('FontStyle.Italic') + expect(obj.$attrs.fontSize).assertEqual('40.000000fp') + expect(obj.$attrs.height).assertEqual('60.000000vp') + expect(obj.$attrs.height).assertContain('FontStyle.Normal') + console.info('testTextInput010 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1450 + * @tc.name testTextInput020 + * @tc.desc aceEtsTest + */ + it('testTextInput020', 0, async function (done) { + console.info('testTextInput020 START'); + let strJson = getInspectorByKey('textInput2'); + let obj = JSON.parse(strJson); + console.info("[textInput2] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Normal') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Search') + console.info('testTextInput020 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1460 + * @tc.name testTextInput030 + * @tc.desc aceEtsTest + */ + it('testTextInput030', 0, async function (done) { + console.info('testTextInput030 START'); + let strJson = getInspectorByKey('textInput3'); + let obj = JSON.parse(strJson); + console.info("[textInput3] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Normal') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Send') + console.info('testTextInput030 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1470 + * @tc.name testTextInput040 + * @tc.desc aceEtsTest + */ + it('testTextInput040', 0, async function (done) { + console.info('testTextInput040 START'); + let strJson = getInspectorByKey('textInput4'); + let obj = JSON.parse(strJson); + console.info("[textInput4] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Normal') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Next') + console.info('testTextInput040 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1480 + * @tc.name testTextInput050 + * @tc.desc aceEtsTest + */ + it('testTextInput050', 0, async function (done) { + console.info('testTextInput050 START'); + let strJson = getInspectorByKey('textInput5'); + let obj = JSON.parse(strJson); + console.info("[textInput5] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Normal') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Done') + console.info('testTextInput050 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1490 + * @tc.name testTextInput060 + * @tc.desc aceEtsTest + */ + it('testTextInput060', 0, async function (done) { + console.info('testTextInput060 START'); + let strJson = getInspectorByKey('textInput6'); + let obj = JSON.parse(strJson); + console.info("[textInput6] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Password') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Go') + console.info('testTextInput060 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1500 + * @tc.name testTextInput070 + * @tc.desc aceEtsTest + */ + it('testTextInput070', 0, async function (done) { + console.info('testTextInput070 START'); + let strJson = getInspectorByKey('textInput7'); + let obj = JSON.parse(strJson); + console.info("[textInput7] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Password') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Search') + console.info('testTextInput070 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1510 + * @tc.name testTextInput080 + * @tc.desc aceEtsTest + */ + it('testTextInput080', 0, async function (done) { + console.info('testTextInput080 START'); + let strJson = getInspectorByKey('textInput8'); + let obj = JSON.parse(strJson); + console.info("[textInput8] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Password') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Send') + console.info('testTextInput080 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1520 + * @tc.name testTextInput090 + * @tc.desc aceEtsTest + */ + it('testTextInput090', 0, async function (done) { + console.info('testTextInput090 START'); + let strJson = getInspectorByKey('textInput9'); + let obj = JSON.parse(strJson); + console.info("[textInput9] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Password') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Next') + console.info('testTextInput090 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1530 + * @tc.name testTextInput100 + * @tc.desc aceEtsTest + */ + it('testTextInput100', 0, async function (done) { + console.info('testTextInput100 START'); + let strJson = getInspectorByKey('textInput10'); + let obj = JSON.parse(strJson); + console.info("[textInput10] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Password') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Done') + console.info('testTextInput100 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1540 + * @tc.name testTextInput110 + * @tc.desc aceEtsTest + */ + it('testTextInput110', 0, async function (done) { + console.info('testTextInput110 START'); + let strJson = getInspectorByKey('textInput11'); + let obj = JSON.parse(strJson); + console.info("[textInput11] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Email') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Go') + console.info('testTextInput110 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1550 + * @tc.name testTextInput120 + * @tc.desc aceEtsTest + */ + it('testTextInput120', 0, async function (done) { + console.info('testTextInput120 START'); + let strJson = getInspectorByKey('textInput12'); + let obj = JSON.parse(strJson); + console.info("[textInput12] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Email') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Search') + console.info('testTextInput120 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1560 + * @tc.name testTextInput130 + * @tc.desc aceEtsTest + */ + it('testTextInput130', 0, async function (done) { + console.info('testTextInput130 START'); + let strJson = getInspectorByKey('textInput13'); + let obj = JSON.parse(strJson); + console.info("[textInput13] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Email') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Send') + console.info('testTextInput130 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1570 + * @tc.name testTextInput140 + * @tc.desc aceEtsTest + */ + it('testTextInput140', 0, async function (done) { + console.info('testTextInput140 START'); + let strJson = getInspectorByKey('textInput14'); + let obj = JSON.parse(strJson); + console.info("[textInput14] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Email') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Next') + console.info('testTextInput140 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1580 + * @tc.name testTextInput150 + * @tc.desc aceEtsTest + */ + it('testTextInput150', 0, async function (done) { + console.info('testTextInput150 START'); + let strJson = getInspectorByKey('textInput15'); + let obj = JSON.parse(strJson); + console.info("[textInput15] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Email') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Done') + console.info('testTextInput150 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1590 + * @tc.name testTextInput160 + * @tc.desc aceEtsTest + */ + it('testTextInput160', 0, async function (done) { + console.info('testTextInput160 START'); + let strJson = getInspectorByKey('textInput16'); + let obj = JSON.parse(strJson); + console.info("[textInput16] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Number') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Go') + console.info('testTextInput160 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1600 + * @tc.name testTextInput170 + * @tc.desc aceEtsTest + */ + it('testTextInput170', 0, async function (done) { + console.info('testTextInput170 START'); + let strJson = getInspectorByKey('textInput17'); + let obj = JSON.parse(strJson); + console.info("[textInput17] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Number') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Search') + console.info('testTextInput170 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1610 + * @tc.name testTextInput180 + * @tc.desc aceEtsTest + */ + it('testTextInput180', 0, async function (done) { + console.info('testTextInput180 START'); + let strJson = getInspectorByKey('textInput18'); + let obj = JSON.parse(strJson); + console.info("[textInput18] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Number') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Send') + console.info('testTextInput180 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1620 + * @tc.name testTextInput190 + * @tc.desc aceEtsTest + */ + it('testTextInput190', 0, async function (done) { + console.info('testTextInput190 START'); + let strJson = getInspectorByKey('textInput19'); + let obj = JSON.parse(strJson); + console.info("[textInput19] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Number') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Next') + console.info('testTextInput190 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1630 + * @tc.name testTextInput190 + * @tc.desc aceEtsTest + */ + it('testTextInput200', 0, async function (done) { + console.info('testTextInput200 START'); + let strJson = getInspectorByKey('textInput20'); + let obj = JSON.parse(strJson); + console.info("[textInput20] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$attrs.type).assertEqual('InputType.Number') + expect(obj.$attrs.enterKeyType).assertEqual('EnterKeyType.Done') + console.info('testTextInput200 End'); + done(); + }); + }) +} diff --git a/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..e3689ddde47e6ba57d54a7f083b057d9aa3a630d --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/ets/MainAbility/test/ToggleJsunit.test.ets @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2021 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets" +import router from '@system.router'; + +export default function toggleJsunit() { + + function sleep(time) { + return new Promise((resolve, reject) => { + setTimeout(() => { + resolve() + }, time * 1000) + }).then(() => { + console.info(`sleep ${time} over...`) + }) + } + + describe('toggleTest', function () { + /** + * run before testcase + */ + beforeEach(async function (done) { + console.info('[toggleTest] before each called') + let options = { + uri: 'pages/Toggle', + } + try { + let pages = router.getState() + console.info("[toggleTest] current page is: " + JSON.stringify(pages.name)); + if (!('Toggle' == pages.name)) { + let result = await router.push(options) + console.info("push toggle page success " + JSON.stringify(result)); + } + } catch (err) { + console.info("push toggle page page error " + JSON.stringify(result)); + } + await sleep(2) + done() + }); + + /** + * run after testcase + */ + afterEach(async function () { + console.info('[toggleTest] after each called') + router.clear(); + await sleep(1) + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1640 + * @tc.name testToggle010 + * @tc.desc aceEtsTest + */ + it('testToggle010', 0, async function (done) { + console.info('testToggle010 START'); + let strJson = getInspectorByKey('toggle1'); + let obj = JSON.parse(strJson); + console.info("[toggle1] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Toggle') + expect(obj.$attrs.type).assertEqual('ToggleType.Switch') + expect(obj.$attrs.isOn).assertEqual('false') + expect(obj.$attrs.selectedColor).assertEqual('#FFFF0000') + expect(obj.$attrs.switchPointColor).assertEqual('#FF808080') + console.info('testToggle010 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1650 + * @tc.name testToggle020 + * @tc.desc aceEtsTest + */ + it('testToggle020', 0, async function (done) { + console.info('testToggle020 START'); + let strJson = getInspectorByKey('toggle2'); + let obj = JSON.parse(strJson); + console.info("[toggle2] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Toggle') + expect(obj.$attrs.type).assertEqual('ToggleType.Switch') + expect(obj.$attrs.isOn).assertEqual('true') + console.info('testToggle020 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1660 + * @tc.name testToggle030 + * @tc.desc aceEtsTest + */ + it('testToggle030', 0, async function (done) { + console.info('testToggle030 START'); + let strJson = getInspectorByKey('toggle3'); + let obj = JSON.parse(strJson); + console.info("[toggle3] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Toggle') + expect(obj.$attrs.type).assertEqual('ToggleType.Checkbox') + expect(obj.$attrs.isOn).assertEqual('false') + console.info('testToggle030 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1670 + * @tc.name testToggle040 + * @tc.desc aceEtsTest + */ + it('testToggle040', 0, async function (done) { + console.info('testToggle040 START'); + let strJson = getInspectorByKey('toggle4'); + let obj = JSON.parse(strJson); + console.info("[toggle4] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Toggle') + expect(obj.$attrs.type).assertEqual('ToggleType.Checkbox') + expect(obj.$attrs.isOn).assertEqual('true') + console.info('testToggle040 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1680 + * @tc.name testToggle050 + * @tc.desc aceEtsTest + */ + it('testToggle050', 0, async function (done) { + console.info('testToggle050 START'); + let strJson = getInspectorByKey('toggle5'); + let obj = JSON.parse(strJson); + console.info("[toggle5] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Toggle') + expect(obj.$attrs.type).assertEqual('ToggleType.Button') + expect(obj.$attrs.isOn).assertEqual('false') + console.info('testToggle050 End'); + done(); + }); + + /** + * @tc.number SUB_ACE_BASIC_ETS_API_1690 + * @tc.name testToggle060 + * @tc.desc aceEtsTest + */ + it('testToggle060', 0, async function (done) { + console.info('testToggle060 START'); + let strJson = getInspectorByKey('toggle6'); + console.info('sendEventByKey result is ' + sendEventByKey('toggle6', 10, '')) + let obj = JSON.parse(strJson); + console.info("[toggle6] get inspector value is: " + JSON.stringify(obj)); + expect(obj.$type).assertEqual('Toggle') + expect(obj.$attrs.type).assertEqual('ToggleType.Button') + expect(obj.$attrs.isOn).assertEqual('true') + console.info('testToggle060 End'); + done(); + }); + }) +} diff --git a/ace/ace_ets_third_test/entry/src/main/resources/base/element/string.json b/ace/ace_ets_third_test/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..03b8532c53ca563f8ed6b1e21d20ad3f67a68906 --- /dev/null +++ b/ace/ace_ets_third_test/entry/src/main/resources/base/element/string.json @@ -0,0 +1,12 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + } + ] +} \ No newline at end of file diff --git a/ace/ace_ets_third_test/entry/src/main/resources/base/media/icon.png b/ace/ace_ets_third_test/entry/src/main/resources/base/media/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..ce307a8827bd75456441ceb57d530e4c8d45d36c Binary files /dev/null and b/ace/ace_ets_third_test/entry/src/main/resources/base/media/icon.png differ diff --git a/ace/ace_ets_third_test/signature/openharmony_sx.p7b b/ace/ace_ets_third_test/signature/openharmony_sx.p7b new file mode 100644 index 0000000000000000000000000000000000000000..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 Binary files /dev/null and b/ace/ace_ets_third_test/signature/openharmony_sx.p7b differ