From f2f641b5ef3c6859fd870c8683b819b08e0ae145 Mon Sep 17 00:00:00 2001 From: bayanxing Date: Tue, 30 Aug 2022 15:31:09 +0800 Subject: [PATCH] =?UTF-8?q?ets=20api=E8=A6=86=E7=9B=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: bayanxing --- arkui/BUILD.gn | 1 + .../src/main/ets/MainAbility/pages/list.ets | 116 ++++++++++ .../main/ets/MainAbility/pages/list_item.ets | 77 +++++++ .../main/ets/MainAbility/pages/matrix2d.ets | 52 +++++ .../main/ets/MainAbility/pages/mediaQuery.ets | 104 +++++++++ .../main/ets/MainAbility/pages/navigator.ets | 55 +++++ .../ets/MainAbility/pages/page_transition.ets | 52 +++++ .../src/main/ets/MainAbility/pages/panel.ets | 105 +++++++++ .../src/main/ets/MainAbility/pages/path.ets | 58 +++++ .../ets/MainAbility/pages/pluginComponent.ets | 66 ++++++ .../src/main/ets/test/list_item.test.ets | 201 +++++++++++++++++ .../entry/src/main/ets/test/matrix2d.test.ets | 201 +++++++++++++++++ .../src/main/ets/test/mediaQuery.test.ets | 204 ++++++++++++++++++ .../src/main/ets/test/navigator.test.ets | 201 +++++++++++++++++ .../main/ets/test/page_transition.test.ets | 201 +++++++++++++++++ .../entry/src/main/ets/test/panel.test.ets | 201 +++++++++++++++++ .../entry/src/main/ets/test/path.test.ets | 201 +++++++++++++++++ .../main/ets/test/pluginComponent.test.ets | 204 ++++++++++++++++++ 18 files changed, 2300 insertions(+) create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/matrix2d.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/mediaQuery.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/navigator.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page_transition.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/path.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/test/matrix2d.test.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/test/mediaQuery.test.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/test/navigator.test.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/test/page_transition.test.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/test/path.test.ets create mode 100644 arkui/ace_ets_component_apilack/entry/src/main/ets/test/pluginComponent.test.ets diff --git a/arkui/BUILD.gn b/arkui/BUILD.gn index 988e84d91..eb91b3627 100644 --- a/arkui/BUILD.gn +++ b/arkui/BUILD.gn @@ -15,6 +15,7 @@ group("arkui") { testonly = true deps = [ "ace_ets_component:ActsAceEtsComponentTest", + "ace_ets_component_apilack:ActsAceEtsApiLackTest", "ace_ets_component_five:ActsAceEtsComponentFiveTest", "ace_ets_component_four:ActsAceEtsComponentFourTest", "ace_ets_component_three:ActsAceEtsComponentThreeTest", diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets new file mode 100644 index 000000000..f828e6388 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list.ets @@ -0,0 +1,116 @@ +/** + * 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 ListLanes { + + @State arr: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] + @State listPosition: number = 0 // 0代表滚动到List顶部,1代表中间值,2代表滚动到List底 + private scroller: Scroller = new Scroller() + + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear ListLanes start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear ListLanes end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("list-Lanes") + .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("lanesText") + + Text("list-AlignListItem") + .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("alignListItemText") + + Text("list-OnScrollBegin") + .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("onScrollBeginText") + + + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('100%') + .height(100) + .fontSize(18) + + } + .border({ width: 2, color: Color.Green }) + }, item => item) + } + + .height(300) + .width("90%") + .editMode(true) + .border({ width: 3, color: Color.Red }) + .lanes({ minLength: 40, maxLength: 60 }) + .onScrollBegin((dx: number, dy: number) => { + if ((this.listPosition == 0 && dy >= 0) || (this.listPosition == 2 && dy <= 0)) { + this.scroller.scrollBy(0, -dy) + return { dxRemain: dx, dyRemain: 0 } + } + this.listPosition = 1; + + return { dxRemain: dx, dyRemain: dy } + + }) + + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets new file mode 100644 index 000000000..eb62585e1 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/list_item.ets @@ -0,0 +1,77 @@ +/** + * 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 List_itemOnSelect { + + @State arr: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19"] + @State alignListItem: ListItemAlign = ListItemAlign.Start + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear List_itemOnSelect start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear List_itemOnSelect end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("list_item-OnSelect") + .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("onSelectText") + + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('100%') + .height(100) + .fontSize(16) + + } + .border({ width: 2, color: Color.Green }) + .onSelect((index:boolean)=>{ + console.info("Select: " + index)}) + }, item => item) + } + .height(300) + .width("90%") + .editMode(true) + .border({ width: 3, color: Color.Red }) + .lanes({ minLength: 40, maxLength: 60 }) + //lanes(5) + .alignListItem(this.alignListItem) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/matrix2d.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/matrix2d.ets new file mode 100644 index 000000000..2b1334623 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/matrix2d.ets @@ -0,0 +1,52 @@ +/** + * 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 Matrix2dMultiply { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Matrix2dMultiply start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear Matrix2dMultiply end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("matrix2d-Multiply") + .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("multiplyText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/mediaQuery.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/mediaQuery.ets new file mode 100644 index 000000000..a46ac667e --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/mediaQuery.ets @@ -0,0 +1,104 @@ +/** + * 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'; + +import mediaquery from '@ohos.mediaquery' +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct MediaQueryOff { + @State color: string = '#000' + @State text: string = 'Test' + listener = mediaquery.matchMediaSync('(orientation: landscape)') + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear MediaQueryOff start`) + this.listener.on('change', (mediaQueryResult) => { + if (mediaQueryResult.matches) { + this.color = '#FFD700' + this.text = 'Landscape' + } else { + this.color = '#DB7093' + this.text = 'Portrait' + } + }) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear MediaQueryOff end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + + Text("mediaQuery-Off") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("offText") + .onClick(() => { + this.listener.off('change', (mediaQueryResult) => { + console.log(JSON.stringify(mediaQueryResult)) + }) + }) + + Text("mediaQuery-MatchMediaSync") + .width(100) + .height(70) + .fontSize(20) + .opacity(1) + .align(Alignment.TopStart) + .fontColor(0xCCCCCC) + .lineHeight(25) + .border({ width: 1 }) + .padding(10) + .textAlign(TextAlign.Center) + .textOverflow({ overflow: TextOverflow.None }) + .key("matchMediaSyncText") + .onClick(() => { + console.log('mediaQuery-MatchMediaSync: ' + JSON.stringify(this.listener)) + }) + + Text(this.text) + .fontSize(50) + .fontColor(this.color) + // .width(100) + // .height(70) + // .fontSize(20) + // .opacity(1) + // .align(Alignment.TopStart) + // .fontColor(0xCCCCCC) + // .lineHeight(25) + // .border({ width: 1 }) + // .padding(10) + // .textAlign(TextAlign.Center) + // .textOverflow({ overflow: TextOverflow.None }) + // .key("offText") + + }.width("100%").height("100%") + } +} + 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 000000000..6f9e10c2a --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/navigator.ets @@ -0,0 +1,55 @@ +/** + * 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') + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page_transition.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page_transition.ets new file mode 100644 index 000000000..e74e254d0 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/page_transition.ets @@ -0,0 +1,52 @@ +/** + * 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 Page_transitionSlide { + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear Page_transitionSlide start`) + } + + aboutToDisappear(){ + Log.showInfo(TAG, `aboutToDisAppear Page_transitionSlide end`) + } + + build(){ + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center,justifyContent:FlexAlign.Center }){ + + Text("page_transition-Slide") + .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("slideText") + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets new file mode 100644 index 000000000..102711f46 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/panel.ets @@ -0,0 +1,105 @@ +/** + * 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 PanelBackgroundMask { + @State show1: boolean = false + @State show2: boolean = false + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear PanelBackgroundMask start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear PanelBackgroundMask end`) + } + + build() { + // Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center }) { + Column() { + Text("panel-BackgroundMask") + .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("backgroundMaskText") + .onClick(() => { + this.show1 = !this.show1 + }) + + Text("panel-OnHeightChange") + .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("onHeightChangeText") + .onClick(() => { + this.show2 = !this.show2 + }) + + Panel(this.show1) { + Column() { + Text("panel-BackgroundMask").fontSize(30) + } + } + .backgroundColor('green') + .type(PanelType.Foldable) + .mode(PanelMode.Half) + .dragBar(false) + .halfHeight(300) + .onChange((width: number, height: number, mode: PanelMode) => { + Log.showInfo(TAG, `width:${width},height:${height},mode:${mode}`) + }) + //.backgroundMask('red') + + Panel(this.show2) { + Column() { + Text("panel-OnHeightChange").fontSize(30) + } + } + .backgroundColor('red') + .type(PanelType.Foldable) + .mode(PanelMode.Half) + .dragBar(false) + .halfHeight(300) + .onChange((width: number, height: number, mode: PanelMode) => { + console.log(`width:${width},height:${height},mode:${mode}`) + }) + + // .onHeightChange((value: number) => { + // Log.showInfo(TAG, 'onHeightChange: ' + value) + // }) + + }.width("100%").height("100%") + } +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/path.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/path.ets new file mode 100644 index 000000000..24ea146ea --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/path.ets @@ -0,0 +1,58 @@ +/** + * 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 PathNe { + private path: any = new Path({ + width: 100, + height: 100, + commands: 'M150 0 L300 300 L0 300 Z' + }) + + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear PathNe start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear PathNe end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + + Text("path-Ne") + .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("neText") + + Path().width(100).height(100).commands('M150 0 L300 300 L0 300 Z') + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets new file mode 100644 index 000000000..c79573983 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/MainAbility/pages/pluginComponent.ets @@ -0,0 +1,66 @@ +/** + * 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'; +import pluginComponentManager from '@ohos.pluginComponent' +const TAG = 'ets_apiLack_add'; + +@Entry +@Component +export default struct PluginComponentRequest { + aboutToAppear() { + Log.showInfo(TAG, `aboutToAppear PluginComponentRequest start`) + } + + aboutToDisappear() { + Log.showInfo(TAG, `aboutToDisAppear PluginComponentRequest end`) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text("pluginComponent-Request") + .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("requestText") + .onClick(() => { + pluginComponentManager.request({ + want: { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + }, + name: "plugintemplate", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + jsonPath: "" + }, (error, data) => { + console.log("request_callback: data=" + JSON.stringify(data)) + }) + }) + + }.width("100%").height("100%") + } +} + diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.test.ets new file mode 100644 index 000000000..863425f4b --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/list_item.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 list_itemOnSelectJsunit() { + describe('list_itemOnSelectTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/list_item', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get list_item state success " + JSON.stringify(pages)); + if (!("list_item" == pages.name)) { + console.info("get list_item state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push list_item page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push list_item page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("list_itemOnSelect after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testlist_itemOnSelect0001 + * @tc.desic acelist_itemOnSelectEtsTest0001 + */ + it('testlist_itemOnSelect0001', 0, async function (done) { + console.info('list_itemOnSelect testlist_itemOnSelect0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onSelectText'); + console.info("[testlist_itemOnSelect0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testlist_itemOnSelect0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testlist_itemOnSelect0002 + * @tc.desic acelist_itemOnSelectEtsTest0002 + */ + it('testlist_itemOnSelect0002', 0, async function (done) { + console.info('list_itemOnSelect testlist_itemOnSelect0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onSelectText'); + console.info("[testlist_itemOnSelect0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testlist_itemOnSelect0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testlist_itemOnSelect0003 + * @tc.desic acelist_itemOnSelectEtsTest0003 + */ + it('testlist_itemOnSelect0003', 0, async function (done) { + console.info('list_itemOnSelect testlist_itemOnSelect0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onSelectText'); + console.info("[testlist_itemOnSelect0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testlist_itemOnSelect0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testlist_itemOnSelect0004 + * @tc.desic acelist_itemOnSelectEtsTest0004 + */ + it('testlist_itemOnSelect0004', 0, async function (done) { + console.info('list_itemOnSelect testlist_itemOnSelect0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onSelectText'); + console.info("[testlist_itemOnSelect0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testlist_itemOnSelect0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testlist_itemOnSelect0005 + * @tc.desic acelist_itemOnSelectEtsTest0005 + */ + it('testlist_itemOnSelect0005', 0, async function (done) { + console.info('list_itemOnSelect testlist_itemOnSelect0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onSelectText'); + console.info("[testlist_itemOnSelect0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testlist_itemOnSelect0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testlist_itemOnSelect0006 + * @tc.desic acelist_itemOnSelectEtsTest0006 + */ + it('testlist_itemOnSelect0006', 0, async function (done) { + console.info('list_itemOnSelect testlist_itemOnSelect0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onSelectText'); + console.info("[testlist_itemOnSelect0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testlist_itemOnSelect0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testlist_itemOnSelect0007 + * @tc.desic acelist_itemOnSelectEtsTest0007 + */ + it('testlist_itemOnSelect0007', 0, async function (done) { + console.info('list_itemOnSelect testlist_itemOnSelect0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onSelectText'); + console.info("[testlist_itemOnSelect0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testlist_itemOnSelect0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testlist_itemOnSelect0009 + * @tc.desic acelist_itemOnSelectEtsTest0009 + */ + it('testlist_itemOnSelect0009', 0, async function (done) { + console.info('list_itemOnSelect testlist_itemOnSelect009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onSelectText'); + console.info("[testlist_itemOnSelect0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testlist_itemOnSelect0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testlist_itemOnSelect0010 + * @tc.desic acelist_itemOnSelectEtsTest0010 + */ + it('testlist_itemOnSelect0010', 0, async function (done) { + console.info('list_itemOnSelect testlist_itemOnSelect0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('onSelectText'); + console.info("[testlist_itemOnSelect0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testlist_itemOnSelect0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/matrix2d.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/matrix2d.test.ets new file mode 100644 index 000000000..28064f754 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/matrix2d.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 matrix2dMultiplyJsunit() { + describe('matrix2dMultiplyTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/matrix2d', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get matrix2d state success " + JSON.stringify(pages)); + if (!("matrix2d" == pages.name)) { + console.info("get matrix2d state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push matrix2d page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push matrix2d page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("matrix2dMultiply after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testmatrix2dMultiply0001 + * @tc.desic acematrix2dMultiplyEtsTest0001 + */ + it('testmatrix2dMultiply0001', 0, async function (done) { + console.info('matrix2dMultiply testmatrix2dMultiply0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('multiplyText'); + console.info("[testmatrix2dMultiply0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testmatrix2dMultiply0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testmatrix2dMultiply0002 + * @tc.desic acematrix2dMultiplyEtsTest0002 + */ + it('testmatrix2dMultiply0002', 0, async function (done) { + console.info('matrix2dMultiply testmatrix2dMultiply0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('multiplyText'); + console.info("[testmatrix2dMultiply0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testmatrix2dMultiply0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testmatrix2dMultiply0003 + * @tc.desic acematrix2dMultiplyEtsTest0003 + */ + it('testmatrix2dMultiply0003', 0, async function (done) { + console.info('matrix2dMultiply testmatrix2dMultiply0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('multiplyText'); + console.info("[testmatrix2dMultiply0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testmatrix2dMultiply0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testmatrix2dMultiply0004 + * @tc.desic acematrix2dMultiplyEtsTest0004 + */ + it('testmatrix2dMultiply0004', 0, async function (done) { + console.info('matrix2dMultiply testmatrix2dMultiply0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('multiplyText'); + console.info("[testmatrix2dMultiply0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testmatrix2dMultiply0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testmatrix2dMultiply0005 + * @tc.desic acematrix2dMultiplyEtsTest0005 + */ + it('testmatrix2dMultiply0005', 0, async function (done) { + console.info('matrix2dMultiply testmatrix2dMultiply0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('multiplyText'); + console.info("[testmatrix2dMultiply0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testmatrix2dMultiply0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testmatrix2dMultiply0006 + * @tc.desic acematrix2dMultiplyEtsTest0006 + */ + it('testmatrix2dMultiply0006', 0, async function (done) { + console.info('matrix2dMultiply testmatrix2dMultiply0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('multiplyText'); + console.info("[testmatrix2dMultiply0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testmatrix2dMultiply0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testmatrix2dMultiply0007 + * @tc.desic acematrix2dMultiplyEtsTest0007 + */ + it('testmatrix2dMultiply0007', 0, async function (done) { + console.info('matrix2dMultiply testmatrix2dMultiply0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('multiplyText'); + console.info("[testmatrix2dMultiply0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testmatrix2dMultiply0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testmatrix2dMultiply0009 + * @tc.desic acematrix2dMultiplyEtsTest0009 + */ + it('testmatrix2dMultiply0009', 0, async function (done) { + console.info('matrix2dMultiply testmatrix2dMultiply009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('multiplyText'); + console.info("[testmatrix2dMultiply0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testmatrix2dMultiply0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testmatrix2dMultiply0010 + * @tc.desic acematrix2dMultiplyEtsTest0010 + */ + it('testmatrix2dMultiply0010', 0, async function (done) { + console.info('matrix2dMultiply testmatrix2dMultiply0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('multiplyText'); + console.info("[testmatrix2dMultiply0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testmatrix2dMultiply0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/mediaQuery.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/mediaQuery.test.ets new file mode 100644 index 000000000..428387bee --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/mediaQuery.test.ets @@ -0,0 +1,204 @@ +/** + * 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 mediaQueryOffJsunit() { + describe('mediaQueryOffTest', function () { + + /** + * run before testcase + */ + beforeAll(async function (done) { + console.info('[mediaQueryOffTest] before each called') + + let result; + let options = { + uri: 'pages/mediaQuery' + } + try { + result = router.push(options) + console.info("push mediaQuery page success " + JSON.stringify(result)); + } catch (err) { + console.error("push mediaQuery page error " + JSON.stringify(result)); + } + await Utils.sleep(4000) + done() + }); + + /** + * run after testcase + */ + afterAll(async function () { + console.info('[mediaQueryOffTest] after each called') + await Utils.sleep(1000) + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testmediaQueryOff0001 + * @tc.desic acemediaQueryOffEtsTest0001 + */ + it('testmediaQueryOff0001', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testmediaQueryOff0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testmediaQueryOff0002 + * @tc.desic acemediaQueryOffEtsTest0002 + */ + it('testmediaQueryOff0002', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testmediaQueryOff0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testmediaQueryOff0003 + * @tc.desic acemediaQueryOffEtsTest0003 + */ + it('testmediaQueryOff0003', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testmediaQueryOff0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testmediaQueryOff0004 + * @tc.desic acemediaQueryOffEtsTest0004 + */ + it('testmediaQueryOff0004', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testmediaQueryOff0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testmediaQueryOff0005 + * @tc.desic acemediaQueryOffEtsTest0005 + */ + it('testmediaQueryOff0005', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testmediaQueryOff0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testmediaQueryOff0006 + * @tc.desic acemediaQueryOffEtsTest0006 + */ + it('testmediaQueryOff0006', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testmediaQueryOff0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testmediaQueryOff0007 + * @tc.desic acemediaQueryOffEtsTest0007 + */ + it('testmediaQueryOff0007', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testmediaQueryOff0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testmediaQueryOff0009 + * @tc.desic acemediaQueryOffEtsTest0009 + */ + it('testmediaQueryOff0009', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testmediaQueryOff0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testmediaQueryOff0010 + * @tc.desic acemediaQueryOffEtsTest0010 + */ + it('testmediaQueryOff0010', 0, async function (done) { + console.info('mediaQueryOff testmediaQueryOff0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('offText'); + console.info("[testmediaQueryOff0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testmediaQueryOff0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} 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 000000000..995a2f699 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/navigator.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 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('targetText'); + console.info("[testnavigatorTarget0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testnavigatorTarget0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testnavigatorTarget0002 + * @tc.desic acenavigatorTargetEtsTest0002 + */ + it('testnavigatorTarget0002', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('targetText'); + console.info("[testnavigatorTarget0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testnavigatorTarget0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testnavigatorTarget0003 + * @tc.desic acenavigatorTargetEtsTest0003 + */ + it('testnavigatorTarget0003', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('targetText'); + console.info("[testnavigatorTarget0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testnavigatorTarget0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testnavigatorTarget0004 + * @tc.desic acenavigatorTargetEtsTest0004 + */ + it('testnavigatorTarget0004', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('targetText'); + console.info("[testnavigatorTarget0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testnavigatorTarget0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testnavigatorTarget0005 + * @tc.desic acenavigatorTargetEtsTest0005 + */ + it('testnavigatorTarget0005', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('targetText'); + console.info("[testnavigatorTarget0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testnavigatorTarget0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testnavigatorTarget0006 + * @tc.desic acenavigatorTargetEtsTest0006 + */ + it('testnavigatorTarget0006', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('targetText'); + console.info("[testnavigatorTarget0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testnavigatorTarget0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testnavigatorTarget0007 + * @tc.desic acenavigatorTargetEtsTest0007 + */ + it('testnavigatorTarget0007', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('targetText'); + console.info("[testnavigatorTarget0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testnavigatorTarget0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testnavigatorTarget0009 + * @tc.desic acenavigatorTargetEtsTest0009 + */ + it('testnavigatorTarget0009', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('targetText'); + console.info("[testnavigatorTarget0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testnavigatorTarget0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testnavigatorTarget0010 + * @tc.desic acenavigatorTargetEtsTest0010 + */ + it('testnavigatorTarget0010', 0, async function (done) { + console.info('navigatorTarget testnavigatorTarget0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('targetText'); + console.info("[testnavigatorTarget0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testnavigatorTarget0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/page_transition.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/page_transition.test.ets new file mode 100644 index 000000000..b4fe94332 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/page_transition.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 page_transitionSlideJsunit() { + describe('page_transitionSlideTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/page_transition', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get page_transition state success " + JSON.stringify(pages)); + if (!("page_transition" == pages.name)) { + console.info("get page_transition state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push page_transition page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push page_transition page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("page_transitionSlide after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpage_transitionSlide0001 + * @tc.desic acepage_transitionSlideEtsTest0001 + */ + it('testpage_transitionSlide0001', 0, async function (done) { + console.info('page_transitionSlide testpage_transitionSlide0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('slideText'); + console.info("[testpage_transitionSlide0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testpage_transitionSlide0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testpage_transitionSlide0002 + * @tc.desic acepage_transitionSlideEtsTest0002 + */ + it('testpage_transitionSlide0002', 0, async function (done) { + console.info('page_transitionSlide testpage_transitionSlide0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('slideText'); + console.info("[testpage_transitionSlide0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testpage_transitionSlide0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testpage_transitionSlide0003 + * @tc.desic acepage_transitionSlideEtsTest0003 + */ + it('testpage_transitionSlide0003', 0, async function (done) { + console.info('page_transitionSlide testpage_transitionSlide0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('slideText'); + console.info("[testpage_transitionSlide0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testpage_transitionSlide0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testpage_transitionSlide0004 + * @tc.desic acepage_transitionSlideEtsTest0004 + */ + it('testpage_transitionSlide0004', 0, async function (done) { + console.info('page_transitionSlide testpage_transitionSlide0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('slideText'); + console.info("[testpage_transitionSlide0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testpage_transitionSlide0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testpage_transitionSlide0005 + * @tc.desic acepage_transitionSlideEtsTest0005 + */ + it('testpage_transitionSlide0005', 0, async function (done) { + console.info('page_transitionSlide testpage_transitionSlide0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('slideText'); + console.info("[testpage_transitionSlide0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testpage_transitionSlide0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testpage_transitionSlide0006 + * @tc.desic acepage_transitionSlideEtsTest0006 + */ + it('testpage_transitionSlide0006', 0, async function (done) { + console.info('page_transitionSlide testpage_transitionSlide0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('slideText'); + console.info("[testpage_transitionSlide0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testpage_transitionSlide0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testpage_transitionSlide0007 + * @tc.desic acepage_transitionSlideEtsTest0007 + */ + it('testpage_transitionSlide0007', 0, async function (done) { + console.info('page_transitionSlide testpage_transitionSlide0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('slideText'); + console.info("[testpage_transitionSlide0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testpage_transitionSlide0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testpage_transitionSlide0009 + * @tc.desic acepage_transitionSlideEtsTest0009 + */ + it('testpage_transitionSlide0009', 0, async function (done) { + console.info('page_transitionSlide testpage_transitionSlide009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('slideText'); + console.info("[testpage_transitionSlide0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testpage_transitionSlide0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testpage_transitionSlide0010 + * @tc.desic acepage_transitionSlideEtsTest0010 + */ + it('testpage_transitionSlide0010', 0, async function (done) { + console.info('page_transitionSlide testpage_transitionSlide0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('slideText'); + console.info("[testpage_transitionSlide0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testpage_transitionSlide0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.test.ets new file mode 100644 index 000000000..847dfd018 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/panel.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 panelBackgroundMaskJsunit() { + describe('panelBackgroundMaskTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/panel', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get panel state success " + JSON.stringify(pages)); + if (!("panel" == pages.name)) { + console.info("get panel state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push panel page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push panel page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("panelBackgroundMask after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpanelBackgroundMask0001 + * @tc.desic acepanelBackgroundMaskEtsTest0001 + */ + it('testpanelBackgroundMask0001', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundMaskText'); + console.info("[testpanelBackgroundMask0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testpanelBackgroundMask0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testpanelBackgroundMask0002 + * @tc.desic acepanelBackgroundMaskEtsTest0002 + */ + it('testpanelBackgroundMask0002', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundMaskText'); + console.info("[testpanelBackgroundMask0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testpanelBackgroundMask0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testpanelBackgroundMask0003 + * @tc.desic acepanelBackgroundMaskEtsTest0003 + */ + it('testpanelBackgroundMask0003', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundMaskText'); + console.info("[testpanelBackgroundMask0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testpanelBackgroundMask0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testpanelBackgroundMask0004 + * @tc.desic acepanelBackgroundMaskEtsTest0004 + */ + it('testpanelBackgroundMask0004', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundMaskText'); + console.info("[testpanelBackgroundMask0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testpanelBackgroundMask0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testpanelBackgroundMask0005 + * @tc.desic acepanelBackgroundMaskEtsTest0005 + */ + it('testpanelBackgroundMask0005', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundMaskText'); + console.info("[testpanelBackgroundMask0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testpanelBackgroundMask0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testpanelBackgroundMask0006 + * @tc.desic acepanelBackgroundMaskEtsTest0006 + */ + it('testpanelBackgroundMask0006', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundMaskText'); + console.info("[testpanelBackgroundMask0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testpanelBackgroundMask0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testpanelBackgroundMask0007 + * @tc.desic acepanelBackgroundMaskEtsTest0007 + */ + it('testpanelBackgroundMask0007', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundMaskText'); + console.info("[testpanelBackgroundMask0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testpanelBackgroundMask0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testpanelBackgroundMask0009 + * @tc.desic acepanelBackgroundMaskEtsTest0009 + */ + it('testpanelBackgroundMask0009', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundMaskText'); + console.info("[testpanelBackgroundMask0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testpanelBackgroundMask0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testpanelBackgroundMask0010 + * @tc.desic acepanelBackgroundMaskEtsTest0010 + */ + it('testpanelBackgroundMask0010', 0, async function (done) { + console.info('panelBackgroundMask testpanelBackgroundMask0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('backgroundMaskText'); + console.info("[testpanelBackgroundMask0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testpanelBackgroundMask0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/path.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/path.test.ets new file mode 100644 index 000000000..114580960 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/path.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 pathNeJsunit() { + describe('pathNeTest', function () { + beforeAll(async function (done) { + console.info("flex beforeEach start"); + let options = { + uri: 'pages/path', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get path state success " + JSON.stringify(pages)); + if (!("path" == pages.name)) { + console.info("get path state success " + JSON.stringify(pages.name)); + let result = await router.push(options); + await Utils.sleep(2000); + console.info("push path page success " + JSON.stringify(result)); + } + } catch (err) { + console.error("push path page error: " + err); + } + done() + }); + + afterEach(async function () { + await Utils.sleep(1000); + console.info("pathNe after each called"); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpathNe0001 + * @tc.desic acepathNeEtsTest0001 + */ + it('testpathNe0001', 0, async function (done) { + console.info('pathNe testpathNe0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('neText'); + console.info("[testpathNe0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testpathNe0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testpathNe0002 + * @tc.desic acepathNeEtsTest0002 + */ + it('testpathNe0002', 0, async function (done) { + console.info('pathNe testpathNe0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('neText'); + console.info("[testpathNe0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testpathNe0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testpathNe0003 + * @tc.desic acepathNeEtsTest0003 + */ + it('testpathNe0003', 0, async function (done) { + console.info('pathNe testpathNe0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('neText'); + console.info("[testpathNe0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testpathNe0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testpathNe0004 + * @tc.desic acepathNeEtsTest0004 + */ + it('testpathNe0004', 0, async function (done) { + console.info('pathNe testpathNe0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('neText'); + console.info("[testpathNe0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testpathNe0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testpathNe0005 + * @tc.desic acepathNeEtsTest0005 + */ + it('testpathNe0005', 0, async function (done) { + console.info('pathNe testpathNe0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('neText'); + console.info("[testpathNe0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testpathNe0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testpathNe0006 + * @tc.desic acepathNeEtsTest0006 + */ + it('testpathNe0006', 0, async function (done) { + console.info('pathNe testpathNe0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('neText'); + console.info("[testpathNe0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testpathNe0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testpathNe0007 + * @tc.desic acepathNeEtsTest0007 + */ + it('testpathNe0007', 0, async function (done) { + console.info('pathNe testpathNe0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('neText'); + console.info("[testpathNe0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testpathNe0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testpathNe0009 + * @tc.desic acepathNeEtsTest0009 + */ + it('testpathNe0009', 0, async function (done) { + console.info('pathNe testpathNe009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('neText'); + console.info("[testpathNe0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testpathNe0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testpathNe0010 + * @tc.desic acepathNeEtsTest0010 + */ + it('testpathNe0010', 0, async function (done) { + console.info('pathNe testpathNe0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('neText'); + console.info("[testpathNe0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testpathNe0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} diff --git a/arkui/ace_ets_component_apilack/entry/src/main/ets/test/pluginComponent.test.ets b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/pluginComponent.test.ets new file mode 100644 index 000000000..aa9aa72c8 --- /dev/null +++ b/arkui/ace_ets_component_apilack/entry/src/main/ets/test/pluginComponent.test.ets @@ -0,0 +1,204 @@ +/** + * 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 pluginComponentRequestJsunit() { + describe('pluginComponentRequestTest', function () { + + /** + * run before testcase + */ + beforeAll(async function (done) { + console.info('[pluginComponentRequestTest] before each called') + + let result; + let options = { + uri: 'pages/pluginComponent' + } + try { + result = router.push(options) + console.info("push pluginComponentRequestTest page success " + JSON.stringify(result)); + } catch (err) { + console.error("push pluginComponentRequestTest page error " + JSON.stringify(result)); + } + await Utils.sleep(4000) + done() + }); + + /** + * run after testcase + */ + afterAll(async function () { + console.info('[pluginComponentRequestTest] after each called') + await Utils.sleep(1000) + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0001 + * @tc.name testpluginComponentRequest0001 + * @tc.desic acepluginComponentRequestEtsTest0001 + */ + it('testpluginComponentRequest0001', 0, async function (done) { + console.info('pluginComponentRequest testpluginComponentRequest0001 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('requestText'); + console.info("[testpluginComponentRequest0001] component width strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.width).assertEqual("100.00vp"); + console.info("[testpluginComponentRequest0001] width value :" + obj.$attrs.width); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0002 + * @tc.name testpluginComponentRequest0002 + * @tc.desic acepluginComponentRequestEtsTest0002 + */ + it('testpluginComponentRequest0002', 0, async function (done) { + console.info('pluginComponentRequest testpluginComponentRequest0002 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('requestText'); + console.info("[testpluginComponentRequest0002] component height strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.height).assertEqual("70.00vp"); + console.info("[testpluginComponentRequest0002] height value :" + obj.$attrs.height); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0003 + * @tc.name testpluginComponentRequest0003 + * @tc.desic acepluginComponentRequestEtsTest0003 + */ + it('testpluginComponentRequest0003', 0, async function (done) { + console.info('pluginComponentRequest testpluginComponentRequest0003 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('requestText'); + console.info("[testpluginComponentRequest0003] component fontSize strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontSize).assertEqual("20.00fp"); + console.info("[testpluginComponentRequest0003] fontSize value :" + obj.$attrs.fontSize); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0004 + * @tc.name testpluginComponentRequest0004 + * @tc.desic acepluginComponentRequestEtsTest0004 + */ + it('testpluginComponentRequest0004', 0, async function (done) { + console.info('pluginComponentRequest testpluginComponentRequest0004 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('requestText'); + console.info("[testpluginComponentRequest0004] component opacity strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.opacity).assertEqual(1); + console.info("[testpluginComponentRequest0004] opacity value :" + obj.$attrs.opacity); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0005 + * @tc.name testpluginComponentRequest0005 + * @tc.desic acepluginComponentRequestEtsTest0005 + */ + it('testpluginComponentRequest0005', 0, async function (done) { + console.info('pluginComponentRequest testpluginComponentRequest0005 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('requestText'); + console.info("[testpluginComponentRequest0005] component align strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.align).assertEqual("Alignment.TopStart"); + console.info("[testpluginComponentRequest0005] align value :" + obj.$attrs.align); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0006 + * @tc.name testpluginComponentRequest0006 + * @tc.desic acepluginComponentRequestEtsTest0006 + */ + it('testpluginComponentRequest0006', 0, async function (done) { + console.info('pluginComponentRequest testpluginComponentRequest0006 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('requestText'); + console.info("[testpluginComponentRequest0006] component fontColor strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.fontColor).assertEqual("#FFCCCCCC"); + console.info("[testpluginComponentRequest0006] fontColor value :" + obj.$attrs.fontColor); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0007 + * @tc.name testpluginComponentRequest0007 + * @tc.desic acepluginComponentRequestEtsTest0007 + */ + it('testpluginComponentRequest0007', 0, async function (done) { + console.info('pluginComponentRequest testpluginComponentRequest0007 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('requestText'); + console.info("[testpluginComponentRequest0007] component lineHeight strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.lineHeight).assertEqual("25.00fp"); + console.info("[testpluginComponentRequest0007] lineHeight value :" + obj.$attrs.lineHeight); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0009 + * @tc.name testpluginComponentRequest0009 + * @tc.desic acepluginComponentRequestEtsTest0009 + */ + it('testpluginComponentRequest0009', 0, async function (done) { + console.info('pluginComponentRequest testpluginComponentRequest009 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('requestText'); + console.info("[testpluginComponentRequest0009] component padding strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.padding).assertEqual("10.00vp"); + console.info("[testpluginComponentRequest0009] padding value :" + obj.$attrs.padding); + done(); + }); + + /* + * @tc.number SUB_ACE_BASIC_ETS_API_0010 + * @tc.name testpluginComponentRequest0010 + * @tc.desic acepluginComponentRequestEtsTest0010 + */ + it('testpluginComponentRequest0010', 0, async function (done) { + console.info('pluginComponentRequest testpluginComponentRequest0010 START'); + await Utils.sleep(2000); + let strJson = getInspectorByKey('requestText'); + console.info("[testpluginComponentRequest0010] component textAlign strJson:" + strJson); + let obj = JSON.parse(strJson); + expect(obj.$type).assertEqual('Text'); + expect(obj.$attrs.textAlign).assertEqual("TextAlign.Left"); + console.info("[testpluginComponentRequest0010] textAlign value :" + obj.$attrs.textAlign); + done(); + }); + }) +} -- GitLab