diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/animationAdd.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/animationAdd.ets new file mode 100644 index 0000000000000000000000000000000000000000..83ecfb23517fc2db3ef884d015b8df38f093dfcb --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/animationAdd.ets @@ -0,0 +1,119 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +class Point { + x: number + y: number + + constructor(x: number, y: number) { + this.x = x + this.y = y + } + plus(rhs: Point): Point { + return new Point(this.x + rhs.x, this.y + rhs.y) + } + subtract(rhs: Point): Point { + return new Point(this.x - rhs.x, this.y - rhs.y) + } + multiply(scale: number): Point { + return new Point(this.x * scale, this.y * scale) + } + equals(rhs: Point): boolean { + return this.x === rhs.x && this.y === rhs.y + } +} + +class PointVector extends Array implements AnimatableArithmetic { + constructor(value: Array) { + super(); + value.forEach(p => this.push(p)) + } + plus(rhs: PointVector): PointVector { + let result = new PointVector([]) + const len = Math.min(this.length, rhs.length) + for (let i = 0; i < len; i++) { + result.push(this[i].plus(rhs[i])) + } + return result + } + subtract(rhs: PointVector): PointVector { + let result = new PointVector([]) + const len = Math.min(this.length, rhs.length) + for (let i = 0; i < len; i++) { + result.push(this[i].subtract(rhs[i])) + } + return result + } + multiply(scale: number): PointVector { + let result = new PointVector([]) + for (let i = 0; i < this.length; i++) { + result.push(this[i].multiply(scale)) + } + return result + } + equals(rhs: PointVector): boolean { + if (this.length != rhs.length) { + return false + } + for (let i = 0; i < this.length; i++) { + if (!this[i].equals(rhs[i])) { + return false + } + } + return true + } + get():Array<[x: number, y: number]> { + let result = [] + this.forEach(p => result.push([p.x, p.y])) + return result + } +} + +@AnimatableExtend(Polyline) function animatablePoints(points: PointVector) { + .points(points.get()) +} + +@Entry +@Component +struct AnimatablePropertyExample { + @State points: PointVector = new PointVector([ + new Point(50, Math.random() * 200), + new Point(100, Math.random() * 200), + new Point(150, Math.random() * 200), + new Point(200, Math.random() * 200), + new Point(250, Math.random() * 200), + ]) + build() { + Column() { + Polyline() + .animatablePoints(this.points) + .animation({duration: 1000, curve: "ease"}) + .size({height:220, width:300}) + .fill(Color.Green) + .stroke(Color.Red) + .backgroundColor('#eeaacc') + Button("Play") + .onClick(() => { + this.points = new PointVector([ + new Point(50, Math.random() * 200), + new Point(100, Math.random() * 200), + new Point(150, Math.random() * 200), + new Point(200, Math.random() * 200), + new Point(250, Math.random() * 200), + ]) + }) + }.width("100%") + .padding(10) + } +} diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/fontAdd.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/fontAdd.ets new file mode 100644 index 0000000000000000000000000000000000000000..6f28eb34f08b32c5fdce3ebeac99aa92c75320c5 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/fontAdd.ets @@ -0,0 +1,65 @@ + +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import font from '@ohos.font'; + +@Entry +@Component +struct FontExample { + fontList: Array; + fontInfo: font.FontInfo; + @State value:string='' + @State value1:string='' + + aboutToAppear(){ + } + + build() { + Column() { + Text(this.value).key('fontList').key('fontlist') + Text(this.value1).key('fontName').key('fontName') + + Button("getSystemFontList") + .width('60%') + .height('6%') + .onClick(()=>{ + this.fontList = font.getSystemFontList() + this.value = this.fontList.toString() + }).margin({top:20}).key("getSystemFontList") + + Button("getgetFontByName") + .width('60%') + .height('6%') + .key("getgetFontByName") + .onClick(()=>{ + this.fontInfo = font.getFontByName('HarmonyOS Sans Italic') + if(this.fontInfo ! =null) { + this.value1 = this.fontInfo.fullName + console.log("getFontByName(): path = " + this.fontInfo.path) + console.log("getFontByName(): postScriptName = " + this.fontInfo.postScriptName) + console.log("getFontByName(): fullName = " + this.fontInfo.fullName) + console.log("getFontByName(): Family = " + this.fontInfo.family) + console.log("getFontByName(): Subfamily = " + this.fontInfo.subfamily) + console.log("getFontByName(): weight = " + this.fontInfo.weight) + console.log("getFontByName(): width = " + this.fontInfo.width) + console.log("getFontByName(): italic = " + this.fontInfo.italic) + console.log("getFontByName(): monoSpace = " + this.fontInfo.monoSpace) + console.log("getFontByName(): symbolic = " + this.fontInfo.symbolic) + } + + }).margin({top:20}) + }.width('100%').height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/grid_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/grid_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..bd6ea1ea572c73baa7fb3113a6da6d81f043a461 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/grid_add.ets @@ -0,0 +1,85 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct GridExampleAdd { + @State Number: String[] = ['0', '1', '2', '3', '4'] + scroller: Scroller = new Scroller() + + build() { + Column({ space: 5 }) { + Grid() { + ForEach(this.Number, (day: string) => { + ForEach(this.Number, (day: string) => { + GridItem() { + Text(day) + .fontSize(16) + .backgroundColor(0xF9CF93) + .width('100%') + .height('100%') + .textAlign(TextAlign.Center) + } + }, day => day) + }, day => day) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr') + .rowsTemplate('1fr 1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .width('90%') + .backgroundColor(0xFAEEE0) + .height(300) + + Text('scroll').fontColor(0xCCCCCC).fontSize(9).width('90%') + Grid(this.scroller) { + ForEach(this.Number, (day: string,index:number) => { + ForEach(this.Number, (day: string,index:number) => { + GridItem() { + Text(day) + .fontSize(16) + .backgroundColor(0xF9CF93) + .width('100%') + .height(80) + .key(''+(index+1)*(index+1)) + .textAlign(TextAlign.Center) + } + }, day => day) + }) + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr') + .columnsGap(10) + .rowsGap(10) + .enableScrollInteraction(true) + .nestedScroll({ + scrollForward:NestedScrollMode.PARENT_FIRST, + scrollBackward:NestedScrollMode.SELF_FIRST + }) + .edgeEffect(EdgeEffect.Spring) + .onScrollIndex((first: number) => { + console.info(first.toString()) + }) + .onScrollBarUpdate((index: number, offset: number) => { + return {totalOffset: (index / 5) * (80 + 10) - 10 - offset, totalLength: 80 * 5 + 10 * 4} + }) + .width('90%') + .backgroundColor(0xFAEEE0) + .height(300) + Button('next page') + .onClick(() => { // 点击后滑到下一页 + this.scroller.scrollPage({ next: true }) + }).key('nexpageAdd') + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/listItemAddgroup.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/listItemAddgroup.ets new file mode 100644 index 0000000000000000000000000000000000000000..2d621625679499f3cf8f126ebfa5c9ded60a25af --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/listItemAddgroup.ets @@ -0,0 +1,61 @@ +@Entry +@Component +struct ListItemGroupExample { + private timetable: any = [ + { + title:'星期一', + projects:['语文', '数学', '英语'] + }, + { + title:'星期二', + projects:['物理', '化学', '生物'] + }, + { + title:'星期三', + projects:['历史', '地理', '政治'] + }, + { + title:'星期四', + projects:['美术', '音乐', '体育'] + } + ] + + @Builder itemHead(text:string) { + Text(text) + .fontSize(20) + .backgroundColor(0xAABBCC) + .width("100%") + .padding(10) + } + + @Builder itemFoot(num:number) { + Text('共' + num + "节课") + .fontSize(16) + .backgroundColor(0xAABBCC) + .width("100%") + .padding(5) + } + + build() { + Column() { + List({ space: 20 }) { + ForEach(this.timetable, (item) => { + ListItemGroup({ header:this.itemHead(item.title), footer:this.itemFoot(item.projects.length) ,style:ListItemGroupStyle.CARD}) { + ForEach(item.projects, (project) => { + ListItem() { + Text(project) + .width("100%").height(100).fontSize(20) + .textAlign(TextAlign.Center).backgroundColor(0xFFFFFF) + } + }, item => item) + } + .divider({ strokeWidth: 1, color: Color.Blue }) // 每行之间的分界线 + }) + } + .width('90%') + .sticky(StickyStyle.Header|StickyStyle.Footer) + .scrollBar(BarState.Off) + .key('listattrs') + }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/list_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/list_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..2dd2d8f005caee5f8a0d27be8215cc5de9015d31 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/list_add.ets @@ -0,0 +1,58 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct ListExampleAdd { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Column() { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem({style:ListItemStyle.CARD}) { + Text('' + item) + .width('100%').height(100).fontSize(16) + .key(''+item) + .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) + } + }, item => item) + } + .listDirection(Axis.Vertical) // 排列方向 + .scrollBar(BarState.Off) + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) // 每行之间的分界线 + .edgeEffect(EdgeEffect.Spring) // 边缘效果设置为Spring + .onScrollIndex((firstIndex: number, lastIndex: number, centerIndex: number) => { + console.info('first' + firstIndex) + console.info('last' + lastIndex) + console.info('center' + centerIndex) + }) + .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM]) + .enableScrollInteraction(true) + .key('listadd') + .nestedScroll({ + scrollForward:NestedScrollMode.PARENT_FIRST, + scrollBackward:NestedScrollMode.SELF_FIRST + }) + .onScroll((scrollOffset: number, scrollState: ScrollState) => { + console.info(`onScroll scrollState = ${ScrollState[scrollState]}, scrollOffset = ${[scrollOffset]}`) + }) + .width('90%') + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5 }) + } +} diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/loadingprogrees_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/loadingprogrees_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..b66e693ab12341c145450decd6b2d7e0900b419d --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/loadingprogrees_add.ets @@ -0,0 +1,28 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct LoadingProgressExampleAdd { + build() { + Column({ space: 5 }) { + Text('Orbital LoadingProgress ').fontSize(9).fontColor(0xCCCCCC).width('90%') + LoadingProgress().key('loadingAdd') + .color(Color.Blue) + .enableLoading(false) + .borderRadius(4) + }.width('100%').margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/messureSize.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/messureSize.ets new file mode 100644 index 0000000000000000000000000000000000000000..2630f0054b0d7f11789d0d72eb362da1bc4a0ed7 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/messureSize.ets @@ -0,0 +1,35 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import measure from '@ohos.measure' +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + textSize : SizeOptions = measure.measureTextSize({ + textContent: "Hello word", + fontSize: '50px', + constraintWidth:'0vp' + }) + build() { + Row() { + Column() { + Text("" + this.textSize.width).key('width11') + Text("" + this.textSize.height).key('height11') + } + .width('100%') + } + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navidesnation_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navidesnation_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..dc6cce9b84f4cea79be7ce78b616d36245776134 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navidesnation_add.ets @@ -0,0 +1,42 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct NavRouterExample { + private arr: number[] = [0, 1, 2, 3] + @State isActive: boolean = false + @State dex: number = 0 + @State value:boolean = false; + build() { + Column() { + NavDestination() { + Text(`我是NavDestination1页内容`).fontSize(50) + Flex({ direction: FlexDirection.Row }) { + Row() { + Image($r('app.media.icon')).width(40).height(40).borderRadius(40).margin({ right: 15 }) + Text('今天共有七节课').fontSize(30) + }.padding({ left: 15 }) + } + }.backgroundColor('#ccc') + .title(`NavDestination1`).onShown(()=>{ + + }).onHidden(()=>{ + + }).onBackPressed(()=> { + return this.value + }) + }.height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navigation_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navigation_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..bb02cb6f8d6017a9b1258b8b02b608afbd7710ca --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navigation_add.ets @@ -0,0 +1,166 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import promptA from '@ohos.promptAction'; +@Entry +@Component +struct NavigationExample2 { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + @State currentIndex: number = 0 + navPathStack = new NavPathStack(); + private value:unknown = [1,24,5,6] + @State Build: Array = [ + { + text: 'add', + num: 0 + }, + { + text: 'app', + num: 1 + }, + { + text: 'collect', + num: 2 + } + ] + + + @Builder NavigationTitle() { + Column() { + Text('Title') + .fontColor('#182431') + .fontSize(30) + .lineHeight(41) + .fontWeight(700) + Text('subtitle') + .fontColor('#182431') + .fontSize(14) + .lineHeight(19) + .opacity(0.4) + .margin({ top: 2, bottom: 20 }) + }.alignItems(HorizontalAlign.Start) + } + + @Builder NavigationMenus() { + Row() { + Text("1") + .width(24) + .height(24) + Text("2") + .width(24) + .height(24) + .margin({ left: 24 }) + } + } + + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Navigation(this.navPathStack) { + TextInput({ placeholder: 'search...' }) + .width('90%') + .height(40) + .enableKeyboardOnFocus(false) + .backgroundColor('#FFFFFF') + .margin({ top: 8 }) + List({ space: 12, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('90%') + .height(72) + .backgroundColor('#FFFFFF') + .borderRadius(24) + .fontSize(16) + .fontWeight(500) + .textAlign(TextAlign.Center) + }.editable(true) + }, item => item) + } + .height(324) + .width('100%') + .margin({ top: 12, left: '10%' }) + } + .title(this.NavigationTitle) + .menus(this.NavigationMenus) + .titleMode(NavigationTitleMode.Full) + .hideTitleBar(false) + .key('navigationAdd') + .hideToolBar(false) + .navDestination((name,parm)=> { + this.navPathStack.pushName(name,parm) + promptA.showToast({message:name}) + + }) + .onTitleModeChange((titleModel: NavigationTitleMode) => { + console.info('titleMode' + titleModel) + }) + + Button('pushName') + .height('5%') + .onClick(() => { // 点击后下滑指定距离150.0vp + this.navPathStack.pushName('navidesnation_add',this.value) + }) + .margin({ top: 10, left: 20 }) + Button('popTo') + .height('5%') + .onClick(() => { + this.navPathStack.popTo('navidesnation_add') + }) + .margin({ top: 60, left: 20 }) + Button('popToIndex') + .height('5%') + .onClick(() => { // 点击后滑动到指定位置,即下滑100.0vp的距离,滑动过程配置有动画 + this.navPathStack.popToIndex(0); + }) + .margin({ top: 110, left: 20 }) + Button('movetoTop') + .height('5%') + .onClick(() => { // 点击后回到顶部 + this.navPathStack.moveToTop("navidesnation_add") + }) + .margin({ top: 150, left: 20 }) + Button('moveIndexToTop') + .height('5%') + .onClick(() => { // 点击后滑到下一页 + this.navPathStack.moveIndexToTop(0) + }).margin({ top: 200, left: 20 }) + Button('getAllPathName') + .height('5%') + .onClick(() => { // 点击后滑到下一页 + this.navPathStack.getAllPathName() + }).margin({ top: 250, left: 20 }) + Button('getParamByIndex') + .height('5%') + .onClick(() => { // 点击后滑到下一页 + this.navPathStack.getParamByIndex(0) + }).margin({ top: 300, left: 20 }) + Button('getParamByName') + .height('5%') + .onClick(() => { // 点击后滑到下一页 + this.navPathStack.getParamByName("navidesnation_add") + }).margin({ top: 350, left: 20 }) + + Button('getIndexbyName') + .height('5%') + .onClick(() => { // 点击后滑到下一页 + this.navPathStack.getIndexByName("navidesnation_add") + }).margin({ top: 400, left: 20 }) + + + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + + + } +} diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navrouteradd.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navrouteradd.ets new file mode 100644 index 0000000000000000000000000000000000000000..129f169f6c382994d9d32b3ea250c3b85978bac8 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/navrouteradd.ets @@ -0,0 +1,69 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct NavRouterExample { + private arr: number[] = [0, 1, 2, 3] + @State isActive: boolean = false + @State dex: number = 0 + + build() { + Column() { + Navigation() { + List({ space: 12, initialIndex: 0 }) { + ForEach(this.arr, (item: number, index: number) => { + ListItem() { + NavRouter({name:"",param:""}) { + Row() { + Image($r('app.media.icon')).width(30).height(30).borderRadius(30).margin({ left: 3, right: 10 }) + Text(`NavRouter${item + 1}`) + .fontSize(22) + .fontWeight(500) + .textAlign(TextAlign.Center) + } + .width(180) + .height(72) + .backgroundColor(this.dex === index ? '#ccc' : '#fff') + .borderRadius(24) + + NavDestination() { + Text(`我是NavDestination第${item + 1}页内容`).fontSize(50) + Flex({ direction: FlexDirection.Row }) { + Row() { + Image($r('app.media.icon')).width(40).height(40).borderRadius(40).margin({ right: 15 }) + Text('今天共有七节课').fontSize(30) + }.padding({ left: 15 }) + } + }.backgroundColor('#ccc') + .title(`NavDestination${item + 1}`) + }.onStateChange((isActivated: boolean) => { + this.dex = index + console.info("the mode is " + NavRouteMode.PUSH_WITH_RECREATE); + console.info("the mode is " + NavRouteMode.REPLACE); + }).mode(NavRouteMode.PUSH) + } + }, item => item) + } + .height('100%') + .margin({ top: 12, left: 12 }) + } + .mode(NavigationMode.Split) + .hideTitleBar(true) + .key('addOne') + .hideToolBar(true) + }.height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/postCardAction.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/postCardAction.ets new file mode 100644 index 0000000000000000000000000000000000000000..e72d94f0157119e38613ab8ce4cbe98bfc9adf60 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/postCardAction.ets @@ -0,0 +1,41 @@ + +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +let storage = new LocalStorage(); +@Entry(storage) +@Component +struct WidgetCard { + @LocalStorageProp('detail') detail: string = 'init'; + + build() { + Column() { + Button('跳转') + .margin('20%') + .onClick(() => { + console.info('postCardAction to EntryAbility'); + postCardAction(this, { + 'action': 'router', + 'abilityName': 'EntryAbility', // 只能跳转到当前应用下的UIAbility + 'params': { + 'detail': 'RouterFromCard' + } + }); + }) + Text(`${this.detail}`).margin('20%') + } + .width('100%') + .height('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/scroll_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/scroll_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..92b8559e4fbd7562f2980545e75c303451ac224e --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/scroll_add.ets @@ -0,0 +1,112 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Curves from '@ohos.curves' + +@Entry +@Component +struct ScrollExample { + scroller: Scroller = new Scroller() + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + ForEach(this.arr, (item) => { + Text(item.toString()) + .width('90%') + .height(150) + .backgroundColor(0xFFFFFF) + .borderRadius(15) + .fontSize(16) + .key(item.toString()) + .textAlign(TextAlign.Center) + .margin({ top: 10 }) + }, item => item) + }.width('100%') + } + .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 + .scrollBar(BarState.On) // 滚动条常驻显示 + .scrollBarColor(Color.Gray) // 滚动条颜色 + .scrollBarWidth(10) // 滚动条宽度 + .edgeEffect(EdgeEffect.None) + .enableScrollInteraction(true) + .key('scrollAdd') + .scrollSnap({snapAlign:ScrollSnapAlign.START}) + .nestedScroll({ + scrollForward:NestedScrollMode.PARENT_FIRST, + scrollBackward:NestedScrollMode.SELF_FIRST + }) + .onScroll((xOffset: number, yOffset: number) => { + console.info(xOffset + ' ' + yOffset) + }) + .onScrollEdge((side: Edge) => { + console.info('To the edge') + }) + .onScrollEnd(() => { + console.info('Scroll Stop') + }) + + Button('scroll 150') + .height('5%') + .onClick(() => { // 点击后下滑指定距离150.0vp + this.scroller.scrollBy(0, 150) + }) + .margin({ top: 10, left: 20 }) + Button('scroll 100') + .height('5%') + .onClick(() => { // 点击后滑动到指定位置,即下滑100.0vp的距离 + this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100 }) + }) + .margin({ top: 60, left: 20 }) + Button('scroll 100') + .height('5%') + .onClick(() => { // 点击后滑动到指定位置,即下滑100.0vp的距离,滑动过程配置有动画 + let curve = Curves.interpolatingSpring(100, 1, 228, 30) //创建一个阶梯曲线 + this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100, animation: { duration: 1000, curve: curve }}) + }) + .margin({ top: 110, left: 20 }) + Button('back top') + .height('5%') + .onClick(() => { // 点击后回到顶部 + this.scroller.scrollEdge(Edge.Top) + + }) + .margin({ top: 160, left: 20 }) + Button('next page') + .height('5%') + .onClick(() => { // 点击后滑到下一页 + this.scroller.scrollPage({ next: true }) + }) + .margin({ top: 210, left: 20 }) + + + Button('back top') + .height('5%') + .onClick(() => { // 点击后回到顶部 + this.scroller.scrollEdge(Edge.Top) + + }) + .margin({ top: 160, left: 20 }) + Button('isScrollEnd') + .height('5%') + .key('isScrollEnd') + .onClick(() => { // 点击后滑到下一页 + this.scroller.isAtEnd(); + }) + .margin({ top: 210, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/scroll_addattrs.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/scroll_addattrs.ets new file mode 100644 index 0000000000000000000000000000000000000000..6d5b0c858c74eff38b971b14fee0a1ee8d03dcc1 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/scroll_addattrs.ets @@ -0,0 +1,112 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import Curves from '@ohos.curves' + +@Entry +@Component +struct ScrollExample { + scroller: Scroller = new Scroller() + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + + build() { + Stack({ alignContent: Alignment.TopStart }) { + Scroll(this.scroller) { + Column() { + ForEach(this.arr, (item) => { + Text(item.toString()) + .width('90%') + .height(150) + .backgroundColor(0xFFFFFF) + .borderRadius(15) + .fontSize(16) + .key(item.toString()) + .textAlign(TextAlign.Center) + .margin({ top: 10 }) + }, item => item) + }.width('100%') + } + .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 + .scrollBar(BarState.On) // 滚动条常驻显示 + .scrollBarColor(Color.Gray) // 滚动条颜色 + .scrollBarWidth(10) // 滚动条宽度 + .edgeEffect(EdgeEffect.None) + .enableScrollInteraction(true) + .key('scrollAdd') + .scrollSnap({snapAlign:ScrollSnapAlign.START,snapPagination:null,enableSnapToStart:false,enableSnapToEnd:false}) + .nestedScroll({ + scrollForward:NestedScrollMode.SELF_ONLY, + scrollBackward:NestedScrollMode.PARALLEL + }) + .onScroll((xOffset: number, yOffset: number) => { + console.info(xOffset + ' ' + yOffset) + }) + .onScrollEdge((side: Edge) => { + console.info('To the edge') + }) + .onScrollEnd(() => { + console.info('Scroll Stop') + }) + + Button('scroll 150') + .height('5%') + .onClick(() => { // 点击后下滑指定距离150.0vp + this.scroller.scrollBy(0, 150) + }) + .margin({ top: 10, left: 20 }) + Button('scroll 100') + .height('5%') + .onClick(() => { // 点击后滑动到指定位置,即下滑100.0vp的距离 + this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100 }) + }) + .margin({ top: 60, left: 20 }) + Button('scroll 100') + .height('5%') + .onClick(() => { // 点击后滑动到指定位置,即下滑100.0vp的距离,滑动过程配置有动画 + let curve = Curves.interpolatingSpring(100, 1, 228, 30) //创建一个阶梯曲线 + this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100, animation: { duration: 1000, curve: curve }}) + }) + .margin({ top: 110, left: 20 }) + Button('back top') + .height('5%') + .onClick(() => { // 点击后回到顶部 + this.scroller.scrollEdge(Edge.Top) + + }) + .margin({ top: 160, left: 20 }) + Button('next page') + .height('5%') + .onClick(() => { // 点击后滑到下一页 + this.scroller.scrollPage({ next: true }) + }) + .margin({ top: 210, left: 20 }) + + + Button('back top') + .height('5%') + .onClick(() => { // 点击后回到顶部 + this.scroller.scrollEdge(Edge.Top) + + }) + .margin({ top: 160, left: 20 }) + Button('isScrollEnd') + .height('5%') + .key('isScrollEnd') + .onClick(() => { // 点击后滑到下一页 + this.scroller.isAtEnd(); + }) + .margin({ top: 210, left: 20 }) + }.width('100%').height('100%').backgroundColor(0xDCDCDC) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/search_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/search_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..ae50a494999a4dfc6d279184401c9e949c0499c4 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/search_add.ets @@ -0,0 +1,68 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct SearchExample { + @State changeValue: string = '' + @State submitValue: string = '' + controller: SearchController = new SearchController() + @State isHidden:boolean = false + @State value1: string = '' + @State value2: string = '' + build() { + Column() { + Text('onSubmit:' + this.submitValue).fontSize(18).margin(15) + Text('onChange:' + this.changeValue).fontSize(18).margin(15) + Text('value1:' + this.value1).fontSize(18).margin(15) + Text('value2:' + this.value2).fontSize(18).margin(15) + Search({ value: this.changeValue, placeholder: 'Type to search...', controller: this.controller }) + .searchButton('SEARCH') + .width('95%') + .height(40) + .key('searchAdd') + .backgroundColor('#F5F5F5') + .placeholderColor(Color.Grey) + .enableKeyboardOnFocus(true) + .selectionMenuHidden(this.isHidden) + .placeholderFont({ size: 14, weight: 400 }) + .onContentScroll((totalOffsetX: number, totalOffsetY: number) =>{ + }) + .onTextSelectionChange((selectionStart: number, selectionEnd: number)=>{ + this.value1 = selectionStart + ""; + this.value2 = selectionEnd + ""; + this.controller.getTextContentLineCount(); + }) + .textFont({ size: 14, weight: 400 }) + .onSubmit((value: string) => { + this.submitValue = value + }) + .onChange((value: string) => { + this.changeValue = value + }) + .margin(20) + Button('Set caretPosition 1') + .onClick(() => { + // 设置光标位置到输入的第一个字符后 + this.controller.caretPosition(1) + }) + + Button('stopEditing') + .onClick(() => { + this.controller.stopEditing(); + }).margin({top:20}) + }.width('100%') + } +} diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/swipe_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/swipe_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..55461e70f63fc5712dba631d9cbc409905e97b70 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/swipe_add.ets @@ -0,0 +1,113 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +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() { + } +} + +@Entry +@Component +struct SwiperExample { + private swiperController: SwiperController = new SwiperController() + private data: MyDataSource = new MyDataSource([]) + @State stringValue : string = "hello" + aboutToAppear(): void { + let list = [] + for (var i = 1; i <= 10; i++) { + list.push(i.toString()); + } + this.data = new MyDataSource(list) + } + + build() { + Column({ space: 5 }) { + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Text(item).width('90%').height(160).backgroundColor(0xAFEEEE).textAlign(TextAlign.Center).fontSize(30) + }, item => item) + } + .cachedCount(2) + .index(1) + .autoPlay(false) + .interval(4000) + .indicator(true) + .loop(false) + .duration(1000) + .itemSpace(0) + .displayArrow({ + isShowBackground:true, + isSidebarMiddle:true, + backgroundSize:24, + backgroundColor:Color.White, + arrowSize:18, + arrowColor:Color.Blue},false) + .curve(Curve.Linear) + .onChange((index: number) => { + console.info(index.toString()) + }) + .onGestureSwipe((index: number, extraInfo: SwiperAnimationEvent) => { + this.stringValue = 'swiper' + console.info("index: " + index) + console.info("current offset: " + extraInfo.currentOffset) + }) + .onAnimationStart((index: number, targetIndex: number, extraInfo: SwiperAnimationEvent) => { + console.info("index: " + index) + console.info("targetIndex: " + targetIndex) + console.info("current offset: " + extraInfo.currentOffset) + console.info("target offset: " + extraInfo.targetOffset) + console.info("velocity: " + extraInfo.velocity) + console.info("mode: " + SwiperDisplayMode.STRETCH) + console.info("mode: " + SwiperDisplayMode.AUTO_LINEAR) + }) + .onAnimationEnd((index: number, extraInfo: SwiperAnimationEvent) => { + console.info("index: " + index) + console.info("current offset: " + extraInfo.currentOffset) + }).key('swiperAdd') + + Row({ space: 12 }) { + Button('showNext') + .onClick(() => { + this.swiperController.showNext() + }) + Button('showPrevious') + .onClick(() => { + this.swiperController.showPrevious() + }) + }.margin(5) + + Text(this.stringValue).key('swiperValue') + }.width('100%') + .margin({ top: 5 }) + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textArea_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textArea_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..ffb2805a594cb87431f65811bae6c96a3bf6da80 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textArea_add.ets @@ -0,0 +1,78 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct TextAreaExample { + @State text: string = '' + controller: TextAreaController = new TextAreaController() + @State value1: string = '' + @State value2: string = '' + build() { + Column() { + Text('value1:' + this.value1).fontSize(18).margin(15) + Text('value2:' + this.value2).fontSize(18).margin(15) + TextArea({ + text: this.text, + placeholder: 'The text area can hold an unlimited amount of text. input your word...', + controller: this.controller + }) + .placeholderFont({ size: 16, weight: 400 }) + .width(336) + .height(56) + .enableKeyboardOnFocus(true) + .selectionMenuHidden(false) + .margin(20) + .barState(BarState.On) + .style(TextContentStyle.INLINE) + .key('textAreaAdd') + .fontSize(16) + .onTextSelectionChange((selectionStart: number, selectionEnd: number)=>{ + this.value1 = selectionStart + ""; + this.value2 = selectionEnd + ""; + this.controller.getTextContentLineCount(); + }) + .onContentScroll((totalOffsetX: number, totalOffsetY: number) =>{ + }) + .fontColor('#182431') + .backgroundColor('#FFFFFF') + .onChange((value: string) => { + this.text = value + }) + Text(this.text) + Button('Set caretPosition 1') + .backgroundColor('#007DFF') + .margin(15) + .onClick(() => { + // 设置光标位置到第一个字符后 + this.controller.caretPosition(1) + }) + + Button('stopEditing') + .onClick(() => { + this.controller.stopEditing(); + }).margin({top:20}) + + Button('getTextContentRect') + .onClick(() => { + this.controller.getTextContentRect(); + }).margin({top:20}) + Button('stopEditing') + .onClick(() => { + this.controller.getTextContentLineCount(); + }).margin({top:20}) + + }.width('100%').height('100%').backgroundColor('#F1F3F5') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textinput_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textinput_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..fae7bf7bbbb4e03da1020c1c8b4888f874dab18d --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/textinput_add.ets @@ -0,0 +1,81 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct TextInputExample { + @State text: string = '' + controller: TextInputController = new TextInputController() + @State isHidden:boolean = false + @State value1: string = '' + @State value2: string = '' + build() { + Column() { + Text('value1:' + this.value1).fontSize(18).margin(15) + Text('value2:' + this.value2).fontSize(18).margin(15) + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width(400) + .height(40) + .margin(20) + .barState(BarState.On) + .key('textInputAdd') + .fontSize(14) + .onContentScroll((totalOffsetX: number, totalOffsetY: number) =>{ + }) + .onTextSelectionChange((selectionStart: number, selectionEnd: number)=>{ + this.value1 = selectionStart + ""; + this.value2 = selectionEnd + ""; + this.controller.getTextContentLineCount(); + }) + .fontColor(Color.Black) + .enableKeyboardOnFocus(true) + .selectionMenuHidden(this.isHidden) + .inputFilter('[a-z]', (e) => { + console.log(JSON.stringify(e)) + }) + .onChange((value: string) => { + this.text = value + }) + Text(this.text) + Button('Set caretPosition 1') + .margin(15) + .onClick(() => { + // 将光标移动至第一个字符后 + this.controller.caretPosition(1) + }) + Button('stopEditing') + .onClick(() => { + this.controller.stopEditing(); + }).margin({top:20}) + // 密码输入框 + TextInput({ placeholder: 'input your password...' }) + .width(400) + .height(40) + .margin(20) + .type(InputType.Password) + .maxLength(9) + .showPasswordIcon(true) + // 内联风格输入框 + TextInput({ placeholder: 'inline style' }) + .width(400) + .height(50) + .margin(20) + .borderRadius(0) + .style(TextInputStyle.Inline) + }.width('100%') + } +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/waterflow_add.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/waterflow_add.ets new file mode 100644 index 0000000000000000000000000000000000000000..f65c885ca08355cb3755227716fc8bbae19f0cb8 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/MainAbility/pages/waterflow_add.ets @@ -0,0 +1,86 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +@Entry +@Component +struct WaterflowDemo { + @State minSize: number = 50 + @State maxSize: number = 100 + @State fontSize: number = 24 + @State colors: number[] = [0xFFC0CB, 0xDA70D6, 0x6B8E23, 0x6A5ACD, 0x00FFFF, 0x00FF7F] + scroller: Scroller = new Scroller() + @State datsSource:number[] = [12,1,0,2,3,4,5,6,7,8,9,12,1,0,2,3,4,5,6,7,8,9] + + aboutToAppear() { + + } + + @Builder itemFoot() { + Column() { + Text(`Footer`) + .fontSize(10) + .backgroundColor(Color.Red) + .width(50) + .height(50) + .align(Alignment.Center) + .margin({ top: 2 }) + } + } + + build() { + Column({ space: 2 }) { + WaterFlow({ footer: this.itemFoot.bind(this), scroller: this.scroller }) { + ForEach(this.datsSource, (item: number) => { + FlowItem() { + Column() { + Text("N" + item).fontSize(12).height('16') + Image('res/waterFlowTest(' + item % 5 + ').jpg') + .objectFit(ImageFit.Fill) + .width('100%') + .layoutWeight(1) + } + } + .width('100%') + .height(20) + .backgroundColor(this.colors[item % 5]) + }, item => item) + } + .columnsTemplate("1fr 1fr 1fr 1fr") + .key('waterflowAdd') + .itemConstraintSize({ + minWidth: 0, + maxWidth: '100%', + minHeight: 0, + maxHeight: '100%' + }) + .columnsGap(10) + .rowsGap(5) + .onReachStart(() => { + console.info("onReachStart") + }) + .onReachEnd(() => { + console.info("onReachEnd") + }) + .enableScrollInteraction(true) + .nestedScroll({ + scrollForward:NestedScrollMode.PARENT_FIRST, + scrollBackward:NestedScrollMode.SELF_FIRST + }) + .backgroundColor(0xFAEEE0) + .width('100%') + .height('80%') + .layoutDirection(FlexDirection.Column) + } + } +} diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/TestAbility/TestAbility.ts b/arkui/ace_ets_component_ui/entry/src/main/ets/TestAbility/TestAbility.ts index 8028a70f8af44690b95a08bd177bca6b09f24687..7ee55f35a3d318a65ed4ea515bd907c401d73815 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/TestAbility/TestAbility.ts +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/TestAbility/TestAbility.ts @@ -34,6 +34,16 @@ export default class TestAbility extends Ability { }); globalThis.abilityContext = this.context; + let windowClass = null; + windowStage.getMainWindow((err, data) => { + if (err.code) { + console.error('Failed to obtain the main window. Cause: ' + JSON.stringify(err)); + return; + } + windowClass = data; + globalThis.uiContext = windowClass.getUIContext(); + }); + } onWindowStageDestroy() { diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..ed7d2b9edb67af247eda90dff7d534ed512a9502 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/ApiCommponentAddJsunit.test.ets @@ -0,0 +1,453 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" +import ohosrouter from '@ohos.router'; +import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.UiTest'; +import CommonFunc from '../MainAbility/utils/Common'; +import {MessageManager,Callback} from '../MainAbility/utils/MessageManager'; +const waitUiReadyMs = 1000; + +export default function ApiCommponentAddJsunit() { + describe('ApiCommponentAddJsunit', function () { + beforeAll(async function (done) { + console.info("ApiCommponentAddJsunit beforeEach start"); + try { + ohosrouter.clear(); + let pages = ohosrouter.getState(); + console.info("ApiCommponentAddJsunit " + JSON.stringify(pages)); + if (!("loadingprogrees_add" == pages.name)) { + console.info("ApiCommponentAddJsunit state success " + JSON.stringify(pages.name)); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/loadingprogrees_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }) + .catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(2000); + console.info("push circle page success "); + } + } catch (err) { + console.error("push circle page error: " + err); + } + done() + + }); + + it('apiCommponentAddJsunit_0100', 0, async function (done) { + console.info('apiCommponentAddJsunit_0100 START'); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/loadingprogrees_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }) + .catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let strJson = getInspectorByKey('loadingAdd'); + let obj = JSON.parse(strJson); + console.info("[apiCommponentAddJsunit_0100'] component obj is: " + obj.$attrs.borderRadius); + expect(obj.$attrs.borderRadius).assertEqual('4.00vp'); + done(); + }); + + it('apiCommponentAddJsunit_0200', 0, async function (done) { + console.info('apiCommponentAddJsunit_0200 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/list_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let gridTop = CommonFunc.getComponentRect('listadd'); + let top = gridTop.top; + let gridBottom = CommonFunc.getComponentRect('listadd'); + let bottom = gridBottom.bottom; + let gridRight = CommonFunc.getComponentRect('listadd'); + let right = gridRight.right; + let driver = await Driver.create(); + await driver.swipe(Math.round(top + 50), Math.round(right - 50), Math.round(bottom - 50), Math.round(right - 50)); + await CommonFunc.sleep(1000); + // judge whether the top + let onScrollStartText = await driver.findComponent(ON.id('4')); + let textAdd = await onScrollStartText.getText(); + console.info("[apiCommponentAddJsunit_0200] onScrollStartText: " + textAdd); + expect(textAdd).assertEqual('4'); + done(); + }); + + it('apiCommponentAddJsunit_0300', 0, async function (done) { + console.info('apiCommponentAddJsunit_0300 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/grid_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let driver = Driver.create(); + let btn = await driver.findComponent(ON.id('nexpageAdd')); + await btn.click(); + await CommonFunc.sleep(100); + // wether if swipe + let gridText = await driver.findComponent(ON.id('25')); + let text = await gridText.getText(); + console.info("apiCommponentAddJsunit_0300] onScrollText: " + text); + expect(text).assertEqual('4'); + done(); + }); + + it('apiCommponentAddJsunit_0400', 0, async function (done) { + console.info('apiCommponentAddJsunit_0400 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/scroll_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let driver = Driver.create(); + let scrollBar = await driver.findComponent(ON.type('Scroll')); + await scrollBar.scrollToBottom(); + await CommonFunc.sleep(100); + // wether if swipe + let gridText = await driver.findComponent(ON.id('9')); + let text = await gridText.getText(); + console.info("[apiCommponentAddJsunit_0500] onScrollText: " + text); + expect(text).assertEqual('9'); + done(); + }); + + it('apiCommponentAddJsunit_0500', 0, async function (done) { + console.info('apiCommponentAddJsunit_0500 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/search_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let driver = Driver.create(); + let searchclick = await driver.findComponent(ON.id('searchAdd')); + await searchclick.click(); + searchclick.longClick(); + await CommonFunc.sleep(4000); + let textComponent3 = await driver.findComponent(ON.text('黏贴')); + await CommonFunc.sleep(500); + // wether if + let text = await textComponent3.getText(); + console.info("[apiCommponentAddJsunit_0500] onScrollText: " + text); + expect(text).assertEqual('黏贴'); + done(); + }); + + it('apiCommponentAddJsunit_0600', 0, async function (done) { + console.info('apiCommponentAddJsunit_0600 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/swipe_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + // whether react + let strJson = getInspectorByKey('swiperValue'); + let obj = JSON.parse(strJson); + console.info("[apiCommponentAddJsunit_0600'] component obj is: " + obj.$attrs.content); + expect(obj.$attrs.content).assertEqual('hello'); + done(); + }); + + it('apiCommponentAddJsunit_0700', 0, async function (done) { + console.info('apiCommponentAddJsunit_0700 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/textArea_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let driver = Driver.create(); + let searchclick = await driver.findComponent(ON.id('textAreaAdd')); + await searchclick.click(); + searchclick.longClick(); + await CommonFunc.sleep(4000); + let textComponent3 = await driver.findComponent(ON.text('黏贴')); + await CommonFunc.sleep(100); + // wether if + let text = await textComponent3.getText(); + console.info("[apiCommponentAddJsunit_0700] onScrollText: " + text); + expect(text).assertEqual('黏贴'); + done(); + }); + + it('apiCommponentAddJsunit_0800', 0, async function (done) { + console.info('apiCommponentAddJsunit_0800 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/textinput_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let driver = Driver.create(); + let searchclick = await driver.findComponent(ON.id('textInputAdd')); + await searchclick.click(); + searchclick.longClick(); + await CommonFunc.sleep(4000); + let textComponent3 = await driver.findComponent(ON.text('黏贴')); + await CommonFunc.sleep(100); + // wether if + let text = await textComponent3.getText(); + console.info("[apiCommponentAddJsunit_0800] onScrollText: " + text); + expect(text).assertEqual('黏贴'); + done(); + }); + + it('apiCommponentAddJsunit_0900', 0, async function (done) { + console.info('apiCommponentAddJsunit_0900 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/waterflow_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + let strJson = getInspectorByKey('waterflowAdd'); + let obj = JSON.parse(strJson); + console.info("[apiCommponentAddJsunit_0900'] component obj is: " + obj.$attrs.enableScrollInteraction); + expect(obj.$attrs.enableScrollInteraction ).assertTrue(); + done(); + }); + + it('apiCommponentAddJsunit_1000', 0, async function (done) { + console.info('apiCommponentAddJsunit_1000 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/navigation_add', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + let strJson = getInspectorByKey('navigationAdd'); + let obj = JSON.parse(strJson); + console.info("[apiCommponentAddJsunit_1000'] component obj is: " + obj.$type); + expect(obj.$type).assertEqual('Navigation'); + done(); + }); + + it('apiCommponentAddJsunit_1100', 0, async function (done) { + console.info('apiCommponentAddJsunit_1100 START'); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/messureSize', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let strJson = getInspectorByKey('width11'); + let obj = JSON.parse(strJson); + console.info("[apiCommponentAddJsunit_1100'] component obj is: " + obj.$attrs.content); + expect(obj.$attrs.content).assertEqual('0'); + done(); + }); + + it('apiCommponentAddJsunit_1200', 0, async function (done) { + console.info('apiCommponentAddJsunit_1200 START'); + try { + expect(SafeAreaType.SYSTEM).assertEqual(0); + expect(SafeAreaType.CUTOUT).assertEqual(1); + expect(SafeAreaType.KEYBOARD).assertEqual(2); + } catch(err) { + console.error("apiCommponentAddJsunit_1200 error " + JSON.stringify(err)); + } + done(); + }); + + it('apiCommponentAddJsunit_1300', 0, async function (done) { + console.info("[apiCommponentAddJsunit_1300] START" ); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/scroll_addattrs', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let driver = Driver.create(); + let scrollBar = await driver.findComponent(ON.type('Scroll')); + await scrollBar.scrollToBottom(); + await CommonFunc.sleep(100); + // wether if swipe + let gridText = await driver.findComponent(ON.id('9')); + let text = await gridText.getText(); + console.info("[apiCommponentAddJsunit_1300] onScrollText: " + text); + expect(text).assertEqual('9'); + done(); + + }); + + it('apiCommponentAddJsunit_1400', 0, async function (done) { + console.info("[apiCommponentAddJsunit_1400] START" ); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/listItemAddgroup', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let strJson = getInspectorByKey('listattrs'); + let obj = JSON.parse(strJson); + console.info("[apiCommponentAddJsunit_1400'] component obj is: " + obj.$type); + expect(obj.$type).assertEqual('List'); + done(); + }); + + it('apiCommponentAddJsunit_1500', 0, async function (done) { + console.info("[apiCommponentAddJsunit_1500] START" ); + ohosrouter.clear(); + ohosrouter.pushUrl({ + url: 'MainAbility/pages/navrouteradd', + params: { + data1: 'message', + data2: { + data3: [123, 456, 789] + } + } + }).then(() => { + // success + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + await CommonFunc.sleep(1000); + let strJson = getInspectorByKey('addOne'); + let obj = JSON.parse(strJson); + console.info("[apiCommponentAddJsunit_1500'] component obj is: " + obj.$type); + expect(obj.$type).assertEqual('Navigation'); + done(); + }); + + }) + + +} \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets index 85d546a9e9824a6cdc284402b040d1f4fc9868f6..0721a9713a71855496bdd5cf301274750234dde7 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/List.test.ets @@ -56,6 +56,8 @@ import NavDestinationJsunit from './NavDestinationJsunit.test.ets'; import GridItemJsunit from './GridItemJsunit.test.ets'; import NavigationJsunit from './NavigationJsunit.test.ets'; import GridColOffsetJsunit from './GridColoffsetJsunit.test.ets'; +import ApiCommponentAddJsunit from './ApiCommponentAddJsunit.test.ets'; +import fontJsunit from './fontJsunit.test.ets'; export default function testsuite() { blankJsunit(); @@ -101,4 +103,6 @@ export default function testsuite() { GridItemJsunit(); NavigationJsunit(); GridColOffsetJsunit(); + fontJsunit(); + ApiCommponentAddJsunit(); } \ No newline at end of file diff --git a/arkui/ace_ets_component_ui/entry/src/main/ets/test/fontJsunit.test.ets b/arkui/ace_ets_component_ui/entry/src/main/ets/test/fontJsunit.test.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e029de238a1049a188608988d3ccaf85bc0de39 --- /dev/null +++ b/arkui/ace_ets_component_ui/entry/src/main/ets/test/fontJsunit.test.ets @@ -0,0 +1,100 @@ +/** + * Copyright (c) 2023 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from "@ohos/hypium" +import router from '@system.router'; +import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.UiTest'; +import CommonFunc from '../MainAbility/utils/Common'; +import {MessageManager,Callback} from '../MainAbility/utils/MessageManager'; + + +export default function fontJsunit() { + describe('fontJsunit', function () { + beforeEach(async function (done) { + console.info("GridColOffsetJsunit beforeEach start"); + let options = { + uri: 'MainAbility/pages/fontAdd', + } + try { + router.clear(); + let pages = router.getState(); + console.info("get GridColOffsetJsunit state pages: " + JSON.stringify(pages)); + if (!("fontAdd" == pages.name)) { + console.info("get GridColOffsetJsunit state pages.name: " + JSON.stringify(pages.name)); + let result = await router.push(options); + await CommonFunc.sleep(2000); + console.info("push GridColOffsetJsunit success: " + JSON.stringify(result)); + } + } catch (err) { + console.error("push GridColOffsetJsunit page error: " + err); + expect().assertFail(); + } + done(); + }); + + it('fontJsunit_0100', 0, async function (done) { + // Get the information of the font + console.info('fontJsunit_0100 START'); + let driver = Driver.create(); + let btn = await driver.findComponent(ON.id('getSystemFontList')); + await btn.click(); + await CommonFunc.sleep(100); + let strJson = getInspectorByKey('fontlist'); + let obj = JSON.parse(strJson); + console.info("[GridColOffsetJsunit_0100] component strJson:" + JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.content).assertEqual(""); + done(); + }); + + it('fontJsunit_0200', 0, async function (done) { + // Get the information of the font + console.info('fontJsunit_0200 START'); + let driver = Driver.create(); + let btn = await driver.findComponent(ON.id('getgetFontByName')); + await btn.click(); + await CommonFunc.sleep(100); + let strJson = getInspectorByKey('fontName'); + let obj = JSON.parse(strJson); + console.info("[GridColOffsetJsunit_0200] component strJson:" + JSON.stringify(obj.$attrs.content)); + expect(obj.$attrs.content).assertEqual(""); + done(); + }); + + it('fontJsunit_0300', 0, async function (done) { + // Get the information of the font + console.info('fontJsunit_0300 START'); + try { + let font = globalThis.uiContext.getFont().getSystemFontList() + expect(font !=null).assertTrue(); + } catch (err) { + console.error("fontJsunit_0300 error " + JSON.stringify(err)); + } + done(); + }); + + it('fontJsunit_0400', 0, async function (done) { + // Get the information of the font + console.info('fontJsunit_0400 START'); + try { + let font = globalThis.uiContext.getFont().getFontByName('HarmonyOS Sans Italic') + expect(font !=null).assertTrue(); + } catch (err) { + console.error("fontJsunit_0400 error " + JSON.stringify(err)); + } + done(); + }); + + + }) +} diff --git a/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json b/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json index a77ea7508f5955ba208a062993c17e0339536951..8929f93f4abddf6da0b343ae0bbb34d34582dcc8 100644 --- a/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json +++ b/arkui/ace_ets_component_ui/entry/src/main/resources/base/profile/main_pages.json @@ -46,6 +46,24 @@ "MainAbility/pages/NavDestinationPage", "MainAbility/pages/NavigationPage", "MainAbility/pages/GridItemPage", - "MainAbility/pages/GridColoffsetPage" + "MainAbility/pages/GridColoffsetPage", + "MainAbility/pages/loadingprogrees_add", + "MainAbility/pages/list_add", + "MainAbility/pages/grid_add", + "MainAbility/pages/scroll_add", + "MainAbility/pages/search_add", + "MainAbility/pages/swipe_add", + "MainAbility/pages/textArea_add", + "MainAbility/pages/textinput_add", + "MainAbility/pages/waterflow_add", + "MainAbility/pages/navigation_add", + "MainAbility/pages/messureSize", + "MainAbility/pages/fontAdd", + "MainAbility/pages/scroll_addattrs", + "MainAbility/pages/listItemAddgroup", + "MainAbility/pages/navrouteradd", + "MainAbility/pages/animationAdd", + "MainAbility/pages/postCardAction" + ] } \ No newline at end of file