提交 24e33313 编写于 作者: H huangdong57

xts-test

Signed-off-by: Nhuangdong57 <huangdong57@huawei.com>
上级 0e805406
/*
* 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 inspector from '@ohos.arkui.inspector';
@Entry
@Component
struct assemblyCallback {
@State message: string = 'Blank'
private scroller: Scroller = new Scroller()
build() {
Row() {
Text('Bluetooth').fontSize(18)
Blank()
Button()
Checkbox()
Toggle({ type: ToggleType.Switch })
Column() {
Text(this.message)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text('Bluetooth').fontSize(18)
Button().key("11")
Checkbox().key("12")
Image('').key("13")
Menu().key("14")
Radio({ value: 'Radio1', group: 'radioGroup' }).key("15")
ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }).key("16")
Toggle({ type: ToggleType.Switch })
}
.width('100%')
}
.height('100%')
}
listener11 = inspector.createComponentObserver('11')
listener12 = inspector.createComponentObserver('12')
listener13 = inspector.createComponentObserver('13')
listener14 = inspector.createComponentObserver('14')
listener15 = inspector.createComponentObserver('15')
listener16 = inspector.createComponentObserver('16')
aboutToAppear() {
let Func11layout = this.layout11.bind(this) // bind current js instance
let Func11draw = this.draw11.bind(this) // bind current js instance
this.listener11.on('layout', Func11layout)
this.listener11.on('draw', Func11draw)
let Func12layout = this.layout12.bind(this) // bind current js instance
let Func12draw = this.draw12.bind(this) // bind current js instance
this.listener12.on('layout', Func12layout)
this.listener12.on('draw', Func12draw)
let Func13layout = this.layout13.bind(this) // bind current js instance
let Func13draw = this.draw13.bind(this) // bind current js instance
this.listener13.on('layout', Func13layout)
this.listener13.on('draw', Func13draw)
let Func14layout = this.layout14.bind(this) // bind current js instance
let Func14draw = this.draw14.bind(this) // bind current js instance
this.listener14.on('layout', Func14layout)
this.listener14.on('draw', Func14draw)
let Func15layout = this.layout15.bind(this) // bind current js instance
let Func15draw = this.draw15.bind(this) // bind current js instance
this.listener15.on('layout', Func15layout)
this.listener15.on('draw', Func15draw)
let Func16layout = this.layout16.bind(this) // bind current js instance
let Func16draw = this.draw16.bind(this) // bind current js instance
this.listener16.on('layout', Func16layout)
this.listener16.on('draw', Func16draw)
}
layout11() {
console.log("skButton, layout")
}
draw11() {
console.log("skButton, draw")
}
layout12() {
console.log("skCheckbox, layout")
}
draw12() {
console.log("skCheckbox, draw")
}
layout13() {
console.log("skImage, layout")
}
draw13() {
console.log("skImage, draw")
}
layout14() {
console.log("skMenu, layout")
}
draw14() {
console.log("skMenu, draw")
}
layout15() {
console.log("skRadio, layout")
}
draw15() {
console.log("skRadio, draw")
}
layout16() {
console.log("skScrollBar, layout")
}
draw16() {
console.log("skScrollBar, draw")
}
}
\ No newline at end of file
/*
* 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 MyDataSourceGrid 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 grid {
private swiperController: SwiperController = new SwiperController()
private data: MyDataSourceGrid = new MyDataSourceGrid([])
@State mywidth: number = 400
@State myheight: number = 400
@State displaycount: number = 1
private arr: number[] = [0, 1, 2, 3, 4, 5, 6]
@State Number: String[] = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15',
'16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30'
]
aboutToAppear(): void {
let list = []
for (var i = 1; i <= 10; i++) {
list.push(i.toString());
}
this.data = new MyDataSourceGrid(list)
}
build() {
Column() {
Grid() {
ForEach(this.Number, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
// .backgroundColor(0xF9CF93)
.width('100%')
.height(80)
.textAlign(TextAlign.Center)
}
.border({ color: 0xAAAAAA, width: 2 })
}, day => day)
}
.key("ArkUX_Grid_List_Swiper_0200")
.columnsTemplate("repeat(auto-fill, 88px)")
.rowsTemplate("repeat(auto-fill, 88px)")
.columnsGap(10)
.rowsGap(10)
.width('90%')
.backgroundColor(0xFAEEE0)
Grid() {
ForEach(this.Number, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
// .backgroundColor(0xF9CF93)
.width('100%')
.height(80)
.textAlign(TextAlign.Center)
}
.border({ color: 0xAAAAAA, width: 2 })
}, day => day)
}
.key("ArkUX_Grid_List_Swiper_0210")
.columnsTemplate("repeat(auto-fill, 300vp)")
.rowsTemplate("repeat(auto-fill, 50vp)")
.columnsGap(10)
.rowsGap(10)
.width('90%')
.backgroundColor(0xFAEEE0)
Grid() {
ForEach(this.Number, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
// .backgroundColor(0xF9CF93)
.width('100%')
.height(80)
.textAlign(TextAlign.Center)
}
.border({ color: 0xAAAAAA, width: 2 })
}, day => day)
}
.key("ArkUX_Grid_List_Swiper_0220")
.columnsTemplate(null)
.rowsTemplate(null)
.columnsGap(10)
.rowsGap(10)
.width('90%')
.backgroundColor(0xFAEEE0)
Grid() {
ForEach(this.Number, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
// .backgroundColor(0xF9CF93)
.width('100%')
.height(80)
.textAlign(TextAlign.Center)
}
.border({ color: 0xAAAAAA, width: 2 })
}, day => day)
}
.key("ArkUX_Grid_List_Swiper_0230")
.columnsTemplate("repeat(auto-fill, 0)")
.rowsTemplate("repeat(auto-fill, 0)")
.columnsGap(10)
.rowsGap(10)
.width('90%')
.backgroundColor(0xFAEEE0)
Grid() {
ForEach(this.Number, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
// .backgroundColor(0xF9CF93)
.width('100%')
.height(80)
.textAlign(TextAlign.Center)
}
.border({ color: 0xAAAAAA, width: 2 })
}, day => day)
}
.key("ArkUX_Grid_List_Swiper_0240")
.columnsTemplate("repeat(auto-fill, 20px)")
.rowsTemplate("repeat(auto-fill, 600vp)")
.columnsGap(10)
.rowsGap(10)
.width('90%')
.backgroundColor(0xFAEEE0)
Grid() {
ForEach(this.Number, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
// .backgroundColor(0xF9CF93)
.width('100%')
.height(80)
.textAlign(TextAlign.Center)
}
.border({ color: 0xAAAAAA, width: 2 })
}, day => day)
}
.key("ArkUX_Grid_List_Swiper_0350")
.columnsTemplate("repeat(auto-fit, 88px)")
.rowsTemplate("repeat(auto-fit, 88px)")
.columnsGap(10)
.rowsGap(10)
.width('90%')
.backgroundColor(0xFAEEE0)
Grid() {
ForEach(this.Number, (day: string) => {
GridItem() {
Text(day)
.fontSize(16)
// .backgroundColor(0xF9CF93)
.width('100%')
.height(80)
.textAlign(TextAlign.Center)
}
.border({ color: 0xAAAAAA, width: 2 })
}, day => day)
}
.key("ArkUX_Grid_List_Swiper_0360")
.columnsTemplate("repeat(auto-fit, 300vp)")
.rowsTemplate("repeat(auto-fit, 50vp)")
.columnsGap(10)
.rowsGap(10)
.width('90%')
.backgroundColor(0xFAEEE0)
}.width(this.mywidth).backgroundColor(0xEEEEEE).margin({ top: 5 })
.height(this.myheight)
}
}
\ No newline at end of file
/*
* 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 MyDataSourceList 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 list {
private data: MyDataSourceList = new MyDataSourceList([])
@State mywidth: number = 400
@State myheight: number = 400
private arr: number[] = [
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10,
11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
21, 22, 23, 24, 25, 26, 27, 28, 29, 30
]
aboutToAppear(): void {
let list = []
for (var i = 1; i <= 10; i++) {
list.push(i.toString());
}
this.data = new MyDataSourceList(list)
}
build() {
Column() {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%')
.height(50)
.fontSize(16)
.textAlign(TextAlign.Center)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
}
.border({ color: 0xAAAAAA, width: 2 })
}, item => item)
}
.padding(10)
.border({ color: 0xAAAAAA, width: 2 })
.listDirection(Axis.Vertical) // 排列方向
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 2, endMargin: 2 }) // 每行之间的分界线
.edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.key("ArkUX_Grid_List_Swiper_0250")
.lanes({ minLength: 100, maxLength: 150 }, 20)
.width('100%')
// .padding()
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%')
.height(50)
.fontSize(16)
.textAlign(TextAlign.Center)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
}
.border({ color: 0xAAAAAA, width: 2 })
}, item => item)
}
.padding(10)
.border({ color: 0xAAAAAA, width: 2 })
.listDirection(Axis.Vertical) // 排列方向
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 2, endMargin: 2 }) // 每行之间的分界线
.edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.key("ArkUX_Grid_List_Swiper_0260")
.lanes({ minLength: 100, maxLength: 150 }, 100)
.width('100%')
// .padding()
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%')
.height(50)
.fontSize(16)
.textAlign(TextAlign.Center)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
}
.border({ color: 0xAAAAAA, width: 2 })
}, item => item)
}
.padding(10)
.border({ color: 0xAAAAAA, width: 2 })
.listDirection(Axis.Vertical) // 排列方向
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 2, endMargin: 2 }) // 每行之间的分界线
.edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.key("ArkUX_Grid_List_Swiper_0270")
.lanes(null)
.width('100%')
// .padding()
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%')
.height(50)
.fontSize(16)
.textAlign(TextAlign.Center)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
}
.border({ color: 0xAAAAAA, width: 2 })
}, item => item)
}
.padding(10)
.border({ color: 0xAAAAAA, width: 2 })
.listDirection(Axis.Vertical) // 排列方向
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 2, endMargin: 2 }) // 每行之间的分界线
.edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.key("ArkUX_Grid_List_Swiper_0280")
.lanes({ minLength: 100, maxLength: 150 }, 500)
.width('100%')
// .padding()
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%')
.height(50)
.fontSize(16)
.textAlign(TextAlign.Center)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
}
.border({ color: 0xAAAAAA, width: 2 })
}, item => item)
}
.padding(10)
.border({ color: 0xAAAAAA, width: 2 })
.listDirection(Axis.Vertical) // 排列方向
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 2, endMargin: 2 }) // 每行之间的分界线
.edgeEffect(EdgeEffect.Spring) // 滑动到边缘无效果
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.key("ArkUX_Grid_List_Swiper_0290")
.lanes({ minLength: 100, maxLength: 150 }, 250)
.width('100%')
// .padding()
}
.width(this.mywidth)
.backgroundColor(0xEEEEEE)
.margin({ top: 5 })
.height(this.myheight)
}
}
\ No newline at end of file
/*
* 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 navigationType {
@State strokeWidthStr: string = '10px'
@State dividerColorStr: string = '#000000'
@State startMarginStr: string = '5px'
@State endMarginStr: string = '5px'
@State nullFlag: boolean = false
@State dividerColor: Color = Color.Red
private arr: number[] = [1, 2, 3];
normalIcon : Resource = $r("app.media.icon")
selectedIcon: Resource = $r("app.media.icon")
build() {
Column() {
Navigation() {
TextInput({ placeholder: 'search...' })
.width("90%")
.height(40)
.backgroundColor('#FFFFFF')
List({ space: 12 }) {
ForEach(this.arr, (item) => {
ListItem() {
NavRouter() {
Text("NavRouter" + item)
.width("100%")
.height(72)
.backgroundColor('#FFFFFF')
.borderRadius(24)
.fontSize(16)
.fontWeight(500)
.textAlign(TextAlign.Center)
NavDestination() {
Text("NavDestinationContent" + item)
}
.title("NavDestinationTitle" + item)
}
}
}, item => item)
}
.width("90%")
.margin({ top: 12 })
}.key("ArkUX_Navigation_1600")
.title("������������")
.titleMode(NavigationTitleMode.Mini)
.mode(NavigationMode.Auto)
.minContentWidth(50)
.navBarWidth(100)
.navBarWidthRange([50, 300])
.menus([
{value: "", icon: "./image/ic_public_search.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}}
])
.toolBar({items: [
{value: "aas", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "bbbsdsdsdsdbb", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "ccccassdsddcccc", icon: "./image/ic_public_highlights.svg", action: ()=> {}}
]})
Navigation() {
TextInput({ placeholder: 'search...' })
.width("90%")
.height(40)
.backgroundColor('#FFFFFF')
List({ space: 12 }) {
ForEach(this.arr, (item) => {
ListItem() {
NavRouter() {
Text("NavRouter" + item)
.width("100%")
.height(72)
.backgroundColor('#FFFFFF')
.borderRadius(24)
.fontSize(16)
.fontWeight(500)
.textAlign(TextAlign.Center)
NavDestination() {
Text("NavDestinationContent" + item)
}
.title("NavDestinationTitle" + item)
}
}
}, item => item)
}
.width("90%")
.margin({ top: 12 })
}.key("ArkUX_Navigation_1700")
.title("������������")
.titleMode(NavigationTitleMode.Mini)
.mode(NavigationMode.Stack)
.minContentWidth(20000)
.navBarWidth(15000)
.navBarWidthRange([10000, 30000])
.menus([
{value: "", icon: "./image/ic_public_search.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}}
])
.toolBar({items: [
{value: "aas", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "bbbsdsdsdsdbb", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "ccccassdsddcccc", icon: "./image/ic_public_highlights.svg", action: ()=> {}}
]})
Navigation() {
TextInput({ placeholder: 'search...' })
.width("90%")
.height(40)
.backgroundColor('#FFFFFF')
List({ space: 12 }) {
ForEach(this.arr, (item) => {
ListItem() {
NavRouter() {
Text("NavRouter" + item)
.width("100%")
.height(72)
.backgroundColor('#FFFFFF')
.borderRadius(24)
.fontSize(16)
.fontWeight(500)
.textAlign(TextAlign.Center)
NavDestination() {
Text("NavDestinationContent" + item)
}
.title("NavDestinationTitle" + item)
}
}
}, item => item)
}
.width("90%")
.margin({ top: 12 })
}.key("ArkUX_Navigation_1800")
.title("������������")
.titleMode(NavigationTitleMode.Mini)
.mode(NavigationMode.Split)
.minContentWidth(30)
.navBarWidth(100)
.navBarWidthRange([10, 20])
.menus([
{value: "", icon: "./image/ic_public_search.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}}
])
.toolBar({items: [
{value: "aas", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "bbbsdsdsdsdbb", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "ccccassdsddcccc", icon: "./image/ic_public_highlights.svg", action: ()=> {}}
]})
Navigation() {
TextInput({ placeholder: 'search...' })
.width("90%")
.height(40)
.backgroundColor('#FFFFFF')
List({ space: 12 }) {
ForEach(this.arr, (item) => {
ListItem() {
NavRouter() {
Text("NavRouter" + item)
.width("100%")
.height(72)
.backgroundColor('#FFFFFF')
.borderRadius(24)
.fontSize(16)
.fontWeight(500)
.textAlign(TextAlign.Center)
NavDestination() {
Text("NavDestinationContent" + item)
}
.title("NavDestinationTitle" + item)
}
}
}, item => item)
}
.width("90%")
.margin({ top: 12 })
}.key("ArkUX_Navigation_1900")
.title("������������")
.titleMode(NavigationTitleMode.Mini)
.navBarWidth(100)
.menus([
{value: "", icon: "./image/ic_public_search.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}}
])
.toolBar({items: [
{value: "aas", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "bbbsdsdsdsdbb", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "ccccassdsddcccc", icon: "./image/ic_public_highlights.svg", action: ()=> {}}
]})
Navigation() {
TextInput({ placeholder: 'search...' })
.width("90%")
.height(40)
.backgroundColor('#FFFFFF')
List({ space: 12 }) {
ForEach(this.arr, (item) => {
ListItem() {
NavRouter() {
Text("NavRouter" + item)
.width("100%")
.height(72)
.backgroundColor('#FFFFFF')
.borderRadius(24)
.fontSize(16)
.fontWeight(500)
.textAlign(TextAlign.Center)
NavDestination() {
Text("NavDestinationContent" + item)
}
.title("NavDestinationTitle" + item)
}
}
}, item => item)
}
.width("90%")
.margin({ top: 12 })
}.key("ArkUX_Navigation_2000")
.title("������������")
.titleMode(NavigationTitleMode.Mini)
.mode(NavigationMode.Split)
.minContentWidth(100)
.navBarWidth(100)
.navBarWidthRange([100, 100])
.menus([
{value: "", icon: "./image/ic_public_search.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}}
])
.toolBar({items: [
{value: "aas", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "bbbsdsdsdsdbb", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "ccccassdsddcccc", icon: "./image/ic_public_highlights.svg", action: ()=> {}}
]})
Navigation() {
TextInput({ placeholder: 'search...' })
.width("90%")
.height(40)
.backgroundColor('#FFFFFF')
List({ space: 12 }) {
ForEach(this.arr, (item) => {
ListItem() {
NavRouter() {
Text("NavRouter" + item)
.width("100%")
.height(72)
.backgroundColor('#FFFFFF')
.borderRadius(24)
.fontSize(16)
.fontWeight(500)
.textAlign(TextAlign.Center)
NavDestination() {
Text("NavDestinationContent" + item)
}
.title("NavDestinationTitle" + item)
}
}
}, item => item)
}
.width("90%")
.margin({ top: 12 })
}.key("ArkUX_Navigation_2100")
.title("������������")
.titleMode(NavigationTitleMode.Mini)
.mode(NavigationMode.Split)
.minContentWidth("40%")
.navBarWidth("30%")
.navBarWidthRange(["20%", "50%"])
.menus([
{value: "", icon: "./image/ic_public_search.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}},
{value: "", icon: "./image/ic_public_add.svg", action: ()=> {}}
])
.toolBar({items: [
{value: "aas", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "bbbsdsdsdsdbb", icon: "./image/ic_public_highlights.svg", action: ()=> {}},
{value: "ccccassdsddcccc", icon: "./image/ic_public_highlights.svg", action: ()=> {}}
]})
}
.height('100%')
.width('100%')
.backgroundColor('#F1F3F5')
}
}
\ No newline at end of file
/*
* 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 web_webview from '@ohos.web.webview'
@Entry
@Component
struct noBarrierComponents {
scroller: Scroller = new Scroller()
private arr: number[] = [0, 1]
@State Number: String[] = ['0', '1']
private arrayA: string[] = ['安']
private arrayB: string[] = ['卜', '白', '包', '毕', '丙']
private arrayC: string[] = ['曹', '成', '陈', '催']
private arrayL: string[] = ['刘', '李', '楼', '梁', '雷', '吕', '柳', '卢']
private value: string[] = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']
public valueArr: number[] = [10, 10]
@State isLunar: boolean = false
private selectedDate: Date = new Date('2021-08-08')
@State formId:number = 0;
@State start: boolean = false
private fromStart: boolean = true
private step: number = 50
private loop: number = Infinity
private src: string = "Running Marquee starts rolling"
@State passwords: Number[] = []
@State message: string = 'please input password!'
private patternLockController: PatternLockController = new PatternLockController()
private value1: string = 'hello world'
@State rating: number = 3.5
@State target: WindowAnimationTarget = undefined
@State data: string = '<h1 style="text-align: center;">h1标题</h1>';
@State changeValue: string = ''
@State submitValue: string = ''
controller: SearchController = new SearchController()
@State outSetValueOne: number = 40
@State isMilitaryTime: boolean = false
private selectedTime: Date = new Date('2022-07-22T08:00:00')
controller1: web_webview.WebviewController = new web_webview.WebviewController()
private surfaceId : string =''
xcomponentController: XComponentController = new XComponentController()
build() {
Scroll(this.scroller) {
Column() {
Text('textAlign1')
.key('textAlign1')
.fontSize(20)
.fontColor(0xCCCCCC)
.accessibilityText("我是无障碍组件")
Text('textAlign2')
.key('textAlign2')
.fontSize(20)
.fontColor(0xCCCCCC)
.accessibilityText("")
Text('textAlign3')
.key('textAlign3')
.fontSize(20)
.fontColor(0xCCCCCC)
.accessibilityText("我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件我是无障碍组件")
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arr, (item) => {
ListItem() {
Text('' + item)
.width('100%').height(100).fontSize(16)
.textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF)
}
}, item => item)
}
.key("list")
.listDirection(Axis.Vertical)
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 })
.edgeEffect(EdgeEffect.Spring)
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.accessibilityText("我是无障碍组件")
.width('90%')
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)
}
.key("Grid")
.columnsTemplate('1fr 1fr ')
.rowsTemplate('1fr 1fr ')
.columnsGap(10)
.rowsGap(10)
.width('90%')
.backgroundColor(0xFAEEE0)
.accessibilityText("我是无障碍组件")
.height(300)
Stack({ alignContent: Alignment.Start }) {
Row() {
List({ space: 20, initialIndex: 0 }) {
ForEach(this.arrayA, (item) => {
ListItem() {
Text(item)
.width('80%')
.height('5%')
.fontSize(30)
.textAlign(TextAlign.Center)
}.editable(true)
}, item => item)
ForEach(this.arrayB, (item) => {
ListItem() {
Text(item)
.width('80%')
.height('5%')
.fontSize(30)
.textAlign(TextAlign.Center)
}.editable(true)
}, item => item)
ForEach(this.arrayC, (item) => {
ListItem() {
Text(item)
.width('80%')
.height('5%')
.fontSize(30)
.textAlign(TextAlign.Center)
}.editable(true)
}, item => item)
ForEach(this.arrayL, (item) => {
ListItem() {
Text(item)
.width('80%')
.height('5%')
.fontSize(30)
.textAlign(TextAlign.Center)
}.editable(true)
}, item => item)
}
.width('50%')
.height('100%')
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.selectedColor(0xFFFFFF)
.popupColor(0xFFFAF0)
.selectedBackgroundColor(0xCCCCCC)
.popupBackground(0xD2B48C)
.usingPopup(true)
.selectedFont({ size: 16, weight: FontWeight.Bolder })
.popupFont({ size: 30, weight: FontWeight.Bolder })
.itemSize(28)
.alignStyle(IndexerAlign.Left)
.onSelect((index: number) => {
console.info(this.value[index] + ' Selected!')
})
.onRequestPopupData((index: number) => {
if (this.value[index] == 'A') {
return this.arrayA
} else if (this.value[index] == 'B') {
return this.arrayB
} else if (this.value[index] == 'C') {
return this.arrayC
} else if (this.value[index] == 'L') {
return this.arrayL
} else {
return []
}
})
.onPopupSelect((index: number) => {
console.info('onPopupSelected:' + index)
})
}
.width('100%')
.height('100%')
}
.key("AlphabetIndexer")
.accessibilityText("我是无障碍组件")
Column() {
Row() {
Text('Bluetooth').fontSize(18)
Blank()
Toggle({ type: ToggleType.Switch }).margin({ top: 14, bottom: 14, left: 6, right: 6 })
}.width('100%').backgroundColor(0xFFFFFF).borderRadius(15).padding({ left: 12 })
}
.backgroundColor(0xEFEFEF)
.padding(20)
.key("Blank")
.accessibilityText("我是无障碍组件")
Button('OK', { type: ButtonType.Normal, stateEffect: true })
.borderRadius(8)
.backgroundColor(0x317aff)
.width(90)
.key("Button")
.accessibilityText("我是无障碍组件")
.onClick(() => {
console.log('ButtonType.Normal')
})
Checkbox({name: 'checkbox1', group: 'checkboxGroup'})
.select(true)
.selectedColor(0xed6f21)
.onChange((value: boolean) => {
console.info('Checkbox1 change is'+ value)
})
.key("Checkbox")
.accessibilityText("我是无障碍组件")
DataPanel({ values: this.valueArr, max: 100, type: DataPanelType.Line })
.width(300)
.height(10)
.key("DataPanel")
.accessibilityText("我是无障碍组件")
DatePicker({
start: new Date('1970-1-1'),
end: new Date('2100-1-1'),
selected: this.selectedDate
})
.lunar(this.isLunar)
.onChange((value: DatePickerResult) => {
this.selectedDate.setFullYear(value.year, value.month, value.day)
console.info('select current date is: ' + JSON.stringify(value))
})
.key("DatePicker")
.accessibilityText("我是无障碍组件")
Divider().strokeWidth(8).color('#F1F3F5') .key("Divider").accessibilityText("我是无障碍组件")
FormComponent({
id:this.formId,
name:"Form1",
bundle:"com.example.cardexample",
ability:"FormAbility",
module:"entry",
dimension:FormDimension.Dimension_2_2,
temporary:false
})
.allowUpdate(true)
.size({width:360,height:360})
.visibility(Visibility.Visible)
.onAcquired((form)=>{
console.log(`form info : ${JSON.stringify(form)}`);
this.formId = form.id;
})
.onError((err)=>{
console.log(`fail to add form, err: ${JSON.stringify(err)}`);
})
.key("FormComponent")
.accessibilityText("我是无障碍组件")
Gauge({ value: 75 })
.width(200).height(200)
.colors([[0x317AF7, 1], [0x5BA854, 1], [0xE08C3A, 1], [0x9C554B, 1]])
.key("Gauge")
.accessibilityText("我是无障碍组件")
Image($r('app.media.icon'))
.width(110).height(110).border({ width: 1 })
.overlay('png', { align: Alignment.Bottom, offset: { x: 0, y: 20 } })
.key("Image")
.accessibilityText("我是无障碍组件")
Marquee({
start: this.start,
step: this.step,
loop: this.loop,
fromStart: this.fromStart,
src: this.src
})
.width(360)
.height(80)
.fontColor('#FFFFFF')
.fontSize(48)
.fontWeight(700)
.backgroundColor('#182431')
.key("Marquee")
.accessibilityText("我是无障碍组件")
.margin({ bottom: 40 })
.onStart(() => {
console.info('Marquee animation complete onStart')
})
.onBounce(() => {
console.info('Marquee animation complete onBounce')
})
.onFinish(() => {
console.info('Marquee animation complete onFinish')
})
PatternLock(this.patternLockController)
.sideLength(200)
.circleRadius(9)
.pathStrokeWidth(18)
.activeColor('#B0C4DE')
.selectedColor('#228B22')
.pathColor('#90EE90')
.backgroundColor('#F5F5F5')
.key("PatternLock")
.accessibilityText("我是无障碍组件")
.autoReset(true)
.onPatternComplete((input: Array<number>) => {
if (input === null || input === undefined || input.length < 5) {
this.message = 'The password length needs to be greater than 5, please enter again.'
return
}
if (this.passwords.length > 0) {
if (this.passwords.toString() === input.toString()) {
this.passwords = input
this.message = 'Set password successfully: ' + this.passwords.toString()
} else {
this.message = 'Inconsistent passwords, please enter again.'
}
} else {
this.passwords = input
this.message = "Please enter again."
}
})
Progress({ value: 20, total: 150, type: ProgressType.ScaleRing })
.color(Color.Grey).value(50).width(100)
.style({ strokeWidth: 20, scaleCount: 20, scaleWidth: 5 })
.key("Progress")
.accessibilityText("我是无障碍组件")
QRCode(this.value1)
.width(200)
.height(200)
.key("QRCode")
.accessibilityText("我是无障碍组件")
Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true)
.height(50)
.width(50)
.key("Radio")
.accessibilityText("我是无障碍组件")
.onChange((isChecked: boolean) => {
console.log('Radio1 status is ' + isChecked)
})
Rating({ rating: this.rating, indicator: false })
.stars(5)
.stepSize(0.5)
.margin({ top: 24 })
.key("Rating")
.accessibilityText("我是无障碍组件")
.onChange((value: number) => {
this.rating = value
})
RemoteWindow(this.target)
.translate({ x: 100, y: 200 })
.scale({ x: 0.5, y: 0.5 })
.opacity(0.8)
.position({ x: px2vp(this.target?.windowBounds.left), y: px2vp(this.target?.windowBounds.top) })
.width(px2vp(this.target?.windowBounds.width))
.height(px2vp(this.target?.windowBounds.height))
.key("RemoteWindow")
.accessibilityText("我是无障碍组件")
RichText(this.data)
.onStart(() => {
console.info('RichText onStart');
})
.onComplete(() => {
console.info('RichText onComplete');
})
.width(500)
.height(400)
.backgroundColor(0XBDDB69)
.key("RichText")
.accessibilityText("我是无障碍组件")
Search({ value: this.changeValue, placeholder: 'Type to search...', controller: this.controller })
.searchButton('SEARCH')
.width(400)
.height(40)
.backgroundColor('#F5F5F5')
.key("Search")
.accessibilityText("我是无障碍组件")
.placeholderColor(Color.Grey)
.placeholderFont({ size: 14, weight: 400 })
.textFont({ size: 14, weight: 400 })
.onSubmit((value: string) => {
this.submitValue = value
})
.onChange((value: string) => {
this.changeValue = value
})
.margin(20)
Select([{ value: 'aaa', icon: "/common/public_icon.svg" },
{ value: 'bbb', icon: "/common/public_icon.svg" },
{ value: 'ccc', icon: "/common/public_icon.svg" },
{ value: 'ddd', icon: "/common/public_icon.svg" }])
.selected(2)
.value('TTTTT')
.font({ size: 16, weight: 500 })
.fontColor('#182431')
.selectedOptionFont({ size: 16, weight: 400 })
.optionFont({ size: 16, weight: 400 })
.key("Select")
.accessibilityText("我是无障碍组件")
.onSelect((index: number) => {
console.info('Select:' + index)
})
Slider({
value: this.outSetValueOne,
min: 0,
max: 100,
style: SliderStyle.OutSet
})
.showTips(true)
.onChange((value: number, mode: SliderChangeMode) => {
this.outSetValueOne = value
console.info('value:' + value + 'mode:' + mode.toString())
})
.key("Slider")
.accessibilityText("我是无障碍组件")
TimePicker({
selected: this.selectedTime,
})
.useMilitaryTime(this.isMilitaryTime)
.onChange((value: TimePickerResult) => {
this.selectedTime.setHours(value.hour, value.minute)
console.info('select current date is: ' + JSON.stringify(value))
})
.key("TimePicker")
.accessibilityText("我是无障碍组件")
Toggle({ type: ToggleType.Switch, isOn: false })
.selectedColor('#007DFF')
.switchPointColor('#FFFFFF')
.onChange((isOn: boolean) => {
console.info('Component status:' + isOn)
})
.key("Toggle")
.accessibilityText("我是无障碍组件")
Web({ src: $rawfile("index.html"), controller: this.controller1 })
.key("Web")
.accessibilityText("我是无障碍组件")
XComponent({
id: 'xcomponent',
type: 'surface',
controller: this.xcomponentController
})
.onLoad(() => {
this.xcomponentController.setXComponentSurfaceSize({surfaceWidth:1920,surfaceHeight:1080});
this.surfaceId = this.xcomponentController.getXComponentSurfaceId()
})
.width('640px')
.height('480px')
.key("XComponent")
.accessibilityText("我是无障碍组件")
}
}
}
}
\ No newline at end of file
......@@ -18,7 +18,7 @@ import events_emitter from '@ohos.events.emitter';
struct stageMediaquery {
@State color: string = '#000'
@State text: string = 'Test'
listener = globalThis.uiContent.getMediaquery().matchMediaSync('(orientation: landscape)')
listener = globalThis.uiContent.getMediaQuery().matchMediaSync('(orientation: landscape)')
aboutToAppear() {
this.listener.on('change', (mediaQueryResult) => {
if (mediaQueryResult.matches) {
......
/*
* 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 MyDataSourceSwiper 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 swiper {
private swiperController: SwiperController = new SwiperController()
private data: MyDataSourceSwiper = new MyDataSourceSwiper([])
@State mywidth: number = 400
@State myheight: number = 400
@State displaycount: number = 1
private arr: number[] = [0, 1, 2, 3, 4, 5, 6]
@State Number: String[] = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15',
'16', '17', '18', '19', '20', '21', '22', '23', '24', '25', '26', '27', '28', '29', '30'
]
aboutToAppear(): void {
let list = []
for (var i = 1; i <= 10; i++) {
list.push(i.toString());
}
this.data = new MyDataSourceSwiper(list)
}
build() {
Column() {
Swiper(this.swiperController) {
Text('1')
.width(150)
.height(80)
.backgroundColor(0xAAAAAA)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('2')
.width(150)
.height(80)
.backgroundColor(0xEEEEEE)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('3')
.width(150)
.height(80)
.backgroundColor(0xCCCCCC)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('4')
.width(150)
.height(80)
.backgroundColor(0xA11111)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('5')
.width(150)
.height(80)
.backgroundColor(0xBBBBBB)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('6')
.width(150)
.height(80)
.backgroundColor(0x233456)
.textAlign(TextAlign.Center)
.fontSize(30)
}
.cachedCount(2)
.index(1)
.autoPlay(true)
.interval(4000)
.indicator(true)
.loop(true)
.duration(1000)
.itemSpace(0)
.curve(Curve.Linear)
.onChange((index: number) => {
console.info(index.toString())
})
.key("ArkUX_Grid_List_Swiper_0300")
.displayCount({ minSize: '200vp'})
.border({color:Color.White,width:10})
// .arrowSize(200)
Swiper(this.swiperController) {
Text('1')
.width(150)
.height(80)
.backgroundColor(0xAAAAAA)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('2')
.width(150)
.height(80)
.backgroundColor(0xEEEEEE)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('3')
.width(150)
.height(80)
.backgroundColor(0xCCCCCC)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('4')
.width(150)
.height(80)
.backgroundColor(0xA11111)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('5')
.width(150)
.height(80)
.backgroundColor(0xBBBBBB)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('6')
.width(150)
.height(80)
.backgroundColor(0x233456)
.textAlign(TextAlign.Center)
.fontSize(30)
}
.cachedCount(2)
.index(1)
.autoPlay(true)
.interval(4000)
.indicator(true)
.loop(true)
.duration(1000)
.itemSpace(0)
.curve(Curve.Linear)
.onChange((index: number) => {
console.info(index.toString())
})
.key("ArkUX_Grid_List_Swiper_0310")
.displayCount({ minSize: '100vp' })
Swiper(this.swiperController) {
Text('1')
.width(150)
.height(80)
.backgroundColor(0xAAAAAA)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('2')
.width(150)
.height(80)
.backgroundColor(0xEEEEEE)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('3')
.width(150)
.height(80)
.backgroundColor(0xCCCCCC)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('4')
.width(150)
.height(80)
.backgroundColor(0xA11111)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('5')
.width(150)
.height(80)
.backgroundColor(0xBBBBBB)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('6')
.width(150)
.height(80)
.backgroundColor(0x233456)
.textAlign(TextAlign.Center)
.fontSize(30)
}
.cachedCount(2)
.index(1)
.autoPlay(true)
.interval(4000)
.indicator(true)
.loop(true)
.duration(1000)
.itemSpace(0)
.curve(Curve.Linear)
.onChange((index: number) => {
console.info(index.toString())
})
.key("ArkUX_Grid_List_Swiper_0320")
.displayCount(null)
Swiper(this.swiperController) {
Text('1')
.width(150)
.height(80)
.backgroundColor(0xAAAAAA)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('2')
.width(150)
.height(80)
.backgroundColor(0xEEEEEE)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('3')
.width(150)
.height(80)
.backgroundColor(0xCCCCCC)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('4')
.width(150)
.height(80)
.backgroundColor(0xA11111)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('5')
.width(150)
.height(80)
.backgroundColor(0xBBBBBB)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('6')
.width(150)
.height(80)
.backgroundColor(0x233456)
.textAlign(TextAlign.Center)
.fontSize(30)
}
.cachedCount(2)
.index(1)
.autoPlay(true)
.interval(4000)
.indicator(true)
.loop(true)
.duration(1000)
.itemSpace(0)
.curve(Curve.Linear)
.onChange((index: number) => {
console.info(index.toString())
})
.key("ArkUX_Grid_List_Swiper_0330")
.displayCount({ minSize: '500vp' })
Swiper(this.swiperController) {
Text('1')
.width(150)
.height(80)
.backgroundColor(0xAAAAAA)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('2')
.width(150)
.height(80)
.backgroundColor(0xEEEEEE)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('3')
.width(150)
.height(80)
.backgroundColor(0xCCCCCC)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('4')
.width(150)
.height(80)
.backgroundColor(0xA11111)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('5')
.width(150)
.height(80)
.backgroundColor(0xBBBBBB)
.textAlign(TextAlign.Center)
.fontSize(30)
Text('6')
.width(150)
.height(80)
.backgroundColor(0x233456)
.textAlign(TextAlign.Center)
.fontSize(30)
}
.cachedCount(2)
.index(1)
.autoPlay(true)
.interval(4000)
.indicator(true)
.loop(true)
.duration(1000)
.itemSpace(0)
.curve(Curve.Linear)
.onChange((index: number) => {
console.info(index.toString())
})
.key("ArkUX_Grid_List_Swiper_0340")
.displayCount({ minSize: '0vp' })
}.width(this.mywidth).backgroundColor(0xEEEEEE).margin({ top: 5 })
.height(this.myheight)
}
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import router from '@system.router';
export default function ActsGridTest() {
describe('ActsGridTest', function () {
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/grid',
}
try {
router.clear();
let pages = router.getState();
console.info("get grid state success " + JSON.stringify(pages));
if (!("grid" == pages.name)) {
console.info("get grid state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push grid page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push grid page error: " + err);
}
done()
});
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
it('ArkUX_Grid_List_Swiper_0200', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0200 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0200');
console.info('ArkUX_Grid_List_Swiper_0200 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0200 obj is: " + JSON.stringify(obj));
let columnsTemplate = obj.$attrs.columnsTemplate
let rowsTemplate = obj.$attrs.rowsTemplate
expect(columnsTemplate).assertEqual("repeat(auto-fill, 88px)");
expect(rowsTemplate).assertEqual("repeat(auto-fill, 88px)");
console.info('ArkUX_Grid_List_Swiper_0200 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0200 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0210', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0210 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0210');
console.info('ArkUX_Grid_List_Swiper_0210 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0210 obj is: " + JSON.stringify(obj));
let columnsTemplate = obj.$attrs.columnsTemplate
let rowsTemplate = obj.$attrs.rowsTemplate
expect(columnsTemplate).assertEqual("repeat(auto-fill, 300vp)");
expect(rowsTemplate).assertEqual("repeat(auto-fill, 50vp)");
console.info('ArkUX_Grid_List_Swiper_0210 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0210 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0220', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0220 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0220');
console.info('ArkUX_Grid_List_Swiper_0220 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0220 obj is: " + JSON.stringify(obj));
let columnsTemplate = obj.$attrs.columnsTemplate
let rowsTemplate = obj.$attrs.rowsTemplate
expect(columnsTemplate).assertEqual("null");
expect(rowsTemplate).assertEqual("null");
console.info('ArkUX_Grid_List_Swiper_0220 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0220 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0230', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0230 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0230');
console.info('ArkUX_Grid_List_Swiper_0230 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0230 obj is: " + JSON.stringify(obj));
let columnsTemplate = obj.$attrs.columnsTemplate
let rowsTemplate = obj.$attrs.rowsTemplate
expect(columnsTemplate).assertEqual("repeat(auto-fill, 0)");
expect(rowsTemplate).assertEqual("repeat(auto-fill, 0)");
console.info('ArkUX_Grid_List_Swiper_0230 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0230 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0240', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0240 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0240');
console.info('ArkUX_Grid_List_Swiper_0240 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0240 obj is: " + JSON.stringify(obj));
let columnsTemplate = obj.$attrs.columnsTemplate
let rowsTemplate = obj.$attrs.rowsTemplate
expect(columnsTemplate).assertEqual("repeat(auto-fill, 20px)");
expect(rowsTemplate).assertEqual("repeat(auto-fill, 600vp)");
console.info('ArkUX_Grid_List_Swiper_0240 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0240 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0350', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0350 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0350');
console.info('ArkUX_Grid_List_Swiper_0350 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0350 obj is: " + JSON.stringify(obj));
let columnsTemplate = obj.$attrs.columnsTemplate
let rowsTemplate = obj.$attrs.rowsTemplate
expect(columnsTemplate).assertEqual("repeat(auto-fit, 88px)");
expect(rowsTemplate).assertEqual("repeat(auto-fit, 88px)");
console.info('ArkUX_Grid_List_Swiper_0350 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0350 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0360', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0360 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0360');
console.info('ArkUX_Grid_List_Swiper_0360 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0360 obj is: " + JSON.stringify(obj));
let columnsTemplate = obj.$attrs.columnsTemplate
let rowsTemplate = obj.$attrs.rowsTemplate
expect(columnsTemplate).assertEqual("repeat(auto-fit, 300vp)");
expect(rowsTemplate).assertEqual("repeat(auto-fit, 50vp)");
console.info('ArkUX_Grid_List_Swiper_0360 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0360 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
......@@ -32,6 +32,14 @@ import stageAnimatorTest from './stageAnimator.test';
import textSpanFontTest from './textSpanFont.test';
import gridScrollbarUpdateTest from './gridScrollbarUpdate.test';
import sidebarTypeTest from './sidebarType.test';
import navigationTypeTest from './navigationType.test';
import noBarrierComponentsTest from './noBarrierComponents.test';
import noBarriersGroupTest from './noBarriersGroup.test';
import assemblyCallbackTest from './assemblyCallback.test';
import ActsGridTest from './Grid.test';
import ActsListTest from './Listitem.test';
import ActsSwiperTest from './Swiper.test';
export default function testsuite() {
stageFontTest()
......@@ -53,4 +61,11 @@ export default function testsuite() {
textSpanFontTest()
gridScrollbarUpdateTest()
sidebarTypeTest()
navigationTypeTest()
noBarrierComponentsTest()
noBarriersGroupTest()
assemblyCallbackTest()
ActsGridTest()
ActsListTest()
ActsSwiperTest()
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import router from '@system.router';
export default function ActsListTest() {
describe('ActsListTest', function () {
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/list',
}
try {
router.clear();
let pages = router.getState();
console.info("get list state success " + JSON.stringify(pages));
if (!("list" == pages.name)) {
console.info("get list state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push list page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push list page error: " + err);
}
done()
});
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
it('ArkUX_Grid_List_Swiper_0250', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0250 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0250');
console.info('ArkUX_Grid_List_Swiper_0250 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0250 obj is: " + JSON.stringify(obj));
let laneGutter = obj.$attrs.laneGutter
expect(laneGutter).assertEqual("20.00vp");
console.info('ArkUX_Grid_List_Swiper_0250 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0250 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0260', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0260 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0260');
console.info('ArkUX_Grid_List_Swiper_0260 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0260 obj is: " + JSON.stringify(obj));
let laneGutter = obj.$attrs.laneGutter
expect(laneGutter).assertEqual("100.00vp");
console.info('ArkUX_Grid_List_Swiper_0260 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0260 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0270', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0270 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0270');
console.info('ArkUX_Grid_List_Swiper_0270 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0270 obj is: " + JSON.stringify(obj));
let laneGutter = obj.$attrs.laneGutter
expect(laneGutter).assertEqual("0.00vp");
console.info('ArkUX_Grid_List_Swiper_0270 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0270 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0280', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0280 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0280');
console.info('ArkUX_Grid_List_Swiper_0280 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0280 obj is: " + JSON.stringify(obj));
let laneGutter = obj.$attrs.laneGutter
expect(laneGutter).assertEqual("500.00vp");
console.info('ArkUX_Grid_List_Swiper_0280 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0280 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0290', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0290 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0290');
console.info('ArkUX_Grid_List_Swiper_0290 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0290 obj is: " + JSON.stringify(obj));
let laneGutter = obj.$attrs.laneGutter
expect(laneGutter).assertEqual("250.00vp");
console.info('ArkUX_Grid_List_Swiper_0290 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0290 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import router from '@system.router';
export default function ActsSwiperTest() {
describe('ActsSwiperTest', function () {
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/swiper',
}
try {
router.clear();
let pages = router.getState();
console.info("get swiper state success " + JSON.stringify(pages));
if (!("swiper" == pages.name)) {
console.info("get swiper state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push swiper page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push swiper page error: " + err);
}
done()
});
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
it('ArkUX_Grid_List_Swiper_0300', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0300 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0300');
console.info('ArkUX_Grid_List_Swiper_0300 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0300 obj is: " + JSON.stringify(obj));
let minSize = obj.$attrs.minSize
expect(minSize).assertEqual("200.00vp");
console.info('ArkUX_Grid_List_Swiper_0300 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0300 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0310', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0310 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0310');
console.info('ArkUX_Grid_List_Swiper_0310 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0310 obj is: " + JSON.stringify(obj));
let minSize = obj.$attrs.minSize
expect(minSize).assertEqual("100.00vp");
console.info('ArkUX_Grid_List_Swiper_0310 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0310 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0320', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0320 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0320');
console.info('ArkUX_Grid_List_Swiper_0320 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0320 obj is: " + JSON.stringify(obj));
let minSize = obj.$attrs.minSize
expect(minSize).assertEqual("0.00vp");
console.info('ArkUX_Grid_List_Swiper_0320 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0320 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0330', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0330 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0330');
console.info('ArkUX_Grid_List_Swiper_0330 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0330 obj is: " + JSON.stringify(obj));
let minSize = obj.$attrs.minSize
expect(minSize).assertEqual("500.00vp");
console.info('ArkUX_Grid_List_Swiper_0330 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0330 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Grid_List_Swiper_0340', 0, async function (done) {
console.info('ArkUX_Grid_List_Swiper_0340 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Grid_List_Swiper_0340');
console.info('ArkUX_Grid_List_Swiper_0340 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Grid_List_Swiper_0340 obj is: " + JSON.stringify(obj));
let minSize = obj.$attrs.minSize
expect(minSize).assertEqual("0.00vp");
console.info('ArkUX_Grid_List_Swiper_0340 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Grid_List_Swiper_0340 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import inspector from '@ohos.arkui.inspector';
import router from '@system.router';
export default function assemblyCallbackTest() {
describe('assemblyCallbackTest', function () {
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/assemblyCallback',
}
try {
router.clear();
let pages = router.getState();
console.info("get assemblyCallback state success " + JSON.stringify(pages));
if (!("assemblyCallback" == pages.name)) {
console.info("get assemblyCallback state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push assemblyCallback page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push assemblyCallback page error: " + err);
}
done()
});
it('ArkUX_Callback_notification_0210', 0, async function (done) {
console.info('ArkUX_Callback_notification_0210 START');
setTimeout(()=>{
try{
let listener11 = inspector.createComponentObserver("null")
console.info('ArkUX_Callback_notification_0210 START :'+ listener11);
console.info('ArkUX_Callback_notification_0210 START :'+ typeof listener11);
expect(typeof listener11).assertEqual("object")
console.info('ArkUX_Callback_notification_0210 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Callback_notification_0210 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Callback_notification_0220', 0, async function (done) {
console.info('ArkUX_Callback_notification_0220 START');
setTimeout(()=>{
try{
let listener12 = inspector.createComponentObserver("")
console.info('ArkUX_Callback_notification_0220 START :'+ listener12);
console.info('ArkUX_Callback_notification_0220 START :'+ typeof listener12);
expect(typeof listener12).assertEqual("object")
console.info('ArkUX_Callback_notification_0220 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Callback_notification_0220 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Callback_notification_0230', 0, async function (done) {
console.info('ArkUX_Callback_notification_0230 START');
setTimeout(()=>{
try{
let listener13 = inspector.createComponentObserver("object")
console.info('ArkUX_Callback_notification_0230 START :'+ listener13);
console.info('ArkUX_Callback_notification_0230 START :'+ typeof listener13);
expect(typeof listener13).assertEqual("object")
console.info('ArkUX_Callback_notification_0230 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Callback_notification_0230 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Callback_notification_0240', 0, async function (done) {
console.info('ArkUX_Callback_notification_0240 START');
setTimeout(()=>{
try{
let listener14 = inspector.createComponentObserver("null")
console.info('ArkUX_Callback_notification_0240 START :'+ listener14);
console.info('ArkUX_Callback_notification_0240 START :'+ typeof listener14);
expect(typeof listener14).assertEqual("object")
console.info('ArkUX_Callback_notification_0240 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Callback_notification_0240 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Callback_notification_0250', 0, async function (done) {
console.info('ArkUX_Callback_notification_0250 START');
setTimeout(()=>{
try{
let listener15 = inspector.createComponentObserver("")
console.info('ArkUX_Callback_notification_0250 START :'+ listener15);
console.info('ArkUX_Callback_notification_0250 START :'+ typeof listener15);
expect(typeof listener15).assertEqual("object")
console.info('ArkUX_Callback_notification_0250 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Callback_notification_0250 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Callback_notification_0260', 0, async function (done) {
console.info('ArkUX_Callback_notification_0260 START');
setTimeout(()=>{
try{
let listener16 = inspector.createComponentObserver("object")
console.info('ArkUX_Callback_notification_0260 START :'+ listener16);
console.info('ArkUX_Callback_notification_0260 START :'+ typeof listener16);
expect(typeof listener16).assertEqual("object")
console.info('ArkUX_Callback_notification_0260 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Callback_notification_0260 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
......@@ -56,6 +56,8 @@ export default function gridScrollbarUpdateTest() {
console.info('Grid_scrollbarUpdate_0801 START');
setTimeout(()=>{
try{
let computeda: ComputedBarAttribute = { totalOffset:10, totalLength:10 }
console.info("Grid_scrollbarUpdate_0801 computeda is: " + JSON.stringify(computeda))
let strJson = getInspectorByKey('Grid_scrollbarUpdate_0800');
console.info('Grid_scrollbarUpdate_0801 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
......@@ -77,6 +79,8 @@ export default function gridScrollbarUpdateTest() {
console.info('Grid_scrollbarUpdate_0802 START');
setTimeout(()=>{
try{
let computedb: ComputedBarAttribute = { totalOffset:0, totalLength:0 }
console.info("Grid_scrollbarUpdate_0802 computedb is: " + JSON.stringify(computedb))
let strJson = getInspectorByKey('Grid_scrollbarUpdate_0800');
console.info('Grid_scrollbarUpdate_0802 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
......
/*
* 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 router from '@system.router';
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "@ohos/hypium"
export default function navigationTypeTest() {
describe('navigationTypeTest', function () {
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/navigationType',
}
try {
router.clear();
let pages = router.getState();
console.info("get navigationType state success " + JSON.stringify(pages));
if (!("navigationType" == pages.name)) {
console.info("get navigationType state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push navigationType page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push navigationType page error: " + err);
}
done()
});
it('ArkUX_Navigation_1600', 0, async function (done) {
console.info('ArkUX_Navigation_1600 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Navigation_1600');
console.info('ArkUX_Navigation_1600 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Navigation_1600 obj is: " + JSON.stringify(obj));
let mode = obj.$attrs.mode
let minContentWidth = obj.$attrs.minContentWidth
let navBarWidth = obj.$attrs.navBarWidth
let navBarWidthRange = obj.$attrs.navBarWidthRange
expect(mode).assertEqual("NavigationMode.SPLIT");
expect(minContentWidth).assertEqual("50.00vp");
expect(navBarWidth).assertEqual("100.00vp");
expect(navBarWidthRange).assertEqual("50.00vp, 300.00vp");
console.info('ArkUX_Navigation_1600 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Navigation_1600 ERR '+ JSON.stringify(err));
}
done();
},500)
})
it('ArkUX_Navigation_1700', 0, async function (done) {
console.info('ArkUX_Navigation_1700 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Navigation_1700');
console.info('ArkUX_Navigation_1700 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Navigation_1700 obj is: " + JSON.stringify(obj));
let mode = obj.$attrs.mode
let minContentWidth = obj.$attrs.minContentWidth
let navBarWidth = obj.$attrs.navBarWidth
let navBarWidthRange = obj.$attrs.navBarWidthRange
expect(mode).assertEqual("NavigationMode.STACK");
expect(minContentWidth).assertEqual("20000.00vp");
expect(navBarWidth).assertEqual("15000.00vp");
expect(navBarWidthRange).assertEqual("10000.00vp, 30000.00vp");
console.info('ArkUX_Navigation_1700 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Navigation_1700 ERR '+ JSON.stringify(err));
}
done();
},500)
})
it('ArkUX_Navigation_1800', 0, async function (done) {
console.info('ArkUX_Navigation_1800 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Navigation_1800');
console.info('ArkUX_Navigation_1800 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Navigation_1800 obj is: " + JSON.stringify(obj));
let mode = obj.$attrs.mode
let minContentWidth = obj.$attrs.minContentWidth
let navBarWidth = obj.$attrs.navBarWidth
let navBarWidthRange = obj.$attrs.navBarWidthRange
expect(mode).assertEqual("NavigationMode.SPLIT");
expect(minContentWidth).assertEqual("30.00vp");
expect(navBarWidth).assertEqual("100.00vp");
expect(navBarWidthRange).assertEqual("10.00vp, 20.00vp");
console.info('ArkUX_Navigation_1800 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Navigation_1800 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Navigation_1900', 0, async function (done) {
console.info('ArkUX_Navigation_1900 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Navigation_1900');
console.info('ArkUX_Navigation_1900 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Navigation_1900 obj is: " + JSON.stringify(obj));
let mode = obj.$attrs.mode
let minContentWidth = obj.$attrs.minContentWidth
let navBarWidth = obj.$attrs.navBarWidth
let navBarWidthRange = obj.$attrs.navBarWidthRange
expect(mode).assertEqual("NavigationMode.STACK");
expect(minContentWidth).assertEqual("360.00vp");
expect(navBarWidth).assertEqual("100.00vp");
expect(navBarWidthRange).assertEqual("240.00vp, 280.00vp");
console.info('ArkUX_Navigation_1900 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Navigation_1900 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Navigation_2000', 0, async function (done) {
console.info('ArkUX_Navigation_2000 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Navigation_2000');
console.info('ArkUX_Navigation_2000 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Navigation_2000 obj is: " + JSON.stringify(obj));
let mode = obj.$attrs.mode
let minContentWidth = obj.$attrs.minContentWidth
let navBarWidth = obj.$attrs.navBarWidth
let navBarWidthRange = obj.$attrs.navBarWidthRange
expect(mode).assertEqual("NavigationMode.SPLIT");
expect(minContentWidth).assertEqual("100.00vp");
expect(navBarWidth).assertEqual("100.00vp");
expect(navBarWidthRange).assertEqual("100.00vp, 100.00vp");
console.info('ArkUX_Navigation_2000 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Navigation_2000 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('ArkUX_Navigation_2100', 0, async function (done) {
console.info('ArkUX_Navigation_2100 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey('ArkUX_Navigation_2100');
console.info('ArkUX_Navigation_2100 START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
console.info("ArkUX_Navigation_2100 obj is: " + JSON.stringify(obj));
let mode = obj.$attrs.mode
let minContentWidth = obj.$attrs.minContentWidth
let navBarWidth = obj.$attrs.navBarWidth
let navBarWidthRange = obj.$attrs.navBarWidthRange
expect(mode).assertEqual("NavigationMode.SPLIT");
expect(minContentWidth).assertEqual("40.00%");
expect(navBarWidth).assertEqual("30.00%");
expect(navBarWidthRange).assertEqual("20.00%, 50.00%");
console.info('ArkUX_Navigation_2100 END ');
} catch(err) {
expect().assertFail()
console.info('ArkUX_Navigation_2100 ERR '+ JSON.stringify(err));
}
done();
},500)
});
});
};
\ No newline at end of file
/*
* Copyright (c) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import hilog from '@ohos.hilog';
import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium'
import events_emitter from '@ohos.events.emitter';
import router from '@system.router';
export default function noBarriersGroupTest() {
describe('noBarriersGroupTest', function () {
beforeEach(async function (done) {
console.info("flex beforeEach start");
let options = {
uri: 'TestAbility/pages/noBarriersGroup',
}
try {
router.clear();
let pages = router.getState();
console.info("get noBarriersGroup state success " + JSON.stringify(pages));
if (!("noBarriersGroup" == pages.name)) {
console.info("get noBarriersGroup state success " + JSON.stringify(pages.name));
let result = await router.push(options);
console.info("push noBarriersGroup page success " + JSON.stringify(result));
}
} catch (err) {
console.error("push noBarriersGroup page error: " + err);
}
done()
});
// Defines a test suite. Two parameters are supported: test suite name and test suite function.
beforeAll(function () {
// Presets an action, which is performed only once before all test cases of the test suite start.
// This API supports only one parameter: preset action function.
})
beforeEach(function () {
// Presets an action, which is performed before each unit test case starts.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: preset action function.
})
afterEach(function () {
// Presets a clear action, which is performed after each unit test case ends.
// The number of execution times is the same as the number of test cases defined by **it**.
// This API supports only one parameter: clear action function.
})
afterAll(function () {
// Presets a clear action, which is performed after all test cases of the test suite end.
// This API supports only one parameter: clear action function.
})
it('noBarriersGroup001', 0, async function (done) {
console.info('noBarriersGroup001 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup1");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup001 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup001 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup002', 0, async function (done) {
console.info('noBarriersGroup002 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup2");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup002 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup002 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup003', 0, async function (done) {
console.info('noBarriersGroup003 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup3");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup003 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup003 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup004', 0, async function (done) {
console.info('noBarriersGroup004 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup4");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup004 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup004 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup005', 0, async function (done) {
console.info('noBarriersGroup005 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup5");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup005 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup005 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup006', 0, async function (done) {
console.info('noBarriersGroup006 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup6");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup006 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup006 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup007', 0, async function (done) {
console.info('noBarriersGroup007 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup7");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup007 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup007 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup008', 0, async function (done) {
console.info('noBarriersGroup008 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup8");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup008 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup008 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup009', 0, async function (done) {
console.info('noBarriersGroup009 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup9");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup009 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup009 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup0010', 0, async function (done) {
console.info('noBarriersGroup0010 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup10");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup0010 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup0010 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup0011', 0, async function (done) {
console.info('noBarriersGroup0011 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup11");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup0011 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup0011 ERR '+ JSON.stringify(err));
}
done();
},500)
});
it('noBarriersGroup0012', 0, async function (done) {
console.info('noBarriersGroup0012 START');
setTimeout(()=>{
try{
let strJson = getInspectorByKey("noBarriersGroup12");
console.info('noBarriersGroup START :'+ JSON.stringify(strJson));
let obj = JSON.parse(strJson);
let type = obj.$type
expect(type).assertEqual("Column");
console.info('noBarriersGroup0012 END ');
} catch(err) {
expect().assertFail()
console.info('noBarriersGroup0012 ERR '+ JSON.stringify(err));
}
done();
},500)
});
})
}
\ No newline at end of file
......@@ -226,7 +226,7 @@ export default function stageMediaquery() {
});
it('testmediaQueryOff0013', 0, async function (done) {
let mediaQuery = globalThis.uiContent.getMediaquery();
let mediaQuery = globalThis.uiContent.getMediaQuery();
console.info('testmediaQueryOff0013 START');
let result;
try {
......
......@@ -20,6 +20,13 @@
"TestAbility/pages/stageAnimator",
"TestAbility/pages/textSpanFont",
"TestAbility/pages/gridScrollBar",
"TestAbility/pages/sidebarType"
"TestAbility/pages/sidebarType",
"TestAbility/pages/navigationType",
"TestAbility/pages/noBarrierComponents",
"TestAbility/pages/noBarriersGroup",
"TestAbility/pages/assemblyCallback",
"TestAbility/pages/list",
"TestAbility/pages/grid",
"TestAbility/pages/swiper"
]
}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册