未验证 提交 bd15e6d6 编写于 作者: O openharmony_ci 提交者: Gitee

!2347 电话子系统新增用例

Merge pull request !2347 from 高曦/OpenHarmony-3.1-Release
......@@ -16,7 +16,14 @@ group("telephonyjstest") {
deps = [
"call_manager:call_manager",
"cellular_data:cellular_data",
"contact_function:ActsContactFunctionEtsTest",
"contact_function_merge:ActsContactFunctionMergeEtsTest",
"contact_performance:ActsContactPerformanceEtsTest",
"contact_stability:ActsContactStabilityEtsTest",
"netmanager_http:ActsNetManagerHttpEtsTest",
"netmanager_socket:ActsNetManagerSocketEtsTest",
"network_search:network_search",
"new_add:ActsNewAddEtsTest",
"sim:sim",
"sms_mms:sms_mms",
]
......
# 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("ActsContactFunctionEtsTest") {
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 = "ActsContactFunctionEtsTest"
}
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": "1800000",
"package": "com.ohos.contactfunction",
"shell-timeout": "60000"
},
"kits": [
{
"test-file-name": [
"ActsContactFunctionEtsTest.hap"
],
"type": "AppInstallKit",
"cleanup-apps": true
}
]
}
{
"app": {
"bundleName": "com.ohos.contactfunction",
"vendor": "open",
"version": {
"code": 1000000,
"name": "1.0.0"
},
"apiVersion": {
"compatible": 7,
"releaseType": "Release",
"target": 7
}
},
"deviceConfig": {},
"module": {
"package": "com.ohos.contactfunction",
"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 })
.fontSize(12)
.fontWeight(FontWeight.Bold)
.fontColor(0xCCCCCC)
.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({ space: '5' }) {
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, type: DataPanelType.Line })
.width(this.width)
.height(this.height)
.key('DataPanel')
.onClick(() => {
router.back()
})
.closeEffect(false)
DataPanel({ values: [20, 40, 20], max: 100, type: DataPanelType.Circle})
.width(this.width)
.height(this.height)
.key('DataPanel2')
.onClick(() => {
router.back()
})
.closeEffect(true)
DataPanel({ values: [20, 40, 20], max: 100})
.width(this.width)
.height(this.height)
.key('DataPanel3')
.onClick(() => {
router.back()
})
.closeEffect(false)
}
.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() {
Column() {
Column({ space : 2 }) {
Text('direction:Column').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.Column,
wrap: FlexWrap.NoWrap,
justifyContent: FlexAlign.Center,
alignItems:ItemAlign.Start,
alignContent: FlexAlign.Start,
}) {
Text('1').width('100%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('100%').height(20).backgroundColor(0xD2B48C)
Text('3').width('100%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('direction:Row').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.Row,
wrap: FlexWrap.Wrap,
justifyContent: FlexAlign.Start,
alignItems:ItemAlign.Start,
alignContent: FlexAlign.Center,
}) {
Text('1').width('20%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('20%').height(20).backgroundColor(0xD2B48C)
Text('3').width('20%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex1')
.height(70)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('direction:RowReverse').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
direction: FlexDirection.RowReverse,
wrap: FlexWrap.Wrap,
justifyContent: FlexAlign.End,
alignItems:ItemAlign.End,
alignContent: FlexAlign.End,
}) {
Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
Text('3').width('50%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex2')
.height(90)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('justifyContent:SpaceBetween').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
justifyContent: FlexAlign.SpaceBetween,
wrap: FlexWrap.Wrap,
}) {
Text('1').width('100%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('100%').height(20).backgroundColor(0xD2B48C)
Text('3').width('100%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex3')
.height(100)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('justifyContent AND alignContent').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
justifyContent: FlexAlign.SpaceEvenly,
alignContent: FlexAlign.SpaceEvenly,
wrap: FlexWrap.Wrap,
}) {
Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
Text('3').width('50%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex4')
.height(90)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
Text('justifyContent AND alignContent').fontSize(9).fontColor(0xCCCCCC).width('90%')
Flex({
justifyContent: FlexAlign.SpaceAround,
alignContent: FlexAlign.SpaceAround,
wrap: FlexWrap.Wrap,
}) {
Text('1').width('50%').height(20).backgroundColor(0xF5DEB3)
Text('2').width('50%').height(20).backgroundColor(0xD2B48C)
Text('3').width('50%').height(20).backgroundColor(0xF5DEB3)
}
.key('flex5')
.height(90)
.width('90%')
.padding(10)
.backgroundColor(0xAFEEEE)
}.width('100%').margin({ top: 5 })
}.width('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 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: "auto", 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 {
@State Width: number = 0
@State height: number = 0
onPageShow() {
console.info('Image page show called');
}
onBuildDone() {
console.info('Image page build done called');
}
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")
.matchTextDirection(false)
.fitOriginalSize(false)
.fillColor(0xCCCCCC)
.objectFit(ImageFit.Cover)
.objectRepeat(ImageRepeat.NoRepeat)
.interpolation(ImageInterpolation.None)
.renderMode(ImageRenderMode.Original)
.autoResize(false)
.syncLoad(false)
.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')
.height(180)
.width(180)
.onComplete((msg: {
width: number,
height: number
}) => {
this.Width = msg.width
this.height = msg.height
console.info('Width ----' + this.Width)
console.info('height ----' + this.height)
})
.onError(() => {
console.info('load image fail')
})
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' }
onPageShow() {
console.info('Navigator page show called');
}
onBuildDone() {
console.info('Navigator page build done called');
}
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
onPageShow() {
console.info('Panel page show called');
}
onBuildDone() {
console.info('Panel page build done called');
}
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 {
onPageShow() {
console.info('Progress page show called');
}
onBuildDone() {
console.info('Progress page build done called');
}
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')
Progress({ value: 20, total: 40, style: ProgressStyle.Ring })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress3')
Progress({ value: 20, total: 40, style: ProgressStyle.ScaleRing })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress4')
Progress({ value: 20, total: 40, style: ProgressStyle.Capsule })
.value(3)
.color(Color.Blue)
.width(50)
.height(70)
.key('progress5')
}
.width(400)
.height(400)
.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 {
@State Color: Color = Color.Pink
onPageShow() {
console.info('Qrcode page show called');
}
onBuildDone() {
console.info('Qrcode page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Text(`Qrcode page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
QRCode('hello world')
.color("#FFFFC0CB")
.backgroundColor(this.Color)
.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 {
@State rating: number = 2
onPageShow() {
console.info('Rating page show called');
}
onBuildDone() {
console.info('Rating page build done called');
}
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'
})
.onChange((value: number) => {
this.rating = value
})
.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.Top
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(400)
.height(200)
.onScroll((xOffset: number, yOffset: number) => {
console.info(` current offset is ${xOffset} ${yOffset}`)
})
.onScrollEnd(() => {
console.info(` now on scroll end`)
})
.onScrollEdge((side: Edge) => {
console.info(`To the edge`)
})
Scroll() {
Row() {
Text('scroll uppppp')
.width(60)
.height(100)
.backgroundColor(Color.Yellow)
.margin({
right: 5,
left: 5
})
.key('text')
Text('scroll to')
.width(60)
.height(100)
.backgroundColor(Color.Green)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollTo({
xOffset: 100,
yOffset: 100,
})
})
Text('scroll page')
.width(60)
.height(100)
.backgroundColor(Color.Blue)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollPage({
next: true
})
})
Text('scroll Edge')
.width(60)
.height(100)
.backgroundColor(Color.Blue)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollEdge(Edge.Top)
})
Text('scroll Edge')
.width(60)
.height(100)
.backgroundColor(Color.Blue)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.currentOffset()
})
Text('scroll to index')
.width(60)
.height(100)
.backgroundColor(Color.Blue)
.margin({
right: 5,
left: 5
})
.onClick(() => {
this.scroller.scrollToIndex(0)
console.info(` now on scroll end`)
})
}
}
.key('scroll1')
.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('scroll2')
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.Free)
.scrollBar(BarState.Off)
.scrollBarColor(Color.Red)
.scrollBarWidth(5)
.width(300)
.height(200)
.key('scroll3')
}
.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 {
@State inSetValue: number= 40
@State outSetValue: number= 40
@State direction: Axis= Axis.Horizontal
@State Begin: number = SliderChangeMode.Begin
onPageShow() {
console.info('Slider page show called');
}
onBuildDone() {
console.info('Slider page build done called');
}
build() {
Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) {
Column() {
Text(`Slider page`)
.fontSize(50)
.fontWeight(FontWeight.Bold)
Slider({
value: this.outSetValue,
min: 0,
max: 100,
step: 1,
direction: Axis.Horizontal,
reverse: false,
style: SliderStyle.OutSet
})
.blockColor('#FFFF0000')
.selectedColor('#FF0000FF')
.trackColor('#FF808080')
.minLabel('10')
.maxLabel('10')
.showTips(false)
.showSteps(false)
.onChange((value: number, mode: SliderChangeMode) => {
this.outSetValue = value
this.Begin = mode
console.info('value: ' + value + '---mode: ' + mode)
})
.width("100")
.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 {
onPageShow() {
console.info('Span page show called');
}
onBuildDone() {
console.info('Span page build done called');
}
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")
.letterSpacing(5)
.fontFamily("sans-serif")
.fontWeight(FontWeight.Bold)
.fontStyle(FontStyle.Italic)
.key('span1')
Span('The second test Span demo')
.textCase(TextCase.LowerCase)
.fontColor(Color.Black)
.letterSpacing('5')
.fontSize(30)
.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 minFontSize: number = 15
@State maxFontSize: number = 15
@State letterSpacing: number= 10
@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)
.minFontSize(this.minFontSize)
.letterSpacing(this.letterSpacing)
.maxFontSize(this.maxFontSize)
.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%')
}
}
// @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 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');
Want.parameters['timeout'] = 100000
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
testsuite();
core.execute();
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('ACE ETS TEST')
.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.
*/
//contact import
import CalllogTest from './contact/Calllog_test.js'
import ContactCardTest from './contact/ContactCard_test.js'
import ContactsTest from './contact/Contacts_test.js'
import GroupsTest from './contact/Groups_test.js'
import ObjectInterfaceTest from './contact/ObjectInterface_test.js'
import RecoveryTest from './contact/recovery_test.js'
import VoicemailTest from './contact/Voicemail_test.js'
import ContactClassTest from './contact/ContactClass_test.js'
import ContacterTest from './contact/ContacterJsunit.ets'
export default function testsuite() {
//contact
ContactClassTest();
ContacterTest();
CalllogTest();
ContactCardTest();
ContactsTest();
GroupsTest();
ObjectInterfaceTest();
RecoveryTest();
VoicemailTest();
}
\ No newline at end of file
// @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.
*/
export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static notCheck = true;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
return this.rect_value = {
"left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
}
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
static async drags(downX, downY, upX, upY, steps, drag) {
var xStep;
var yStep;
var swipeSteps;
var ret;
xStep = 0;
yStep = 0;
ret = false;
swipeSteps = steps;
if (swipeSteps == 0) {
swipeSteps = 1;
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
if (drag) {
await this.sleep(500)
}
for (var i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
if (drag) {
await this.sleep(100)
}
var upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
}
/*
* 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 contact from '@ohos.contact';
import utils from '../Utils.ets'
import {describe, expect, it} from 'deccjsunit/index'
export default function ContactClassTest() {
describe('ContactClassTest', function () {
console.log('*************ContactClassTest is start*************');
/* *
* @tc.number : telephony_contact_phoneNumber_test_0100
* @tc.name : CUSTOM_LABEL NUM_HOME NUM_MOBILE NUM_WORK NUM_FAX_WORK
* @tc.desc : check class PhoneNumber
*/
it("telephony_contact_phoneNumber_test_0100", 0, async function (done) {
console.log("************* telephony_contact_phoneNumber_test_0100 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
expect(0).assertEqual(contact.PhoneNumber.CUSTOM_LABEL);
expect(1).assertEqual(contact.PhoneNumber.NUM_HOME);
expect(2).assertEqual(contact.PhoneNumber.NUM_MOBILE);
expect(3).assertEqual(contact.PhoneNumber.NUM_WORK);
expect(4).assertEqual(contact.PhoneNumber.NUM_FAX_WORK);
done();
} catch (error) {
console.log("telephony_contact_phoneNumber_test_0100 error " + error.message);
}
console.log("************* telephony_contact_phoneNumber_test_0100 Test end*************");
});
/* *
* @tc.number : telephony_contact_phoneNumber_test_0200
* @tc.name : NUM_FAX_HOME NUM_PAGER NUM_OTHER NUM_CALLBACK NUM_CAR
* @tc.desc : check class PhoneNumber
*/
it("telephony_contact_phoneNumber_test_0200", 0, async function (done) {
console.log("************* telephony_contact_phoneNumber_test_0200 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(5).assertEqual(contact.PhoneNumber.NUM_FAX_HOME);
expect(6).assertEqual(contact.PhoneNumber.NUM_PAGER);
expect(7).assertEqual(contact.PhoneNumber.NUM_OTHER);
expect(8).assertEqual(contact.PhoneNumber.NUM_CALLBACK);
expect(9).assertEqual(contact.PhoneNumber.NUM_CAR);
done();
console.log("************* telephony_contact_phoneNumber_test_0200 Test end*************");
});
/* *
* @tc.number : telephony_contact_phoneNumber_test_0300
* @tc.name : NUM_COMPANY_MAIN NUM_ISDN NUM_MAIN NUM_OTHER_FAX NUM_RADIO
* @tc.desc : check class PhoneNumber
*/
it("telephony_contact_phoneNumber_test_0300", 0, async function (done) {
console.log("************* telephony_contact_phoneNumber_test_0300 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(10).assertEqual(contact.PhoneNumber.NUM_COMPANY_MAIN);
expect(11).assertEqual(contact.PhoneNumber.NUM_ISDN);
expect(12).assertEqual(contact.PhoneNumber.NUM_MAIN);
expect(13).assertEqual(contact.PhoneNumber.NUM_OTHER_FAX);
expect(14).assertEqual(contact.PhoneNumber.NUM_RADIO);
done();
console.log("************* telephony_contact_phoneNumber_test_0300 Test end*************");
});
/* *
* @tc.number : telephony_contact_phoneNumber_test_0400
* @tc.name : NUM_TELEX NUM_TTY_TDD NUM_WORK_MOBILE NUM_WORK_PAGER NUM_ASSISTANT NUM_MMS INVALID_LABEL_ID labelName
* @tc.desc : check class PhoneNumber
*/
it("telephony_contact_phoneNumber_test_0400", 0, async function (done) {
console.log("************* telephony_contact_phoneNumber_test_0400 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(15).assertEqual(contact.PhoneNumber.NUM_TELEX);
expect(16).assertEqual(contact.PhoneNumber.NUM_TTY_TDD);
expect(17).assertEqual(contact.PhoneNumber.NUM_WORK_MOBILE);
expect(18).assertEqual(contact.PhoneNumber.NUM_WORK_PAGER);
expect(19).assertEqual(contact.PhoneNumber.NUM_ASSISTANT);
expect(20).assertEqual(contact.PhoneNumber.NUM_MMS);
expect(-1).assertEqual(contact.PhoneNumber.INVALID_LABEL_ID);
expect(typeof contact.PhoneNumber.labelName).assertEqual("string");
done();
console.log("************* telephony_contact_phoneNumber_test_0400 Test end*************");
});
/* *
* @tc.number : telephony_contact_postalAddress_test_0100
* @tc.name : CUSTOM_LABEL ADDR_HOME ADDR_WORK ADDR_OTHER INVALID_LABEL_ID
* @tc.desc : check class PostalAddress
*/
it("telephony_contact_postalAddress_test_0100", 0, async function (done) {
console.log("************* telephony_contact_postalAddress_test_0100 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(0).assertEqual(contact.PostalAddress.CUSTOM_LABEL);
expect(1).assertEqual(contact.PostalAddress.ADDR_HOME);
expect(2).assertEqual(contact.PostalAddress.ADDR_WORK);
expect(3).assertEqual(contact.PostalAddress.ADDR_OTHER);
expect(-1).assertEqual(contact.PostalAddress.INVALID_LABEL_ID);
done();
console.log("************* telephony_contact_postalAddress_test_0100 Test end*************");
});
/* *
* @tc.number : telephony_contact_postalAddress_test_0200
* @tc.name : labelName neighborhood pobox postalAddress postcode street
* @tc.desc : check class PostalAddress
*/
it("telephony_contact_postalAddress_test_0200", 0, async function (done) {
console.log("************* telephony_contact_postalAddress_test_0200 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
var postalAddress = new contact.PostalAddress({
'labelName': 'testLabel',
'neighborhood': 'beijing',
'pobox': 'testBox',
'postalAddress': 'testAddress',
'postcode': 'testCode',
'street': 'testStreet'
})
expect(postalAddress.labelName).assertEqual('testLabel');
expect(postalAddress.neighborhood).assertEqual('beijing');
expect(postalAddress.pobox).assertEqual('testBox');
expect(postalAddress.postalAddress).assertEqual('testAddress');
expect(postalAddress.postcode).assertEqual('testCode');
expect(postalAddress.street).assertEqual('testStreet');
} catch (err) {
console.log("telephony_contact_postalAddress_test_0200 test error " + err.message);
}
done();
console.log("************* telephony_contact_postalAddress_test_0200 Test end*************");
});
/* *
* @tc.number : telephony_contact_relation_test_0100
* @tc.name : CUSTOM_LABEL ADDR_HOME ADDR_WORK ADDR_OTHER INVALID_LABEL_ID
* @tc.desc : check class Relation
*/
it("telephony_contact_relation_test_0100", 0, async function (done) {
console.log("************* telephony_contact_relation_test_0100 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(0).assertEqual(contact.Relation.CUSTOM_LABEL);
expect(1).assertEqual(contact.Relation.RELATION_ASSISTANT);
expect(2).assertEqual(contact.Relation.RELATION_BROTHER);
expect(3).assertEqual(contact.Relation.RELATION_CHILD);
expect(4).assertEqual(contact.Relation.RELATION_DOMESTIC_PARTNER);
done();
console.log("************* telephony_contact_relation_test_0100 Test end*************");
});
/* *
* @tc.number : telephony_contact_relation_test_0200
* @tc.name : RELATION_FATHER RELATION_FRIEND RELATION_MANAGER RELATION_MOTHER RELATION_PARENT
* @tc.desc : check class Relation
*/
it("telephony_contact_relation_test_0200", 0, async function (done) {
console.log("************* telephony_contact_relation_test_0200 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(5).assertEqual(contact.Relation.RELATION_FATHER);
expect(6).assertEqual(contact.Relation.RELATION_FRIEND);
expect(7).assertEqual(contact.Relation.RELATION_MANAGER);
expect(8).assertEqual(contact.Relation.RELATION_MOTHER);
expect(9).assertEqual(contact.Relation.RELATION_PARENT);
done();
console.log("************* telephony_contact_relation_test_0200 Test end*************");
});
/* *
* @tc.number : telephony_contact_Relation_test_0300
* @tc.name : RELATION_PARTNER RELATION_REFERRED_BY RELATION_RELATIVE
RELATION_SISTER RELATION_SPOUSE INVALID_LABEL_ID
* @tc.desc : check class Relation
*/
it("telephony_contact_relation_test_0300", 0, async function (done) {
console.log("************* telephony_contact_relation_test_0300 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(10).assertEqual(contact.Relation.RELATION_PARTNER);
expect(11).assertEqual(contact.Relation.RELATION_REFERRED_BY);
expect(12).assertEqual(contact.Relation.RELATION_RELATIVE);
expect(13).assertEqual(contact.Relation.RELATION_SISTER);
expect(14).assertEqual(contact.Relation.RELATION_SPOUSE);
expect(-1).assertEqual(contact.Relation.INVALID_LABEL_ID);
done();
console.log("************* telephony_contact_relation_test_0300 Test end*************");
});
/* *
* @tc.number : telephony_contact_relation_test_0400
* @tc.name : labelName relationName
* @tc.desc : check class Relation
*/
it("telephony_contact_relation_test_0400", 0, async function (done) {
console.log("************* telephony_contact_relation_test_0400 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
var relation = new contact.Relation({
'labelName': 'testLabel',
'relationName': 'testRelation'
})
expect(relation.labelName).assertEqual('testLabel');
expect(relation.relationName).assertEqual('testRelation');
} catch (err) {
console.log("telephony_contact_relation_test_0400 test error " + err.message);
}
done();
console.log("************* telephony_contact_relation_test_0400 Test end*************");
});
/* *
* @tc.number : telephony_contact_sipAddress_test_0100
* @tc.name : CUSTOM_LABEL SIP_HOME SIP_WORK SIP_OTHER INVALID_LABEL_ID
* @tc.desc : check class SipAddress
*/
it("telephony_contact_sipAddress_test_0100", 0, async function (done) {
console.log("************* telephony_contact_sipAddress_test_0100 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
expect(0).assertEqual(contact.SipAddress.CUSTOM_LABEL);
expect(1).assertEqual(contact.SipAddress.SIP_HOME);
expect(2).assertEqual(contact.SipAddress.SIP_WORK);
expect(3).assertEqual(contact.SipAddress.SIP_OTHER);
expect(-1).assertEqual(contact.SipAddress.INVALID_LABEL_ID);
done();
console.log("************* telephony_contact_sipAddress_test_0100 Test end*************");
});
/* *
* @tc.number : telephony_contact_sipAddress_test_0200
* @tc.name : labelName sipAddress
* @tc.desc : check class SipAddress
*/
it("telephony_contact_sipAddress_test_0200", 0, async function (done) {
console.log("************* telephony_contact_sipAddress_test_0200 Test start*************");
if (utils.notCheck) {
expect(true).assertTrue();
done();
return;
}
try {
var sip = new contact.SipAddress({
'labelName': 'testLabel',
'sipAddress': 'testSip'
})
expect(sip.labelName).assertEqual('testLabel');
expect(sip.sipAddress).assertEqual('testSip');
} catch (err) {
console.log("telephony_contact_sipAddress_test_0200 test error " + err.message);
}
done();
console.log("************* telephony_contact_sipAddress_test_0200 Test end*************");
});
console.log('*************ContactClassTest is end*************');
})
}
\ No newline at end of file
// @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'
import contact from '@ohos.contact';
import utils from '../Utils.ets'
export default function contacterJsunit() {
describe('ContacterTest',function () {
/**
* @tc.number Telephony_contact_Contact_0100
* @tc.name Test The Contact enum
* @tc.desc Function test
*/
it('Telephony_contact_Contact_0100', 0, async function (done) {
console.info("Telephony_contact_Contact_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Contact.INVALID_CONTACT_ID === -1).assertTrue();
expect(contact.Contact.id === 0).assertTrue();
expect(contact.Contact.key !== "test").assertTrue();
console.info("Telephony_contact_Contact_0100 end")
done();
});
/**
* @tc.number Telephony_contact_Contact_0200
* @tc.name Test The Contact enum
* @tc.desc Function test
*/
it('Telephony_contact_Contact_0200', 0, async function (done) {
console.info("Telephony_contact_Contact_0200 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Contact.INVALID_CONTACT_ID === -1).assertTrue();
expect(contact.Contact.id === 1).assertTrue();
expect(contact.Contact.key !== "key").assertTrue();
console.info("Telephony_contact_Contact_0200 end")
done();
});
/**
* @tc.number Telephony_contact_Attribute_0100
* @tc.name Test The Attribute enum
* @tc.desc Function test
*/
it('Telephony_contact_Attribute_0100', 0, async function (done) {
console.info("Telephony_contact_Attribute_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Attribute.ATTR_CONTACT_EVENT === 0).assertTrue();
expect(contact.Attribute.ATTR_EMAIL === 0).assertTrue();
expect(contact.Attribute.ATTR_GROUP_MEMBERSHIP === 0).assertTrue();
expect(contact.Attribute.ATTR_IM === 0).assertTrue();
expect(contact.Attribute.ATTR_NAME === 0).assertTrue();
expect(contact.Attribute.ATTR_NICKNAME === 0).assertTrue();
expect(contact.Attribute.ATTR_NOTE === 0).assertTrue();
expect(contact.Attribute.ATTR_ORGANIZATION === 0).assertTrue();
expect(contact.Attribute.ATTR_PHONE === 0).assertTrue();
expect(contact.Attribute.ATTR_PORTRAIT === 0).assertTrue();
expect(contact.Attribute.ATTR_POSTAL_ADDRESS === 0).assertTrue();
expect(contact.Attribute.ATTR_RELATION === 0).assertTrue();
expect(contact.Attribute.ATTR_SIP_ADDRESS === 0).assertTrue();
expect(contact.Attribute.ATTR_WEBSITE === 0).assertTrue();
console.info("Telephony_contact_Attribute_0100 end")
done();
});
/**
* @tc.number Telephony_contact_Attribute_0200
* @tc.name Test The Attribute enum
* @tc.desc Function test
*/
it('Telephony_contact_Attribute_0200', 0, async function (done) {
console.info("Telephony_contact_Attribute_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Attribute.ATTR_CONTACT_EVENT === 1).assertTrue();
expect(contact.Attribute.ATTR_EMAIL === 1).assertTrue();
expect(contact.Attribute.ATTR_GROUP_MEMBERSHIP === 1).assertTrue();
expect(contact.Attribute.ATTR_IM === 1).assertTrue();
expect(contact.Attribute.ATTR_NAME === 1).assertTrue();
expect(contact.Attribute.ATTR_NICKNAME === 1).assertTrue();
expect(contact.Attribute.ATTR_NOTE === 1).assertTrue();
expect(contact.Attribute.ATTR_ORGANIZATION === 1).assertTrue();
expect(contact.Attribute.ATTR_PHONE === 1).assertTrue();
expect(contact.Attribute.ATTR_PORTRAIT === 1).assertTrue();
expect(contact.Attribute.ATTR_POSTAL_ADDRESS === 1).assertTrue();
expect(contact.Attribute.ATTR_RELATION === 1).assertTrue();
expect(contact.Attribute.ATTR_SIP_ADDRESS === 1).assertTrue();
expect(contact.Attribute.ATTR_WEBSITE === 1).assertTrue();
console.info("Telephony_contact_Attribute_0200 end")
done();
});
/**
* @tc.number Telephony_contact_Email_0100
* @tc.name Test The Attribute Email
* @tc.desc Function test
*/
it('Telephony_contact_Email_0100', 0, async function (done) {
console.info("Telephony_contact_Email_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Email.CUSTOM_LABEL === 0).assertTrue();
expect(contact.Email.EMAIL_HOME === 1).assertTrue();
expect(contact.Email.EMAIL_WORK === 2).assertTrue();
expect(contact.Email.EMAIL_OTHER === 3).assertTrue();
expect(contact.Email.INVALID_LABEL_ID === -1).assertTrue();
expect(contact.Email.email !== "email").assertTrue();
expect(contact.Email.labelName !== "email").assertTrue();
expect(contact.Email.displayName !== "email").assertTrue();
console.info("Telephony_contact_Email_0100 end")
done();
});
/**
* @tc.number Telephony_contact_Email_0200
* @tc.name Test The Attribute Email
* @tc.desc Function test
*/
it('Telephony_contact_Email_0200', 0, async function (done) {
console.info("Telephony_contact_Email_0200 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Email.CUSTOM_LABEL === 0).assertTrue();
expect(contact.Email.EMAIL_HOME === 1).assertTrue();
expect(contact.Email.EMAIL_WORK === 2).assertTrue();
expect(contact.Email.EMAIL_OTHER === 3).assertTrue();
expect(contact.Email.INVALID_LABEL_ID === -1).assertTrue();
expect(contact.Email.email !== "email2").assertTrue();
expect(contact.Email.labelName !== "email2").assertTrue();
expect(contact.Email.displayName !== "email2").assertTrue();
console.info("Telephony_contact_Email_0200 end")
done();
});
/**
* @tc.number Telephony_contact_Event_0100
* @tc.name Test The Attribute Event
* @tc.desc Function test
*/
it('Telephony_contact_Event_0100', 0, async function (done) {
console.info("Telephony_contact_Event_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Event.CUSTOM_LABEL === 0).assertTrue();
expect(contact.Event.EVENT_ANNIVERSARY === 1).assertTrue();
expect(contact.Event.EVENT_OTHER === 2).assertTrue();
expect(contact.Event.EVENT_BIRTHDAY === 3).assertTrue();
expect(contact.Event.INVALID_LABEL_ID === -1).assertTrue();
expect(contact.Event.eventDate !== "event").assertTrue();
expect(contact.Event.labelName !== "event").assertTrue();
console.info("Telephony_contact_Event_0100 end")
done();
});
/**
* @tc.number Telephony_contact_Event_0200
* @tc.name Test The Attribute Event
* @tc.desc Function test
*/
it('Telephony_contact_Event_0200', 0, async function (done) {
console.info("Telephony_contact_Event_0200 start")
if(utils.notCheck){
done();
return;
}
expect(contact.Event.CUSTOM_LABEL === 0).assertTrue();
expect(contact.Event.EVENT_ANNIVERSARY === 1).assertTrue();
expect(contact.Event.EVENT_OTHER === 2).assertTrue();
expect(contact.Event.EVENT_BIRTHDAY === 3).assertTrue();
expect(contact.Event.INVALID_LABEL_ID === -1).assertTrue();
expect(contact.Event.eventDate !== "event2").assertTrue();
expect(contact.Event.labelName !== "event2").assertTrue();
console.info("Telephony_contact_Event_0200 end")
done();
});
/**
* @tc.number Telephony_contact_ImAddress_0100
* @tc.name Test The Attribute ImAddress
* @tc.desc Function test
*/
it('Telephony_contact_ImAddress_0100', 0, async function (done) {
console.info("Telephony_contact_ImAddress_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.ImAddress.CUSTOM_LABEL === -1).assertTrue();
expect(contact.ImAddress.IM_AIM === 0).assertTrue();
expect(contact.ImAddress.IM_MSN === 1).assertTrue();
expect(contact.ImAddress.IM_YAHOO === 2).assertTrue();
expect(contact.ImAddress.IM_SKYPE === 3).assertTrue();
expect(contact.ImAddress.IM_QQ === 4).assertTrue();
expect(contact.ImAddress.IM_ICQ === 6).assertTrue();
expect(contact.ImAddress.IM_JABBER === 7).assertTrue();
expect(contact.ImAddress.INVALID_LABEL_ID === -2).assertTrue();
expect(contact.ImAddress.imAddress !== "imAddress").assertTrue();
expect(contact.ImAddress.labelName !== "imAddress").assertTrue();
console.info("Telephony_contact_ImAddress_0100 end")
done();
});
/**
* @tc.number Telephony_contact_ImAddress_0200
* @tc.name Test The Attribute ImAddress
* @tc.desc Function test
*/
it('Telephony_contact_ImAddress_0200', 0, async function (done) {
console.info("Telephony_contact_ImAddress_0100 start")
if(utils.notCheck){
done();
return;
}
expect(contact.ImAddress.CUSTOM_LABEL === -1).assertTrue();
expect(contact.ImAddress.IM_AIM === 0).assertTrue();
expect(contact.ImAddress.IM_MSN === 1).assertTrue();
expect(contact.ImAddress.IM_YAHOO === 2).assertTrue();
expect(contact.ImAddress.IM_SKYPE === 3).assertTrue();
expect(contact.ImAddress.IM_QQ === 4).assertTrue();
expect(contact.ImAddress.IM_ICQ === 6).assertTrue();
expect(contact.ImAddress.IM_JABBER === 7).assertTrue();
expect(contact.ImAddress.INVALID_LABEL_ID === -2).assertTrue();
expect(contact.ImAddress.imAddress !== "imAddress2").assertTrue();
expect(contact.ImAddress.labelName !== "imAddress2").assertTrue();
console.info("Telephony_contact_ImAddress_0200 end")
done();
});
})
}
\ 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.
*/
// sim slot id
export const DEFAULT_SLOTID = 0;
export const SLOTID3 = 3;
export const SLOTID2 = 2;
export const SLOTID_MINUS1 = -1;
// sim correct password
export const CORRECT_PIN = '1234';
export const CORRECT_PIN2 = '18099014';
// sim incorrect password
export const INCORRECT_PIN = '134679';
export const INCORRECT_PIN_LEN3 = '123';
export const INCORRECT_PUK = '134679';
export const INCORRECT_PIN2 = '134679';
export const INCORRECT_PIN2_LEN3 = '123';
export const INCORRECT_PIN2_LEN9 = '123456789';
export const INCORRECT_PUK2 = '134679';
// lock status response
export const LOCK_RESULT = { SUCCESS: 0, FAILURE: -1, EXCEPTION: -2 };
\ No newline at end of file
{
"string": [
{
"name": "entry_MainAbility",
"value": "entry_MainAbility"
},
{
"name": "description_mainability",
"value": "ETS_Empty Ability"
}
]
}
\ No newline at end of file
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册