提交 4d7ec310 编写于 作者: O openharmony_ci 提交者: Gitee

!1438 ACE2.0 TS 测试用例

Merge pull request !1438 from jiyong/master
......@@ -13,5 +13,9 @@
group("ace") {
testonly = true
deps = [ "ace_standard:ace_standard_test" ]
deps = [
"ace_ets_standard:ActsAceEtsStTest",
"ace_ets_test:ActsAceEtsTest",
"ace_standard:ace_standard_test",
]
}
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceEtsStTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_demo_ets_assets",
":ace_demo_ets_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAceEtsStTest"
}
ohos_js_assets("ace_demo_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("ace_demo_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "600000",
"package": "com.open.harmony.myapplication",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAceEtsStTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.open.harmony.myapplication",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "com.open.harmony.myapplication",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/Button",
"pages/Blank",
"pages/DataPanel",
"pages/Divider",
"pages/Text",
"pages/RowSplit",
"pages/Scroll",
"pages/Stack",
"pages/Image",
"pages/Progress",
"pages/Qrcode",
"pages/Rating",
"pages/Span",
"pages/Slider",
"pages/Badge",
"pages/Column",
"pages/ColumnSplit",
"pages/Counter",
"pages/Flex",
"pages/GridContainer"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct badge {
@State counts: number = 33
@State message: string = 'new'
@State active: boolean = false
private content: string = "badge Page";
onPageShow() {
console.info('badge page show called');
}
onBuildDone() {
console.info('badge page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Badge({
count: this.counts,
position: BadgePosition.Right,
maxCount: 99,
style: { color: 0xFFFFFF, fontSize: 16, badgeSize: 20, badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(100).height(50).backgroundColor(0x317aff)
}
.width(100)
.height(50)
.key('badge')
Text("BadgePosition.RightTop").fontSize(16)
Badge({
count: this.counts,
position: BadgePosition.RightTop,
maxCount: 99,
style: { color: 0xFFFFFF, fontSize: 16, badgeSize: 20, badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(100).height(50).backgroundColor(0x317aff)
}
.width(100)
.height(50)
.key('badge1')
Text("BadgePosition.Left").fontSize(16)
Badge({
count: this.counts,
position: BadgePosition.Left,
maxCount: 99,
style: { color: Color.Pink, fontSize: 16, badgeSize: 20, badgeColor: Color.Red }
}) {
Button('message')
.onClick(() => {
this.counts++
})
.width(100).height(50).backgroundColor(0x317aff)
}
.width(100)
.height(50)
.key('badge2')
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct blank_testcase {
@State Color: Color = Color.Pink
@State active: boolean = false
private content: string = "Blank Page"
onPageShow() {
console.info('Blank page show called');
}
onBuildDone() {
console.info('Blank page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Blank(100)
.color(this.Color)
.key('blank')
Text('on/off').fontSize(18).height(60)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router'
@Entry
@Component
struct button_testcase {
@State stateEffect: boolean = true
@State ButtonType: ButtonType = ButtonType.Circle
private content: string = "Button Page";
onPageShow() {
console.info('Button page show called');
}
onBuildDone() {
console.info('Button page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button('1.value', { type: ButtonType.Circle, stateEffect: this.stateEffect })
.height(40)
.width(40)
.key('button')
.backgroundColor('#0D9FFB')
.onClick(() => {
router.back()
})
.padding(10)
Button() {
Text("2.Capsule")
}
.type(ButtonType.Capsule)
.stateEffect(false)
.backgroundColor('#0D9FFB')
.padding(10)
.key('button1')
Button() {
Text("3.Normal")
}.type(ButtonType.Normal)
.backgroundColor('#0D9FFB')
.key('button2')
}.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct column {
@State active: boolean = false
private content: string = "Column Page"
onPageShow() {
console.info('Column page show called');
}
onBuildDone() {
console.info('Column page build done called');
}
build() {
Column({ space: 5 }) {
Text('alignItems(Center)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.Center).width('90%').border({ width: 1 }).key('column')
Text('alignItems(Start)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.Start).width('90%').border({ width: 1 }).key('column1')
Text('alignItems(End)').fontSize(9).fontColor(0xCCCCCC).width('90%')
Column() {
Column().width('50%').height(50).backgroundColor(0xAFEEEE)
Column().width('50%').height(50).backgroundColor(0x00FFFF)
}.alignItems(HorizontalAlign.End).width('90%').border({ width: 1 }).key('column2')
}.width('100%').padding({ top: 5 })
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct columnSplit {
private content: string = "ColumnSplit Page"
onPageShow() {
console.info('ColumnSplit page show called');
}
onBuildDone() {
console.info('ColumnSplit page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column() {
Text('ColumnSplit').fontSize(9).fontColor(0xCCCCCC).width('90%')
ColumnSplit() {
Text('1').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('2').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('3').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.key('columnSplit')
.resizeable(true)
.width('90%').height('60%')
}.width("100%")
Column() {
Text('ColumnSplit1').fontSize(9).fontColor(0xCCCCCC).width('90%')
ColumnSplit() {
Text('1').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('2').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('3').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center)
Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center)
}.key('columnSplit1')
.resizeable(false)
.width('90%').height('60%')
}.width("100%")
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct counter {
@State value: number = 0
@State active: boolean = false
private content: string = "Counter Page"
onPageShow() {
console.info('Counter page show called');
}
onBuildDone() {
console.info('Counter page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Counter() {
Text(this.value.toString())
}.margin(100)
.key('counter')
.onInc(() => {
this.value++
})
.onDec(() => {
this.value--
})
}.width("100%")
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router'
@Entry
@Component
struct dataPanel_testcase {
@State width: string= "200"
@State height: string= "100"
@State active: boolean = false
private content: string = "DataPanel Page"
onPageShow() {
console.info('Blank page show called');
}
onBuildDone() {
console.info('Blank page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
DataPanel({ values: [20, 40, 20], max: 100 })
.width(this.width)
.height(this.height)
.key('DataPanel')
.onClick(() => {
router.back()
})
.closeEffect(false)
DataPanel({ values: [20, 40, 20], max: 100 })
.width(this.width)
.height(this.height)
.key('DataPanel2')
.onClick(() => {
router.back()
})
.closeEffect(true)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router'
@Entry
@Component
struct divider_textcase {
@State vertical: boolean = true
@State color: Color = Color.Red
@State strokeWidth: number = 7
@State lineCap: LineCapStyle = LineCapStyle.Butt
@State active: boolean = false
private content: string = "Divider Page";
onPageShow() {
console.info('Button page show called');
}
onBuildDone() {
console.info('Button page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
Divider()
.lineCap(LineCapStyle.Butt)
.strokeWidth(this.strokeWidth)
.color(this.color)
.vertical(this.vertical)
.height(150)
.key('divider')
.onClick(() => {
router.back()
})
Divider()
.lineCap(LineCapStyle.Round)
.vertical(false)
.color(Color.Green)
.strokeWidth(10)
.height(150)
.key('divider1')
Divider()
.lineCap(LineCapStyle.Square)
.color(Color.Green)
.vertical(true)
.strokeWidth(10)
.height(150)
.key('divider2')
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct flex {
private content: string = "Flex Page"
onPageShow() {
console.info('Flex page show called');
}
onBuildDone() {
console.info('Flex page build done called');
}
build() {
Scroll() {
Column() {
Text("Flex").fontSize(16)
Flex({
direction: FlexDirection.Column,
wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.Center,
alignContent: FlexAlign.Start,
alignItems: ItemAlign.Auto
}) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column({ space: 5 }) {
Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
Text('Flex01').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex02').width('20%').height(50).backgroundColor(0xD2B48C)
Text('Flex03').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex04').width('20%').height(50).backgroundColor(0xD2B48C)
}.width('100%').margin({ top: 5 })
}
.key('flex')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text("Flex1").fontSize(16)
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
justifyContent: FlexAlign.Start,
alignContent: FlexAlign.Center,
alignItems: ItemAlign.Center
}) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column({ space: 5 }) {
Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
Text('Flex10').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex12').width('20%').height(50).backgroundColor(0xD2B48C)
Text('Flex13').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex14').width('20%').height(50).backgroundColor(0xD2B48C)
}.width('100%').margin({ top: 5 })
}
.key('flex1')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text("Flex2").fontSize(16)
Flex({
direction: FlexDirection.RowReverse,
wrap: FlexWrap.WrapReverse,
justifyContent: FlexAlign.End,
alignContent: FlexAlign.End,
alignItems: ItemAlign.Start
}) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column({ space: 5 }) {
Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
Text('Flex21').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex22').width('20%').height(50).backgroundColor(0xD2B48C)
Text('Flex23').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex24').width('20%').height(50).backgroundColor(0xD2B48C)
}.width('100%').margin({ top: 5 })
}
.key('flex2')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text("Flex3").fontSize(16)
Flex({
direction: FlexDirection.ColumnReverse,
wrap: FlexWrap.WrapReverse,
justifyContent: FlexAlign.SpaceBetween,
alignContent: FlexAlign.SpaceBetween,
alignItems: ItemAlign.Stretch
}) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column({ space: 5 }) {
Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
Text('Flex31').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex32').width('20%').height(50).backgroundColor(0xD2B48C)
Text('Flex33').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex34').width('20%').height(50).backgroundColor(0xD2B48C)
}.width('100%').margin({ top: 5 })
}
.key('flex3')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text("Flex4").fontSize(16)
Flex({
direction: FlexDirection.ColumnReverse,
wrap: FlexWrap.WrapReverse,
justifyContent: FlexAlign.SpaceEvenly,
alignContent: FlexAlign.SpaceEvenly,
alignItems: ItemAlign.End
}) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column({ space: 5 }) {
Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
Text('Flex41').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex42').width('20%').height(50).backgroundColor(0xD2B48C)
Text('Flex43').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex44').width('20%').height(50).backgroundColor(0xD2B48C)
}.width('100%').margin({ top: 5 })
}
.key('flex4')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text("Flex5").fontSize(16)
Flex({
direction: FlexDirection.ColumnReverse,
wrap: FlexWrap.WrapReverse,
justifyContent: FlexAlign.SpaceAround,
alignContent: FlexAlign.SpaceAround,
alignItems: ItemAlign.Baseline
}) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column({ space: 5 }) {
Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
Text('Flex51').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex52').width('20%').height(50).backgroundColor(0xD2B48C)
Text('Flex53').width('20%').height(50).backgroundColor(0xF5DEB3)
Text('Flex54').width('20%').height(50).backgroundColor(0xD2B48C)
}.width('100%').margin({ top: 5 })
}
.key('flex5')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
}
}
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct gridContainer {
@State sizeType: SizeType = SizeType.XS
@State active: boolean = false
private content: string = "GridContainer Page"
onPageShow() {
console.info('GridContainer page show called');
}
onBuildDone() {
console.info('GridContainer page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Scroll() {
Column({ space: 5 }) {
GridContainer({ columns: 12, sizeType: this.sizeType, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer')
.width('90%')
.alignItems(HorizontalAlign.Start)
Text('Click Simulate to change the device width').fontSize(9).width('90%').fontColor(0xCCCCCC)
Row() {
Button('XS')
.onClick(() => {
this.sizeType = SizeType.XS
}).backgroundColor(0x317aff)
Button('SM')
.onClick(() => {
this.sizeType = SizeType.SM
}).backgroundColor(0x317aff)
Button('MD')
.onClick(() => {
this.sizeType = SizeType.MD
}).backgroundColor(0x317aff)
Button('LG')
.onClick(() => {
this.sizeType = SizeType.LG
}).backgroundColor(0x317aff)
}
GridContainer({ columns: 12, sizeType: SizeType.MD, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer1')
.width('90%')
.alignItems(HorizontalAlign.Center)
GridContainer({ columns: 12, sizeType: SizeType.SM, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer2')
.width('90%')
.alignItems(HorizontalAlign.End)
GridContainer({ columns: 12, sizeType: SizeType.LG, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer3')
.width('90%')
.alignItems(HorizontalAlign.End)
GridContainer({ columns: 12, sizeType: SizeType.Auto, gutter: 10, margin: 20 }) {
Row() {
Text('1')
.useSizeType({
xs: { span: 6, offset: 0 },
sm: { span: 2, offset: 0 },
md: { span: 2, offset: 0 },
lg: { span: 2, offset: 0 }
})
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
Text('2').gridSpan(2)
.height(50).backgroundColor(0x00BFFF).textAlign(TextAlign.Center)
Text('3').gridOffset(3)
.height(50).backgroundColor(0x4682B4).textAlign(TextAlign.Center)
}
}.key('gridContainer4')
.width('90%')
.alignItems(HorizontalAlign.End)
}.width('100%').margin({ top: 5 })
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct image_textcase {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Image page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Cover)
.objectRepeat(ImageRepeat.NoRepeat)
.interpolation(ImageInterpolation.None)
.renderMode(ImageRenderMode.Original)
.sourceSize({ width: 200, height: 100 })
.alt("/resources/rawfile/person.png")
.key('image1')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Contain)
.objectRepeat(ImageRepeat.X)
.interpolation(ImageInterpolation.High)
.renderMode(ImageRenderMode.Template)
.key('image2')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.Fill)
.objectRepeat(ImageRepeat.Y)
.interpolation(ImageInterpolation.Low)
.key('image3')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.None)
.objectRepeat(ImageRepeat.XY)
.interpolation(ImageInterpolation.Medium)
.key('image4')
Image("/resources/rawfile/hand.png")
.objectFit(ImageFit.ScaleDown)
.key('image5')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(4)
}
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct navigator_testcase {
@State active: boolean = false
@State params: Object = { text: 'news' }
build() {
Column() {
Navigator({ target: "pages/index", type: NavigationType.Back }) {
Text('Navigator test in Navigator,back')
}.active(this.active)
.key('navigator')
.params({
data: 24
})
Navigator({ target: "pages/index", type: NavigationType.Push }) {
Text('Navigator test in Navigator,push')
}.active(this.active)
.key('navigator2')
.params({
data: 24
})
Navigator({ target: "pages/index", type: NavigationType.Replace }) {
Text('Navigator test in Navigator,replace')
}.active(this.active)
.key('navigator3')
.params({
data: 24
})
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct PanelExample {
@State show: boolean = true
build() {
Column() {
Text('2021-09-30 Today Calendar: 1.afternoon......Click for details')
.width('90%')
.height(50)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
.padding({ left: 20 })
.onClick(() => {
this.show = !this.show
})
Panel(this.show) {
Column() {
Text('Today Calendar')
Divider()
Text('1. afternoon 4:00 The project meeting')
}
}
.key('panel')
.type(PanelType.Foldable)
.mode(PanelMode.Half)
.dragBar(true)
.fullHeight(500)
.halfHeight(250)
.miniHeight(100)
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
})
Panel(this.show) {
Column() {
Text('Today Calendar')
Divider()
Text('1. afternoon 4:00 The project meeting')
}
}
.key('panel2')
.type(PanelType.Minibar)
.mode(PanelMode.Mini)
.dragBar(true)
.fullHeight(500)
.halfHeight(250)
.miniHeight(100)
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
})
Panel(false) {
Column() {
Text('Today Calendar')
Divider()
Text('1. afternoon 4:00 The project meeting')
}
}
.key('panel3')
.type(PanelType.Temporary)
.mode(PanelMode.Full)
.dragBar(true)
.fullHeight(500)
.halfHeight(250)
.miniHeight(100)
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
})
}.width('100%').height('50%').backgroundColor(0xDCDCDC).padding({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct progress_testcase {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Progress page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Progress({ value: 20, total: 40, style: ProgressStyle.Linear })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress')
Progress({ value: 20, total: 40, style: ProgressStyle.Eclipse })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress2')
}
.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct qrcode_textcase {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`Qrcode page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
QRCode('hello world')
.color("#FFFFC0CB")
.width("200")
.height("100")
.key('qrcode')
}
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct rating_testcase {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Rating page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Rating({ rating: 2, indicator: false })
.stepSize(0.5)
.stars(5)
.starStyle({
backgroundUri: '/resources/rawfile/star-1-1.png',
foregroundUri: '/resources/rawfile/star-1-3.png',
secondaryUri: '/resources/rawfile/star-1-2.png'
})
.key('rating1')
Rating({ rating: 2, indicator: true })
.stepSize(0.5)
.stars(5)
.starStyle({
backgroundUri: '/resources/rawfile/star-1-1.png',
foregroundUri: '/resources/rawfile/star-1-3.png',
secondaryUri: '/resources/rawfile/star-1-2.png'
})
.key('rating2')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router'
@Entry
@Component
struct rowSplit_testcase {
@State resizeable: boolean = false
private content: string = "rowSplit Page";
onPageShow() {
console.info('RowSplit page show called');
}
onBuildDone() {
console.info('RowSplit page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
RowSplit() {
Column() {
Text('Demo1.RowSplit')
.fontSize(15)
.fontWeight(FontWeight.Bold)
}
Column() {
Text('Demo2.RowSplit')
.fontSize(15)
.fontWeight(FontWeight.Bold)
}
}
.height(100)
.key('rowSplit')
.resizeable(this.resizeable)
.onClick(() => {
router.back()
})
RowSplit() {
Column() {
Text('Demo3.RowSplit')
.fontSize(15)
.fontWeight(FontWeight.Bold)
}
Column() {
Text('Demo4.RowSplit')
.fontSize(15)
.fontWeight(FontWeight.Bold)
}
}.height(100)
.key('rowSplit1')
.resizeable(true)
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct scroll_testcase {
@State scrollBarWidth: number = 20
@State scrollable: ScrollDirection = ScrollDirection.None
@State scrollBarColor: Color = Color.Pink
@State scrollBar: BarState= BarState.On
private value1: Array<number> = [1, 2, 3, 4, 5, 6, 7, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30]
@State edge: Edge= Edge.Bottom
private content: string = "Scroll Page";
scroller: Scroller = new Scroller();
onPageShow() {
console.info('Button page show called');
}
onBuildDone() {
console.info('Button page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Scroll(this.scroller) {
Column() {
ForEach(
this.value1,
item => {
Text(`${item}`)
.fontSize(15)
.width(400)
.margin(10)
.height(70)
.backgroundColor(0xfff5deb3)
},
item => item
)
}
}
.scrollable(ScrollDirection.Vertical)
.scrollBar(this.scrollBar)
.scrollBarColor(this.scrollBarColor)
.scrollBarWidth(this.scrollBarWidth)
.key('scroll')
.width(300)
.height(200)
.onScroll((xOffset: number, yOffset: number) => {
console.error(` current offset is ${xOffset} ${yOffset}`)
})
.onScrollEnd(() => {
console.error(` now on scroll end`)
})
Scroll() {
Row() {
Text('scroll uppppp')
.width(80)
.height(100)
.backgroundColor(Color.Yellow)
.margin({
right: 5,
left: 5
})
.key('text')
Text('scroll to')
.width(100)
.height(100)
.backgroundColor(Color.Green)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollTo({
xOffset: 100,
yOffset: 100,
})
})
Text('scroll page')
.width(100)
.height(100)
.backgroundColor(Color.Blue)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollPage({
next: true
})
})
}
}
.height(100).scrollable(ScrollDirection.Horizontal)
Scroll() {
Column() {
Text("start").fontSize(30)
Text("scrollable1")
Text("scrollable2")
Text("scrollable3")
Text("scrollable4")
Text("scrollable1")
Text("scrollable2")
Text("scrollable3")
Text("scrollable4")
}
}
.padding(10)
.scrollable(ScrollDirection.None)
.scrollBar(BarState.Off)
.scrollBarColor(Color.Red)
.scrollBarWidth(5)
.width(300)
.height(200)
.key('scroll1')
Scroll() {
Column() {
Text("start").fontSize(30)
Text("scrollable1")
Text("scrollable2")
Text("scrollable3")
Text("scrollable4")
Text("scrollable1")
Text("scrollable2")
Text("scrollable3")
Text("scrollable4")
}
}
.padding(10)
.scrollable(ScrollDirection.Horizontal)
.scrollBar(BarState.Off)
.scrollBarColor(Color.Red)
.scrollBarWidth(5)
.width(300)
.height(200)
.key('scroll2')
}
.key('flex')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct slider {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Slider page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Slider({
value: 40,
min: 0,
max: 100,
step: 1,
style: SliderStyle.OutSet
})
.blockColor('#FFFF0000')
.selectedColor('#FF0000FF')
.trackColor('#FF808080')
.showTips(false)
.showSteps(false)
.width("200")
.height("100")
.key('slider1')
Slider({
value: 40,
min: 0,
max: 100,
step: 1,
style: SliderStyle.InSet
})
.blockColor(Color.Red)
.selectedColor(Color.Blue)
.trackColor(Color.Gray)
.showTips(true)
.showSteps(true)
.key('slider2')
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct span_textcase {
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text() {
Span('Test Span demo')
.decoration({ type: TextDecorationType.LineThrough, "color": Color.Red })
.textCase(TextCase.UpperCase)
.fontColor(Color.Blue)
.fontSize("20fp")
.fontWeight(FontWeight.Bold)
.fontStyle(FontStyle.Italic)
.key('span1')
Span('The second test Span demo')
.textCase(TextCase.LowerCase)
.fontColor(Color.Black)
.fontSize("30fp")
.key('span2')
Span('The third test Span demo')
.textCase(TextCase.Normal)
.fontColor(Color.Yellow)
.fontSize("30fp")
.key('span3')
}
}
.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(4)
}
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router'
@Entry
@Component
struct stack_testcase {
@State alignContent: Alignment = Alignment.Bottom
private content: string = "Stack Page";
onPageShow() {
console.info('Stack page show called');
}
onBuildDone() {
console.info('Stack page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Stack({ alignContent: this.alignContent }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}
.width('100%')
.height(80)
.margin({ top: 5 })
.key('stack')
.onClick(() => {
router.back()
})
Stack({ alignContent: Alignment.BottomStart }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack1')
Stack({ alignContent: Alignment.BottomEnd }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack2')
Stack({ alignContent: Alignment.Start }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack3')
Stack({ alignContent: Alignment.Center }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack4')
Stack({ alignContent: Alignment.End }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(80).margin({ top: 5 })
.key('stack5')
Stack({ alignContent: Alignment.Top }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(60).margin({ top: 5 })
.key('stack6')
Stack({ alignContent: Alignment.TopStart }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(60).margin({ top: 5 })
.key('stack7')
Stack({ alignContent: Alignment.TopEnd }) {
Text('First child, show in bottom').width('90%').height('100%').backgroundColor(0xd2cab3).align(Alignment.Top)
Text('Second child, show in top').width('70%').height('60%').backgroundColor(0xc1cbac).align(Alignment.Top)
}.width('100%').height(60).margin({ top: 5 })
.key('stack8')
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import router from '@system.router'
var paramInfo = router.getParams()
console.info("cd paramInfo" + JSON.stringify(paramInfo))
@Entry
@Component
struct text_textcase {
@State textAlign: TextAlign= TextAlign.End
@State lineHeight: string= '15fp'
@State overflow: TextOverflow = TextOverflow.Ellipsis
@State textOverflow: textOverflow<{ "overflow": TextOverflow }> = { "overflow": this.overflow }
@State maxLines: number = 2
@State baselineOffset: number = 0
@State textCase: TextCase= TextCase.Normal
@State decoration: decoration<{
type: TextDecorationType,
color: Color
}> = { type: TextDecorationType.Underline, color: Color.Red }
@State color: Color = Color.Red
@State width: string= "200"
@State height: string= "100"
@State size: size = { width: 200, height: 100 }
@State marginBottom: string = "10px"
@State marginTop: string = "10px"
@State marginLeft: string = "10px"
@State marginRingt: string= "10px"
@State paddingBottom: string= "5"
@State paddingTop: string= "5"
@State paddingLeft: string= "5"
@State paddingRingt: string= "5"
@State constraintSize: constraintSize = { minWidth: 20, maxWidth: 200, minHeight: 0, maxHeight: 50 }
@State layoutPriority: string= "9px"
@State layoutWeight: string = "10px"
@State align: Alignment = Alignment.Center
@State direction: Direction = Direction.Auto
@State position: position<{
x: string,
y: string
}> = { x: "50", y: "50" }
@State markAnchor: markAnchor<{
x: string,
y: string
}> = { x: "50", y: "50" }
@State offset: offset<{
x: string,
y: string
}> = { x: "50", y: "50" }
@State flexGrow: number = 5
@State flexShrink: number = 2
@State flexBasis: number = 0
@State alignSelf: ItemAlign = ItemAlign.Auto
@State borderStyle: BorderStyle = BorderStyle.Dashed
@State borderRadius: number = 10
@State borderWidth: string= "4px"
@State borderColor: Color= Color.Blue
@State backgroundColor: Color = Color.Pink
@State backgroundImageSize: ImageSize = ImageSize.Cover
@State backgroundImagePosition: Alignment= Alignment.Center
@State opacity: number= 1
@State visibility: Visibility= Visibility.Visible
@State enabled: boolean = false
@State zIndex: number = 1
@State fontStyle: FontStyle = FontStyle.Italic
@State fontSize: number = 15
@State fontWeight: FontWeight= FontWeight.Bold
@State fontColor: Color= Color.Black
@State active: boolean = false
private content: string = "Text Page";
onPageShow() {
console.info('Text page show called');
}
onBuildDone() {
console.info('Text page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text('Text Anto test,Text Anto test,Text Anto test,Text Anto test,test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test')
.width(this.width)
.height(this.height)
.padding({ bottom: this.paddingBottom, top: this.paddingTop, right: this.paddingRingt, left: this.paddingLeft })
.margin({ bottom: this.marginBottom, top: this.marginTop, right: this.marginRingt, left: this.marginLeft })
.constraintSize(this.constraintSize)
.layoutWeight(this.layoutWeight)
.align(this.align)
.direction(this.direction)
.position(this.position)
.markAnchor(this.markAnchor)
.offset(this.offset)
.flexBasis(this.flexBasis)
.flexGrow(this.flexGrow)
.flexShrink(this.flexShrink)
.alignSelf(this.alignSelf)
.borderStyle(this.borderStyle)
.borderRadius(this.borderRadius)
.borderWidth(this.borderWidth)
.borderColor(this.borderColor)
.backgroundColor(this.backgroundColor)
.opacity(this.opacity)
.visibility(this.visibility)
.enabled(this.enabled)
.zIndex(this.zIndex)
.fontColor(this.fontColor)
.fontSize(this.fontSize)
.fontWeight(this.fontWeight)
.fontStyle(this.fontStyle)
.fontFamily("sans-serif")
.textAlign(this.textAlign)
.textOverflow(this.textOverflow)
.lineHeight(this.lineHeight)
.baselineOffset(this.baselineOffset)
.maxLines(2)
.textCase(this.textCase)
.decoration(this.decoration)
.aspectRatio(1)
.fontColor(Color.Black)
.key('Text')
Text('Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test')
.size({ width: 100, height: 50 })
.padding({ bottom: 5, top: 5, right: 5, left: 10 })
.margin({ bottom: 15, top: 10, right: 10, left: 10 })
.fontSize(13)
.textAlign(TextAlign.Start)
.align(Alignment.Start)
.direction(Direction.Ltr)
.alignSelf(ItemAlign.Start)
.borderStyle(BorderStyle.Dotted)
.borderWidth(2)
.visibility(Visibility.Hidden)
.enabled(true)
.fontWeight(FontWeight.Normal)
.textAlign(TextAlign.Start)
.textOverflow(TextOverflow.Clip)
.maxLines(2)
.textCase(TextCase.LowerCase)
.decoration({ "type": TextDecorationType.LineThrough, "color": Color.Red })
.fontColor(Color.White)
.key('Text1')
Text('Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.width('100%')
.textAlign(TextAlign.Center)
.align(Alignment.TopEnd)
.direction(Direction.Rtl)
.alignSelf(ItemAlign.Center)
.borderStyle(BorderStyle.Solid)
.borderWidth(2)
.visibility(Visibility.None)
.fontWeight(FontWeight.Bolder)
.textAlign(TextAlign.Center)
.textOverflow(TextOverflow.None)
.textCase(TextCase.UpperCase)
.decoration({ "type": TextDecorationType.None, "color": Color.Red })
.fontColor(Color.Blue)
.key('Text2')
Text('Text Anto test,Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.Top)
.alignSelf(ItemAlign.End)
.borderWidth(2)
.width('100%')
.fontWeight(FontWeight.Lighter)
.decoration({ type: TextDecorationType.Overline, color: Color.Red })
.fontColor(Color.Gray)
.key('Text3')
Text('Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.TopStart)
.alignSelf(ItemAlign.Baseline)
.borderWidth(2)
.width('100%')
.fontWeight(FontWeight.Medium)
.fontColor(Color.Brown)
.key('Text4')
Text('Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.End)
.alignSelf(ItemAlign.Stretch)
.borderWidth(2)
.width('100%')
.fontWeight(FontWeight.Regular)
.fontColor(Color.Grey)
.key('Text5')
Text('Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.BottomEnd)
.width('100%')
.fontColor(Color.Orange)
.key('Text6')
Text('Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.Bottom)
.width('100%')
.fontColor(Color.Yellow)
.key('Text7')
Text('Text Anto test,Text Anto test,Text Anto test')
.fontSize(13)
.align(Alignment.BottomStart)
.width('100%')
.key('Text8')
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../test/List.test.ets"
import featureAbility from "@ohos.ability.featureAbility"
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
const reportExtend = new ReportExtend(file)
core.addService('report', reportExtend)
core.init()
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
const timeout = 10000
configService.setConfig(timeout)
console.info('parameters---->' + JSON.stringify(Want.parameters))
configService.setConfig(Want.parameters)
testsuite()
core.execute()
console.info('Operation successful. Data: ' + JSON.stringify(Want));
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ccc World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function badgeJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('badgeTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name testBadge010
* @tc.desc aceEtsTest
*/
it('testBadge010', 0, async function (done) {
console.info('new Badge0 START');
let options = {
uri: 'pages/Badge',
}
try {
let result = await router.push(options)
console.info("push badge page success " + JSON.stringify(result));
} catch (err) {
console.error("push badge page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('badge');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Badge');
console.log(JSON.stringify(obj.$type))
console.info("yr badge0 type: " + JSON.stringify(obj.$type));
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.count).assertEqual('33');
console.log("yr badge0 count-'33'" + JSON.stringify(obj.$attrs.count))
expect(obj.$attrs.position).assertEqual('BadgePosition.Right');
console.log("yr badge0 position-BadgePosition.Right" + JSON.stringify(obj.$attrs.position))
expect(obj.$attrs.maxCount).assertEqual('99');
console.log("yr badge0 maxCount-'99'" + JSON.stringify(obj.$attrs.maxCount))
expect(obj.$attrs.style.color).assertEqual('0xFFFFFF');
expect(obj.$attrs.style.fontSize).assertEqual('16');
expect(obj.$attrs.style.badgeSize).assertEqual('20');
console.log("badge0 style : " + JSON.stringify(obj.$attrs.style))
console.info('testGetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0610
* @tc.name testBadge020
* @tc.desc aceEtsTest
*/
it('testBadge020', 0, async function (done) {
console.info('new Badge1 START');
let strJson = getInspectorByKey('badge1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.position).assertEqual('BadgePosition.RightTop');
console.log("yr badge1 position-'BadgePosition.RightTop'" + JSON.stringify(obj.$attrs.position))
console.info('new Badge1 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0620
* @tc.name testBadge030
* @tc.desc aceEtsTest
*/
it('testBadge030', 0, async function (done) {
console.info('new Badge2 START');
let strJson = getInspectorByKey('badge2');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.position).assertEqual('BadgePosition.Left');
console.log("yr badge2 position-'BadgePosition.Left'" + JSON.stringify(obj.$attrs.position))
console.info('testGetInspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function blankJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('BlankTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0630
* @tc.name testBlankGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('BlankGetInspectorByKey', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/Blank',
}
try {
let result = await router.push(options)
console.info("push blank page success " + JSON.stringify(result));
} catch (err) {
console.error("push blan page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('blank');
let obj = JSON.parse(strJson);
console.info("cd blank component obj is: " + JSON.stringify(obj));
console.log("cd blank type" + JSON.stringify(obj.$type));
console.log("cd blank min" + JSON.stringify(obj.$attrs.min));
console.log("cd blank color" + JSON.stringify(obj.$attrs.color));
expect(obj.$type).assertEqual('Blank')
expect(obj.$attrs.min).assertEqual('100.000000vp')
console.info('cd BlankGetInspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function buttonJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('buttonTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0640
* @tc.name testButtonGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('buttonGetInspectorByKey010', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/Button',
}
try {
let result = await router.push(options)
console.info("push button page success " + JSON.stringify(result));
} catch (err) {
console.error("push button page error " + JSON.stringify(result));
}
await sleep(2)
let strJson = getInspectorByKey('button');
let obj = JSON.parse(strJson);
console.info("cd button component obj is: " + JSON.stringify(obj));
console.log("cd button type" + JSON.stringify(obj.$type));
console.log("cd button Buttontype" + JSON.stringify(obj.$attrs.type));
console.log("cd button stateEffect" + JSON.stringify(obj.$attrs.stateEffect));
console.log("cd button label" + JSON.stringify(obj.$attrs.label));
expect(obj.$type).assertEqual('Button')
expect(obj.$attrs.type).assertEqual('ButtonType.Circle')
expect(obj.$attrs.stateEffect).assertEqual('true')
expect(obj.$attrs.label).assertEqual('1.value')
console.info('cd buttonInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0650
* @tc.name testButtonGetInspectorByKey020
* @tc.desc aceEtsTest
*/
it('ButtonGetInspectorByKey020', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('button1');
let obj = JSON.parse(strJson);
console.info("cd button1 component obj is: " + JSON.stringify(obj));
console.log("cd button1 type" + JSON.stringify(obj.$type));
console.log("cd button1 Buttontype" + JSON.stringify(obj.$attrs.type));
console.log("cd button1 stateEffect" + JSON.stringify(obj.$attrs.stateEffect));
expect(obj.$attrs.type).assertEqual('ButtonType.Capsule')
expect(obj.$attrs.stateEffect).assertEqual('false')
console.info('cd button1InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0660
* @tc.name testButtonGetInspectorByKey030
* @tc.desc aceEtsTest
*/
it('ButtonGetInspectorByKey030', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('button2');
let obj = JSON.parse(strJson);
console.info("cd button2 component obj is: " + JSON.stringify(obj));
console.log("cd button2 type" + JSON.stringify(obj.$type));
console.log("cd button2 Buttontype" + JSON.stringify(obj.$attrs.type));
expect(obj.$attrs.type).assertEqual('ButtonType.Normal')
console.info('cd button2InspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function columnJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('columnTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0670
* @tc.name testColumn010
* @tc.desc aceEtsTest
*/
it('testColumn010', 0, async function (done) {
console.info('new Column0 START');
let options = {
uri: 'pages/Column',
}
try {
let result = await router.push(options)
console.info("push Column page success " + JSON.stringify(result));
} catch (err) {
console.error("push Column page error " + JSON.stringify(result));
}
await sleep(3)
let strJson = getInspectorByKey('column');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Column');
console.info("yr new Column0-Column: " + JSON.stringify(obj.$type))
expect(obj.$attrs.alignItems).assertEqual('HorizontalAlign.Center')
console.log("yr new Column0 alignItems-'HorizontalAlign.Center':" + JSON.stringify(obj.$attrs.alignItems));
console.info('new Column0 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0680
* @tc.name testColumn020
* @tc.desc aceEtsTest
*/
it('testColumn020', 0, async function (done) {
console.info('new Column1 START');
let strJson = getInspectorByKey('column1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.alignItems).assertEqual('HorizontalAlign.Start')
console.log("yr new Column1 alignItems-'HorizontalAlign.Start':" + JSON.stringify(obj.$attrs.alignItems));
console.info('new Column1 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0690
* @tc.name testColumn030
* @tc.desc aceEtsTest
*/
it('testColumn030', 0, async function (done) {
console.info('new Column2 START');
let strJson = getInspectorByKey('column2');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.alignItems).assertEqual('HorizontalAlign.End');
console.log("yr new Column2 alignItems-'HorizontalAlign.End':" + JSON.stringify(obj.$attrs.alignItems));
console.info('new Column2 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function columnSplitJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('columnSplitTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0700
* @tc.name testColumnSplit010
* @tc.desc aceEtsTest
*/
it('testColumnSplit010', 0, async function (done) {
console.info('new columnSplit0 START');
let options = {
uri: 'pages/ColumnSplit',
}
try {
let result = await router.push(options)
console.info("push columnSplit page success " + JSON.stringify(result));
} catch (err) {
console.error("push columnSplit page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('columnSplit')
let obj = JSON.parse(strJson)
console.info("component obj is: " + JSON.stringify(obj))
expect(obj.$type).assertEqual('ColumnSplit')
console.info("yr ColumnSplit0 type: " + JSON.stringify(obj.$type))
expect(obj.$attrs.resizeable).assertEqual('true')
console.log("yr columnSplit0 obj.$resizeable-'true':" + JSON.stringify(obj.$attrs.resizeable))
console.info('new columnSplit0 END')
done()
})
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0710
* @tc.name testColumnSplit020
* @tc.desc aceEtsTest
*/
it('testColumnSplit020', 0, async function (done) {
console.info('new columnSplit1 START');
let strJson = getInspectorByKey('columnSplit1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.resizeable).assertEqual('false')
console.log("yr columnSplit obj.$resizeable-'false':" + JSON.stringify(obj.$attrs.resizeable));
console.info('new columnSplit1 END');
done();
})
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function counterJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('counterTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0720
* @tc.name testCounterGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('testCounterGetInspectorByKey010', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/Counter',
}
try {
let result = await router.push(options)
console.info("push counter page success " + JSON.stringify(result));
} catch (err) {
console.error("push counter page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('counter');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.info('testGetInspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function datapanelJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('dataPanelTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0730
* @tc.name testDataPanelGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('testDataPanelGetInspectorByKey010', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/DataPanel',
}
try {
let result = await router.push(options)
console.info("push DataPanel success " + JSON.stringify(result));
} catch (err) {
console.error("push DataPanel page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('DataPanel');
let obj = JSON.parse(strJson);
console.info("cd DatePanel component obj is: " + JSON.stringify(obj));
console.log("cd DataPanel type " + JSON.stringify(obj.$type));
console.log("cd DataPanel values1 " + typeof ([20, 40, 20]));
console.log("cd DataPanel values " + typeof (obj.$attrs.values));
console.log("cd DataPanel values" + JSON.stringify(obj.$attrs.values));
console.log("cd DataPanel max" + JSON.stringify(obj.$attrs.max));
console.log("panel closeEffect" + JSON.stringify(obj.$attrs.closeEffect))
expect(obj.$attrs.closeEffect).assertEqual("false")
expect(obj.$type).assertEqual("DataPanel")
expect(JSON.stringify(obj.$attrs.values)).assertEqual('[20,40,20]')
expect(obj.$attrs.max).assertEqual(100.000000.toFixed(6))
console.info('cd dataPanelInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0740
* @tc.name testDataPanelGetInspectorByKey020
* @tc.desc aceEtsTest
*/
it('testDataPanelGetInspectorByKey020', 0, async function (done) {
console.info('testGetInspectorByKey START');
await sleep(1)
let strJson = getInspectorByKey('DataPanel2');
let obj = JSON.parse(strJson);
console.info("cd DatePanel component obj is: " + JSON.stringify(obj));
console.log("panel closeEffect" + JSON.stringify(obj.$attrs.closeEffect))
expect(obj.$attrs.closeEffect).assertEqual("true")
console.info('cd dataPanelInspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function dividerJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('dividerTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0750
* @tc.name testDividerGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('testDividerGetInspectorByKey010', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/Divider',
}
try {
let result = await router.push(options)
console.info("push divider page success " + JSON.stringify(result));
} catch (err) {
console.error("push divider page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('divider');
let obj = JSON.parse(strJson);
console.info("cd divider component obj is: " + JSON.stringify(obj));
console.log("cd divider type" + JSON.stringify(obj.$type));
console.log("cd divider color" + JSON.stringify(obj.$attrs.color));
expect(obj.$type).assertEqual('Divider')
expect(obj.$attrs.color).assertEqual('#FFFF0000')
console.info(" divider component obj is: " + JSON.stringify(obj));
console.log("cd divider strokeWidth" + JSON.stringify(obj.$attrs.strokeWidth));
console.log("cd divider vertical" + JSON.stringify(obj.$attrs.vertical));
console.log("cd divider lineCap" + JSON.stringify(obj.$attrs.lineCap));
expect(obj.$attrs.strokeWidth).assertEqual("7.000000")
expect(obj.$attrs.vertical).assertEqual('true')
expect(obj.$attrs.lineCap == LineCapStyle.Square)
console.info('cd dividerInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0760
* @tc.name testDividerGetInspectorByKey020
* @tc.desc aceEtsTest
*/
it('testDividerGetInspectorByKey020', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('divider1');
let obj = JSON.parse(strJson);
console.info(" divider1 component obj is: " + JSON.stringify(obj));
console.log("cd divider1 vertical" + JSON.stringify(obj.$attrs.vertical));
console.log("cd divider1 lineCap" + JSON.stringify(obj.$attrs.lineCap));
expect(obj.$attrs.vertical).assertEqual('false')
expect(obj.$attrs.lineCap == LineCapStyle.Round)
console.info('cd divider1InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0770
* @tc.name testDividerGetInspectorByKey030
* @tc.desc aceEtsTest
*/
it('testDividerGetInspectorByKey030', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('divider2');
let obj = JSON.parse(strJson);
console.info(" divider2 component obj is: " + JSON.stringify(obj));
console.log("cd divider2 lineCap" + JSON.stringify(obj.$attrs.lineCap));
expect(obj.$attrs.lineCap == LineCapStyle.Square)
console.info('cd divider2InspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function flexJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('flexTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0770
* @tc.name testFlex010
* @tc.desc aceEtsTest
*/
it('testFlex010', 0, async function (done) {
console.info('new Flex0 START');
let options = {
uri: 'pages/Flex',
}
try {
let result = await router.push(options)
console.info("push Flex page success " + JSON.stringify(result));
} catch (err) {
console.error("push Flex page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('flex');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Flex');
console.info("yr Flex0 type: " + JSON.stringify(obj.$type));
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Column');
console.log("yr flex0 obj.$attrs.constructor.direction-'FlexDirection.Column':" + JSON.stringify(obj.$attrs.constructor.direction));
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.NoWrap');
console.log("yr flex0 obj.$attrs.constructor.wrap-'FlexWrap.NoWrap':" + JSON.stringify(obj.$attrs.constructor.wrap));
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Center');
console.log("yr flex0 obj.$attrs.constructor.justifyContent-'FlexAlign.Center':" + JSON.stringify(obj.$attrs.constructor.justifyContent));
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Start");
console.log("yr flex0 obj.$attrs.constructor.alignContent-'FlexAlign.Start':" + JSON.stringify(obj.$attrs.constructor.alignContent));
console.info('new Flex0 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0780
* @tc.name testFlex020
* @tc.desc aceEtsTest
*/
it('testFlex020', 0, async function (done) {
console.info('new Flex1 START');
let strJson = getInspectorByKey('flex1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.Row')
console.log("yr flex1 direction-'FlexDirection.Row':" + JSON.stringify(obj.$attrs.constructor.direction));
expect(obj.$attrs.constructor.wrap).assertEqual('FlexWrap.Wrap')
console.log("yr flex1 wrap-'FlexWrap.Wrap':" + JSON.stringify(obj.$attrs.constructor.wrap));
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.Start');
console.log("yr flex1 justifyContent-'FlexAlign.Start':" + JSON.stringify(obj.$attrs.constructor.justifyContent));
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.Center");
console.log("yr flex1 obj.$attrs.constructor.alignContent-'FlexAlign.Center':" + JSON.stringify(obj.$attrs.constructor.alignContent));
console.info('new Flex1 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0790
* @tc.name testFlex030
* @tc.desc aceEtsTest
*/
it('testFlex030', 0, async function (done) {
console.info('new Flex2 START');
let strJson = getInspectorByKey('flex2');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.constructor.direction).assertEqual('FlexDirection.RowReverse');
console.log("yr flex2 direction-'FlexDirection.RowReverse':" + JSON.stringify(obj.$attrs.constructor.direction));
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.End');
console.log("yr flex2 justifyContent-'FlexAlign.End':" + JSON.stringify(obj.$attrs.constructor.justifyContent));
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.End");
console.log("yr flex2 alignContent-'FlexAlign.End':" + JSON.stringify(obj.$attrs.constructor.alignContent));
console.info('new Flex2 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0800
* @tc.name testFlex040
* @tc.desc aceEtsTest
*/
it('testFlex040', 0, async function (done) {
console.info('new Flex3 START');
let strJson = getInspectorByKey('flex3');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("yr flex3 direction-'FlexDirection.ColumnReverse':" + JSON.stringify(obj.$attrs.constructor.direction));
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceBetween');
console.log("yr flex3 justifyContent-'FlexAlign.SpaceBetween':" + JSON.stringify(obj.$attrs.constructor.justifyContent));
console.info('new Flex3 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0810
* @tc.name testFlex050
* @tc.desc aceEtsTest
*/
it('testFlex050', 0, async function (done) {
console.info('new Flex4 START');
let strJson = getInspectorByKey('flex4');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceEvenly');
console.log("yr flex4 obj.$attrs.justifyContent-'FlexAlign.SpaceEvenly':" + JSON.stringify(obj.$attrs.constructor.justifyContent));
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.SpaceEvenly");
console.log("yr flex4 obj.$attrs.constructor.alignContent-'FlexAlign.SpaceEvenly':" + JSON.stringify(obj.$attrs.constructor.alignContent));
console.info('new Flex4 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0820
* @tc.name testFlex060
* @tc.desc aceEtsTest
*/
it('testFlex060', 0, async function (done) {
console.info('new Flex5 START');
let strJson = getInspectorByKey('flex5');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.constructor.justifyContent).assertEqual('FlexAlign.SpaceAround');
console.log("yr flex5 obj.$attrs.constructor.justifyContent-'FlexAlign.SpaceAround':" + JSON.stringify(obj.$attrs.constructor.justifyContent));
expect(obj.$attrs.constructor.alignContent).assertEqual("FlexAlign.SpaceAround");
console.log("yr flex5 obj.$attrs.constructor.alignContent-'FlexAlign.SpaceAround':" + JSON.stringify(obj.$attrs.constructor.alignContent));
console.info('testGetInspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function gridContainerJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('gridContainerTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0830
* @tc.name testGridContainer010
* @tc.desc aceEtsTest
*/
it('testGridContainer010', 0, async function (done) {
console.info('new GridContainer0 START');
let options = {
uri: 'pages/GridContainer',
}
try {
let result = await router.push(options)
console.info("push GridContainer page success " + JSON.stringify(result));
} catch (err) {
console.error("push GridContainer page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('gridContainer');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('GridContainer');
console.info("yr GridContainer0 type: " + JSON.stringify(obj.$type));
console.log("yr gridContainer0 obj.$attrs.alignItems-'HorizontalAlign.Start':" + JSON.stringify(obj.$attrs.alignItems));
console.info('new GridContainer0 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0840
* @tc.name testGridContainer020
* @tc.desc aceEtsTest
*/
it('testGridContainer020', 0, async function (done) {
console.info('new GridContainer1 START');
let strJson = getInspectorByKey('gridContainer1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.alignItems).assertEqual('HorizontalAlign.Center');
console.log("yr gridContainer1 obj.$attrs.alignItems-'HorizontalAlign.Center':" + JSON.stringify(obj.$attrs.alignItems));
console.info('new GridContainer1 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0850
* @tc.name testGridContainer030
* @tc.desc aceEtsTest
*/
it('testGridContainer030', 0, async function (done) {
console.info('new GridContainer2 START');
let strJson = getInspectorByKey('gridContainer2');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.alignItems).assertEqual('HorizontalAlign.End');
console.log("yr gridContainer obj.$attrs.alignItems-'HorizontalAlign.End':" + JSON.stringify(obj.$attrs.alignItems));
console.info('new GridContainer2 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0860
* @tc.name testGridContainer040
* @tc.desc aceEtsTest
*/
it('testGridContainer040', 0, async function (done) {
console.info('new GridContainer3 START');
let strJson = getInspectorByKey('gridContainer3');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.alignItems).assertEqual('HorizontalAlign.End');
console.log("yr gridContainer3 obj.$attrs.alignItems-'HorizontalAlign.End':" + JSON.stringify(obj.$attrs.alignItems));
console.info('new GridContainer3 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0870
* @tc.name testGridContainer050
* @tc.desc aceEtsTest
*/
it('testGridContainer050', 0, async function (done) {
console.info('new GridContainer4 START');
let strJson = getInspectorByKey('gridContainer4');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("gridContainer obj.$attrs.sizeType:" + JSON.stringify(obj.$attrs.sizeType)); //undefinde
console.info('new GridContainer4 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function imageJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('imageTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0880
* @tc.name testGetImageAttr010
* @tc.desc aceEtsTest
*/
it('testGetImageAttr010', 0, async function (done) {
console.info('testGetImageAttr1 START');
let options = {
uri: 'pages/Image',
}
try {
let result = await router.push(options)
console.info("push image page success " + JSON.stringify(result));
} catch (err) {
console.error("push image page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('image1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("image1 objectFit" + JSON.stringify(obj.$attrs.objectFit));
console.log("image1 objectRepeat" + JSON.stringify(obj.$attrs.objectRepeat));
console.log("image1 interpolation" + JSON.stringify(obj.$attrs.interpolation));
console.log("image1 renderMode" + JSON.stringify(obj.$attrs.renderMode));
console.log("image1 sourceSize" + JSON.stringify(obj.$attrs.sourceSize));
console.log("image1 alt" + JSON.stringify(obj.$attrs.alt));
expect(obj.$attrs.objectFit).assertEqual('ImageFit.Cover')
expect(obj.$attrs.objectRepeat).assertEqual('ImageRepeat.NoRepeat')
expect(obj.$attrs.interpolation).assertEqual('ImageInterpolation.None')
expect(obj.$attrs.renderMode).assertEqual('ImageRenderMode.Original')
expect(obj.$attrs.sourceSize).assertEqual("[200.00 x 100.00]")
expect(obj.$attrs.alt).assertEqual('/resources/rawfile/person.png')
console.info('testGetImageAttr1 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0890
* @tc.name testGetImageAttr020
* @tc.desc aceEtsTest
*/
it('testGetImageAttr020', 0, async function (done) {
console.info('testGetImageAttr2 START');
await sleep(1)
let strJson = getInspectorByKey('image2');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("image2 objectFit" + JSON.stringify(obj.$attrs.objectFit));
console.log("image2 objectRepeat" + JSON.stringify(obj.$attrs.objectRepeat));
console.log("image2 interpolation" + JSON.stringify(obj.$attrs.interpolation));
console.log("image2 renderMode" + JSON.stringify(obj.$attrs.renderMode));
expect(obj.$attrs.objectFit).assertEqual('ImageFit.Contain')
expect(obj.$attrs.interpolation).assertEqual('ImageInterpolation.High')
expect(obj.$attrs.renderMode).assertEqual('ImageRenderMode.Template')
console.info('testGetImageAttr2 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0900
* @tc.name testGetImageAttr030
* @tc.desc aceEtsTest
*/
it('testGetImageAttr030', 0, async function (done) {
console.info('testGetImageAttr3 START');
await sleep(1)
let strJson = getInspectorByKey('image3');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("image3 objectFit" + JSON.stringify(obj.$attrs.objectFit));
console.log("image3 objectRepeat" + JSON.stringify(obj.$attrs.objectRepeat));
console.log("image3 interpolation" + JSON.stringify(obj.$attrs.interpolation));
expect(obj.$attrs.objectRepeat).assertEqual('ImageRepeat.Y')
expect(obj.$attrs.interpolation).assertEqual('ImageInterpolation.Low')
console.info('testGetImageAttr3 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0910
* @tc.name testGetImageAttr040
* @tc.desc aceEtsTest
*/
it('testGetImageAttr040', 0, async function (done) {
console.info('testGetImageAttr4 START');
await sleep(1)
let strJson = getInspectorByKey('image4');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("image4 objectFit" + JSON.stringify(obj.$attrs.objectFit));
console.log("image4 objectRepeat" + JSON.stringify(obj.$attrs.objectRepeat));
console.log("image4 interpolation" + JSON.stringify(obj.$attrs.interpolation));
expect(obj.$attrs.objectFit).assertEqual('ImageFit.None')
expect(obj.$attrs.interpolation).assertEqual('ImageInterpolation.Medium')
console.info('testGetImageAttr4 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0920
* @tc.name testGetImageAttr050
* @tc.desc aceEtsTest
*/
it('testGetImageAttr050', 0, async function (done) {
console.info('testGetImageAttr5 START');
await sleep(1)
let strJson = getInspectorByKey('image5');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("image5 objectFit" + JSON.stringify(obj.$attrs.objectFit));
expect(obj.$attrs.objectFit).assertEqual('ImageFit.ScaleDown')
console.info('testGetImageAttr5 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import badgeJsunit from './BadgeJsunit.test.ets';
import dividerJsunit from './DividerJsunit.test.ets'
import buttonJsunit from './ButtonJsunit.test.ets'
import blankJsunit from './BlankJsunit.test.ets'
import datapanelJsunit from './DataPanelJsunit.test.ets'
import textJsunit from './TextJsunit.test.ets'
import rowSplitJsunit from './RowSplitJsunit.test.ets'
import ScrollJsunit from './ScrollJsunit.test.ets'
import StackJsunit from './StackJsunit.test.ets'
import imageJsunit from './ImageJsunit.test.ets'
import progressJsunit from './ProgressJsunit.test.ets'
import qrcodeJsunit from './QrcodeJsunit.test.ets'
import ratingJsunit from './RatingJsunit.test.ets'
import spanJsunit from './SpanJsunit.test.ets'
import sliderJsunit from './SliderJsunit.test.ets'
import gridContainerJsunit from './GridContainerJsunit.test.ets';
import flexJsunit from './FlexJsunit.test.ets';
import counterJsunit from './CounterJsunit.test.ets';
import columnSplitJsunit from './ColumnSplitJsunit.test.ets';
import columnJsunit from './ColumnJsunit.test.ets';
export default function testsuite() {
buttonJsunit()
blankJsunit()
datapanelJsunit()
dividerJsunit()
textJsunit()
rowSplitJsunit()
ScrollJsunit()
StackJsunit()
imageJsunit()
progressJsunit()
qrcodeJsunit()
ratingJsunit()
spanJsunit()
sliderJsunit()
badgeJsunit()
columnJsunit()
columnSplitJsunit()
counterJsunit()
flexJsunit()
gridContainerJsunit()
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function panelJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('panelTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0930
* @tc.name testPanelGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('testPanelGetInspectorByKey010', 0, async function (done) {
console.info('++++++++++++++++ Panel TestCase 1 START ++++++++++++++++');
let options = {
uri: 'pages/Panel',
}
try {
let result = await router.push(options)
console.info(JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('panel');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Panel')
console.log('Panel‘s type is ' + JSON.stringify(obj.$attrs.type))
console.log('Panel‘s mode is ' + JSON.stringify(obj.$attrs.mode))
console.log('Panel‘s dragBar is ' + JSON.stringify(obj.$attrs.dragBar))
console.log('Panel‘s fullHeight is ' + JSON.stringify(obj.$attrs.fullHeight))
console.log('Panel‘s halfHeight is ' + JSON.stringify(obj.$attrs.halfHeight))
console.log('Panel‘s miniHeight is ' + JSON.stringify(obj.$attrs.miniHeight))
expect(obj.$attrs.type).assertEqual('PanelType.Foldable')
expect(obj.$attrs.mode).assertEqual('PanelMode.Half')
expect(obj.$attrs.dragBar).assertEqual('true')
expect(obj.$attrs.fullHeight).assertEqual('500.000000vp')
expect(obj.$attrs.halfHeight).assertEqual('250.000000vp')
expect(obj.$attrs.miniHeight).assertEqual('100.000000vp')
console.info('++++++++++++++++ Panel TestCase 1 End ++++++++++++++++');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0940
* @tc.name testPanelGetInspectorByKey020
* @tc.desc aceEtsTest
*/
it('testPanelGetInspectorByKey020', 0, async function (done) {
console.info('++++++++++++++++ Panel TestCase 2 START ++++++++++++++++');
await sleep(1)
let strJson = getInspectorByKey('panel2');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Panel')
console.log('Panel‘s type is ' + JSON.stringify(obj.$attrs.type))
console.log('Panel‘s mode is ' + JSON.stringify(obj.$attrs.mode))
console.log('Panel‘s show is ' + JSON.stringify(obj.$attrs.show))
expect(obj.$attrs.type).assertEqual('PanelType.Minibar')
expect(obj.$attrs.mode).assertEqual('PanelMode.Mini')
expect(obj.$attrs.show).assertEqual('true')
console.info('++++++++++++++++ Panel TestCase 2 End ++++++++++++++++');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0950
* @tc.name testPanelGetInspectorByKey030
* @tc.desc aceEtsTest
*/
it('testPanelGetInspectorByKey030', 0, async function (done) {
console.info('++++++++++++++++ Panel TestCase 3 START ++++++++++++++++');
await sleep(1)
let strJson = getInspectorByKey('panel3');
let obj = JSON.parse(strJson);
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Panel')
console.log('Panel‘s type is ' + JSON.stringify(obj.$attrs.type))
console.log('Panel‘s mode is ' + JSON.stringify(obj.$attrs.mode))
console.log('Panel‘s show is ' + JSON.stringify(obj.$attrs.show))
expect(obj.$attrs.type).assertEqual('PanelType.Temporary')
expect(obj.$attrs.mode).assertEqual('PanelMode.Full')
expect(obj.$attrs.show).assertEqual('false')
console.info('++++++++++++++++ Panel TestCase 3 End ++++++++++++++++');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function progressJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('progressTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0960
* @tc.name testGetProgressAttr010
* @tc.desc aceEtsTest
*/
it('testGetProgressAttr010', 0, async function (done) {
console.info('testGetProgressAttr START');
let options = {
uri: 'pages/Progress',
}
try {
let result = await router.push(options)
console.info("push Progress page success " + JSON.stringify(result));
} catch (err) {
console.error("push Progress page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('progress');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("progress value" + JSON.stringify(obj.$attrs.value))
console.log("progress type" + JSON.stringify(obj.$type))
console.log("progress color" + JSON.stringify(obj.$attrs.color))
console.log("progress width" + JSON.stringify(obj.$attrs.width))
console.log("progress height" + JSON.stringify(obj.$attrs.height))
console.log("progress total" + JSON.stringify(obj.$attrs.total))
console.log("progress style" + JSON.stringify(obj.$attrs.style))
expect(obj.$attrs.value).assertEqual(3.000000.toFixed(6))
expect(obj.$type).assertEqual('Progress')
expect(obj.$attrs.color).assertEqual("#FF0000FF")
expect(obj.$attrs.width).assertEqual("50.000000vp")
expect(obj.$attrs.height).assertEqual("70.000000vp")
expect(obj.$attrs.total).assertEqual(40.000000.toFixed(6))
expect(obj.$attrs.style).assertEqual("ProgressStyle.Linear")
console.info('testGetProgressAttr END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0970
* @tc.name testGetProgressAttr020
* @tc.desc aceEtsTest
*/
it('testGetProgressAttr020', 0, async function (done) {
console.info('testGetProgressAttr2 START');
await sleep(1)
let strJson = getInspectorByKey('progress2');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("progress style" + JSON.stringify(obj.$attrs.style))
expect(obj.$attrs.style).assertEqual("ProgressStyle.Eclipse")
console.info('testGetProgressAttr2 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function qrcodeJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('QrcodeTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0980
* @tc.name testGetQrcodeAttr010
* @tc.desc aceEtsTest
*/
it('testGetQrcodeAttr010', 0, async function (done) {
console.info('testGetQrcodeAttr START');
let options = {
uri: 'pages/Qrcode',
}
try {
let result = await router.push(options)
console.info("push Qrcode page success " + JSON.stringify(result));
} catch (err) {
console.error("push Qrcode page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('qrcode');
let obj = JSON.parse(strJson);
console.info("Qrcode component obj is: " + JSON.stringify(obj));
console.info("qrcode width" + JSON.stringify(obj.$attrs.width))
console.info("qrcode height" + JSON.stringify(obj.$attrs.height))
console.info("qrcode value" + JSON.stringify(obj.$attrs.value))
expect(obj.$attrs.value).assertEqual("hello world")
console.info('testGetQrcodeAttr END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function ratingJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('ratingTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0990
* @tc.name testGetRatingAttr010
* @tc.desc aceEtsTest
*/
it('testGetRatingAttr010', 0, async function (done) {
console.info('testGetRatingAttr1 START');
let options = {
uri: 'pages/Rating',
}
try {
let result = await router.push(options)
console.info("push Rating page success " + JSON.stringify(result));
} catch (err) {
console.error("push Rating page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('rating1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.info("rating1 rating" + JSON.stringify(obj.$attrs.rating))
console.info("rating1 indicator" + JSON.stringify(obj.$attrs.indicator))
console.info("rating1 stepSize" + JSON.stringify(obj.$attrs.stepSize))
console.info("rating1 stars" + JSON.stringify(obj.$attrs.stars))
console.info("rating1 starStyle" + JSON.stringify(obj.$attrs.starStyle))
expect(obj.$attrs.rating).assertEqual("2.000000")
expect(obj.$attrs.indicator).assertEqual("false")
expect(obj.$attrs.stepSize).assertEqual("0.500000")
expect(obj.$attrs.stars).assertEqual("5")
expect(obj.$attrs.starStyle)
.assertEqual('{"backgroundUri":"/resources/rawfile/star-1-1.png","foregroundUri":"/resources/rawfile/star-1-3.png","secondaryUri":"/resources/rawfile/star-1-2.png"}')
console.info('testGetRatingAttr1 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1000
* @tc.name testGetRatingAttr020
* @tc.desc aceEtsTest
*/
it('testGetRatingAttr020', 0, async function (done) {
console.info('testGetRatingAttr2 START');
await sleep(1)
let strJson = getInspectorByKey('rating2');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.info("rating2 indicator" + JSON.stringify(obj.$attrs.indicator))
expect(obj.$attrs.indicator).assertEqual("true")
console.info('testGetRatingAttr2 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function rowSplitJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('RowSplitTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1010
* @tc.name testRowSplitGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('testRowSplitGetInspectorByKey010', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/RowSplit',
}
try {
let result = await router.push(options)
console.info("push rowSplit page success " + JSON.stringify(result));
} catch (err) {
console.error("push rowSplit page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('rowSplit');
let obj = JSON.parse(strJson);
console.info("cd rowSplit component obj is: " + JSON.stringify(obj));
console.log("cd rowSplit type" + JSON.stringify(obj.$type));
console.log("cd rowSplit resizeable" + JSON.stringify(obj.$attrs.resizeable));
expect(obj.$type).assertEqual('RowSplit')
expect(obj.$attrs.resizeable).assertEqual('false')
console.info('cd RowSplitInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1020
* @tc.name testRowSplitGetInspectorByKey020
* @tc.desc aceEtsTest
*/
it('testRowSplitGetInspectorByKey020', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('rowSplit1');
let obj = JSON.parse(strJson);
console.info("cd rowSplit1 component obj is: " + JSON.stringify(obj));
console.log("cd rowSplit1 resizeable" + JSON.stringify(obj.$attrs.resizeable));
expect(obj.$attrs.resizeable).assertEqual('true')
console.info('cd RowSplit1InspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function ScrollJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('scrollTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1020
* @tc.name testScrollGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('testScrollGetInspectorByKey010', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/Scroll',
}
try {
let result = await router.push(options)
console.info("push scroll page success " + JSON.stringify(result));
} catch (err) {
console.error("push scroll page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('scroll');
let obj = JSON.parse(strJson);
console.info("cd scroll component obj is: " + JSON.stringify(obj));
console.log("cd scroll type" + JSON.stringify(obj.$type));
console.log("cd scroll scrollable" + JSON.stringify(obj.$attrs.scrollable));
console.log("cd scroll scrollBar" + JSON.stringify(obj.$attrs.scrollBar));
console.log("cd scroll scrollBarColor" + JSON.stringify(obj.$attrs.scrollBarColor));
console.log("cd scroll scrollBarWidth" + JSON.stringify(obj.$attrs.scrollBarWidth));
expect(obj.$type).assertEqual('Scroll');
expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.Vertical')
expect(obj.$attrs.scrollBarColor).assertEqual('#FFFFC0CB')
expect(obj.$attrs.scrollBarWidth).assertEqual('20.000000px')
console.info('cd ScorllGetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1030
* @tc.name testScrollGetInspectorByKey020
* @tc.desc aceEtsTest
*/
it('testScrollGetInspectorByKey020', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('scroll1');
let obj = JSON.parse(strJson);
console.info("cd scroll1 component obj is: " + JSON.stringify(obj));
console.log("cd scroll1 scrollable" + JSON.stringify(obj.$attrs.scrollable));
console.log("cd scroll1 scrollBar" + JSON.stringify(obj.$attrs.scrollBar));
expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.None')
expect(obj.$attrs.scrollBar).assertEqual('BarState.Off')
console.info('cd Scorll1GetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1040
* @tc.name testScrollGetInspectorByKey030
* @tc.desc aceEtsTest
*/
it('testScrollGetInspectorByKey030', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('scroll2');
let obj = JSON.parse(strJson);
console.info("cd scroll2 component obj is: " + JSON.stringify(obj));
console.log("cd scroll2 scrollable" + JSON.stringify(obj.$attrs.scrollable));
console.log("cd scroll2 scrollBar" + JSON.stringify(obj.$attrs.scrollBar));
expect(obj.$attrs.scrollable).assertEqual('ScrollDirection.Horizontal')
expect(obj.$attrs.scrollBar).assertEqual('BarState.Off')
console.info('cd Scorll2GetInspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function sliderJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('SliderTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1060
* @tc.name testGetSliderAttr010
* @tc.desc aceEtsTest
*/
it('testGetSliderAttr010', 0, async function (done) {
console.info('testGetSliderAttr1 START');
let options = {
uri: 'pages/Slider',
}
try {
let result = await router.push(options)
console.info("push Slider page success " + JSON.stringify(result));
} catch (err) {
console.error("push Slider page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('slider1');
let obj = JSON.parse(strJson);
console.info("component obj is Slider: " + JSON.stringify(obj));
console.info("slider1 blockColor" + JSON.stringify(obj.$attrs.blockColor))
console.info("slider1 selectedColor" + JSON.stringify(obj.$attrs.selectedColor))
console.info("slider1 trackColor" + JSON.stringify(obj.$attrs.trackColor))
console.info("slider1 showTips" + JSON.stringify(obj.$attrs.showTips))
console.info("slider1 showSteps" + JSON.stringify(obj.$attrs.showSteps))
console.info("slider1 value" + JSON.stringify(obj.$attrs.value))
console.info("slider1 min" + JSON.stringify(obj.$attrs.min))
console.info("slider1 max" + JSON.stringify(obj.$attrs.max))
console.info("slider1 step" + JSON.stringify(obj.$attrs.step))
console.info("slider1 style" + JSON.stringify(obj.$attrs.style))
expect(obj.$attrs.blockColor).assertEqual('#FFFF0000')
expect(obj.$attrs.selectedColor).assertEqual('#FF0000FF')
expect(obj.$attrs.trackColor).assertEqual('#FF808080')
expect(obj.$attrs.showTips).assertEqual("false")
expect(obj.$attrs.showSteps).assertEqual("false")
expect(obj.$attrs.value).assertEqual(40.000000.toFixed(6))
expect(obj.$attrs.min).assertEqual(0.000000.toFixed(6))
expect(obj.$attrs.max).assertEqual(100.000000.toFixed(6))
expect(obj.$attrs.step).assertEqual(1.000000.toFixed(6))
expect(obj.$attrs.style).assertEqual("SliderStyle.Outset")
console.info('testGetSliderAttr1 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1070
* @tc.name testGetSliderAttr020
* @tc.desc aceEtsTest
*/
it('testGetSliderAttr020', 0, async function (done) {
console.info('testGetSliderAttr2 START');
await sleep(1)
let strJson = getInspectorByKey('slider2');
let obj = JSON.parse(strJson);
console.info("component obj is Slider: " + JSON.stringify(obj));
console.info("slider2 showTips" + JSON.stringify(obj.$attrs.showTips))
console.info("slider2 showSteps" + JSON.stringify(obj.$attrs.showSteps))
console.info("slider1 style" + JSON.stringify(obj.$attrs.style))
expect(obj.$attrs.showTips).assertEqual("true")
expect(obj.$attrs.showSteps).assertEqual("true")
expect(obj.$attrs.style).assertEqual("SliderStyle.Inset")
console.info('testGetSliderAttr2 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function spanJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('SpanTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1080
* @tc.name testGetSpanAttr010
* @tc.desc aceEtsTest
*/
it('testGetSpanAttr010', 0, async function (done) {
console.info('testGetSpanAttr1 START');
let options = {
uri: 'pages/Span',
}
try {
let result = await router.push(options)
console.info("push Span page success " + JSON.stringify(result));
} catch (err) {
console.error("push Span page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('span1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.info("span1 decoration" + JSON.stringify(obj.$attrs.decoration))
console.info("span1 textCase" + JSON.stringify(obj.$attrs.textCase))
console.info("span1 content" + JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.decoration).assertEqual('{"Type":"TextDecorationType.LineThrough","Color":"#FFFF0000"}')
expect(obj.$attrs.textCase).assertEqual('TextCase.UpperCase')
expect(obj.$attrs.content).assertEqual('Test Span demo')
console.info('testGetSpanAttr1 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1090
* @tc.name testGetSpanAttr020
* @tc.desc aceEtsTest
*/
it('testGetSpanAttr020', 0, async function (done) {
console.info('testGetSpanAttr2 START');
await sleep(1)
let strJson = getInspectorByKey('span2');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.info("span2 textCase" + JSON.stringify(obj.$attrs.textCase))
console.info("span2 content" + JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.textCase).assertEqual('TextCase.LowerCase')
expect(obj.$attrs.content).assertEqual('The second test Span demo')
console.info('testGetSpanAttr2 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1100
* @tc.name testGetSpanAttr030
* @tc.desc aceEtsTest
*/
it('testGetSpanAttr030', 0, async function (done) {
console.info('testGetSpanAttr3 START');
await sleep(1)
let strJson = getInspectorByKey('span3');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.info("span3 textCase" + JSON.stringify(obj.$attrs.textCase))
console.info("span3 content" + JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.textCase).assertEqual('TextCase.Normal')
expect(obj.$attrs.content).assertEqual('The third test Span demo')
console.info('testGetSpanAttr3 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function StackJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('StackTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1110
* @tc.name testStackGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('testStackGetInspectorByKey010', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/Stack',
}
try {
let result = await router.push(options)
console.info("push stack page success " + JSON.stringify(result));
} catch (err) {
console.error("push stack page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('stack');
let obj = JSON.parse(strJson);
console.info("cd stack component obj is: " + JSON.stringify(obj));
console.log("cd stack type" + JSON.stringify(obj.$type));
console.log("cd stack alignContent" + JSON.stringify(obj.$attrs.alignContent));
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.Bottom')
console.info('cd stackGetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1120
* @tc.name testStackGetInspectorByKey020
* @tc.desc aceEtsTest
*/
it('testStackGetInspectorByKey020', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('stack1');
let obj = JSON.parse(strJson);
console.info("cd stack1 component obj is: " + JSON.stringify(obj));
console.log("cd stack1 alignContent" + JSON.stringify(obj.$attrs.alignContent));
expect(obj.$type).assertEqual('Stack')
expect(obj.$attrs.alignContent).assertEqual('Alignment.BottomStart')
console.info('cd stack1GetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1130
* @tc.name testStackGetInspectorByKey030
* @tc.desc aceEtsTest
*/
it('testStackGetInspectorByKey030', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('stack2');
let obj = JSON.parse(strJson);
console.info("cd stack2 component obj is: " + JSON.stringify(obj));
console.log("cd stack2 alignContent" + JSON.stringify(obj.$attrs.alignContent));
expect(obj.$attrs.alignContent).assertEqual('Alignment.BottomEnd')
console.info('cd stack2GetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1140
* @tc.name testStackGetInspectorByKey040
* @tc.desc aceEtsTest
*/
it('testStackGetInspectorByKey040', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('stack3');
let obj = JSON.parse(strJson);
console.info("cd stack3 component obj is: " + JSON.stringify(obj));
console.log("cd stack3 alignContent" + JSON.stringify(obj.$attrs.alignContent));
expect(obj.$attrs.alignContent).assertEqual('Alignment.Start')
console.info('cd stack3GetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1150
* @tc.name testStackGetInspectorByKey050
* @tc.desc aceEtsTest
*/
it('testStackGetInspectorByKey050', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('stack4');
let obj = JSON.parse(strJson);
console.info("cd stack4 component obj is: " + JSON.stringify(obj));
console.log("cd stack4 alignContent" + JSON.stringify(obj.$attrs.alignContent));
expect(obj.$attrs.alignContent).assertEqual('Alignment.Center')
console.info('cd stack4GetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1160
* @tc.name testStackGetInspectorByKey060
* @tc.desc aceEtsTest
*/
it('testStackGetInspectorByKey060', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('stack5');
let obj = JSON.parse(strJson);
console.info("cd stack5 component obj is: " + JSON.stringify(obj));
console.log("cd stack5 alignContent" + JSON.stringify(obj.$attrs.alignContent));
expect(obj.$attrs.alignContent).assertEqual('Alignment.End')
console.info('cd stack5GetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1170
* @tc.name testStackGetInspectorByKey070
* @tc.desc aceEtsTest
*/
it('testStackGetInspectorByKey070', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('stack6');
let obj = JSON.parse(strJson);
console.info("cd stack6 component obj is: " + JSON.stringify(obj));
console.log("cd stack6 alignContent" + JSON.stringify(obj.$attrs.alignContent));
expect(obj.$attrs.alignContent).assertEqual('Alignment.Top')
console.info('cd stack6GetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1180
* @tc.name testStackGetInspectorByKey080
* @tc.desc aceEtsTest
*/
it('testStackGetInspectorByKey080', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('stack7');
let obj = JSON.parse(strJson);
console.info("cd stack7 component obj is: " + JSON.stringify(obj));
console.log("cd stack7 alignContent" + JSON.stringify(obj.$attrs.alignContent));
expect(obj.$attrs.alignContent).assertEqual('Alignment.TopStart')
console.info('cd stack7GetInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1190
* @tc.name testStackGetInspectorByKey090
* @tc.desc aceEtsTest
*/
it('testStackGetInspectorByKey090', 0, async function (done) {
await sleep(1)
let strJson = getInspectorByKey('stack8');
let obj = JSON.parse(strJson);
console.info("cd stack8 component obj is: " + JSON.stringify(obj));
console.log("cd stack8 alignContent" + JSON.stringify(obj.$attrs.alignContent));
expect(obj.$attrs.alignContent).assertEqual('Alignment.TopEnd')
console.info('cd stack8GetInspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function textJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('textTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1200
* @tc.name textGetInspectorByKey010
* @tc.desc aceEtsTest
*/
it('textGetInspectorByKey010', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/Text',
}
try {
let result = await router.push(options)
console.info("push text page success " + JSON.stringify(result));
} catch (err) {
console.error("push text page error " + JSON.stringify(result));
}
await sleep(2)
let strJson = getInspectorByKey('Text');
let obj = JSON.parse(strJson);
console.info("cd text component obj is: " + JSON.stringify(obj));
console.log("cd text type" + JSON.stringify(obj.$type));
console.log("cd text height" + JSON.stringify(obj.$attrs.height));
console.log("cd text width" + JSON.stringify(obj.$attrs.width));
console.log("cd text padding" + JSON.stringify(obj.$attrs.padding));
console.log("cd text constraintSize" + JSON.stringify(obj.$attrs.constraintSize));
console.log("cd text opacity" + JSON.stringify(obj.$attrs.opacity));
console.log("cd text align" + JSON.stringify(obj.$attrs.align));
console.log("cd text markAnchor type1" + typeof ({
"x": "50.000000vp", "y": "50.000000vp"
}));
console.log("cd text markAnchor1" + JSON.stringify({
"x": "50.000000vp", "y": "50.000000vp"
}));
console.log("cd text markAnchor type" + typeof (obj.$attrs.markAnchor));
console.log("cd text markAnchor" + JSON.stringify(obj.$attrs.markAnchor));
console.log("cd text offset" + JSON.stringify(obj.$attrs.offset));
console.log("cd text position" + JSON.stringify(obj.$attrs.position));
console.log("cd text flexGrow" + JSON.stringify(obj.$attrs.flexGrow));
console.log("cd text flexShrink" + JSON.stringify(obj.$attrs.flexShrink));
console.log("cd text alignSelf" + JSON.stringify(obj.$attrs.alignSelf));
console.log("cd text borderStyle" + JSON.stringify(obj.$attrs.borderStyle));
console.log("cd text borderRadius" + JSON.stringify(obj.$attrs.borderRadius));
console.log("cd text borderWidth" + JSON.stringify(obj.$attrs.borderWidth));
console.log("cd text borderColor" + JSON.stringify(obj.$attrs.borderColor));
console.log("cd text backgroundColor" + JSON.stringify(obj.$attrs.backgroundColor));
console.log("cd text enabled" + JSON.stringify(obj.$attrs.enabled));
console.log("cd text zIndex" + JSON.stringify(obj.$attrs.zIndex));
console.log("cd text fontColor" + JSON.stringify(obj.$attrs.fontColor));
console.log("cd text visibility" + JSON.stringify(obj.$attrs.visibility));
console.log("cd text fontSize" + JSON.stringify(obj.$attrs.fontSize));
console.log("cd text fontWeight" + JSON.stringify(obj.$attrs.fontWeight));
console.log("cd text fontStyle" + JSON.stringify(obj.$attrs.fontStyle));
console.log("cd text fontFamily" + JSON.stringify(obj.$attrs.fontFamily));
console.log("cd text textAlign" + JSON.stringify(obj.$attrs.textAlign));
console.log("cd text textOverflow" + JSON.stringify(obj.$attrs.textOverflow));
console.log("cd text lineHeight" + JSON.stringify(obj.$attrs.lineHeight));
console.log("cd text baselineOffset" + JSON.stringify(obj.$attrs.baselineOffset));
console.log("cd text maxLines" + JSON.stringify(obj.$attrs.maxLines));
console.log("cd text textCase" + JSON.stringify(obj.$attrs.textCase));
console.log("cd text decoration" + JSON.stringify(obj.$attrs.decoration));
console.log("cd text decoration1" + JSON.stringify(JSON.stringify({
type: "TextDecorationType.Underline", color: "#FFFF0000"
})));
console.log("cd text direction" + JSON.stringify(obj.$attrs.direction));
console.log("cd text aspectRatio" + JSON.stringify(obj.$attrs.aspectRatio));
console.log("cd text fontColor" + JSON.stringify(obj.$attrs.fontColor));
expect(obj.$type).assertEqual('Text')
expect(obj.$attrs.width).assertEqual('200.000000vp')
expect(obj.$attrs.padding).assertEqual('5.000000vp')
expect(obj.$attrs.margin).assertEqual('10.000000px')
expect(obj.$attrs.opacity).assertEqual(1)
expect(obj.$attrs.align).assertEqual("Alignment.Center")
expect(JSON.stringify(obj.$attrs.markAnchor)).assertEqual(JSON.stringify({
"x": "50.000000vp", "y": "50.000000vp"
}))
expect(JSON.stringify(obj.$attrs.offset)).assertEqual(JSON.stringify({
"x": "50.000000vp", "y": "50.000000vp"
}))
expect(obj.$attrs.flexGrow).assertEqual(5)
expect(obj.$attrs.flexShrink).assertEqual(2)
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Auto")
expect(obj.$attrs.borderStyle).assertEqual("BorderStyle.Dashed")
expect(obj.$attrs.borderRadius).assertEqual("10.000000vp")
expect(obj.$attrs.borderWidth).assertEqual("4.000000px")
expect(obj.$attrs.borderColor).assertEqual("#FF0000FF")
expect(obj.$attrs.backgroundColor).assertEqual("#FFFFC0CB")
expect(obj.$attrs.enabled).assertEqual(false)
expect(obj.$attrs.zIndex).assertEqual(1)
expect(obj.$attrs.fontColor).assertEqual("#FF000000")
expect(obj.$attrs.visibility).assertEqual("Visibility.Visible")
expect(obj.$attrs.fontSize).assertEqual("15")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Bold")
expect(obj.$attrs.fontStyle).assertEqual("FontStyle.Italic")
expect(obj.$attrs.fontFamily).assertEqual("sans-serif")
expect(obj.$attrs.textAlign).assertEqual("TextAlign.End")
expect(obj.$attrs.textOverflow).assertEqual("TextOverflow.Ellipsis")
expect(obj.$attrs.lineHeight).assertEqual("15")
expect(obj.$attrs.baselineOffset).assertEqual("0")
expect(obj.$attrs.maxLines).assertEqual("2")
expect(obj.$attrs.textCase).assertEqual("TextCase.Normal")
expect(obj.$attrs.decoration).assertEqual(JSON.stringify({
type: "TextDecorationType.Underline", color: "#FFFF0000"
}))
expect(obj.$attrs.direction).assertEqual("Direction.Auto")
expect(obj.$attrs.aspectRatio).assertEqual(1)
expect(obj.$attrs.fontColor).assertEqual("#FF000000")
console.info('cd textInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1210
* @tc.name textGetInspectorByKey020
* @tc.desc aceEtsTest
*/
it('textGetInspectorByKey020', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text1');
let obj = JSON.parse(strJson);
console.info("cd text1 component obj is: " + JSON.stringify(obj));
console.log("cd text1 align" + JSON.stringify(obj.$attrs.align));
console.log("cd text1 alignSelf" + JSON.stringify(obj.$attrs.alignSelf));
console.log("cd text1 borderStyle" + JSON.stringify(obj.$attrs.borderStyle));
console.log("cd text1 enabled" + JSON.stringify(obj.$attrs.enabled));
console.log("cd text1 visibility" + JSON.stringify(obj.$attrs.visibility));
console.log("cd text1 fontWeight" + JSON.stringify(obj.$attrs.fontWeight));
console.log("cd text1 textAlign" + JSON.stringify(obj.$attrs.textAlign));
console.log("cd text1 textOverflow" + JSON.stringify(obj.$attrs.textOverflow));
console.log("cd text1 direction" + JSON.stringify(obj.$attrs.direction));
console.log("cd text1 textCase" + JSON.stringify(obj.$attrs.textCase));
console.log("cd text1 decoration" + JSON.stringify(obj.$attrs.decoration));
console.log("cd text1 decoration1" + JSON.stringify(JSON.stringify({
type: "TextDecorationType.LineThrough", color: "#FFFF0000"
})));
console.log("cd text1 fontColor" + JSON.stringify(obj.$attrs.fontColor));
console.log("cd text padding" + JSON.stringify(obj.$attrs.padding));
console.log("cd text margin" + JSON.stringify(obj.$attrs.margin))
expect(obj.$attrs.direction).assertEqual("Direction.Ltr")
expect(obj.$attrs.align).assertEqual("Alignment.Start")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Start")
expect(obj.$attrs.borderStyle).assertEqual("BorderStyle.Dotted")
expect(obj.$attrs.enabled).assertEqual(true)
expect(obj.$attrs.visibility).assertEqual("Visibility.Hidden")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Normal")
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Start")
expect(obj.$attrs.textOverflow).assertEqual("TextOverflow.Clip")
expect(obj.$attrs.decoration).assertEqual(JSON.stringify({
type: "TextDecorationType.LineThrough", color: "#FFFF0000"
}))
expect(obj.$attrs.fontColor).assertEqual("#FFFFFFFF")
console.info('cd text1InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1220
* @tc.name textGetInspectorByKey030
* @tc.desc aceEtsTest
*/
it('textGetInspectorByKey030', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text2');
let obj = JSON.parse(strJson);
console.info("cd text2 component obj is: " + JSON.stringify(obj));
console.log("cd text2 align" + JSON.stringify(obj.$attrs.align));
console.log("cd text2 alignSelf" + JSON.stringify(obj.$attrs.alignSelf));
console.log("cd text2 borderStyle" + JSON.stringify(obj.$attrs.borderStyle));
console.log("cd text2 visibility" + JSON.stringify(obj.$attrs.visibility));
console.log("cd text2 fontWeight" + JSON.stringify(obj.$attrs.fontWeight));
console.log("cd text2 textAlign" + JSON.stringify(obj.$attrs.textAlign));
console.log("cd text2 textOverflow" + JSON.stringify(obj.$attrs.textOverflow));
console.log("cd text2 direction" + JSON.stringify(obj.$attrs.direction));
console.log("cd text2 textCase" + JSON.stringify(obj.$attrs.textCase));
console.log("cd text2 decoration" + JSON.stringify(obj.$attrs.decoration));
console.log("cd text2 decoration1" + JSON.stringify(JSON.stringify({
type: "TextDecorationType.Noneh", color: "#FFFF0000"
})));
console.log("cd text2 fontColor" + JSON.stringify(obj.$attrs.fontColor));
expect(obj.$attrs.direction).assertEqual("Direction.Rtl")
expect(obj.$attrs.align).assertEqual("Alignment.TopEnd")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Center")
expect(obj.$attrs.borderStyle).assertEqual("BorderStyle.Solid")
expect(obj.$attrs.visibility).assertEqual("Visibility.None")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Bolder")
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Center")
expect(obj.$attrs.textCase).assertEqual("TextCase.UpperCase")
expect(obj.$attrs.decoration).assertEqual(JSON.stringify({
type: "TextDecorationType.None", color: "#FFFF0000"
}))
expect(obj.$attrs.fontColor).assertEqual("#FF0000FF")
console.info('cd text2InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1230
* @tc.name textGetInspectorByKey040
* @tc.desc aceEtsTest
*/
it('textGetInspectorByKey040', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text3');
let obj = JSON.parse(strJson);
console.info("cd text3 component obj is: " + JSON.stringify(obj));
console.log("cd text3 align" + JSON.stringify(obj.$attrs.align));
console.log("cd text3 alignSelf" + JSON.stringify(obj.$attrs.alignSelf));
console.log("cd text3 fontWeight" + JSON.stringify(obj.$attrs.fontWeight));
console.log("cd text3 decoration" + JSON.stringify(obj.$attrs.decoration));
console.log("cd text3 fontColor" + JSON.stringify(obj.$attrs.fontColor));
expect(obj.$attrs.align).assertEqual("Alignment.Top")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.End")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Lighter")
expect(obj.$attrs.decoration).assertEqual(JSON.stringify({
type: "TextDecorationType.Overline", color: "#FFFF0000"
}))
expect(obj.$attrs.fontColor).assertEqual("#FF808080")
console.info('cd text3InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1240
* @tc.name textGetInspectorByKey050
* @tc.desc aceEtsTest
*/
it('textGetInspectorByKey050', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text4');
let obj = JSON.parse(strJson);
console.info("cd text4 component obj is: " + JSON.stringify(obj));
console.log("cd text4 align" + JSON.stringify(obj.$attrs.align));
console.log("cd text4 alignSelf" + JSON.stringify(obj.$attrs.alignSelf));
console.log("cd text4 fontWeight" + JSON.stringify(obj.$attrs.fontWeight));
console.log("cd text4 fontColor" + JSON.stringify(obj.$attrs.fontColor));
expect(obj.$attrs.align).assertEqual("Alignment.TopStart")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Baseline")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Medium")
expect(obj.$attrs.fontColor).assertEqual("#FFA52A2A")
console.info('cd text4InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1250
* @tc.name textGetInspectorByKey060
* @tc.desc aceEtsTest
*/
it('textGetInspectorByKey060', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text5');
let obj = JSON.parse(strJson);
console.info("cd text5 component obj is: " + JSON.stringify(obj));
console.log("cd text5 align" + JSON.stringify(obj.$attrs.align));
console.log("cd text5 alignSelf" + JSON.stringify(obj.$attrs.alignSelf));
console.log("cd text5 fontWeight" + JSON.stringify(obj.$attrs.fontWeight));
console.log("cd text5 fontColor" + JSON.stringify(obj.$attrs.fontColor));
expect(obj.$attrs.align).assertEqual("Alignment.End")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Stretch")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Regular")
expect(obj.$attrs.fontColor).assertEqual("#FF808080")
console.info('cd text5InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1260
* @tc.name textGetInspectorByKey070
* @tc.desc aceEtsTest
*/
it('textGetInspectorByKey070', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text6');
let obj = JSON.parse(strJson);
console.info("cd text6 component obj is: " + JSON.stringify(obj));
console.log("cd text6 align" + JSON.stringify(obj.$attrs.align));
console.log("cd text6 fontColor" + JSON.stringify(obj.$attrs.fontColor));
expect(obj.$attrs.align).assertEqual("Alignment.BottomEnd")
expect(obj.$attrs.fontColor).assertEqual("#FFFFA500")
console.info('cd text6InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1270
* @tc.name textGetInspectorByKey080
* @tc.desc aceEtsTest
*/
it('textGetInspectorByKey080', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text7');
let obj = JSON.parse(strJson);
console.info("cd text7 component obj is: " + JSON.stringify(obj));
console.log("cd text7 align" + JSON.stringify(obj.$attrs.align));
console.log("cd text7 fontColor" + JSON.stringify(obj.$attrs.fontColor));
expect(obj.$attrs.align).assertEqual("Alignment.Bottom")
expect(obj.$attrs.fontColor).assertEqual("#FFFFFF00")
console.info('cd text7InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_1280
* @tc.name textGetInspectorByKey090
* @tc.desc aceEtsTest
*/
it('textGetInspectorByKey090', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text8');
let obj = JSON.parse(strJson);
console.info("cd text8 component obj is: " + JSON.stringify(obj));
console.log("cd text8 align" + JSON.stringify(obj.$attrs.align));
expect(obj.$attrs.align).assertEqual("Alignment.BottomStart")
console.info('cd text8InspectorByKey END');
done();
});
})
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsAceEtsTest") {
hap_profile = "./entry/src/main/config.json"
deps = [
":ace_ets_assets",
":ace_ets_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsAceEtsTest"
}
ohos_js_assets("ace_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("ace_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
{
"description": "Configuration for hjunit demo Tests",
"driver": {
"type": "JSUnitTest",
"test-timeout": "600000",
"package": "com.open.harmony.standardtest",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsAceEtsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.open.harmony.standardtest",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "com.open.harmony.standardtest",
"name": ".MyApplication",
"mainAbility": ".MainAbility",
"srcPath": "MainAbility",
"deviceType": [
"phone"
],
"distro": {
"deliveryWithInstall": true,
"moduleName": "entry",
"moduleType": "entry",
"installationFree": false
},
"abilities": [
{
"skills": [
{
"entities": [
"entity.system.home"
],
"actions": [
"action.system.home"
]
}
],
"orientation": "unspecified",
"visible": true,
"srcPath": "MainAbility",
"name": ".MainAbility",
"srcLanguage": "ets",
"icon": "$media:icon",
"description": "$string:description_mainability",
"formsEnabled": false,
"label": "$string:entry_MainAbility",
"type": "page",
"launchType": "standard"
}
],
"js": [
{
"mode": {
"syntax": "ets",
"type": "pageAbility"
},
"pages": [
"pages/index",
"pages/AlphabetIndexer",
"pages/Grid",
"pages/GridItem",
"pages/HyperLink",
"pages/List",
"pages/ListItem",
"pages/Navigator",
"pages/Panel",
"pages/Row",
"pages/Swiper",
"pages/Tab",
"pages/Calendar",
"pages/AlertDialog",
"pages/Prop",
"pages/Link",
"pages/AppStorage",
"pages/Video"
],
"name": ".MainAbility",
"window": {
"designWidth": 720,
"autoDesignWidth": false
}
}
]
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct alertdialog {
@State currentTest: string = 'default'
build() {
Column() {
Text(`${this.currentTest}`)
.fontSize(20)
Button('Show Dialog With Two Buttons')
.width(300)
.margin(10)
.backgroundColor(Color.Blue)
.onClick(() => {
AlertDialog.show({
title: 'Title',
message: 'This is message',
primaryButton: {
value: '11111111111',
action: () => {
this.currentTest = 'primaryButton'
}
},
secondaryButton: {
value: 'cancle',
action: () => {
this.currentTest = 'secondaryButton'
}
},
cancel: () => {
this.currentTest = 'cancel'
}
})
.key('alertDialog')
})
}
.width('100%')
.height('100%')
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct alphabetIndexer {
private value: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']
private value1: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I']
@State active: boolean = false
private content: string = "AlphabetIndexer Page"
onPageShow() {
console.info('alphabetIndexer page show called');
}
onBuildDone() {
console.info('alphabetIndexer page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Text("AlphabetIndexer0")
AlphabetIndexer({ arrayValue: this.value, selected: 0 })
.selectedColor(0xffffff)
.key('alphabetIndexer')
.popupColor('#FF737373')
.selectedBackgroundColor('#FF0000E6')
.popupBackground('#FF00DDDD')
.usingPopup(true)
.selectedFont({ size: 16, weight: FontWeight.Regular })
.popupFont({ size: 30, weight: FontWeight.Bolder, style: FontStyle.Normal })
.itemSize(28)
.alignStyle(IndexerAlign.Left)
Text("AlphabetIndexer1")
AlphabetIndexer({ arrayValue: this.value1, selected: 0 })
.selectedColor(0xffffff)
.key('alphabetIndexer1')
.popupColor('#FF737373')
.selectedBackgroundColor('#FF0000E6')
.popupBackground('#FF00DDDD')
.usingPopup(false)
.selectedFont({ size: 16, weight: FontWeight.Lighter })
.popupFont({ size: 30, weight: FontWeight.Bold, style: FontStyle.Italic })
.itemSize(28)
.alignStyle(IndexerAlign.Right)
.margin({ left: 50 })
}
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import router from '@system.router'
AppStorage.SetOrCreate("PropC", 1)
var link3 = AppStorage.Link("PropC");
AppStorage.SetOrCreate("PropA", 47);
var link1 = AppStorage.Link("PropA");
var link2 = AppStorage.Link("PropA");
var prop1 = AppStorage.Prop("PropA");
AppStorage.SetAndLink("PropB", 50)
var PropBValue = String(AppStorage.Get("PropB"))
AppStorage.SetAndProp("PropA", 47)
var PropAValue = String(AppStorage.Get("PropA"))
for (let key of AppStorage.Keys()) {
var keys = key
}
var setPropAValue = String(AppStorage.Set("PropA", 20))
var deleteValue = String(AppStorage.Delete("PropC"))
var hasValue = String(AppStorage.Has("PropB"))
var isMutableValue = String(AppStorage.IsMutable("PropB"))
@Entry
@Component
struct appStorage_test {
private content: string = "appStorage Page";
@State str1: string = link1.get().toString();
@State str2: string = link2.get().toString();
@State str3: string = prop1.get().toString()
@State str6: string = link3.get().toString();
@State PropB: string = PropBValue
@State PropA: string = PropAValue
@State keys: string = keys
@State str4: string = link1.get().toString()
@State str5: string = setPropAValue
@State str7: string = deleteValue
@State str8: string= hasValue
@State str9: string= isMutableValue
onPageShow() {
console.info('appStorage page show called');
}
onBuildDone() {
console.info('appStorage page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Button(this.str1)
.margin(15)
.key('Button0_1')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Button(this.str3)
.margin(15)
.key('Button0_2')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Button(this.PropB)
.margin(15)
.key('Button0_3')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Button(this.PropA)
.margin(15)
.key('Button0_4')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Button(this.str8)
.margin({ top: 10 })
.key('Button0_5')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Button(this.keys)
.margin(15)
.key('Button0_6')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Button(this.str4)
.margin(15)
.key('Button0_7')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Button(this.str5)
.margin(15)
.key('Button0_8')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Button(this.str6)
.margin(15)
.key('Button0_9')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Button(this.str7)
.margin(15)
.key('Button0_10')
.fontWeight(FontWeight.Bold)
.fontSize(20)
Text(this.str9)
.margin({ top: 10 })
.key('Button0_12')
.fontWeight(FontWeight.Bold)
.fontSize(20)
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct calendar {
@State curMonth: MonthData = { year: 0, month: 0, data: [] };
@State preMonth: MonthData = { year: 0, month: 0, data: [] };
@State nextMonth: MonthData = { year: 0, month: 0, data: [] }
@State year: number = 0
@State month: number = 0
Controller: CalendarController = new CalendarController();
private lunarMonthDays: string[] = [
'初一', '初二', '初三', '初四', '初五', '初六', '初七', '初八', '初九', '初十',
'十一', '十二', '十三', '十四', '十五', '十六', '十七', '十八', '十九', '二十',
'廿一', '廿二', '廿三', '廿四', '廿五', '廿六', '廿七', '廿八', '廿九', '三十']
private lunarMonthNames: string[] = ['正月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '冬月', '腊月']
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Start
}) {
Row() {
Text(`${this.year} 年 ${this.month + 1} 月`)
.fontSize(20)
.fontWeight(FontWeight.Bold)
}
Calendar({
date: { year: 2021, month: 8, day: 35 },
currentData: this.curMonth,
preData: this.preMonth,
nextData: this.nextMonth,
controller: this.Controller
})
.showHoliday(true)
.needSlide(true)
.offDays(Week.Tue | Week.Wed)
.startOfWeek(Week.Sun)
.currentDayStyle({
dayColor: Color.Black,
lunarColor: Color.Gray,
dayFontSize: 15,
lunarDayFontSize: 10,
boundaryColOffset: 10
})
.nonCurrentDayStyle({
nonCurrentMonthDayColor: Color.Black,
nonCurrentMonthLunarColor: Color.Gray
})
.todayStyle({
focusedDayColor: Color.Red,
focusedLunarColor: Color.Orange,
focusedAreaBackgroundColor: Color.Blue,
focusedAreaRadius: 20
})
.onRequestData((request) => {
switch (request.monthState) {
case 0:
this.year = request.currentYear;
this.month = request.currentMonth;
this.curMonth.year = request.year;
this.curMonth.month = request.month;
this.curMonth.data = [];
for (var i = 0; i < 35; ++i) {
this.curMonth.data.push({
index: i,
lunarMonth: this.lunarMonthNames[i%12],
lunarDay: this.lunarMonthDays[i % 30],
dayMark: "work",
dayMarkValue: "",
year: request.year;
month: request.month;
day: i + 1;
isFirstOfLunar: false,
hasSchedule: false,
markLunarDay: false
});
if (i % 7 == 0 || i % 7 == 6) {
this.curMonth.data[i].dayMarkValue = "休"
}
}
break;
case 1:
this.year = request.currentYear;
this.month = request.currentMonth;
this.preMonth.year = request.year;
this.preMonth.month = request.month
this.preMonth.data = [];
for (var i = 0; i < 35; ++i) {
this.preMonth.data.push({
index: i,
lunarMonth: this.lunarMonthNames[i%12],
lunarDay: this.lunarMonthDays[i % 30],
dayMark: "work",
dayMarkValue: "",
year: request.year,
month: request.month,
day: i + 1,
isFirstOfLunar: false,
hasSchedule: false,
markLunarDay: false
});
if (i % 7 == 0 || i % 7 == 6) {
this.preMonth.data[i].dayMarkValue = "休"
}
}
break;
case 2:
this.year = request.currentYear;
this.month = request.currentMonth;
this.nextMonth.year = request.year;
this.nextMonth.month = request.month;
this.nextMonth.data = [];
for (var i = 0; i < 35; ++i) {
this.nextMonth.data.push({
index: i,
lunarMonth: this.lunarMonthNames[i%12],
lunarDay: this.lunarMonthDays[i % 30],
dayMark: "work",
dayMarkValue: "",
year: request.year,
month: request.month,
day: i + 1,
isFirstOfLunar: false,
hasSchedule: false,
markLunarDay: false
});
if (i % 7 == 0 || i % 7 == 6) {
this.nextMonth.data[i].dayMarkValue = "休"
}
}
break;
}
})
}.margin({ bottom: 10, right: 20, left: 20, top: 0 })
.height("50%")
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@CustomDialog
struct CustomDialogExample {
controller: CustomDialogController
cancel: () => void
confirm: () => void
build() {
Column() {
Text('Software uninstall').width('70%').fontSize(20).margin({ top: 10, bottom: 10 })
Image($r('app.media.icon')).width(80).height(80)
Text('Whether to uninstall a software?').fontSize(16).margin({ bottom: 10 })
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('cancel')
.onClick(() => {
this.controller.close()
this.cancel()
}).backgroundColor(0xffffff).fontColor(Color.Black)
Button('confirm')
.onClick(() => {
this.controller.close()
this.confirm()
}).backgroundColor(0xffffff).fontColor(Color.Red)
}.margin({ bottom: 10 })
}
}
}
@Entry
@Component
struct CustomDialogUser {
dialogController: CustomDialogController = new CustomDialogController({
builder: CustomDialogExample({ cancel: this.onCancel, confirm: this.onAccept }),
cancel: this.existApp,
autoCancel: true
})
onCancel() {
console.info('Callback when the first button is clicked')
}
onAccept() {
console.info('Callback when the second button is clicked')
}
existApp() {
console.info('Click the callback in the blank area')
}
build() {
Column() {
Button('click me')
.onClick(() => {
this.dialogController.open()
}).backgroundColor(0x317aff)
}.width('100%').margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct grid_testcase {
@State Number: String[] = ['0', '1', '2', '3', '4']
@State active: boolean = false
build() {
Column() {
Navigator({ target: "pages/index", type: NavigationType.Back }) {
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)
.key('Grid')
}.width('100%').margin({ top: 5 })
}.active(this.active)
.params({
data: 19
})
}.width(300)
.height(350)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct gridItem_testcasee {
@State numbers: string[] = Array.apply(null, Array(16)).map(function (item, i) {
return i.toString()
})
@State active: boolean = false
build() {
Column() {
Navigator({ target: "pages/index", type: NavigationType.Back }) {
Column() {
Grid() {
GridItem() {
Text('4')
.fontSize(16)
.backgroundColor(0xFAEEE0)
.width('100%')
.height('100%')
.textAlign(TextAlign.Center)
}
.rowStart(1)
.rowEnd(4)
.columnStart(1)
.columnEnd(2)
.forceRebuild(false)
.key('GridItem1')
ForEach(this.numbers, (item) => {
GridItem() {
Text(item)
.fontSize(16)
.backgroundColor(0xF9CF93)
.width('100%')
.height('100%')
.textAlign(TextAlign.Center)
}.forceRebuild(false)
}, item => item)
GridItem() {
Text('5')
.fontSize(16)
.backgroundColor(0xDBD0C0)
.width('100%')
.height('100%')
.textAlign(TextAlign.Center)
}.columnStart(1)
.columnEnd(5)
.forceRebuild(false)
.key('GridItem2')
}
.columnsTemplate('1fr 1fr 1fr 1fr 1fr')
.rowsTemplate('1fr 1fr 1fr 1fr 1fr')
.width('90%').height(300)
}.width('100%').margin({ top: 5 })
}.active(this.active)
.params({
data: 20
})
}.width(300)
.height(350)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct hyperLink_testcase {
@State active: boolean = false
build() {
Column() {
Column() {
Hyperlink('https://developer.harmonyos.com/', 'Go to the developer website') {
Text("click to link to developer page")
.fontSize(30)
}.color("#008000")
.key('hyperlink1')
}.width('100%').margin({ top: 5 })
}
.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct link {
private content: string = "link Page";
@State isPlaying: boolean = false
onPageShow() {
console.info('link page show called');
}
onBuildDone() {
console.info('link page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll() {
Column() {
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
PlayButton({ stateEffect: $isPlaying })
Button("Button1 stateEffect false", { type: ButtonType.Normal })
.backgroundColor(Color.Gray)
.stateEffect(this.isPlaying)
.key("Button")
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
@Component
struct PlayButton {
@Link stateEffect: boolean
build() {
Column() {
Text("子组件button")
Button("Button2 stateEffect ", { type: ButtonType.Capsule })
.backgroundColor(Color.Pink)
.stateEffect(this.stateEffect)
.key("Button1")
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct ListExample {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@State editFlag: boolean = false
build() {
Stack({ alignContent: Alignment.TopStart }) {
Column() {
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)
}.editable(true)
}, item => item)
}
.key('list')
.listDirection(Axis.Vertical)
.divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 })
.edgeEffect(EdgeEffect.None)
.chainAnimation(false)
.onScrollIndex((firstIndex: number, lastIndex: number) => {
console.info('first' + firstIndex)
console.info('last' + lastIndex)
})
.editMode(this.editFlag)
.onItemDelete((index: number) => {
console.info(this.arr[index] + 'Delete')
this.arr.splice(index, 1)
console.info(JSON.stringify(this.arr))
this.editFlag = false
return true
})
.width('90%')
}.width('100%')
Button('edit list')
.onClick(() => {
this.editFlag = !this.editFlag
}).margin({ top: 5, left: 20 })
}.width('100%').height('50%').backgroundColor(0xDCDCDC).padding({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct listItem_testcase {
private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
@State editFlag: boolean = false
@State active: boolean = false
build() {
Column() {
Column() {
List() {
ListItem() {
Text('sticky:Normal , item1111')
.width('100%')
.height(40)
.fontSize(12)
}.sticky(Sticky.Normal)
.editable(true)
.key('listitem')
ListItem() {
Text('sticky:Opacity , item3333')
.width('100%')
.height(40)
.fontSize(12)
}.sticky(Sticky.Opacity)
.editable(true)
.key('listitem3')
}
}.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 })
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct navigator_testcase {
@State active:boolean =false
@State params:Object ={ text: 'news' }
build() {
Column(){
Navigator({target:"pages/index",type:NavigationType.Back}){
Text('Navigator test go to Navigator, back called')
}.active(this.active)
.key('navigator')
.params({
data:24
})
Navigator({target:"pages/index",type:NavigationType.Push}){
Text('Navigator test go to Navigator, router called')
}.active(this.active)
.key('navigator2')
.params({
data:24
})
Navigator({target:"pages/index",type:NavigationType.Replace}){
Text('Navigator test go to Navigator,changed called')
}.active(this.active)
.key('navigator3')
.params({
data:24
})
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct PanelExample {
@State show: boolean = true
build() {
Column() {
Text('2021-09-30 Today Calendar: 1.afternoon......Click for details')
.width('90%')
.height(50)
.borderRadius(10)
.backgroundColor(0xFFFFFF)
.padding({ left: 20 })
.onClick(() => {
this.show = !this.show
})
Panel(this.show) {
Column() {
Text('Today Calendar')
Divider()
Text('1. afternoon 4:00 The project meeting')
}
}
.key('panel')
.type(PanelType.Foldable)
.mode(PanelMode.Half)
.dragBar(true)
.fullHeight(500)
.halfHeight(250)
.miniHeight(100)
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
})
Panel(this.show) {
Column() {
Text('Today Calendar')
Divider()
Text('1. afternoon 4:00 The project meeting')
}
}
.key('panel2')
.type(PanelType.Minibar)
.mode(PanelMode.Mini)
.dragBar(true)
.fullHeight(500)
.halfHeight(250)
.miniHeight(100)
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
})
Panel(false) {
Column() {
Text('Today Calendar')
Divider()
Text('1. afternoon 4:00 The project meeting')
}
}
.key('panel3')
.type(PanelType.Temporary)
.mode(PanelMode.Full)
.dragBar(true)
.fullHeight(500)
.halfHeight(250)
.miniHeight(100)
.onChange((value: any) => {
console.info(`width:${value.width},height:${value.height},mode:${value.mode}`)
})
}.width('100%').height('50%').backgroundColor(0xDCDCDC).padding({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct prop {
@State value: number = 0
private content: string = "prop Page";
@State isPlaying: boolean = false
@State countDownStartValue: number = 10
onPageShow() {
console.info('Prop page show called');
}
onBuildDone() {
console.info('Prop page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Scroll(){
Column(){
Text(`${this.content}`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Column() {
Text(`${this.countDownStartValue}`)
.key("Text001")
Button() {
Text('+1 - Nuggets in New Game')
}.onClick(() => {
this.countDownStartValue += 1
})
Button() {
Text('-1 - Nuggets in New Game')
}.onClick(() => {
this.countDownStartValue -= 1
})
CountDownComponent({ count: this.countDownStartValue, costOfOneAttempt: 2})
}
}
}
}
.key('flex')
.width('100%')
.height('100%')
}
}
@Component
struct CountDownComponent {
@Prop count: number
private costOfOneAttempt: number
build() {
Column() {
Text(`${this.count}`)
.key("Text002")
}
}}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct row_testcase {
@State alignItems: VerticalAlign= VerticalAlign.Top
@State active: boolean = false
build() {
Column() {
Navigator({ target: "pages/index", type: NavigationType.Back }) {
Row() {
Column() {
Text("Row-Demo1")
}
Column() {
Text("Demo2")
}
}
.key('row')
.alignItems(this.alignItems)
}.active(this.active)
.params({
data: 26
})
}.width(300)
.height(300)
.borderColor(Color.Pink)
.borderWidth(2)
}
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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([])
private 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(20)
}, item => item)
}
.key('swiper')
.cachedCount(2)
.index(1)
.autoPlay(true)
.interval(4000)
.indicator(true)
.loop(false)
.duration(1000)
.vertical(false)
.itemSpace(0)
.onChange((index: number) => {
console.info(index.toString())
})
Flex({ justifyContent: FlexAlign.SpaceAround }) {
Button('next')
.onClick(() => {
this.swiperController.showNext()
})
Button('preview')
.onClick(() => {
this.swiperController.showPrevious()
})
}
}.margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct TabsExample {
private controller: TabsController = new TabsController()
build() {
Column() {
Tabs({ barPosition: BarPosition.Start, index: 1, controller: this.controller }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar('pink')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Yellow)
}.tabBar('yellow')
.key('tabcontent')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Blue)
}.tabBar('blue')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Green)
}.tabBar('green')
}
.key('tab')
.vertical(true)
.scrollable(true)
.barMode(BarMode.Fixed)
.barWidth(70)
.barHeight(150)
.animationDuration(400)
.onChange((index: number) => {
console.info(index.toString())
})
.width('90%')
.backgroundColor(0xF5F5F5)
Tabs({ barPosition: BarPosition.End, index: 1, controller: this.controller }) {
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Pink)
}.tabBar('pink')
TabContent() {
Column().width('100%').height('100%').backgroundColor(Color.Green)
}.tabBar('green')
}
.key('tab2')
.vertical(false)
.scrollable(false)
.barMode(BarMode.Scrollable)
.barWidth(70)
.barHeight(150)
.animationDuration(400)
.onChange((index: number) => {
console.info(index.toString())
})
.width('90%')
.backgroundColor(0xF5F5F5)
}.width('100%').height(150).margin({ top: 5 })
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@Entry
@Component
struct VideoCreateComponent {
@State srcs: string = '/resources/rawfile/video/show.mp4';
@State previewUri: string = '/resources/image/dark.jpg';
@State currentProgressRates: number = 1;
@State autoPlays: boolean = false;
@State controlsss: boolean = true;
myVideoController: VideoController = new VideoController();
@State startStaus: boolean = true;
build() {
Column() {
Video({
src: this.srcs,
previewUri: this.previewUri,
currentProgressRate: this.currentProgressRates,
controller: this.myVideoController
})
.width(700)
.height(500)
.autoPlay(this.autoPlays)
.muted(true)
.controls(this.controlsss)
.loop(true)
.objectFit(ImageFit.Cover)
.key('video')
Row() {
Button("start").onClick(() => {
this.myVideoController.start();
});
Button("pause").onClick(() => {
this.myVideoController.pause();
});
Button("stop").onClick(() => {
this.myVideoController.stop();
});
}
Row() {
Button("setCurrentTime").onClick(() => {
this.myVideoController.setCurrentTime(9);
});
Button("requestFullscreen").onClick(() => {
this.myVideoController.requestFullscreen(true);
});
Button("exitFullscreen").onClick(() => {
this.myVideoController.exitFullscreen();
});
}
}
}
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets"
import testsuite from "../test/List.test.ets"
import featureAbility from "@ohos.ability.featureAbility"
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance()
const expectExtend = new ExpectExtend({
'id': 'extend'
})
core.addService('expect', expectExtend)
const reportExtend = new ReportExtend(file)
core.addService('report', reportExtend)
core.init()
core.subscribeEvent('task', reportExtend)
const configService = core.getDefaultService('config')
const timeout=10000
configService.setConfig(timeout)
console.info('parameters---->' + JSON.stringify(Want.parameters))
configService.setConfig(Want.parameters)
testsuite()
core.execute()
console.info('Operation successful. Data: ' + JSON.stringify(Want));
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ccc World')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
// @ts-nocheck
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function alphabetIndexerJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('alphabetIndexerTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0100
* @tc.name alphabetIndexerTest001
* @tc.desc aceEtsTest
*/
it('alphabetIndexerTest001', 0, async function (done) {
console.info('AlphabetIndexerTest001 START');
let options = {
uri: 'pages/AlphabetIndexer',
}
try {
let result = await router.push(options)
console.info("push AlphabetIndexer page success " + JSON.stringify(result));
} catch (err) {
console.error("push AlphabetIndexer page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('alphabetIndexer');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('AlphabetIndexer');
console.info('AlphabetIndexerTest001 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0110
* @tc.name alphabetIndexerTest002
* @tc.desc aceEtsTest
*/
it('alphabetIndexerTest002', 0, async function (done) {
console.info('AlphabetIndexerTest002 START');
let strJson = getInspectorByKey('alphabetIndexer1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.info('AlphabetIndexerTest002 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function appStorageJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('appStorageTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0130
* @tc.name appStorageTest001
* @tc.desc aceEtsTest
*/
it('appStorageTest001', 0, async function (done) {
console.info('AppStorageTest001 START');
let options = {
uri: 'pages/AppStorage',
}
try {
let result = await router.push(options)
console.info("push AppStorage0 page success " + JSON.stringify(result));
} catch (err) {
console.error("push AppStorage0 page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('Button0_1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Button');
console.log(JSON.stringify(obj.$type))
console.info("yr AppStorage0 type: " + JSON.stringify(obj.$type));
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('20');
console.log("yr AppStorage0 label-'47'" + JSON.stringify(obj.$attrs.label))
console.info('AppStorage0 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0140
* @tc.name appStorageTest002
* @tc.desc aceEtsTest
*/
it('appStorageTest002', 0, async function (done) {
console.info('AppStorageTest002 START');
let strJson = getInspectorByKey('Button0_2');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('20');
console.log("yr AppStorage1 label-'47'" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest002 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0150
* @tc.name appStorageTest003
* @tc.desc aceEtsTest
*/
it('appStorageTest003', 0, async function (done) {
console.info('AppStorageTest003 START');
let strJson = getInspectorByKey('Button0_3');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('50');
console.log("yr AppStorage2 label-'50'" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest003 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0160
* @tc.name appStorageTest004
* @tc.desc aceEtsTest
*/
it('appStorageTest004', 0, async function (done) {
console.info('AppStorageTest004 START');
let strJson = getInspectorByKey('Button0_4');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('47');
console.log("yr AppStorage3 label-'47'" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest004 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0170
* @tc.name appStorageTest005
* @tc.desc aceEtsTest
*/
it('appStorageTest005', 0, async function (done) {
console.info('AppStorageTest005 START');
let strJson = getInspectorByKey('Button0_5');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('true');
console.log("yr AppStorage4 label-' '" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest005 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0180
* @tc.name appStorageTest006
* @tc.desc aceEtsTest
*/
it('appStorageTest006', 0, async function (done) {
console.info('AppStorageTest006 START');
let strJson = getInspectorByKey('Button0_6');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('PropB');
console.log("yr AppStorage5 label-'PropA'" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest006 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0190
* @tc.name appStorageTest007
* @tc.desc aceEtsTest
*/
it('appStorageTest007', 0, async function (done) {
console.info('AppStorageTest007 START');
let strJson = getInspectorByKey('Button0_7');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('20');
console.log("yr AppStorage6 label-'47'" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest007 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0100
* @tc.name appStorageTest008
* @tc.desc aceEtsTest
*/
it('appStorageTest008', 0, async function (done) {
console.info('AppStorageTest008 START');
let strJson = getInspectorByKey('Button0_8');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('true');
console.log("yr AppStorage7 label-'20'" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest008 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0210
* @tc.name appStorageTest009
* @tc.desc aceEtsTest
*/
it('appStorageTest008', 0, async function (done) {
console.info('AppStorageTest009 START');
let strJson = getInspectorByKey('Button0_9');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('1');
console.log("yr AppStorage8 label-'1'" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest009 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0220
* @tc.name appStorageTest010
* @tc.desc aceEtsTest
*/
it('appStorageTest010', 0, async function (done) {
console.info('AppStorageTest010 START');
let strJson = getInspectorByKey('Button0_10');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.label).assertEqual('false');
console.log("yr AppStorage9 label-' '" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest010 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0230
* @tc.name appStorageTest011
* @tc.desc aceEtsTest
*/
it('appStorageTest011', 0, async function (done) {
console.info('AppStorageTest011 START');
let strJson = getInspectorByKey('Button0_12');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.content).assertEqual('true');
console.log("yr AppStorage11 label-'50'" + JSON.stringify(obj.$attrs.label))
console.info('AppStorageTest011 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function gridItemJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('gridItemTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0340
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('gridItemTest001', 0, async function (done) {
console.info('gridItemTest001 START');
let options = {
uri: 'pages/GridItem',
}
try {
let result = await router.push(options)
console.info( JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('GridItem1');
let obj = JSON.parse(strJson);
console.info("属性值集合: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('GridItem')
console.log('GridItem1‘s rowStart is '+JSON.stringify(obj.$attrs.rowStart))
console.log('GridItem1‘s rowEnd is '+JSON.stringify(obj.$attrs.rowEnd))
console.log('GridItem1‘s columnStart is '+JSON.stringify(obj.$attrs.columnStart))
console.log('GridItem1‘s columnEnd is '+JSON.stringify(obj.$attrs.columnEnd))
console.log('GridItem1‘s forceRebuild is '+JSON.stringify(obj.$attrs.forceRebuild))
await sleep(1)
expect(obj.$attrs.rowStart).assertEqual('1')
expect(obj.$attrs.rowEnd).assertEqual('4')
expect(obj.$attrs.columnStart).assertEqual('1')
expect(obj.$attrs.columnEnd).assertEqual('2')
expect(obj.$attrs.forceRebuild).assertEqual('false')
console.info('gridItemTest001 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function gridJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('gridTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0350
* @tc.name gridItemTest001
* @tc.desc aceEtsTest
*/
it('gridTest001', 0, async function (done) {
console.info('gridTest001 START');
let options = {
uri: 'pages/Grid',
}
try {
let result = await router.push(options)
console.info( JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('Grid');
let obj = JSON.parse(strJson);
console.info("属性值集合: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Grid')
console.log(JSON.stringify(obj.$attrs.columnsTemplate))
console.log(JSON.stringify(obj.$attrs.rowsTemplate))
console.log(JSON.stringify(obj.$attrs.rowsTemplate))
console.log(JSON.stringify(obj.$attrs.columnsGap))
console.log(JSON.stringify(obj.$attrs.rowsGap))
await sleep(1)
expect(obj.$attrs.columnsTemplate).assertEqual('1fr 1fr 1fr 1fr 1fr')
expect(obj.$attrs.rowsTemplate).assertEqual('1fr 1fr 1fr 1fr 1fr')
console.info('gridTest001 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function hyperlinkJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('hyperLinkTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0360
* @tc.name hyperLinkTest001
* @tc.desc aceEtsTest
*/
it('hyperLinkTest001', 0, async function (done) {
console.info('++++++++++++++++ Hyperlink TestCase 1 START ++++++++++++++++');
let options = {
uri: 'pages/HyperLink',
}
try {
let result = await router.push(options)
console.info( JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('hyperlink1');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Hyperlink')
console.info("属性值集合: " + JSON.stringify(obj));
console.log('Hyperlink‘s address is '+JSON.stringify(obj.$attrs.address))
console.log('Hyperlink‘s content is '+JSON.stringify(obj.$attrs.content))
expect(obj.$attrs.address).assertEqual('https://developer.harmonyos.com/')
expect(obj.$attrs.content).assertEqual('Go to the developer website')
console.info('++++++++++++++++ Hyperlink TestCase 1 End ++++++++++++++++');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function linkJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('linkTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0370
* @tc.name linkTest001
* @tc.desc aceEtsTest
*/
it('linkTest001', 0, async function (done) {
console.info('linkTest001 START');
let options = {
uri: 'pages/Link',
}
try {
let result = await router.push(options)
console.info("push link0 page success " + JSON.stringify(result));
} catch (err) {
console.error("push link0 page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('Button');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Button');
console.log(JSON.stringify(obj.$type))
console.info("yr link0 type: " + JSON.stringify(obj.$type));
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.stateEffect).assertEqual('false');
console.log("yr link0 stateEffect-'false'"+JSON.stringify(obj.$attrs.stateEffect))
console.info('linkTest001 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0380
* @tc.name linkTest001
* @tc.desc aceEtsTest
*/
it('linkTest002', 0, async function (done) {
console.info('linkTest002 START');
let strJson = getInspectorByKey('Button1');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.stateEffect).assertEqual('false');
console.log("yr link1 stateEffect-'false'"+JSON.stringify(obj.$attrs.stateEffect))
console.info('linkTest002 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import appStorageJsunit from './AppStorageJsunit.test.ets';
import linkJsunit from './LinkJsunit.test.ets';
import propJsunit from './PropJsunit.test.ets';
import alphabetIndexerJsunit from './AlphabetIndexerJsunit.test.ets';
import listJsunit from './ListJsunit.test.ets';
import tabJsunit from './TabJsunit.test.ets';
import swiperJsunit from './SwiperJsunit.test.ets';
import panelJsunit from './PanelJsunit.test.ets';
import navigatorJsunit from './NavigatorJsunit.test.ets';
import rowJsunit from './RowJsunit.test.ets';
import listItemJsunit from './ListItemJsunit.test.ets';
import hyperlinkJsunit from './HyperLinkJsunit.test.ets';
import gridItemJsunit from './GridItem.test.ets';
import gridJsunit from './GridJsnuit.test.ets';
import videoJsunit from './VideoJsunit.test.ets';
export default function testsuite() {
alphabetIndexerJsunit()
hyperlinkJsunit()
rowJsunit()
gridJsunit()
gridItemJsunit()
navigatorJsunit()
panelJsunit()
swiperJsunit()
tabJsunit()
propJsunit()
linkJsunit()
appStorageJsunit()
videoJsunit()
listItemJsunit()
listJsunit()
}
\ No newline at end of file
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function listItemJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('listItemTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0390
* @tc.name listItemTest001
* @tc.desc aceEtsTest
*/
it('listItemTest001', 0, async function (done) {
console.info('++++++++++++++++ ListItem TestCase 1 START ++++++++++++++++');
let options = {
uri: 'pages/ListItem',
}
try {
let result = await router.push(options)
console.info(JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('listitem');
console.log(JSON.stringify(strJson))
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('ListItem')
console.log(JSON.stringify(obj.$attrs.type))
console.log('ListItem1‘s sticky is ' + JSON.stringify(obj.$attrs.sticky))
console.log('ListItem1‘s editable is ' + JSON.stringify(obj.$attrs.editable))
expect(obj.$attrs.sticky).assertEqual('Sticky.Normal')
expect(obj.$attrs.editable).assertEqual('true')
console.info('++++++++++++++++ ListItem TestCase 1 End ++++++++++++++++');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0400
* @tc.name listItemTest002
* @tc.desc aceEtsTest
*/
it('listItemTest002', 0, async function (done) {
console.info('++++++++++++++++ ListItem TestCase 2 START ++++++++++++++++');
let strJson = getInspectorByKey('listitem3');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('ListItem')
console.log(JSON.stringify(obj.$attrs.type))
console.log('ListItem2‘s sticky is ' + JSON.stringify(obj.$attrs.sticky))
console.log('ListItem2‘s editable is ' + JSON.stringify(obj.$attrs.editable))
await sleep(1)
expect(obj.$attr.sticky).assertEqual('Sticky.Opacity')
expect(obj.$attr.editable).assertEqual('true')
console.info('++++++++++++++++ ListItem TestCase 3 End ++++++++++++++++');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function listJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('listTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0410
* @tc.name listTest001
* @tc.desc aceEtsTest
*/
it('listTest001', 0, async function (done) {
console.info('++++++++++++++++ List TestCase 1 START ++++++++++++++++');
let options = {
uri: 'pages/List',
}
try {
let result = await router.push(options)
console.info(JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('list');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('List')
console.log('List‘s space is ' + JSON.stringify(obj.$attrs.space))
console.log('List‘s initialIndex is ' + JSON.stringify(obj.$attrs.initialIndex))
console.log('List‘s listDirection is ' + JSON.stringify(obj.$attrs.listDirection))
console.log('List‘s divider is ' + JSON.stringify(obj.$attrs.divider))
console.log('List‘s edgeEffect is ' + JSON.stringify(obj.$attrs.edgeEffect))
expect(obj.$attrs.initialIndex).assertEqual(0.000000.toFixed(6))
expect(obj.$attrs.listDirection).assertEqual('Axis.Vertical')
expect(obj.$attrs.edgeEffect).assertEqual('EdgeEffect.None')
expect(obj.$attrs.editMode).assertEqual("false")
console.info('++++++++++++++++ List TestCase 1 End ++++++++++++++++');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function navigatorJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('navigatorTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0420
* @tc.name navigatorTest001
* @tc.desc aceEtsTest
*/
it('navigatorTest001', 0, async function (done) {
console.info('++++++++++++++++ Navigator TestCase 1 START ++++++++++++++++');
let options = {
uri: 'pages/Navigator',
}
try {
let result = await router.push(options)
console.info( JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('navigator');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Navigator')
console.log('Navigator‘s target is '+JSON.stringify(obj.$attrs.target))
console.log('Navigator‘s type is '+JSON.stringify(obj.$attrs.type))
console.log('Navigator‘s active is '+JSON.stringify(obj.$attrs.active))
console.log('Navigator‘s params is '+JSON.stringify(obj.$attrs.params))
expect(obj.$attrs.target).assertEqual('pages/index')
expect(obj.$attrs.type).assertEqual('NavigationType.Back')
expect(obj.$attrs.active).assertEqual('false')
expect(obj.$attrs.params).assertEqual(JSON.stringify({"data":24}))
console.info('++++++++++++++++ Navigator TestCase 1 End ++++++++++++++++');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0430
* @tc.name navigatorTest002
* @tc.desc aceEtsTest
*/
it('navigatorTest002', 0, async function (done) {
console.info('++++++++++++++++ Navigator TestCase 2 START ++++++++++++++++');
await sleep(1)
let strJson = getInspectorByKey('navigator2');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Navigator')
console.log('Navigator‘s type is '+JSON.stringify(obj.$attrs.type))
expect(obj.$attrs.type).assertEqual('NavigationType.Push')
console.info('++++++++++++++++ Navigator TestCase 2 End ++++++++++++++++');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0440
* @tc.name navigatorTest003
* @tc.desc aceEtsTest
*/
it('navigatorTest003', 0, async function (done) {
console.info('++++++++++++++++ Navigator TestCase 3 START ++++++++++++++++');
await sleep(1)
let strJson = getInspectorByKey('navigator3');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Navigator')
console.log('Navigator‘s type is '+JSON.stringify(obj.$attrs.type))
expect(obj.$attrs.type).assertEqual('NavigationType.Replace')
console.info('++++++++++++++++ Navigator TestCase 3 End ++++++++++++++++');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function panelJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('panelTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0440
* @tc.name panelTest001
* @tc.desc aceEtsTest
*/
it('panelTest001', 0, async function (done) {
console.info('++++++++++++++++ Panel TestCase 1 START ++++++++++++++++');
let options = {
uri: 'pages/Panel',
}
try {
let result = await router.push(options)
console.info( JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('panel');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Panel')
console.log('Panel‘s type is '+JSON.stringify(obj.$attrs.type))
console.log('Panel‘s mode is '+JSON.stringify(obj.$attrs.mode))
console.log('Panel‘s dragBar is '+JSON.stringify(obj.$attrs.dragBar))
console.log('Panel‘s fullHeight is '+JSON.stringify(obj.$attrs.fullHeight))
console.log('Panel‘s halfHeight is '+JSON.stringify(obj.$attrs.halfHeight))
console.log('Panel‘s miniHeight is '+JSON.stringify(obj.$attrs.miniHeight))
expect(obj.$attrs.type).assertEqual('PanelType.Foldable')
expect(obj.$attrs.mode).assertEqual('PanelMode.Half')
expect(obj.$attrs.dragBar).assertEqual('true')
expect(obj.$attrs.fullHeight).assertEqual('500.000000vp')
expect(obj.$attrs.halfHeight).assertEqual('250.000000vp')
expect(obj.$attrs.miniHeight).assertEqual('100.000000vp')
console.info('++++++++++++++++ Panel TestCase 1 End ++++++++++++++++');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0450
* @tc.name panelTest002
* @tc.desc aceEtsTest
*/
it('panelTest002', 0, async function (done) {
console.info('++++++++++++++++ Panel TestCase 2 START ++++++++++++++++');
await sleep(1)
let strJson = getInspectorByKey('panel2');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Panel')
console.log('Panel‘s type is '+JSON.stringify(obj.$attrs.type))
console.log('Panel‘s mode is '+JSON.stringify(obj.$attrs.mode))
console.log('Panel‘s show is '+JSON.stringify(obj.$attrs.show))
expect(obj.$attrs.type).assertEqual('PanelType.Minibar')
expect(obj.$attrs.mode).assertEqual('PanelMode.Mini')
expect(obj.$attrs.show).assertEqual('true')
console.info('++++++++++++++++ Panel TestCase 2 End ++++++++++++++++');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0460
* @tc.name panelTest003
* @tc.desc aceEtsTest
*/
it('panelTest003', 0, async function (done) {
console.info('++++++++++++++++ Panel TestCase 3 START ++++++++++++++++');
await sleep(1)
let strJson = getInspectorByKey('panel3');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Panel')
console.log('Panel‘s type is '+JSON.stringify(obj.$attrs.type))
console.log('Panel‘s mode is '+JSON.stringify(obj.$attrs.mode))
console.log('Panel‘s show is '+JSON.stringify(obj.$attrs.show))
expect(obj.$attrs.type).assertEqual('PanelType.Temporary')
expect(obj.$attrs.mode).assertEqual('PanelMode.Full')
expect(obj.$attrs.show).assertEqual('false')
console.info('++++++++++++++++ Panel TestCase 3 End ++++++++++++++++');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function propJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('propTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0470
* @tc.name propTest001
* @tc.desc aceEtsTest
*/
it('propTest001', 0, async function (done) {
console.info('propTest001 START');
let options = {
uri: 'pages/Prop',
}
try {
let result = await router.push(options)
console.info("push prop0 page success " + JSON.stringify(result));
} catch (err) {
console.error("push prop0 page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('Text001');
let obj = JSON.parse(strJson);
expect(obj.$type).assertEqual('Text');
console.log(JSON.stringify(obj.$type))
console.log("cd attrs.conten type1"+typeof("10"))
console.log("yr prop0 content-'10'"+obj.$attrs.content)
expect(obj.$attrs.content).assertEqual("10");
console.info('propTest001 END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0480
* @tc.name propTest001
* @tc.desc aceEtsTest
*/
it('propTest002', 0, async function (done) {
console.info('propTest002 START');
let strJson = getInspectorByKey('Text002');
let obj = JSON.parse(strJson);
console.info("component obj is: " + JSON.stringify(obj));
console.log("cd attrs.conten type"+typeof(obj.$attrs.content))
console.log("cd attrs.conten type1 "+typeof("10"))
expect(obj.$attrs.content).assertEqual("10");
console.log("cd prop0 content-'10'"+JSON.stringify(obj.$attrs.content))
console.info('propTest002 END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function rowJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('rowTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0490
* @tc.name rowTest001
* @tc.desc aceEtsTest
*/
it('rowTest001', 0, async function (done) {
console.info('++++++++++++++++ Row TestCase 1 START ++++++++++++++++');
let options = {
uri: 'pages/Row',
}
try {
let result = await router.push(options)
console.info( JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('row');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Row')
console.log('Row‘s useAlign is '+JSON.stringify(obj.$attrs.useAlign))
console.log('Row‘s space is '+JSON.stringify(obj.$attrs.space))
console.log('Row‘s alignItems is '+JSON.stringify(obj.$attrs.alignItems))
expect(obj.$attrs.alignItems).assertEqual('VerticalAlign.Top')
console.info('++++++++++++++++ Row TestCase 1 End ++++++++++++++++');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function swiperJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
//返回首页
async function backToIndex() {
let backToIndexPromise = new Promise((resolve, reject) => {
console.info('afterEach backToIndexPromise ...');
setTimeout(() => {
router.back({
uri: 'pages/index'
});
resolve();
}, 500);
});
let clearPromise = new Promise((resolve, reject) => {
console.info('afterEach clearPromise ...');
setTimeout(() => {
router.clear();
resolve();
}, 500);
});
await backToIndexPromise.then(() => {
return clearPromise;
});
}
describe('swiperTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0500
* @tc.name swiperTest001
* @tc.desc aceEtsTest
*/
it('swiperTest001', 0, async function (done) {
console.info('++++++++++++++++ Swiper TestCase 1 START ++++++++++++++++');
let options = {
uri: 'pages/Swiper',
}
try {
let result = await router.push(options)
console.info( JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('swiper');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Swiper')
console.log('Swiper‘s index is '+JSON.stringify(obj.$attrs.index))
console.log('Swiper‘s autoPlay is '+JSON.stringify(obj.$attrs.autoPlay))
console.log('Swiper‘s interval is '+JSON.stringify(obj.$attrs.interval))
console.log('Swiper‘s indicator is '+JSON.stringify(obj.$attrs.indicator))
console.log('Swiper‘s loop is '+JSON.stringify(obj.$attrs.loop))
console.log('Swiper‘s duration is '+JSON.stringify(obj.$attrs.duration))
console.log('Swiper‘s vertical is '+JSON.stringify(obj.$attrs.vertical))
console.log('Swiper‘s itemSpace is '+JSON.stringify(obj.$attrs.itemSpace))
expect(obj.$attrs.index).assertEqual('1')
expect(obj.$attrs.autoPlay).assertEqual('true')
expect(obj.$attrs.interval).assertEqual('4000')
expect(obj.$attrs.indicator).assertEqual('true')
expect(obj.$attrs.loop).assertEqual('false')
expect(obj.$attrs.vertical).assertEqual('false')
expect(obj.$attrs.duration).assertEqual(1000.000000.toFixed(6))
console.info('++++++++++++++++ Swiper TestCase 1 End +++++++++++++++++');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function tabJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('tabTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0510
* @tc.name tabTest001
* @tc.desc aceEtsTest
*/
it('tabTest001', 0, async function (done) {
console.info('++++++++++++++++ Tab TestCase 1 START ++++++++++++++++');
let options = {
uri: 'pages/Tab',
}
try {
let result = await router.push(options)
console.info( JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('tab');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Tabs')
expect(obj.$attrs.barPosition).assertEqual('BarPosition.Start')
expect(obj.$attrs.index).assertEqual('1')
expect(obj.$attrs.vertical).assertEqual("true")
expect(obj.$attrs.scrollable).assertEqual("true")
expect(obj.$attrs.barMode).assertEqual('BarMode.Fixed')
expect(obj.$attrs.barWidth).assertEqual(70.000000.toFixed(6))
expect(obj.$attrs.barHeight).assertEqual(150.000000.toFixed(6))
console.info('++++++++++++++++ Tab TestCase 1 End ++++++++++++++++');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0520
* @tc.name tabTest002
* @tc.desc aceEtsTest
*/
it('tabTest002', 0, async function (done) {
console.info('++++++++++++++++ Tab TestCase 2 START ++++++++++++++++');
let options = {
uri: 'pages/Tab',
}
try {
let result = await router.push(options)
console.info( JSON.stringify(result));
} catch (err) {
console.error(JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('tabcontent');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
console.log(JSON.stringify(obj.$attrs.tabBar))
expect(obj.$type).assertEqual('TabContent')
expect(obj.$attrs.tabBar).assertEqual('yellow')
console.info('++++++++++++++++ Tab TestCase 2 End ++++++++++++++++');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0530
* @tc.name tabTest003
* @tc.desc aceEtsTest
*/
it('tabTest003', 0, async function (done) {
console.info('++++++++++++++++ Tab TestCase 3 START ++++++++++++++++');
await sleep(1)
let strJson = getInspectorByKey('tab2');
let obj = JSON.parse(strJson);
console.info("get inspector value is: " + JSON.stringify(obj));
console.log(JSON.stringify(obj.$type))
expect(obj.$type).assertEqual('Tabs')
expect(obj.$attrs.barPosition).assertEqual('BarPosition.End')
expect(obj.$attrs.barMode).assertEqual('BarMode.Scrollable')
expect(obj.$attrs.vertical).assertEqual("false")
expect(obj.$attrs.scrollable).assertEqual("false")
console.info('++++++++++++++++ Tab TestCase 3 End ++++++++++++++++');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function textJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('textTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0540
* @tc.name textTest001
* @tc.desc aceEtsTest
*/
it('textTest001', 0, async function (done) {
console.info('testGetInspectorByKey START');
let options = {
uri: 'pages/Text',
}
try {
let result = await router.push(options)
console.info("push text page success " + JSON.stringify(result));
} catch (err) {
console.error("push text page error " + JSON.stringify(result));
}
await sleep(2)
let strJson = getInspectorByKey('Text');
let obj = JSON.parse(strJson);
console.info("cd text component obj is: " + JSON.stringify(obj));
expect(obj.$type).assertEqual('Text')
expect(obj.$attrs.width).assertEqual('100.000000vp')
expect(obj.$attrs.padding).assertEqual('5.000000vp')
expect(obj.$attrs.opacity).assertEqual(1)
expect(obj.$attrs.align).assertEqual("Alignment.Center")
expect(JSON.stringify(obj.$attrs.markAnchor)).assertEqual(JSON.stringify({
"x": "50.000000vp", "y": "50.000000vp"
}))
expect(JSON.stringify(obj.$attrs.offset)).assertEqual(JSON.stringify({
"x": "50.000000vp", "y": "50.000000vp"
}))
expect(obj.$attrs.flexGrow).assertEqual(5)
expect(obj.$attrs.flexShrink).assertEqual(2)
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Auto")
expect(obj.$attrs.borderStyle).assertEqual("BorderStyle.Dashed")
expect(obj.$attrs.borderRadius).assertEqual("10.000000vp")
expect(obj.$attrs.borderWidth).assertEqual("4.000000px")
expect(obj.$attrs.borderColor).assertEqual("#FF0000FF")
expect(obj.$attrs.backgroundColor).assertEqual("#FFFFC0CB")
expect(obj.$attrs.enabled).assertEqual(false)
expect(obj.$attrs.zIndex).assertEqual(1)
expect(obj.$attrs.fontColor).assertEqual("#FF000000")
expect(obj.$attrs.visibility).assertEqual("Visibility.Visible")
expect(obj.$attrs.fontSize).assertEqual("15")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Bold")
expect(obj.$attrs.fontStyle).assertEqual("FontStyle.Italic")
expect(obj.$attrs.fontFamily).assertEqual("sans-serif")
expect(obj.$attrs.textAlign).assertEqual("TextAlign.End")
expect(obj.$attrs.textOverflow).assertEqual("TextOverflow.Ellipsis")
expect(obj.$attrs.lineHeight).assertEqual("15")
expect(obj.$attrs.baselineOffset).assertEqual("0")
expect(obj.$attrs.maxLines).assertEqual("2")
expect(obj.$attrs.textCase).assertEqual("TextCase.Normal")
expect(obj.$attrs.decoration).assertEqual(JSON.stringify({
type: "TextDecorationType.Underline", color: "#FFFF0000"
}))
expect(obj.$attrs.direction).assertEqual("Direction.Auto")
expect(obj.$attrs.aspectRatio).assertEqual(1)
expect(obj.$attrs.fontColor).assertEqual("#FF000000")
console.info('cd textInspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0550
* @tc.name textTest002
* @tc.desc aceEtsTest
*/
it('textTest002', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text1');
let obj = JSON.parse(strJson);
console.info("cd text1 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.direction).assertEqual("Direction.Ltr")
expect(obj.$attrs.align).assertEqual("Alignment.Start")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Start")
expect(obj.$attrs.borderStyle).assertEqual("BorderStyle.Dotted")
expect(obj.$attrs.enabled).assertEqual(true)
expect(obj.$attrs.visibility).assertEqual("Visibility.Hidden")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Normal")
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Start")
expect(obj.$attrs.textOverflow).assertEqual("TextOverflow.Clip")
expect(obj.$attrs.decoration).assertEqual(JSON.stringify({
type: "TextDecorationType.LineThrough", color: "#FFFF0000"
}))
expect(obj.$attrs.fontColor).assertEqual("#FFFFFFFF")
console.info('cd text1InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0560
* @tc.name textTest003
* @tc.desc aceEtsTest
*/
it('textTest003', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text2');
let obj = JSON.parse(strJson);
console.info("cd text2 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.direction).assertEqual("Direction.Rtl")
expect(obj.$attrs.align).assertEqual("Alignment.TopEnd")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Center")
expect(obj.$attrs.borderStyle).assertEqual("BorderStyle.Solid")
expect(obj.$attrs.visibility).assertEqual("Visibility.None")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Bolder")
expect(obj.$attrs.textAlign).assertEqual("TextAlign.Center")
expect(obj.$attrs.textCase).assertEqual("TextCase.UpperCase")
expect(obj.$attrs.decoration).assertEqual(JSON.stringify({
type: "TextDecorationType.None", color: "#FFFF0000"
}))
expect(obj.$attrs.fontColor).assertEqual("#FF0000FF")
console.info('cd text2InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0570
* @tc.name textTest004
* @tc.desc aceEtsTest
*/
it('textTest004', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text3');
let obj = JSON.parse(strJson);
console.info("cd text3 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.align).assertEqual("Alignment.Top")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.End")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Lighter")
expect(obj.$attrs.decoration).assertEqual(JSON.stringify({
type: "TextDecorationType.Overline", color: "#FFFF0000"
}))
expect(obj.$attrs.fontColor).assertEqual("#FF808080")
console.info('cd text3InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0580
* @tc.name textTest005
* @tc.desc aceEtsTest
*/
it('textTest005', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text4');
let obj = JSON.parse(strJson);
console.info("cd text4 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.align).assertEqual("Alignment.TopStart")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Baseline")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Medium")
expect(obj.$attrs.fontColor).assertEqual("#FFA52A2A")
console.info('cd text4InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0590
* @tc.name textTest006
* @tc.desc aceEtsTest
*/
it('textTest006', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text5');
let obj = JSON.parse(strJson);
console.info("cd text5 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.align).assertEqual("Alignment.End")
expect(obj.$attrs.alignSelf).assertEqual("ItemAlign.Stretch")
expect(obj.$attrs.fontWeight).assertEqual("FontWeight.Regular")
expect(obj.$attrs.fontColor).assertEqual("#FF808080")
console.info('cd text5InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0600
* @tc.name textTest007
* @tc.desc aceEtsTest
*/
it('textTest007', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text6');
let obj = JSON.parse(strJson);
console.info("cd text6 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.align).assertEqual("Alignment.BottomEnd")
expect(obj.$attrs.fontColor).assertEqual("#FFFFA500")
console.info('cd text6InspectorByKey END')
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0610
* @tc.name textTest008
* @tc.desc aceEtsTest
*/
it('textTest008', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text7');
let obj = JSON.parse(strJson);
console.info("cd text7 component obj is: " + JSON.stringify(obj));
expect(obj.$attrs.align).assertEqual("Alignment.Bottom")
expect(obj.$attrs.fontColor).assertEqual("#FFFFFF00")
console.info('cd text7InspectorByKey END');
done();
});
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0620
* @tc.name textTest009
* @tc.desc aceEtsTest
*/
it('textTest009', 0, async function (done) {
await sleep(2)
let strJson = getInspectorByKey('Text8');
let obj = JSON.parse(strJson);
console.info("cd text8 component obj is: " + JSON.stringify(obj));
console.log("cd text8 align" + JSON.stringify(obj.$attrs.align));
expect(obj.$attrs.align).assertEqual("Alignment.BottomStart")
console.info('cd text8InspectorByKey END');
done();
});
})
}
/*
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets"
import router from '@system.router';
export default function videoJsunit() {
function sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time * 1000)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
describe('VideoAppInfoTest', function () {
/**
* @tc.number SUB_ACE_BASIC_ETS_API_0630
* @tc.name videoAppInfoTest001
* @tc.desc aceEtsTest
*/
it('videoAppInfoTest001', 0, async function (done) {
console.info('videoAppInfoTest001 START');
let options = {
uri: 'pages/Video',
}
try {
let result = await router.push(options)
console.info("push video page success " + JSON.stringify(result));
} catch (err) {
console.error("push video page error " + JSON.stringify(result));
}
await sleep(1)
let strJson = getInspectorByKey('video');
let obj = JSON.parse(strJson);
console.info("cd video component obj is: " + JSON.stringify(obj));
console.log("cd video type" +JSON.stringify(obj.$type));
console.log("cd video autoPlay" +JSON.stringify(obj.$attrs.autoPlay));
console.log("cd video muted" +JSON.stringify(obj.$attrs.muted));
console.log("cd video controls" +JSON.stringify(obj.$attrs.controls));
console.log("cd video loop" +JSON.stringify(obj.$attrs.loop));
console.log("cd video objectFit" +JSON.stringify(obj.$attrs.objectFit));
console.info('videoAppInfoTest001 END');
done();
});
})
}
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
......@@ -394,6 +394,7 @@ describe('basicabilityapi', function () {
it('testConfigurationGetLocale', 0, function () {
console.info('testConfigurationGetLocale START');
const localeInfo = configuration.getLocale();
console.info("[configuration.getLocale] localeInfo: " + JSON.stringify(localeInfo));
console.info("[configuration.getLocale] language: " + localeInfo.language);
console.info("[configuration.getLocale] countryOrRegion: " + localeInfo.countryOrRegion);
console.info("[configuration.getLocale] dir: " + localeInfo.dir);
......@@ -421,7 +422,7 @@ describe('basicabilityapi', function () {
console.info('[settimeout] v2: ' + v2);
expect('test').assertEqual(v1);
expect('message').assertEqual(v2);
expect(delay).assertLess(end_time - start_time);
expect().assertTrue(end_time - start_time >= delay);
console.info('testSetTimeout END');
done();
}, delay, 'test', 'message');
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册