diff --git a/arkui/ace_ets_component_apilack/entry/src/main/config.json b/arkui/ace_ets_component_apilack/entry/src/main/config.json index 4958672eb38dc328b21afd0064ca2498482cad35..ce4b6c28f191b120efa90a1a09aee5dd309c8dbe 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/config.json +++ b/arkui/ace_ets_component_apilack/entry/src/main/config.json @@ -80,11 +80,21 @@ "pages/gridItem", "pages/inspector", "pages/lazyForEach", + "pages/navigator", "pages/path", "pages/polygon", "pages/polyLine", + "pages/progress", "pages/rect", - "pages/scroll" + "pages/scroll", + "pages/search", + "pages/swiper", + "pages/tabs", + "pages/text", + "pages/textArea", + "pages/textInput", + "pages/textPicker", + "pages/video" ], "name": ".MainAbility", "window": { diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/inspector.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/inspector.ets index d7c1c67db714883d0d0d1875306fc721a5002ef2..5ce6272c42d42f44a396f84ea52e563d3083d5f1 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/inspector.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/inspector.ets @@ -90,12 +90,12 @@ struct Inspector { .fontSize(50) .fontWeight(FontWeight.Bold) .onClick(()=> { - let getInspectorNodeByIdObj = JSON.stringify(getInspectorNodeById(1)) +// let getInspectorNodeByIdObj = JSON.stringify(getInspectorNodeById(1)) try { var backData1 = { data: { "result": "success", - "getInspectorNodeById":getInspectorNodeByIdObj + "getInspectorNodeById":"getInspectorNodeByIdObj" } } let backEvent1 = { diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/lazyForEach.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/lazyForEach.ets index 5ea532312af44d2ff8d3bb3da8cc27edbac19a69..6920afa5c63d9d0be3dc1890ff48a99da23ea390 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/lazyForEach.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/lazyForEach.ets @@ -215,7 +215,7 @@ struct LazyForEachOnDataAdd { } } let backEvent1 = { - eventId: 101, + eventId: 201, priority: events_emitter.EventPriority.LOW } console.info("LazyForEachOnDataAdd_101 onClick start to emit action") @@ -265,7 +265,7 @@ struct LazyForEachOnDataAdd { } } let backEvent2 = { - eventId: 102, + eventId: 202, priority: events_emitter.EventPriority.LOW } console.info("LazyForEachOnDataAdd_102 onClick start to emit action") @@ -315,7 +315,7 @@ struct LazyForEachOnDataAdd { } } let backEvent3 = { - eventId: 103, + eventId: 203, priority: events_emitter.EventPriority.LOW } console.info("LazyForEachOnDataAdd_103 onClick start to emit action") @@ -366,7 +366,7 @@ struct LazyForEachOnDataAdd { } } let backEvent4 = { - eventId: 104, + eventId: 204, priority: events_emitter.EventPriority.LOW } console.info("LazyForEachOnDataAdd_104 onClick start to emit action") diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/navigator.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/navigator.ets new file mode 100644 index 0000000000000000000000000000000000000000..ecd76d5e343d6a8db4ecc41c851789b1ae7b54f2 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/navigator.ets @@ -0,0 +1,56 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct NavigatorTarget { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear NavigatorTarget start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear NavigatorTarget end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("navigator-Target") + .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("targetText") + + Navigator({ target: '', type: NavigationType.Push }) { + Text('Go to target page') + .width('100%').textAlign(TextAlign.Center) + }.params({ text: 'target' }).target('pages/index') + .key("Navigator") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/progress.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/progress.ets new file mode 100644 index 0000000000000000000000000000000000000000..95598b3857b61d01ba0979967caf584e923534d8 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/progress.ets @@ -0,0 +1,57 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct ProgressStyle { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ProgressStyle start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ProgressStyle end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("progress-Style") + .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("styleText") + Row({ space: 40 }) { + Progress({ value: 20, total: 150, type: ProgressType.Ring }) + .color(Color.Green).value(50).width(100) + .style({ strokeWidth: 20, scaleCount: 30, scaleWidth: 20 }) + .key("Progress") + } + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/search.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/search.ets new file mode 100644 index 0000000000000000000000000000000000000000..64dc6cd51f55cf421d68a266eaeba45038d09be5 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/search.ets @@ -0,0 +1,106 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct SearchOnCut { + controller: SearchController = new SearchController() + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear SearchOnCut start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear SearchOnCut end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("search-OnCut") + .width(320) + .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("onCutText") + + Search({ value: '', placeholder: 'search-OnCut', controller: this.controller }) + .searchButton('Search') + .textFont({ size: 20 }) + .placeholderFont({ size: 20 }) + .onCut((value: string) => { + console.log('onCut: ' + value) + }) + .key("OnCut") + + Text("search-OnPaste") + .width(320) + .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("onPasteText") + + Search({ value: '', placeholder: 'search-OnPaste', controller: this.controller }) + .searchButton('Search') + .textFont({ size: 20 }) + .placeholderFont({ size: 20 }) + .onPaste((value: string) => { + console.log('onPaste: ' + value) + }) + .key("OnPaste") + + Text("search-CopyOption") + .width(320) + .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("copyOptionText") + + Search({ value: '', placeholder: 'search-CopyOption', controller: this.controller }) + .searchButton('Search') + .textFont({ size: 20 }) + .placeholderFont({ size: 20 }) +// 编译报错 +// .copyOption(CopyOption.InApp) + .key("CopyOption") + + }.width("100%").height("100%") + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets new file mode 100644 index 0000000000000000000000000000000000000000..43a9673ad5f2eb5ba1f71a9ea29f5a8dadb4ceda --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/swiper.ets @@ -0,0 +1,121 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; + +class MyDataSource implements IDataSource { + private list: number[] = [] + private listener: DataChangeListener + + constructor(list: number[]) { + this.list = list + } + + totalCount(): number { + return this.list.length + } + + getData(index: number): any { + return this.list[index] + } + + registerDataChangeListener(listener: DataChangeListener): void { + this.listener = listener + } + + unregisterDataChangeListener() { + } +} + + +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct SwiperCurve { + + private swiperController: SwiperController = new SwiperController() + private data: MyDataSource = new MyDataSource([]) + + aboutToAppear(): void { + Log.showInfo(TAG, `aboutToAppear SwiperCurve start`) + let list = [] + for (var i = 1; i <= 10; i++) { + list.push(i.toString()); + } + this.data = new MyDataSource(list) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear SwiperCurve end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Column({ space: 5 }) { + + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Text(item).width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(20) + }, item => item) + } + .cachedCount(2) + .index(1) + .autoPlay(true) + .interval(4000) + .indicator(true) // 默认开启指示点 + .loop(false) // 默认开启循环播放 + .duration(1000) + .vertical(false) // 默认横向切换 + .itemSpace(0) + .curve(Curve.Linear) // 动画曲线 + .onChange((index: number) => { + console.info(index.toString()) + }) + + Flex({ justifyContent: FlexAlign.SpaceAround }) { + Button('next') + .onClick(() => { + this.swiperController.showNext() + }) + Button('preview') + .onClick(() => { + this.swiperController.showPrevious() + }) + } + }.margin({ top: 5 }) + + + Text("swiper-Curve") + .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("curveText") + + }.width("100%").height("100%") + + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/tabs.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/tabs.ets new file mode 100644 index 0000000000000000000000000000000000000000..e4f3ae50adf44c20c3991c645dbb462c929ffcb2 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/tabs.ets @@ -0,0 +1,72 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TabsBarPosition { + + private controller: TabsController = new TabsController() + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TabsBarPosition start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TabsBarPosition end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("tabs-BarPosition") + .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("barPositionText") + + + Tabs({ barPosition: BarPosition.Start, controller: this.controller }) { + TabContent() { + Column().width('100%').height('100%').backgroundColor(Color.Pink) + }.tabBar('pink') + + TabContent() { + Column().width('100%').height('100%').backgroundColor(Color.Yellow) + }.tabBar('yellow') + + } + .vertical(true).scrollable(true).barMode(BarMode.Fixed) + .barWidth(70).barHeight(150).animationDuration(400) + .onChange((index: number) => { + console.info(index.toString()) + }) + .width('90%').backgroundColor(0xF5F5F5) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/text.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/text.ets new file mode 100644 index 0000000000000000000000000000000000000000..dbaf1e6c69ea955ae15d16570b4bb89c5448039b --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/text.ets @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TextMinFontSize { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TextMinFontSize start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TextMinFontSize end `) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("text-MinFontSize") + .width(100) + .height(70) + .fontSize('30px') + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("minFontSizeText") + .minFontSize('50px') + + Text("text-CopyOption") + .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("copyOptionText") + .copyOption(0) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textArea.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textArea.ets new file mode 100644 index 0000000000000000000000000000000000000000..a97ff56708baade0b8fe8d98c480f4fa04a8d11b --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textArea.ets @@ -0,0 +1,89 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TextAreaOnCut { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TextAreaOnCut start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TextAreaOnCut end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + TextArea({placeholder: "textArea-OnCut" }) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //input输入框中的文字被剪切时触发 + .onCut(() => { + console.log('onCut method is triggered'); + }) + .key("onCutText") + + TextArea({placeholder: "textArea-OnPaste" }) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //input输入框中的粘贴文字时触发 + .onPaste(() => { + console.log("onPaste method is triggered") + }) + .key("onPasteText") + + TextArea({placeholder: "textArea-CopyOption" }) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + /**copyOption(value: boolean | CopyOption): + * 设置复制选项时调用 + * InApp = 0,Share in app. + * LocalDevice = 1,Share in local device. + * CrossDevice = 2,Share cross device. + */ + .copyOption(0) + .key("copyOptionText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textInput.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textInput.ets new file mode 100644 index 0000000000000000000000000000000000000000..ee290598aa23a4a1f7bffdd718dc712b350c277e --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textInput.ets @@ -0,0 +1,115 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TextInputOnEditChange { + @State num: number = 0 + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TextInputOnEditChange start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TextInputOnEditChange end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + TextInput({placeholder: "textInput-OnEditChange" }) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .onEditChange(() => { + console.log(`Input state changed ${this.num++}`) + }) + .key("onEditChangeText") + + TextInput({placeholder:"textInput-OnCut"}) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //input输入框中的文字被剪切时触发 + .onCut(() =>{ + console.log("onCut method is triggered") + }) + .key("onCutText") + + TextInput({placeholder:"textInput-OnPaste"}) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //input输入框中的粘贴文字时触发 + .onPaste(() => { + console.log("onPaste method is triggered") + }) + .key("onPasteText") + + TextInput({placeholder:"textInput-CopyOption"}) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //设置复制选项时调用 + .copyOption(0) + .key("copyOptionText") + + TextInput({placeholder:"textInput-ShowPasswordIcon"}) + .type(InputType.Password) + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + //设置密码显示/隐藏图标时调用 + .showPasswordIcon(true) + .key("showPasswordIconText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textPicker.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textPicker.ets new file mode 100644 index 0000000000000000000000000000000000000000..cfc3d49e9593eef45ee5fa0b64ead8828dc6eca9 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/textPicker.ets @@ -0,0 +1,47 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct TextPickerDefaultPickerItemHeight { + private select: number = 1 + private fruits: string[] = ['1.apple', '2.orange','3.peach', '4.grape'] + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear TextPickerDefaultPickerItemHeight start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear TextPickerDefaultPickerItemHeight end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + TextPicker({range: this.fruits, selected: this.select}) + .onChange((value: string, index: number) => { + console.info('Picker item changed, value: ' + value + ', index: ' + index) + }) + .defaultPickerItemHeight('80px') + .key("defaultPickerItemHeightText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/video.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/video.ets new file mode 100644 index 0000000000000000000000000000000000000000..fdbf5edceffb96a21f9e1dc0883b06f03523c880 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/video.ets @@ -0,0 +1,101 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 Log from '../common/Log.ets'; +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default +struct VideoOnFullscreenChange { + + @State srcs: Resource = $rawfile('videoTest.mp4'); + @State currentProgressRates: number = 1; + @State autoPlays: boolean = false; + controller: VideoController = new VideoController(); + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear VideoOnFullscreenChange start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear VideoOnFullscreenChange end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Video({ + src: this.srcs, + currentProgressRate: this.currentProgressRates, + controller: this.controller + }).width(600).height(400) + .autoPlay(this.autoPlays) + .key("onFullscreenChangeText") + .onStart(() => { + console.error('onStart'); + }) + .onFullscreenChange(() => { + console.log('screen is changed') + console.info('screen is changed') + console.error('screen is changed') + console.warn('screen is changed') + }) + .onPause(() => { + console.error('onPause'); + }) + .onFinish(() => { + console.error('onFinish'); + }) + .onError(() => { + console.error('onFinish'); + }) + .onPrepared((e) => { + console.error('onPrepared is ' + e.duration); + }) + .onSeeking((e) => { + console.error('onSeeking is ' + e.time); + }) + .onSeeked((e) => { + console.error('onSeekedis ' + e.time); + }) + .onUpdate((e) => { + console.error('onUpdateis ' + e.time); + }) + Row() { + Button("FullScreen").onClick(() => { + this.controller.requestFullscreen(true) + }); + Button("ExitFullScreen").onClick(() => { + this.controller.exitFullscreen() + }); + } + + Row() { + Button("start").onClick(() => { + this.controller.start(); + }); + Button("pause").onClick(() => { + this.controller.pause(); + }); + Button("stop").onClick(() => { + this.controller.stop(); + }); + } + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets index 47fa559b5b8cf1957ed1d682d2846df862f82cd9..36a51b42e9072ebcad4f9853489b2fdc3765d012 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/List.test.ets @@ -21,13 +21,24 @@ import gridMaxCountJsunit from './grid.test.ets'; import gridItemOnSelectJsunit from './gridItem.test.ets'; import inspectorJsunit from './inspector.test.ets' import lazyForEachOnDataAddJsunit from './lazyForEach.test.ets'; +import navigatorTargetJsunit from './navigator.test.ets' import pathNewTest from './path.test.ets'; import polygonNewJsunit from './polygon.test.ets'; import polyLineNeJsunit from './polyLine.test.ets'; +import progressScaleCountJsunit from './progress.test.ets'; import rectNeJsunit from './rect.test.ets'; import scrollOnScrollBeginJsunit from './scroll.test.ets'; +import searchOnCutJsunit from './search.test.ets' +import swiperCurveJsunit from './swiper.test.ets'; +import tabsBarPositionJsunit from './tabs.test.ets'; +import textMinFontSizeJsunit from './text.test.ets'; +import textAreaOnCutJsunit from './textArea.test.ets'; +import textInputOnEditChangeJsunit from './textInput.test.ets'; +import textPickerDefaultPickerItemHeightJsunit from './textPicker.test.ets'; +import videoOnFullscreenChangeJsunit from './video.test.ets'; export default function testsuite() { + lazyForEachOnDataAddJsunit() alphabetIndexerOnSelectJsunit() checkBoxGroupSelectAllJsunit() circleNewJsunit() @@ -35,10 +46,19 @@ export default function testsuite() { gridMaxCountJsunit() gridItemOnSelectJsunit() inspectorJsunit() - lazyForEachOnDataAddJsunit() + navigatorTargetJsunit() pathNewTest() polygonNewJsunit() polyLineNeJsunit() + progressScaleCountJsunit() rectNeJsunit() scrollOnScrollBeginJsunit() + searchOnCutJsunit() + swiperCurveJsunit() + tabsBarPositionJsunit() + textMinFontSizeJsunit() + textAreaOnCutJsunit() + textInputOnEditChangeJsunit() + textPickerDefaultPickerItemHeightJsunit() + videoOnFullscreenChangeJsunit() } \ No newline at end of file diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/inspector.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/inspector.test.ets index bdb2c16bed6181718d7ae08ec219018627a97399..fef7406ca3812dc6ef18ad07fd947c136fd4d103 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/inspector.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/inspector.test.ets @@ -144,6 +144,11 @@ export default function inspectorJsunit() { } }); + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testInspectorTestAdd0005 + * @tc.desic aceTestInspectorTestAdd0005 + */ it('testInspectorTestAdd0005', 0, async function (done) { console.info('testInspectorTestAdd0005 START'); try { @@ -164,9 +169,9 @@ export default function inspectorJsunit() { }); /* - * @tc.number SUB_ACE_BASIC_ETS_API_0004 - * @tc.name testInspectorTestAdd0004 - * @tc.desic aceTestInspectorTestAdd0004 + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testInspectorTestAdd0006 + * @tc.desic aceTestInspectorTestAdd0006 */ it('testInspectorTestAdd0006', 0, async function (done) { var innerEvent3 = { diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/lazyForEach.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/lazyForEach.test.ets index b9b912ec150cb45bc0ed0bd2d362d7ad42fdd8fd..04f59487328857752b355d7e69c237fd34dc2935 100644 --- a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/lazyForEach.test.ets +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/lazyForEach.test.ets @@ -55,7 +55,7 @@ export default function lazyForEachOnDataAddJsunit() { console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0001 START'); var innerEvent1 = { - eventId: 101, + eventId: 201, priority: events_emitter.EventPriority.LOW } var callback1 = (eventData) => { @@ -87,7 +87,7 @@ export default function lazyForEachOnDataAddJsunit() { console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0002 START'); var innerEvent2 = { - eventId: 102, + eventId: 202, priority: events_emitter.EventPriority.LOW } var callback2 = (eventData) => { @@ -119,7 +119,7 @@ export default function lazyForEachOnDataAddJsunit() { console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0003 START'); var innerEvent3 = { - eventId: 103, + eventId: 203, priority: events_emitter.EventPriority.LOW } var callback3 = (eventData) => { @@ -151,7 +151,7 @@ export default function lazyForEachOnDataAddJsunit() { console.info('lazyForEachOnDataAdd testlazyForEachOnDataAdd0004 START'); var innerEvent4 = { - eventId: 104, + eventId: 204, priority: events_emitter.EventPriority.LOW } var callback4 = (eventData) => { diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/navigator.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/navigator.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..540890439a82bd6e9d07bb4d07c0de06d79d560e --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/navigator.test.ets @@ -0,0 +1,65 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function navigatorTargetJsunit() { + describe('navigatorTargetTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/navigator', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get navigator state success " + JSON.stringify(pages)); + if (!("navigator" == pages.name)) { + console.info("get navigator state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push navigator page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push navigator page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("navigatorTarget after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testnavigatorTarget0001 + * @tc.desic acenavigatorTargetEtsTest0001 + */ + it('testnavigatorTarget0001', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Navigator'); + console.info("[testnavigatorTarget0001] component strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Navigator'); + expect(obj.$attrs.target).assertEqual("pages/index"); + console.info("[testnavigatorTarget0001] target value :" + obj.$attrs.target); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/progress.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/progress.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a01034c224cc8c3a2c46db398abbc6323d9b5945 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/progress.test.ets @@ -0,0 +1,150 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function progressStyleJsunit() { + describe('progressStyleTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/progress', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get progress state success " + JSON.stringify(pages)); + if (!("progress" == pages.name)) { + console.info("get progress state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push progress page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push progress page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("progressStyle after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testprogressStyle0001 + * @tc.desic aceprogressStyleEtsTest0001 + */ + it('testprogressStyle0001', 0, async function (done) { + console.info('progressStyle testprogressStyle0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testprogressStyle0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testprogressStyle0002 + * @tc.desic aceprogressStyleEtsTest0002 + */ + it('testprogressStyle0002', 0, async function (done) { + console.info('progressStyle testprogressStyle0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0002] component color strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.color).assertEqual("#FF008000"); + console.info("[testprogressStyle0002] color value :" + obj.$attrs.color); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testprogressStyle0003 + * @tc.desic aceprogressStyleEtsTest0003 + */ + it('testprogressStyle0003', 0, async function (done) { + console.info('progressStyle testprogressStyle0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0003] component value strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.value).assertEqual("50.000000"); + console.info("[testprogressStyle0003] value value :" + obj.$attrs.value); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testprogressStyle0004 + * @tc.desic aceprogressStyleEtsTest0004 + */ + it('testprogressStyle0004', 0, async function (done) { + console.info('progressStyle testprogressStyle0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0004] component style strokeWidth strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.strokeWidth).assertEqual("20.00vp"); + console.info("[testprogressStyle0004] style strokeWidth value :" + obj.$attrs.style.strokeWidth); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testprogressStyle0005 + * @tc.desic aceprogressStyleEtsTest0005 + */ + it('testprogressStyle0005', 0, async function (done) { + console.info('progressStyle testprogressStyle0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0005] component style scaleCount strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.scaleCount).assertEqual("30"); + console.info("[testprogressStyle0005] style scaleCount value :" + obj.$attrs.style.scaleCount); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testprogressStyle0006 + * @tc.desic aceprogressStyleEtsTest0006 + */ + it('testprogressStyle0006', 0, async function (done) { + console.info('progressStyle testprogressStyle0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('Progress'); + console.info("[testprogressStyle0006] component style scaleWidth strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Progress'); + expect(obj.$attrs.style.scaleWidth).assertEqual("20.00vp"); + console.info("[testprogressStyle0006] style scaleWidth value :" + obj.$attrs.style.scaleWidth); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/search.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/search.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..567a45048076c18d9b7e42936d9204bc297ab421 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/search.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function searchOnCutJsunit() { + describe('searchOnCutTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/search', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get search state success " + JSON.stringify(pages)); + if (!("search" == pages.name)) { + console.info("get search state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push search page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push search page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("searchOnCut after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testsearchOnCut0001 + * @tc.desic acesearchOnCutEtsTest0001 + */ + it('testsearchOnCut0001', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("320.00vp"); + console.info("[testsearchOnCut0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testsearchOnCut0002 + * @tc.desic acesearchOnCutEtsTest0002 + */ + it('testsearchOnCut0002', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testsearchOnCut0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testsearchOnCut0003 + * @tc.desic acesearchOnCutEtsTest0003 + */ + it('testsearchOnCut0003', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testsearchOnCut0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testsearchOnCut0004 + * @tc.desic acesearchOnCutEtsTest0004 + */ + it('testsearchOnCut0004', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testsearchOnCut0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testsearchOnCut0005 + * @tc.desic acesearchOnCutEtsTest0005 + */ + it('testsearchOnCut0005', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testsearchOnCut0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testsearchOnCut0006 + * @tc.desic acesearchOnCutEtsTest0006 + */ + it('testsearchOnCut0006', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testsearchOnCut0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testsearchOnCut0007 + * @tc.desic acesearchOnCutEtsTest0007 + */ + it('testsearchOnCut0007', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testsearchOnCut0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testsearchOnCut0009 + * @tc.desic acesearchOnCutEtsTest0009 + */ + it('testsearchOnCut0009', 0, async function (done) { + console.info('searchOnCut testsearchOnCut009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testsearchOnCut0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testsearchOnCut0010 + * @tc.desic acesearchOnCutEtsTest0010 + */ + it('testsearchOnCut0010', 0, async function (done) { + console.info('searchOnCut testsearchOnCut0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testsearchOnCut0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testsearchOnCut0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/swiper.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/swiper.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..4c83f088f504e550a4c2a5f44dcacb36df99c2db --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/swiper.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function swiperCurveJsunit() { + describe('swiperCurveTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/swiper', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get swiper state success " + JSON.stringify(pages)); + if (!("swiper" == pages.name)) { + console.info("get swiper state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push swiper page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push swiper page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("swiperCurve after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testswiperCurve0001 + * @tc.desic aceswiperCurveEtsTest0001 + */ + it('testswiperCurve0001', 0, async function (done) { + console.info('swiperCurve testswiperCurve0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testswiperCurve0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testswiperCurve0002 + * @tc.desic aceswiperCurveEtsTest0002 + */ + it('testswiperCurve0002', 0, async function (done) { + console.info('swiperCurve testswiperCurve0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testswiperCurve0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testswiperCurve0003 + * @tc.desic aceswiperCurveEtsTest0003 + */ + it('testswiperCurve0003', 0, async function (done) { + console.info('swiperCurve testswiperCurve0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testswiperCurve0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testswiperCurve0004 + * @tc.desic aceswiperCurveEtsTest0004 + */ + it('testswiperCurve0004', 0, async function (done) { + console.info('swiperCurve testswiperCurve0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testswiperCurve0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testswiperCurve0005 + * @tc.desic aceswiperCurveEtsTest0005 + */ + it('testswiperCurve0005', 0, async function (done) { + console.info('swiperCurve testswiperCurve0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testswiperCurve0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testswiperCurve0006 + * @tc.desic aceswiperCurveEtsTest0006 + */ + it('testswiperCurve0006', 0, async function (done) { + console.info('swiperCurve testswiperCurve0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testswiperCurve0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testswiperCurve0007 + * @tc.desic aceswiperCurveEtsTest0007 + */ + it('testswiperCurve0007', 0, async function (done) { + console.info('swiperCurve testswiperCurve0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testswiperCurve0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testswiperCurve0009 + * @tc.desic aceswiperCurveEtsTest0009 + */ + it('testswiperCurve0009', 0, async function (done) { + console.info('swiperCurve testswiperCurve009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testswiperCurve0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testswiperCurve0010 + * @tc.desic aceswiperCurveEtsTest0010 + */ + it('testswiperCurve0010', 0, async function (done) { + console.info('swiperCurve testswiperCurve0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('curveText'); + console.info("[testswiperCurve0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testswiperCurve0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/tabs.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/tabs.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..b65cbfd51b84c77e6b72786781350a93559b7a45 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/tabs.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function tabsBarPositionJsunit() { + describe('tabsBarPositionTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/tabs', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get tabs state success " + JSON.stringify(pages)); + if (!("tabs" == pages.name)) { + console.info("get tabs state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push tabs page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push tabs page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("tabsBarPosition after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtabsBarPosition0001 + * @tc.desic acetabsBarPositionEtsTest0001 + */ + it('testtabsBarPosition0001', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testtabsBarPosition0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtabsBarPosition0002 + * @tc.desic acetabsBarPositionEtsTest0002 + */ + it('testtabsBarPosition0002', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testtabsBarPosition0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtabsBarPosition0003 + * @tc.desic acetabsBarPositionEtsTest0003 + */ + it('testtabsBarPosition0003', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testtabsBarPosition0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtabsBarPosition0004 + * @tc.desic acetabsBarPositionEtsTest0004 + */ + it('testtabsBarPosition0004', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtabsBarPosition0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtabsBarPosition0005 + * @tc.desic acetabsBarPositionEtsTest0005 + */ + it('testtabsBarPosition0005', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testtabsBarPosition0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtabsBarPosition0006 + * @tc.desic acetabsBarPositionEtsTest0006 + */ + it('testtabsBarPosition0006', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testtabsBarPosition0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtabsBarPosition0007 + * @tc.desic acetabsBarPositionEtsTest0007 + */ + it('testtabsBarPosition0007', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testtabsBarPosition0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtabsBarPosition0009 + * @tc.desic acetabsBarPositionEtsTest0009 + */ + it('testtabsBarPosition0009', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testtabsBarPosition0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtabsBarPosition0010 + * @tc.desic acetabsBarPositionEtsTest0010 + */ + it('testtabsBarPosition0010', 0, async function (done) { + console.info('tabsBarPosition testtabsBarPosition0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('barPositionText'); + console.info("[testtabsBarPosition0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testtabsBarPosition0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/text.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/text.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e28cd9054c6c3a9e9748c7bb10e22a0c419edd5 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/text.test.ets @@ -0,0 +1,202 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function textMinFontSizeJsunit() { + describe('textMinFontSizeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/text', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get text state success " + JSON.stringify(pages)); + if (!("text" == pages.name)) { + console.info("get text state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push text page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push text page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textMinFontSize after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtextMinFontSize0001 + * @tc.desic acetextMinFontSizeEtsTest0001 + */ + it('testtextMinFontSize0001', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testtextMinFontSize0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtextMinFontSize0002 + * @tc.desic acetextMinFontSizeEtsTest0002 + */ + it('testtextMinFontSize0002', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testtextMinFontSize0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtextMinFontSize0003 + * @tc.desic acetextMinFontSizeEtsTest0003 + */ + it('testtextMinFontSize0003', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("30.00px"); + console.info("[testtextMinFontSize0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtextMinFontSize0004 + * @tc.desic acetextMinFontSizeEtsTest0004 + */ + it('testtextMinFontSize0004', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtextMinFontSize0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtextMinFontSize0005 + * @tc.desic acetextMinFontSizeEtsTest0005 + */ + it('testtextMinFontSize0005', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testtextMinFontSize0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtextMinFontSize0006 + * @tc.desic acetextMinFontSizeEtsTest0006 + */ + it('testtextMinFontSize0006', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testtextMinFontSize0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtextMinFontSize0007 + * @tc.desic acetextMinFontSizeEtsTest0007 + */ + it('testtextMinFontSize0007', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testtextMinFontSize0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtextMinFontSize0009 + * @tc.desic acetextMinFontSizeEtsTest0009 + */ + it('testtextMinFontSize0009', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testtextMinFontSize0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtextMinFontSize0010 + * @tc.desic acetextMinFontSizeEtsTest0010 + */ + it('testtextMinFontSize0010', 0, async function (done) { + console.info('textMinFontSize testtextMinFontSize0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('minFontSizeText'); + console.info("[testtextMinFontSize0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testtextMinFontSize0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textArea.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textArea.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..8e8b7f850d4e97d4db3da092622f8ab0fdaa6042 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textArea.test.ets @@ -0,0 +1,203 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function textAreaOnCutJsunit() { + describe('textAreaOnCutTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/textArea', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textArea state success " + JSON.stringify(pages)); + if (!("textArea" == pages.name)) { + console.info("get textArea state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push textArea page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push textArea page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textAreaOnCut after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtextAreaOnCut0001 + * @tc.desic acetextAreaOnCutEtsTest0001 + */ + it('testtextAreaOnCut0001', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testtextAreaOnCut0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtextAreaOnCut0002 + * @tc.desic acetextAreaOnCutEtsTest0002 + */ + it('testtextAreaOnCut0002', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testtextAreaOnCut0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtextAreaOnCut0003 + * @tc.desic acetextAreaOnCutEtsTest0003 + */ + it('testtextAreaOnCut0003', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testtextAreaOnCut0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtextAreaOnCut0004 + * @tc.desic acetextAreaOnCutEtsTest0004 + */ + it('testtextAreaOnCut0004', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtextAreaOnCut0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtextAreaOnCut0005 + * @tc.desic acetextAreaOnCutEtsTest0005 + */ + it('testtextAreaOnCut0005', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testtextAreaOnCut0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtextAreaOnCut0006 + * @tc.desic acetextAreaOnCutEtsTest0006 + */ + it('testtextAreaOnCut0006', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testtextAreaOnCut0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtextAreaOnCut0007 + * @tc.desic acetextAreaOnCutEtsTest0007 + */ + it('testtextAreaOnCut0007', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.lineHeight).assertEqual(undefined); + console.info("[testtextAreaOnCut0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtextAreaOnCut0009 + * @tc.desic acetextAreaOnCutEtsTest0009 + */ + it('testtextAreaOnCut0009', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.padding).assertEqual("0.00px"); + console.info("[testtextAreaOnCut0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtextAreaOnCut0010 + * @tc.desic acetextAreaOnCutEtsTest0010 + */ + it('testtextAreaOnCut0010', 0, async function (done) { + console.info('textAreaOnCut testtextAreaOnCut0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onCutText'); + console.info("[testtextAreaOnCut0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextArea'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Center"); + console.info("[testtextAreaOnCut0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + + + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textInput.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textInput.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..a860bd99a0109169fb5175ca73a2ac18a0fd1574 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textInput.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function textInputOnEditChangeJsunit() { + describe('textInputOnEditChangeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/textInput', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textInput state success " + JSON.stringify(pages)); + if (!("textInput" == pages.name)) { + console.info("get textInput state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push textInput page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push textInput page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textInputOnEditChange after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtextInputOnEditChange0001 + * @tc.desic acetextInputOnEditChangeEtsTest0001 + */ + it('testtextInputOnEditChange0001', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testtextInputOnEditChange0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtextInputOnEditChange0002 + * @tc.desic acetextInputOnEditChangeEtsTest0002 + */ + it('testtextInputOnEditChange0002', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testtextInputOnEditChange0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtextInputOnEditChange0003 + * @tc.desic acetextInputOnEditChangeEtsTest0003 + */ + it('testtextInputOnEditChange0003', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testtextInputOnEditChange0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtextInputOnEditChange0004 + * @tc.desic acetextInputOnEditChangeEtsTest0004 + */ + it('testtextInputOnEditChange0004', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtextInputOnEditChange0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtextInputOnEditChange0005 + * @tc.desic acetextInputOnEditChangeEtsTest0005 + */ + it('testtextInputOnEditChange0005', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testtextInputOnEditChange0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtextInputOnEditChange0006 + * @tc.desic acetextInputOnEditChangeEtsTest0006 + */ + it('testtextInputOnEditChange0006', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testtextInputOnEditChange0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtextInputOnEditChange0007 + * @tc.desic acetextInputOnEditChangeEtsTest0007 + */ + it('testtextInputOnEditChange0007', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.lineHeight).assertEqual(undefined); + console.info("[testtextInputOnEditChange0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtextInputOnEditChange0009 + * @tc.desic acetextInputOnEditChangeEtsTest0009 + */ + it('testtextInputOnEditChange0009', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.padding).assertEqual("0.00px"); + console.info("[testtextInputOnEditChange0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtextInputOnEditChange0010 + * @tc.desic acetextInputOnEditChangeEtsTest0010 + */ + it('testtextInputOnEditChange0010', 0, async function (done) { + console.info('textInputOnEditChange testtextInputOnEditChange0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onEditChangeText'); + console.info("[testtextInputOnEditChange0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextInput'); + expect(obj.$attrs.textAlign).assertEqual(undefined); + console.info("[testtextInputOnEditChange0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textPicker.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textPicker.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..da74d1508c3d727e071c1e961f49a8408d063d78 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/textPicker.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function textPickerDefaultPickerItemHeightJsunit() { + describe('textPickerDefaultPickerItemHeightTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/textPicker', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get textPicker state success " + JSON.stringify(pages)); + if (!("textPicker" == pages.name)) { + console.info("get textPicker state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push textPicker page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push textPicker page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("textPickerDefaultPickerItemHeight after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testtextPickerDefaultPickerItemHeight0001 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0001 + */ + it('testtextPickerDefaultPickerItemHeight0001', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.width).assertEqual("-"); + console.info("[testtextPickerDefaultPickerItemHeight0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testtextPickerDefaultPickerItemHeight0002 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0002 + */ + it('testtextPickerDefaultPickerItemHeight0002', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.height).assertEqual("-"); + console.info("[testtextPickerDefaultPickerItemHeight0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testtextPickerDefaultPickerItemHeight0003 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0003 + */ + it('testtextPickerDefaultPickerItemHeight0003', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.fontSize).assertEqual(undefined); + console.info("[testtextPickerDefaultPickerItemHeight0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testtextPickerDefaultPickerItemHeight0004 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0004 + */ + it('testtextPickerDefaultPickerItemHeight0004', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testtextPickerDefaultPickerItemHeight0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testtextPickerDefaultPickerItemHeight0005 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0005 + */ + it('testtextPickerDefaultPickerItemHeight0005', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.align).assertEqual("Alignment.Center"); + console.info("[testtextPickerDefaultPickerItemHeight0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testtextPickerDefaultPickerItemHeight0006 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0006 + */ + it('testtextPickerDefaultPickerItemHeight0006', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.fontColor).assertEqual(undefined); + console.info("[testtextPickerDefaultPickerItemHeight0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testtextPickerDefaultPickerItemHeight0007 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0007 + */ + it('testtextPickerDefaultPickerItemHeight0007', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.lineHeight).assertEqual(undefined); + console.info("[testtextPickerDefaultPickerItemHeight0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testtextPickerDefaultPickerItemHeight0009 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0009 + */ + it('testtextPickerDefaultPickerItemHeight0009', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.padding).assertEqual("0.00px"); + console.info("[testtextPickerDefaultPickerItemHeight0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testtextPickerDefaultPickerItemHeight0010 + * @tc.desic acetextPickerDefaultPickerItemHeightEtsTest0010 + */ + it('testtextPickerDefaultPickerItemHeight0010', 0, async function (done) { + console.info('textPickerDefaultPickerItemHeight testtextPickerDefaultPickerItemHeight0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('defaultPickerItemHeightText'); + console.info("[testtextPickerDefaultPickerItemHeight0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('TextPicker'); + expect(obj.$attrs.textAlign).assertEqual(undefined); + console.info("[testtextPickerDefaultPickerItemHeight0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/video.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/video.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..85ae48faaf816faa7f09a833ec450c8b267624c3 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/video.test.ets @@ -0,0 +1,201 @@ +/** + * Copyright (c) 2022 Shenzhen Kaihong Digital Industry Development 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 router from '@system.router'; +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "hypium/index" +import Utils from './Utils.ets' + +export default function videoOnFullscreenChangeJsunit() { + describe('videoOnFullscreenChangeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/video', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get video state success " + JSON.stringify(pages)); + if (!("video" == pages.name)) { + console.info("get video state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push video page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push video page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("videoOnFullscreenChange after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testvideoOnFullscreenChange0001 + * @tc.desic acevideoOnFullscreenChangeEtsTest0001 + */ + it('testvideoOnFullscreenChange0001', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.width).assertEqual("600.00vp"); + console.info("[testvideoOnFullscreenChange0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testvideoOnFullscreenChange0002 + * @tc.desic acevideoOnFullscreenChangeEtsTest0002 + */ + it('testvideoOnFullscreenChange0002', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.height).assertEqual("400.00vp"); + console.info("[testvideoOnFullscreenChange0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testvideoOnFullscreenChange0003 + * @tc.desic acevideoOnFullscreenChangeEtsTest0003 + */ + it('testvideoOnFullscreenChange0003', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.fontSize).assertEqual(undefined); + console.info("[testvideoOnFullscreenChange0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testvideoOnFullscreenChange0004 + * @tc.desic acevideoOnFullscreenChangeEtsTest0004 + */ + it('testvideoOnFullscreenChange0004', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testvideoOnFullscreenChange0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testvideoOnFullscreenChange0005 + * @tc.desic acevideoOnFullscreenChangeEtsTest0005 + */ + it('testvideoOnFullscreenChange0005', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.align).assertEqual("Alignment.Center"); + console.info("[testvideoOnFullscreenChange0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testvideoOnFullscreenChange0006 + * @tc.desic acevideoOnFullscreenChangeEtsTest0006 + */ + it('testvideoOnFullscreenChange0006', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.fontColor).assertEqual(undefined); + console.info("[testvideoOnFullscreenChange0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testvideoOnFullscreenChange0007 + * @tc.desic acevideoOnFullscreenChangeEtsTest0007 + */ + it('testvideoOnFullscreenChange0007', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.lineHeight).assertEqual(undefined); + console.info("[testvideoOnFullscreenChange0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testvideoOnFullscreenChange0009 + * @tc.desic acevideoOnFullscreenChangeEtsTest0009 + */ + it('testvideoOnFullscreenChange0009', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.padding).assertEqual("0.00px"); + console.info("[testvideoOnFullscreenChange0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testvideoOnFullscreenChange0010 + * @tc.desic acevideoOnFullscreenChangeEtsTest0010 + */ + it('testvideoOnFullscreenChange0010', 0, async function (done) { + console.info('videoOnFullscreenChange testvideoOnFullscreenChange0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onFullscreenChangeText'); + console.info("[testvideoOnFullscreenChange0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Video'); + expect(obj.$attrs.textAlign).assertEqual(undefined); + console.info("[testvideoOnFullscreenChange0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +}