diff --git a/telephony/telephonyjstest/BUILD.gn b/telephony/telephonyjstest/BUILD.gn index 6593a125f04acfbec937c7c7a0b76f4a55275aaa..40b4ab46ba61d8a909ee43336b4a602f0401efe4 100644 --- a/telephony/telephonyjstest/BUILD.gn +++ b/telephony/telephonyjstest/BUILD.gn @@ -16,10 +16,6 @@ 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", diff --git a/telephony/telephonyjstest/contact_function/BUILD.gn b/telephony/telephonyjstest/contact_function/BUILD.gn deleted file mode 100644 index b02f559e300048dd7ea6a8e4335c7684f0e21d6a..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# 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" -} diff --git a/telephony/telephonyjstest/contact_function/Test.json b/telephony/telephonyjstest/contact_function/Test.json deleted file mode 100644 index ebe415586abc266ca2513a634c63c3631ab843e1..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "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 - } - ] -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/config.json b/telephony/telephonyjstest/contact_function/entry/src/main/config.json deleted file mode 100644 index 1bb6a9c49005b915436ac4d0a57e35de006d5ed4..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/config.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "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" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.LOCATION", - "reason": "need use ohos.permission.LOCATION" - }, - { - "name":"ohos.permission.SET_TELEPHONY_STATE", - "reason":"need use ohos.permission.SET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.GET_TELEPHONY_STATE", - "reason":"need use ohos.permission.GET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.PLACE_CALL", - "reason":"need use ohos.permission.PLACE_CALL" - }, - { - "name":"ohos.permission.READ_CONTACTS", - "reason":"need use ohos.permission.READ_CONTACTS" - }, - { - "name":"ohos.permission.WRITE_CONTACTS", - "reason":"need use ohos.permission.WRITE_CONTACTS" - }, - { - "name":"ohos.permission.SEND_MESSAGES", - "reason":"need use ohos.permission.SEND_MESSAGES" - }, - { - "name":"ohos.permission.RECEIVE_SMS", - "reason":"need use ohos.permission.RECEIVE_SMS" - }, - { - "name":"ohos.permission.READ_CALL_LOG", - "reason":"need use ohos.permission.READ_CALL_LOG" - }, - { - "name":"ohos.permission.GET_NETWORK_INFO", - "reason":"need use ohos.permission.GET_NETWORK_INFO" - }, - { - "name":"ohos.permission.INTERNET", - "reason":"need use ohos.permission.INTERNET" - } - ], - "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 diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/app.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 261fadca29ff0ea310a8bc105ddd1af65e2dd2f6..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Badge.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Badge.ets deleted file mode 100644 index 66de6f8e3b9c0360931602dd25d1511878ac63ab..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Badge.ets +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Blank.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Blank.ets deleted file mode 100644 index a50fc719e09ab27c91f9705ac06008e936830f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Blank.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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%') - - - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Button.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Button.ets deleted file mode 100644 index ac2271ea3a13664bbbb6afe4f173abae9e66f867..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Button.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Column.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Column.ets deleted file mode 100644 index b9e5c84e21ccf25419be432d8f95418fac82070a..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Column.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 }) - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets deleted file mode 100644 index cb0597310a15be8ab4503a3ae89385e3708fac96..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Counter.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Counter.ets deleted file mode 100644 index ecdbfaf10393e7a348fd76098868e6455505b07f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Counter.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/DataPanel.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/DataPanel.ets deleted file mode 100644 index 3c624848482b22998b2a1d137796ddaedbcf198c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/DataPanel.ets +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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%') - - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Divider.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Divider.ets deleted file mode 100644 index 02bf60779418674d1fd58127907fdb3915bd8f8f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Divider.ets +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Flex.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Flex.ets deleted file mode 100644 index a0e21251e80008c5be9f29aa52074acc5eb24a78..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Flex.ets +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/GridContainer.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/GridContainer.ets deleted file mode 100644 index 57358110413406263e70a2a5f650cbfeb22a4387..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/GridContainer.ets +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Image.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Image.ets deleted file mode 100644 index 5cc583e931f51aa8e4f2bd55decfeeb14a40afb4..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Image.ets +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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) - } - } -} - - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Navigator.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Navigator.ets deleted file mode 100644 index 6c50769cf2ab045cbe48b52e294b4105a21e1c3d..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Navigator.ets +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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) - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Panel.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Panel.ets deleted file mode 100644 index 32ddabbd1ccbae3805dd462e6f04b28364d6a1e7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Panel.ets +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Progress.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Progress.ets deleted file mode 100644 index c8608089fe51e1988fd305fc49db028b6c2efe76..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Progress.ets +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Qrcode.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Qrcode.ets deleted file mode 100644 index 5c0dd84eff5a6653ee5fd940662d141025a1bb4e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Qrcode.ets +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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') - } - } -} - - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Rating.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Rating.ets deleted file mode 100644 index b29e26a392fca6f15a5b7f0eb4156dd3bc767c3f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Rating.ets +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/RowSplit.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/RowSplit.ets deleted file mode 100644 index 0f4f397b13b83e98ac643633309b02858f337eb0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/RowSplit.ets +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Scroll.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Scroll.ets deleted file mode 100644 index 363089d22580febed16b983d8a4b2877cde52bec..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Scroll.ets +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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 = [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') - - } -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Slider.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Slider.ets deleted file mode 100644 index 625cd02874f16e9debb7638322624f890e08fa62..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Slider.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Span.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Span.ets deleted file mode 100644 index df5a71043f1ae000b822646f6b56df7ae103fa1f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Span.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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) - } - } -} - - - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Stack.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Stack.ets deleted file mode 100644 index 2a694889f0e768afbd3e3af6a17c3af9d8738cfb..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Stack.ets +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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%') - - } -} - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Text.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Text.ets deleted file mode 100644 index fbd1415dc815b0f1966476c430f7d69e28e587ee..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/Text.ets +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 10359134da915c9b44b0836ba4881bca71f43f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,65 +0,0 @@ -// @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%') - } -} - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 0da9c54105c1cdd0a4120940982c7f065f00f911..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,38 +0,0 @@ -/** - * 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 diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/Utils.ets deleted file mode 100644 index 65f70088ddb62bcf80f4e0ec07dc841a8ab033f0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/Utils.ets +++ /dev/null @@ -1,119 +0,0 @@ -// @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) - } -} - - - - diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Calllog_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Calllog_test.js deleted file mode 100644 index d94514f7e2727ece1161260a90192a1b4737713e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Calllog_test.js +++ /dev/null @@ -1,1361 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CALLLOG = "dataability:///com.ohos.calllogability"; -const calllogUri = "dataability:///com.ohos.calllogability/calls/calllog"; -import common from './common.js'; - -export default function CalllogTest() { - describe('CalllogTest', function () { - console.log("----------CalllogTest is starting!----------"); - - async function calllogQueryForALL(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': calllogQueryByInsert start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' : logMessage calllogQueryByInsert key = ' + key + - ' dbResult :' + dbresult + ' value : ' + value); - console.info(tag + ' : logMessage calllogQueryByInsert value ' + (value == dbresult)); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - console.info(tag + " :logMessage calllogQueryByInsert: end"); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage calllogQueryByInsert: error = " + error); - } - } - - async function calllogQueryForDelete(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': calllogQueryForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage calllogQueryForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage calllogQueryForDelete: error = " + error); - } - } - - async function calllogQueryForBatchInsert(array, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': calllogQueryForBatchInsert start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", array[0].get("phone_number")); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - var size = array.size(); - console.info(tag + ' : logMessage calllogQueryForBatchInsert: size' + size); - expect(resultSet.rowCount == size).assertEqual(true); - var i = 0; - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of array[i]) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' : logMessage calllogQueryForBatchInsert dbresult :' + dbresult + - ' value : ' + value); - console.info(tag + ' : logMessage calllogQueryForBatchInsert value ' + (value == dbresult)); - expect(value == dbresult).assertTrue(); - } - i++; - } while (resultSet.goToNextRow()); - } - - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage calllogQueryByInsert: error = " + error); - } - } - - async function callLogDelete(tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info(tag + ': callLogDelete deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } - - /** - * @tc.number calllog_insert_test_100 - * @tc.name Insert call log - * @tc.desc Function test - */ - it("calllog_insert_test_100", 0, async function (done) { - console.info("--------logMessage calllog_insert_test_100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_insert_test_100: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = common.getCallLogInsertMap() - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_insert_test_100"); - await callLogDelete("calllog_insert_test_100"); - done(); - } catch (error) { - console.info("logMessage calllog_insert_test_100: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_update_test_400 - * @tc.name Single call log update - * @tc.desc Function test - */ - it("calllog_update_test_400", 0, async function (done) { - console.info("--------logMessage calllog_update_test_400 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_update_test_400: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await updateOneCalllog(); - done(); - } catch (error) { - console.info("logMessage calllog_update_test_400: calllog insert error = " + error); - done(); - } - ; - - async function updateOneCalllog() { - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - var updateCode = await DAHelper.update(calllogUri, common.getCallLogUpdate(), condition); - console.info("logMessage calllog_update_test_400: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = common.getCallLogUpdateMap(); - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_update_test_400"); - await callLogDelete("calllog_update_test_400"); - } catch (error) { - console.info("logMessage calllog_update_test_400: update error = " + error); - done(); - } - ; - } - }); - - /** - * @tc.number calllog_update_test_500 - * @tc.name Update all call logs - * @tc.desc Function test - */ - it("calllog_update_test_500", 0, async function (done) { - console.info("--------logMessage calllog_update_test_500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1122445566", "ring_duration": "500" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_update_test_500: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await updateAllCalllog(); - done(); - } catch (error) { - console.info("logMessage calllog_update_test_500: calllog insert error = " + error); - done(); - } - ; - async function updateAllCalllog() { - var updateValues = { - "answer_state": "1" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var updateCode = await DAHelper.update(calllogUri, updateValues, condition) - console.info("logMessage calllog_update_test_500: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map([["phone_number", "1122445566"], ["ring_duration", "500"]]) - map.set("id", calllogId.toString()); - map.set("answer_state", "1"); - await calllogQueryForALL(map, "calllog_update_test_500"); - await callLogDelete("calllog_update_test_500"); - } catch (error) { - console.info("logMessage calllog_update_test_500: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_delete_test_1300 - * @tc.name Delete call log - * @tc.desc Function test - */ - it("calllog_delete_test_1300", 0, async function (done) { - console.info("--------logMessage calllog_delete_test_1300 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "123456", "ring_duration": "200" - }; - try { - var callLogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_delete_test_1300: callLogId = " + callLogId); - expect(callLogId > 0).assertTrue(); - await deleteOneCallLog(); - done(); - } catch (error) { - console.info("logMessage calllog_delete_test_1300: calllog insert error = " + error); - done(); - } - - async function deleteOneCallLog() { - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info("logMessage calllog_delete_test_1300: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - await calllogQueryForDelete(map, "calllog_delete_test_1300"); - } catch (error) { - console.info("logMessage calllog_delete_test_1300: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_batchInset_test_1600 - * @tc.name Insert call logs in batches - * @tc.desc Function test - */ - it("calllog_batchInset_test_1600", 0, async function (done) { - console.info("--------logMessage calllog_batchInset_test_1600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "phone_number": "1600", "ring_duration": "333" - }; - var addBulkValue2 = { - "phone_number": "1600", "ring_duration": "600" - }; - var addBulkValue3 = { - "phone_number": "1600", "ring_duration": "600" - }; - var addBulkValue4 = { - "phone_number": "1600", "ring_duration": "600" - }; - var addBulkValue5 = { - "phone_number": "1600", "ring_duration": "600" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - console.info("logMessage calllog_batchInset_test_1600: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await calllogQueryForBatchInsert(common.getCallLogBatchInsert(), "calllog_batchInset_test_1600"); - await callLogDelete("calllog_batchInset_test_1600"); - done(); - } catch (error) { - console.info("logMessage calllog_batchInset_test_1600: error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_query_test_1200 - * @tc.name Query all call logs - * @tc.desc Function test - */ - it("calllog_query_test_1200", 0, async function (done) { - console.info("------------calllog_query_test_1200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "123566456", "ring_duration": "200" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_query_test_1200: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = new Map([["phone_number", "123566456"], ["ring_duration", "200"]]); - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_query_test_1200"); - await callLogDelete("calllog_query_test_1200"); - done(); - } catch (error) { - console.info("logMessage calllog_query_test_1200: calllog insert error = " + error); - } - }); - - /** - * @tc.number calllog_query_test_1100 - * @tc.name Query call logs of combined conditions - * @tc.desc Function test - */ - it("calllog_query_test_1100", 0, async function (done) { - console.info("------------calllog_query_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "44325008", "ring_duration": "100" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_query_test_1100: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryCalllog(); - await callLogDelete("calllog_query_test_1100"); - done() - } catch (error) { - console.info("logMessage calllog_query_test_1100: calllog insert error = " + error); - done(); - } - - async function queryCalllog() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.lessThan("ring_duration", "200").orderByAsc("id"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_query_test_1100: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_query_test_1100: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_query_test_1100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info('logMessage calllog_query_test_1100: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "44325008").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_query_test_1100: query error:" + error); - done(); - } - } - }); - - /** - * @tc.number calllog_query_test_800 - * @tc.name Query a single call log - * @tc.desc Function test - */ - it("calllog_query_test_800", 0, async function (done) { - console.info("------------calllog_query_test_800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "88888888888", "ring_duration": "100" - }; - try { - var callLogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_query_test_800: callLogId = " + callLogId); - expect(callLogId > 0).assertTrue(); - await queryOneCallLog(); - await callLogDelete("calllog_query_test_800"); - done(); - } catch (error) { - console.info("logMessage calllog_query_test_800: calllog insert error = " + error); - done(); - } - - async function queryOneCallLog() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_query_test_800: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_query_test_800: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_query_test_800: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info('logMessage calllog_query_test_800: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "88888888888").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_query_test_800: query error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_fuzzyquery_test_100 - * @tc.name Fuzzy query ability based on mobile phone number (beginning of a certain field) - * @tc.desc Function test - */ - it("calllog_fuzzyquery_test_100", 0, async function (done) { - console.info("------------calllog_fuzzyquery_test_100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "196320147" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_fuzzyquery_test_100: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryByStartsWithPhoneNumber(); - await callLogDelete("calllog_fuzzyquery_test_100"); - done(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_100: calllog insert error = " + error); - done(); - } - - async function queryByStartsWithPhoneNumber() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phone_number", "196%"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_fuzzyquery_test_100: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_fuzzyquery_test_100: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_fuzzyquery_test_100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info( - 'logMessage calllog_fuzzyquery_test_100: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "196320147").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_100: query error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_fuzzyquery_test_200 - * @tc.name Fuzzy query ability based on mobile phone number (at the end of a certain field) - * @tc.desc Function test - */ - it("calllog_fuzzyquery_test_200", 0, async function (done) { - console.info("------------calllog_fuzzyquery_test_200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "126467821" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_fuzzyquery_test_200: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryByEndWithPhoneNumber(); - await callLogDelete("calllog_fuzzyquery_test_200"); - done(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_200: calllog insert error = " + error); - done(); - } - - async function queryByEndWithPhoneNumber() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phone_number", "%821"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_fuzzyquery_test_200: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_fuzzyquery_test_200: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_fuzzyquery_test_200: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info( - 'logMessage calllog_fuzzyquery_test_200: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "126467821").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_200: query error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_fuzzyquery_test_300 - * @tc.name Fuzzy query ability based on mobile phone number (including a certain field) - * @tc.desc Function test - */ - it("calllog_fuzzyquery_test_300", 0, async function (done) { - console.info("------------calllog_fuzzyquery_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1234567855557568" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_fuzzyquery_test_300: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryByPhoneNumberContainsField(); - await callLogDelete("calllog_fuzzyquery_test_300"); - done(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_300: calllog insert error = " + error); - done(); - } - - async function queryByPhoneNumberContainsField() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phone_number", "%555%"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage calllog_fuzzyquery_test_300: columnNames:" + resultSet.columnNames); - console.info("logMessage calllog_fuzzyquery_test_300: columnCount:" + resultSet.columnCount); - console.info('logMessage calllog_fuzzyquery_test_300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == calllogId.toString()).assertTrue(); - console.info( - 'logMessage calllog_fuzzyquery_test_300: phone_number = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "1234567855557568").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_fuzzyquery_test_300: query error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_insert_test_200 - * @tc.name Abnormal use case, an incorrect field is passed in when inserting data - * @tc.desc Function test - */ - it("abnormal_calllog_insert_test_200", 0, async function (done) { - console.info("------------abnormal_calllog_insert_test_200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_numbers": "1111111111" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_insert_test_200: calllogId = " + calllogId); - expect(calllogId == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_insert_test_200: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_calllog_insert_test_300 - * @tc.name Abnormal use case, an incorrect table name is passed in when inserting data - * @tc.desc Function test - */ - it("abnormal_calllog_insert_test_300", 0, async function (done) { - console.info("------------abnormal_calllog_insert_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/calllogs"; - - var insertValues = { - "phone_number": "456789410" - }; - try { - var calllogId = await DAHelper.insert(errorUri, insertValues); - console.info("logMessage abnormal_calllog_insert_test_300: calllogId = " + calllogId); - expect(calllogId == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_insert_test_300: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_calllog_update_test_600 - * @tc.name Abnormal use case, passing in a wrong field when updating data - * @tc.desc Function test - */ - it("abnormal_calllog_update_test_600", 0, async function (done) { - console.info("------------abnormal_calllog_update_test_600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1020202020" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_update_test_600: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalUpdate(); - await callLogDelete("abnormal_calllog_update_test_600"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_600: calllog insert error = " + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "phone_numbers": "22001122" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogId.toString()); - try { - var updataCode = await DAHelper.update(calllogUri, updateValues, condition); - console.info("logMessage abnormal_calllog_update_test_600: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("phone_number", "1020202020"); - await calllogQueryForALL(map, "abnormal_calllog_update_test_600"); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_600: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_update_test_700 - * @tc.name Abnormal use case, an incorrect table name is passed in when updating data - * @tc.desc Function test - */ - it("abnormal_calllog_update_test_700", 0, async function (done) { - console.info("------------abnormal_calllog_update_test_700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/calllogs"; - - var insertValues = { - "phone_number": "9952364" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_update_test_700: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalUpdate(); - await callLogDelete("abnormal_calllog_update_test_700"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_700: calllog insert error = " + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "phone_numbers": "22001122" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - try { - var updataCode = await DAHelper.update(errorUri, updateValues, condition); - console.info("logMessage abnormal_calllog_update_test_700: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("phone_number", "9952364"); - await calllogQueryForALL(map, "abnormal_calllog_update_test_700"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_700: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_delete_test_1400 - * @tc.name Abnormal use case, passing in a wrong field when deleting data - * @tc.desc Function test - */ - it("abnormal_calllog_delete_test_1400", 0, async function (done) { - console.info("------------abnormal_calllog_delete_test_1400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "789130" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_delete_test_1400: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalDelete(); - await callLogDelete("abnormal_calllog_delete_test_1400"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_1400: calllog insert error = " + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogId.toString()); - try { - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info("logMessage abnormal_calllog_delete_test_1400: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("phone_number", "789130"); - await calllogQueryForALL(map, "abnormal_calllog_delete_test_1400"); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_1400: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_delete_test_1500 - * @tc.name Abnormal use case, passing in an incorrect table name when deleting data - * @tc.desc Function test - */ - it("abnormal_calllog_delete_test_1500", 0, async function (done) { - console.info("------------abnormal_calllog_delete_test_1500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/calllogs"; - - var insertValues = { - "phone_number": "1564721" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_delete_test_1500: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalDelete(); - await callLogDelete("abnormal_calllog_delete_test_1500"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_1500: calllog insert error = " + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - try { - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info("logMessage abnormal_calllog_delete_test_1500: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - done() - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("phone_number", "1564721"); - await calllogQueryForALL(map, "abnormal_calllog_delete_test_1500"); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_1500: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_query_test_900 - * @tc.name Abnormal use case, an incorrect field is passed in when querying - * @tc.desc Function test - */ - it("abnormal_calllog_query_test_900", 0, async function (done) { - console.info("------------abnormal_calllog_query_test_900 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1564721" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_query_test_900: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await abnormalQuery(); - await callLogDelete("abnormal_calllog_query_test_900"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_900: calllog insert error = " + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogId.toString()); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - console.info('logMessage abnormal_calllog_query_test_900: goToFirstRow' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow()).assertEqual(false); - resultSet.close(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_900:query error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_calllog_batchinsert_test_1700 - * @tc.name abnormal_batchinsert - * @tc.desc Function test - */ - it("abnormal_calllog_batchinsert_test_1700", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_batchinsert_test_1700 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "phone_number": "5555555555", "ring_duration": "500" - }; - var addBulkValue2 = { - "phone_number": "1511002", "ring_duration": "100" - }; - var addBulkValue3 = { - "phone_numbers": "1521003", "ring_duration": "100" - }; - var addBulkValue4 = { - "phone_number": "1521004", "ring_durations": "100" - }; - var addBulkValue5 = { - "phone_number": "1521005", "ring_duration": "100" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - console.info("logMessage abnormal_calllog_batchinsert_test_1700: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_batchinsert_test_1700: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_delete_test_1800 - * @tc.name batchDelete - * @tc.desc Function test - */ - it("calllog_delete_test_1800", 0, async function (done) { - console.info("--------logMessage calllog_delete_test_1800 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_delete_test_1800: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = common.getCallLogInsertMap() - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_delete_test_1800"); - await executeBatch(); - } catch (error) { - console.info("logMessage calllog_delete_test_1800: calllog insert error = " + error); - done(); - } - - async function executeBatch() { - console.info("logMessage calllog_delete_test_1800: executeBatch start "); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - DAHelper.executeBatch(URI_CALLLOG, [{ - uri: calllogUri, - type: featureAbility.DataAbilityOperationType.TYPE_DELETE, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage calllog_delete_test_1800: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage calllog_delete_test_1800: data_3 = " + data); - console.info("logMessage calllog_delete_test_1800: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - }; - }); - - /** - * @tc.number calllog_update_test_1900 - * @tc.name batchUpdate - * @tc.desc Function test - */ - it("calllog_update_test_1900", 0, async function (done) { - console.info("--------logMessage calllog_update_test_1900 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_update_test_1900: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = common.getCallLogInsertMap() - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_update_test_1900"); - await executeBatch(); - } catch (error) { - console.info("logMessage calllog_update_test_1900: calllog insert error = " + error); - done(); - } - - async function executeBatch() { - var updateValues = { - "phone_number": "123456789" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - DAHelper.executeBatch(URI_CALLLOG, [{ - uri: calllogUri, - type: featureAbility.DataAbilityOperationType.TYPE_UPDATE, - valuesBucket: updateValues, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage calllog_update_test_1900: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage calllog_update_test_1900: data_3 = " + data); - console.info("logMessage calllog_update_test_1900: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - }; - }); - - /** - * @tc.number calllog_Delete_test_2000 - * @tc.name calllog Delete - * @tc.desc Function test - */ - it("calllog_Delete_test_2000", 0, async function (done) { - console.info("--------logMessage calllog_Delete_test_2000 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "123456", "ring_duration": "200" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - var calllogIdThree = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - expect(calllogIdThree > 0).assertTrue(); - await deleteCalllog(); - done(); - } catch (error) { - console.info("logMessage calllog_Delete_test_2000: calllog insert error = " + error); - done(); - } - - async function deleteCalllog() { - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString()); - condition.or(); - condition.equalTo("id", calllogIdTwo.toString()); - condition.or(); - condition.equalTo("id", calllogIdThree.toString()); - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info("logMessage calllog_Delete_test_2000: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var resultColumns = []; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - } catch (error) { - console.info("logMessage calllog_Delete_test_2000: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number calllog_Delete_test_2100 - * @tc.name calllog Delete - * @tc.desc Function test - */ - it("calllog_Delete_test_2100", 0, async function (done) { - console.info("--------logMessage calllog_Delete_test_2100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var calllogId = await DAHelper.insert(calllogUri, common.getCallLogInsert()); - console.info("logMessage calllog_Delete_test_2100: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - var map = common.getCallLogInsertMap() - map.set("id", calllogId.toString()); - await calllogQueryForALL(map, "calllog_Delete_test_2100"); - await callLogDelete("calllog_Delete_test_2100"); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId); - var resultColumns = []; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage calllog_Delete_test_2100: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_queryContains_test_2200 - * @tc.name calllog Delete - * @tc.desc Function test - */ - it("calllog_queryContains_test_2200", 0, async function (done) { - console.info("--------logMessage calllog_queryContains_test_2200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "123456789220099999" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage calllog_queryContains_test_2200: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - - var resultColumns = ["phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.contains("phone_number", "99999"); - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var phone = resultSet.getString(resultSet.getColumnIndex("phone_number")); - console.info("logMessage calllog_queryContains_test_2200: phone is = " + phone); - expect(phone == "123456789220099999").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - await callLogDelete(); - done(); - } catch (error) { - console.info("logMessage calllog_queryContains_test_2200: calllog insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_calllog_update_test_2300 - * @tc.name Update all call records, pass in a field that does not exist - * @tc.desc Function test - */ - it("abnormal_calllog_update_test_2300", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_update_test_2300 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "15748646546", display_name: "name2300" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - await updateOneCalllog(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_2300: calllog insert error = " + error); - done(); - } - ; - async function updateOneCalllog() { - try { - var insertValues = { - phone_number: "15748646546", display_names: "nameUpdateError2300" - }; - var condition = - new ohosDataAbility.DataAbilityPredicates(); - var updateCode = await DAHelper.update(calllogUri, insertValues, condition); - console.info("logMessage abnormal_calllog_update_test_2300: updateCode = " + updateCode); - expect(updateCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("display_name", "name2300"); - await calllogQueryForALL(map, "abnormal_calllog_update_test_2300"); - map.set("id", calllogIdTwo.toString()); - await calllogQueryForALL(map, "abnormal_calllog_update_test_2300"); - await callLogDelete("calllog_update_test_2300"); - } catch (error) { - console.info("logMessage abnormal_calllog_update_test_2300: update error = " + error); - done(); - } - ; - } - }); - - /** - * @tc.number abnormal_calllog_query_test_2400 - * @tc.name When querying call records based on combined conditions, incorrect field - * names and non-existent data are passed in - * @tc.desc Function test - */ - it("abnormal_calllog_query_test_2400", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_query_test_2400 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "15748646546", display_name: "name2300" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", calllogId.toString() + "ksks"); - var resultColumns = ["display_names"]; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - console.info("abnormal_calllog_query_test_2400: resultSet.rowCount = " + resultSet.rowCount); - expect(resultSet.rowCount == -1).assertTrue(); - resultSet.close(); - await callLogDelete("abnormal_calllog_query_test_2400"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_2400: calllog insert error = " + error); - done(); - } - ; - }); - - /** - * @tc.number abnormal_calllog_query_test_2500 - * @tc.name When querying all call records based on combined conditions, incorrect field - * names and non-existent data are passed in - * @tc.desc Function test - */ - it("abnormal_calllog_query_test_2500", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_query_test_2500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "15748646546", display_name: "name2300" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info('abnormal_calllog_query_test_2500 calllogId = ' + calllogId); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - console.info('abnormal_calllog_query_test_2500 calllogIdTwo = ' + calllogIdTwo); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var resultColumns = ["display_names"]; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - console.info('abnormal_calllog_query_test_2500 resultSet.goToFirstRow() = ' + resultSet.goToFirstRow()); - console.info('abnormal_calllog_query_test_2500 resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.goToFirstRow() == false).assertTrue(); - resultSet.close(); - await callLogDelete("abnormal_calllog_query_test_2500"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_2500: calllog insert error = " + error); - done(); - } - ; - }); - - /** - * @tc.number abnormal_calllog_delete_test_2600 - * @tc.name Batch call records are added, and some of them fail, depending on the processing logic - * @tc.desc Function test - */ - it("abnormal_calllog_delete_test_2600", 0, async function (done) { - console.info("--------logMessage abnormal_calllog_delete_test_2600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "15748646546", display_name: "name2300" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_2600: calllog insert error = " + error); - done(); - } - ; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogIdTwo.toString()); - condition.or(); - condition.equalTo("id", calllogId.toString()); - var code = await DAHelper.delete(calllogUri, condition); - console.info("logMessage abnormal_calllog_delete_test_2600: code = " + code); - expect(code == -1).assertTrue(); - condition.clear(); - var resultColumns = []; - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - var count = 2; - expect(resultSet.rowCount == count).assertTrue(); - resultSet.close(); - await callLogDelete("abnormal_calllog_delete_test_2600"); - done(); - }); - - /** - * @tc.number abnormal_calllog_update_test_2700 - * @tc.name When batch call records are modified, the wrong field or table name is passed in - * @tc.desc Function test - */ - it("abnormal_calllog_delete_test_2700", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - phone_number: "270015748646546", display_name: "name2700" - } - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - var calllogIdTwo = await DAHelper.insert(calllogUri, insertValues); - expect(calllogId > 0).assertTrue(); - expect(calllogIdTwo > 0).assertTrue(); - await updateOneCalllog(); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_2700: calllog insert error = " + error); - done(); - } - ; - async function updateOneCalllog() { - try { - var insertValues = { - phone_number: "270015748646546", display_names: "nameUpdateError2700" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", calllogIdTwo.toString()); - condition.or(); - condition.equalTo("id", calllogId.toString()); - var updateCode = await DAHelper.update(calllogUri, insertValues, condition); - console.info("logMessage abnormal_calllog_delete_test_2700: updateCode = " + updateCode); - expect(updateCode == -1).assertTrue(); - var map = new Map(); - map.set("id", calllogId.toString()); - map.set("display_name", "name2700"); - await calllogQueryForALL(map, "abnormal_calllog_delete_test_2700"); - map.set("id", calllogIdTwo.toString()); - await calllogQueryForALL(map, "abnormal_calllog_delete_test_2700"); - await callLogDelete("abnormal_calllog_delete_test_2700"); - } catch (error) { - console.info("logMessage abnormal_calllog_delete_test_2700: update error = " + error); - done(); - } - ; - } - }); - - /** - * @tc.number abnormal_calllog_query_test_2800 - * @tc.name Fuzzy search query based on mobile phone number - * @tc.desc Function test - */ - it("abnormal_calllog_query_test_2800", 0, async function (done) { - console.info("------------abnormal_calllog_query_test_2800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "196320147" - }; - try { - var calllogId = await DAHelper.insert(calllogUri, insertValues); - console.info("logMessage abnormal_calllog_query_test_2800: calllogId = " + calllogId); - expect(calllogId > 0).assertTrue(); - await queryByStartsWithPhoneNumberError(); - await callLogDelete("abnormal_calllog_query_test_2800"); - done(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_2800: calllog insert error = " + error); - done(); - } - - async function queryByStartsWithPhoneNumberError() { - var resultColumns = ["id", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phone_numbers", "196%"); - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - console.info("logMessage abnormal_calllog_query_test_2800: resultSet.rowCount = " + resultSet.rowCount); - expect(resultSet.rowCount == -1).assertTrue(); - resultSet.close(); - } catch (error) { - console.info("logMessage abnormal_calllog_query_test_2800: query error = " + error); - done(); - } - } - }); - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('callllog afterAll logMessage get DAHelper success! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(calllogUri, condition); - console.info('callllog afterAll end logMessage deleteCode = ' + deleteCode); - }); - }) -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactCard_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactCard_test.js deleted file mode 100644 index 7e25361d026a08e1d86164c14e95ab0780bc4f4f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactCard_test.js +++ /dev/null @@ -1,5441 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const profilecontactUri = "dataability:///com.ohos.contactsdataability/profile/contact"; -const profileRawContactUri = "dataability:///com.ohos.contactsdataability/profile/raw_contact"; -const profileContactDataUri = "dataability:///com.ohos.contactsdataability/profile/contact_data"; -const profileGroupUri = "dataability:///com.ohos.contactsdataability/profile/groups"; -const profileBlocklistUri = "dataability:///com.ohos.contactsdataability/profile/contact_blocklist"; -const profilesearchContactUri = "dataability:///com.ohos.contactsdataability/profile/search_contact"; -const profileDeletedContactsUri = "dataability:///com.ohos.contactsdataability/profile/deleted_raw_contact"; -const profileDeletedRawContactRecord = - "dataability:///com.ohos.contactsdataability/profile/deleted_raw_contact_record"; - -export default function ContactCardTest() { - describe('ContactCardTest', function () { - console.info("-------ContactsTest is starting!--------"); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - async function contactsQuery(map, tag, uri) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - sleep(2000); - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ':logMessage contactsQuery key = ' + key + ' dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - async function queryBatch(map, tag, size) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryBatch start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", map.get("raw_contact_id")); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - console.info(tag + ': queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage resultSet.rowCount: error = " + error); - } - } - - async function queryIdForDelete(map, tag, uri) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryIdForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - sleep(1000); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage queryIdForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - async function deleteAll(uri, tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(uri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info(tag + ': deleteAll error = ' + error); - } - } - - async function deleteRawContact(tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - var deleteCode = await DAHelper.delete(profileRawContactUri, condition); - console.info(tag + ': deleteRawContact deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - sleep(1000); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - var code = await DAHelper.delete(profileDeletedContactsUri, conditionAll); - console.info(tag + ': Completely delete code = ' + code); - expect(code == 0).assertTrue(); - } catch (error) { - console.info(tag + ': deleteRawContact error = ' + error); - } - } - - async function insertData(rawContactId, type, value, position) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var contactDataValues1 = - { - "raw_contact_id": rawContactId, "content_type": type, "detail_info": value, "position": position - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - console.info("logMessage : contactDataId " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage : contact_data name insert error = " + error); - } - return contactDataId; - } - - /** - * @tc.number contactCard_insert_test_100 - * @tc.name Insert contact data - * @tc.desc Function test - */ - it("contactCard_insert_test_100", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_insert_test_100: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insert_test_100", profileRawContactUri); - await deleteRawContact("contactCard_insert_test_100"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_100: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_insert_test_400 - * @tc.name Insert contact details (name, company, position, mobile phone number) - * @tc.desc Function test - */ - it("contactCard_insert_test_400", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataNameInsert(DAHelper, rawContactId); - await dataCompanyInsert(DAHelper, rawContactId); - await dataPhoneInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_400"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_400"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_400: raw_contact insert error = " + error); - done(); - } - }); - - async function dataNameInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaocheng" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - console.info("logMessage contactCard_insert_test_400: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "xiaocheng"); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insert_test_400", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_400: contact_data name insert error = " + error); - done(); - } - } - - async function dataCompanyInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "developer" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - console.info("logMessage contactCard_insert_test_400: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "TT"); - map.set("position", "developer"); - contactsQuery(map, "contactCard_insert_test_400", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_400: contact_data company insert error = " + error); - done(); - } - } - - async function dataPhoneInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "12345678" - }; - try { - var contactDataId3 = await DAHelper.insert(profileContactDataUri, contactDataValues3); - sleep(1000); - console.info("logMessage contactCard_insert_test_400: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "12345678"); - await contactsQuery(map, "contactCard_insert_test_400", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_400: contact_data phone insert error = " + error); - done(); - } - } - - /** - * @tc.number contactCard_insert_test_500 - * @tc.name Insert contact details (nickname, email, home) - * @tc.desc Function test - */ - it("contactCard_insert_test_500", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataEmailInsert(DAHelper, rawContactId); - await dataNickNameInsert(DAHelper, rawContactId); - await dataPostalAddressInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_500"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_500"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_500: raw_contact insert error = " + error); - done(); - } - }); - - async function dataEmailInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "166@163.com" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contactCard_insert_test_500: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "166@163.com"); - await contactsQuery(map, "contactCard_insert_test_500_1", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_500: contact_data email insert error = " + error); - } - } - - async function dataNickNameInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaocheng" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - console.info("logMessage contactCard_insert_test_500: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "xiaocheng"); - await contactsQuery(map, "contactCard_insert_test_500_2", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_500: contact_data nickname insert error = " + error); - } - } - - async function dataPostalAddressInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "NanJingSoftRoad" - }; - try { - var contactDataId3 = await DAHelper.insert(profileContactDataUri, contactDataValues3); - console.info("logMessage contactCard_insert_test_500: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "NanJingSoftRoad"); - await contactsQuery(map, "contactCard_insert_test_500_3", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_500: contact_data postal_address insert error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_600 - * @tc.name Insert contact details (remarks, AIM, birthday) - * @tc.desc Function test - */ - it("contactCard_insert_test_600", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues) - console.info("logMessage contactCard_insert_test_600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataNoteInsert(DAHelper, rawContactId); - await dataAimInsert(DAHelper, rawContactId); - await dataEventInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_600"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_600"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_600: raw_contact insert error = " + error); - done(); - } - }); - - async function dataNoteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "note", - "detail_info": "javaGangster" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - console.info("logMessage contactCard_insert_test_600: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "javaGangster"); - await contactsQuery(map, "contactCard_insert_test_600_1", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_600: contact_data note insert error = " + error); - done(); - } - } - - async function dataAimInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, "content_type": "im", "detail_info": "aaaaa" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - console.info("logMessage contactCard_insert_test_600: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "aaaaa"); - await contactsQuery(map, "contactCard_insert_test_600_2", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_600: contact_data aim insert error = " + error); - } - } - - async function dataEventInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "contact_event", - "detail_info": "19960229" - }; - try { - var contactDataId3 = await DAHelper.insert(profileContactDataUri, contactDataValues3); - console.info("logMessage contactCard_insert_test_600: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "19960229"); - await contactsQuery(map, "contactCard_insert_test_600_3", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_600: contact_data event insert error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_700 - * @tc.name Insert contact details (URL, assistant, group) - * @tc.desc Function test - */ - it("contactCard_insert_test_700", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataWebsiteInsert(DAHelper, rawContactId); - await dataRelationInsert(DAHelper, rawContactId); - await dataWebsiteInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_700"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_700"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_700: raw_contact insert error = " + error); - done(); - } - }); - - async function dataWebsiteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "website", - "detail_info": "www.com" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contactCard_insert_test_700: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "www.com"); - await contactsQuery(map, "contactCard_insert_test_700_1", profileContactDataUri); - await contactDataRelationInsert(); - } catch (error) { - console.info("logMessage contactCard_insert_test_700: contact_data website insert error = " + error); - } - } - - async function dataRelationInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "relation", - "detail_info": "Secretary" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - sleep(1000); - console.info("logMessage contactCard_insert_test_700: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "Secretary"); - await contactsQuery(map, "contactCard_insert_test_700_2", profileContactDataUri); - await contactDataGroupInsert(); - } catch (error) { - console.info("logMessage contactCard_insert_test_700: contact_data relation insert error = " + error); - } - } - - async function dataGroupInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": "1" - }; - try { - var contactDataId3 = await DAHelper.insert(profileContactDataUri, contactDataValues3); - sleep(1000); - console.info("logMessage contactCard_insert_test_700: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "1"); - await contactsQuery(map, "contactCard_insert_test_700_3", profileContactDataUri); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_700: contact_data group insert error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_800 - * @tc.name Insert contact details (phone ringtone) - * @tc.desc Function test - */ - it("contactCard_insert_test_800", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataMiscInsert(DAHelper, rawContactId); - await deleteRawContact("contactCard_insert_test_800"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_800"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_800: raw_contact insert error = " + error); - done(); - } - }); - - async function dataMiscInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_misc", - "detail_info": "1234" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contactCard_insert_test_800: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "1234"); - await contactsQuery(map, "contactCard_insert_test_800_1", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_800: contact_data misc insert error = " + error); - } - } - - /** - * @tc.number contactCard_update_test_900 - * @tc.name Update contact data - * @tc.desc Function test - */ - it("contactCard_update_test_900", 0, async function (done) { - console.info("------logMessage contactCard_update_test_900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "licheng", - "company": "TT", - "position": "developer", - "favorite": 1, - "phonetic_name": "licheng||lc" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_900"); - await deleteAll(profileContactDataUri, "contactCard_update_test_900"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_900: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactUpdate(DAHelper, rawContactId) { - var updateValues = { - "display_name": "dacheng", - "company": "oo", - "position": "Testers", - "favorite": 0, - "phonetic_name": "dacheng||dc" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_900: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "dacheng"); - map.set("company", "oo"); - map.set("position", "Testers"); - map.set("favorite", "0"); - map.set("phonetic_name", "dacheng||dc"); - await contactsQuery(map, "contactCard_update_test_900", profileRawContactUri); - } catch (error) { - console.info('logMessage contactCard_update_test_900: raw_contact update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1200 - * @tc.name Update contact details (name) - * @tc.desc Function test - */ - it("contactCard_update_test_1200", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNameInsert(DAHelper, rawContactId); - await dataNameUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1200"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1200"); - done(); - } catch (error) { - console.info('logMessage contactCard_update_test_1200: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataNameInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "xiaoyuan" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1200: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1200: contact_data insert error = ' + error); - } - } - - async function dataNameUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "dayuan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1200: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "dayuan"); - await contactsQuery(map, "contactCard_update_test_1200", profileRawContactUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1200: contact_data update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1300 - * @tc.name Update contact details (company, position) - * @tc.desc Function test - */ - it("contactCard_update_test_1300", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataCompanyInsert(DAHelper, rawContactId); - await dataCompanyUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1300"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1300"); - done(); - } catch (error) { - console.info('logMessage contactCard_update_test_1300: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataCompanyInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "Testers", - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1300: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1300: contact_data insert error = ' + error); - } - } - - async function dataCompanyUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "OOOO", "position": "developer" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1300: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("company", "OOOO"); - map.set("position", "developer"); - await contactsQuery(map, "contactCard_update_test_1300", profileRawContactUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1300: contact_data update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1400 - * @tc.name Update contact details (mobile phone number) - * @tc.desc Function test - */ - it("contactCard_update_test_1400", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataPhoneInsert(DAHelper, rawContactId); - await dataPhoneUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1400"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1400"); - done(); - } catch (error) { - console.info('logMessage contactCard_update_test_1400: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforeDataPhoneInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "phone", "detail_info": "123456" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1400: contact_data insert error = ' + error); - } - } - - async function dataPhoneUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "99663355" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1400: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "99663355"); - await contactsQuery(map, "contactCard_update_test_1400", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1400: contact_data update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1500 - * @tc.name Update contact details (nickname) - * @tc.desc Function test - */ - it("contactCard_update_test_1500", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNickNameInsert(DAHelper, rawContactId); - await dataNickNameUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1500"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1500"); - done(); - } catch (error) { - console.info('logMessage contactCard_update_test_1500: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataNickNameInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaoyuan" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1500: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1500: contact_data insert error = ' + error); - } - } - - async function dataNickNameUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "fengyuan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1500: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "fengyuan"); - await contactsQuery(map, "contactCard_update_test_1500", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1500: contact_data update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1600 - * @tc.name Update contact details (email) - * @tc.desc Function test - */ - it("contactCard_update_test_1600", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataEmailInsert(DAHelper, rawContactId); - await dataEmailUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1600"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1600"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_1600: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataEmailInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "166@163.com" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1600: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1600: contact_data insert error = ' + error); - } - } - - async function dataEmailUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "199@163.com" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition) - sleep(1000); - console.info('logMessage contactCard_update_test_1600: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "199@163.com"); - await contactsQuery(map, "contactCard_update_test_1600", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1600: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1700 - * @tc.name Update Contact Details (Residential) - * @tc.desc Function test - */ - it("contactCard_update_test_1700", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataPostalInsert(DAHelper, rawContactId); - await dataPostalUpdate(); - await deleteRawContact("contactCard_update_test_1700"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1700"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_1700: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataPostalInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "NanJing" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1700: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_update_test_1700: contact_data insert error = " + error); - } - } - - async function dataPostalUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "BeiJing" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1700: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "BeiJing"); - await contactsQuery(map, "contactCard_update_test_1700", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1700: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1800 - * @tc.name Update contact details (remarks) - * @tc.desc Function test - */ - it("contactCard_update_test_1800", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_1800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNoteInsert(DAHelper, rawContactId); - await dataNoteUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1800"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1800"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_1800: raw_contact insert error = " + error); - done(); - } - }); - - async function beforedataNoteInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "note", "detail_info": "Gangster" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1800: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_1800: contact_data insert error = ' + error); - } - } - - async function dataNoteUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "God" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1800: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "God"); - await contactsQuery(map, "contactCard_update_test_1800", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1800: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_1900 - * @tc.name Update Contact Details (AIM) - * @tc.desc Function test - */ - it("contactCard_update_test_1900", 0, async function (done) { - console.info("------logMessage contactCard_update_test_1900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues) - console.info("logMessage contactCard_update_test_1900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataAimInsert(DAHelper, rawContactId); - await dataAimUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_1900"); - await deleteAll(profileContactDataUri, "contactCard_update_test_1900"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_1900: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataAimInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "im", "detail_info": "aaaaa" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_1900: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_update_test_1900: contact_data insert error = " + error); - } - } - - async function dataAimUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "bbbbb" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_1900: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "bbbbb"); - await contactsQuery(map, "contactCard_update_test_1900", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_1900: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2000 - * @tc.name Update Contact Details (Birthday) - * @tc.desc Function test - */ - it("contactCard_update_test_2000", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_2000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataEventInsert(DAHelper, rawContactId); - await dataEventUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2000"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2000"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2000: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataEventInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_event", - "detail_info": "19960229" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contactCard_update_test_2000: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2000: contact_data insert error = ' + error); - } - } - - async function dataEventUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "19971021" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2000: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "19971021"); - await contactsQuery(map, "contactCard_update_test_2000", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2000: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2100 - * @tc.name Update contact details (website) - * @tc.desc Function test - */ - it("contactCard_update_test_2100", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_2100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataWebsiteInsert(DAHelper, rawContactId); - await dataWebsiteUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2100"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2100"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2100: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataWebsiteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "website", - "detail_info": "www.com" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contactCard_update_test_2100: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2100: contact_data insert error = ' + error); - } - } - - async function dataWebsiteUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "www.123.com" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2100: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "www.123.com"); - await contactsQuery(map, "contactCard_update_test_2100", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2100: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2200 - * @tc.name Update contact details (assistant) - * @tc.desc Function test - */ - it("contactCard_update_test_2200", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_2200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataRelationInsert(DAHelper, rawContactId); - await dataRelationUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2200"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2200"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2200: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataRelationInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "relation", - "detail_info": "Secretary" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_update_test_2200: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2200: contact_data insert error = ' + error); - } - } - - async function dataRelationUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "spouse" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2200: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "spouse"); - await contactsQuery(map, "contactCard_update_test_2200", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2200: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2300 - * @tc.name Update contact detail data table (group) - * @tc.desc Function test - */ - it("contactCard_update_test_2300", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_update_test_2300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataGroupInsert(DAHelper, rawContactId); - await dataGroupUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2300"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2300"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2300: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataGroupInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": "2" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_update_test_2300: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2300: contact_data insert error = ' + error); - } - } - - async function dataGroupUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "7" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2300: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "3"); - await contactsQuery(map, "contactCard_update_test_2300", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2300: update error = ' + error); - } - } - - /** - * @tc.number contactCard_update_test_2400 - * @tc.name Update contact detail data table (phone ringtone) - * @tc.desc Function test - */ - it("contactCard_update_test_2400", 0, async function (done) { - console.info("------logMessage contactCard_update_test_2400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contactCard_update_test_2400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataMiscInsert(DAHelper, rawContactId); - await dataMiscUpdate(DAHelper, rawContactId); - await deleteRawContact("contactCard_update_test_2400"); - await deleteAll(profileContactDataUri, "contactCard_update_test_2400"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_2400: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataMiscInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_misc", - "detail_info": "1234" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contactCard_update_test_2400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contactCard_update_test_2400: contact_data insert error = ' + error); - } - } - - async function dataMiscUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "999" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contactCard_update_test_2400: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "999"); - await contactsQuery(map, "contactCard_update_test_2300", profileContactDataUri); - } catch (error) { - console.info('logMessage contactCard_update_test_2400: update error = ' + error); - } - } - - /** - * @tc.number contactCard_favorite_test_2500 - * @tc.name Favorite contacts - * @tc.desc Function test - */ - it("contactCard_favorite_test_2500", 0, async function (done) { - console.info("-------logMessage contactCard_favorite_test_2500 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaocai", "company": "TT", "position": "Testers" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues) - console.info('logMessage contactCard_favorite_test_2500: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await updateFavorite(DAHelper, rawContactId); - await deleteRawContact("contactCard_favorite_test_2500"); - done(); - } catch (error) { - console.info('logMessage contactCard_favorite_test_2500: raw_contact insert error = ' + error); - done(); - } - }); - - async function updateFavorite(DAHelper, rawContactId) { - var updateValues = { - "favorite": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contactCard_favorite_test_2500: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaocai"); - map.set("company", "TT"); - map.set("position", "Testers"); - map.set("favorite", "1"); - await contactsQuery(map, "contactCard_favorite_test_2500", profileRawContactUri); - } catch (error) { - console.info('logMessage contactCard_favorite_test_2500: update error = ' + error); - } - } - - /** - * @tc.number contactCard_unfavorite_test_2600 - * @tc.name Unfavorite contacts - * @tc.desc Function test - */ - it("contactCard_unfavorite_test_2600", 0, async function (done) { - console.info("-------logMessage contactCard_unfavorite_test_2600 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaohong", "company": "TT", "position": "Testers", "favorite": 1 - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info('logMessage contactCard_unfavorite_test_2600: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await updateUnFavorite(DAHelper, rawContactId); - await deleteRawContact("contactCard_unfavorite_test_2600"); - done(); - } catch (error) { - console.info('logMessage contactCard_unfavorite_test_2600: raw_contact insert error = ' + error); - done(); - } - }); - - async function updateUnFavorite(DAHelper, rawContactId) { - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contactCard_unfavorite_test_2600: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaohong"); - map.set("company", "TT"); - map.set("position", "Testers"); - map.set("favorite", "0"); - await contactsQuery(map, "contactCard_favorite_test_2500", profileRawContactUri); - } catch (error) { - console.info("logMessage contactCard_unfavorite_test_2600: update error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_2700 - * @tc.name Insert contact black list - * @tc.desc Function test - */ - it("contactCard_insert_test_2700", 0, async function (done) { - console.info("-------logMessage contactCard_insert_test_2700 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var blocklistId = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - sleep(1000); - console.info('logMessage contactCard_insert_test_2700: blocklistId = ' + blocklistId); - expect(blocklistId > 0).assertTrue(); - var map = common.getProfileBlockListMap(); - map.set("id", blocklistId.toString()); - await contactsQuery(map, "contactCard_insert_test_2700", profileBlocklistUri); - await deleteAll(profileBlocklistUri, "contactCard_insert_test_2700"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_2700: blocklist insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_delete_test_2800 - * @tc.name Delete contact black list - * @tc.desc Function test - */ - it("contactCard_delete_test_2800", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_2800 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var blocklistId = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - sleep(1000); - console.info('logMessage contactCard_delete_test_2800: blocklistId = ' + blocklistId); - expect(blocklistId > 0).assertTrue(); - await blocklistDelete(); - done(); - } catch (error) { - console.info('logMessage contactCard_delete_test_2800: blocklist insert error = ' + error); - done(); - } - - async function blocklistDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", blocklistId.toString()); - try { - var deleteCode = await DAHelper.delete(profileBlocklistUri, condition); - sleep(1000); - console.info("logMessage contactCard_delete_test_2800: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", blocklistId.toString()); - await queryIdForDelete(map, "contactCard_delete_test_2800", profileBlocklistUri); - } catch (error) { - console.info('logMessage contactCard_delete_test_2800: delete error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_insert_test_2900 - * @tc.name Insert contact group - * @tc.desc Function test - */ - it("contactCard_insert_test_2900", 0, async function (done) { - console.info("-------logMessage contactCard_insert_test_2900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var groupValues = { - "group_name": "TestersThird" - }; - try { - var groupId = await DAHelper.insert(profileGroupUri, groupValues); - sleep(1000); - console.info("logMessage contactCard_insert_test_2900: groupId =" + groupId); - expect(groupId > 0).assertTrue(); - await groupRawContactInsert(DAHelper); - await deleteRawContact("contactCard_insert_test_2900"); - await deleteAll(profileGroupUri, "contactCard_insert_test_2900"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_2900"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_2900: group insert error =" + error); - done(); - } - }); - - async function groupRawContactInsert(DAHelper) { - var rawContactValues = { - "display_name": "liyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_insert_test_2900: rawContactId =" + rawContactId); - expect(rawContactId > 0).assertTrue(); - await groupDataInsert(DAHelper, rawContactId); - } catch (error) { - console.info("logMessage contactCard_insert_test_2900: raw_contact insert error =" + error); - } - } - - async function groupDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues) - sleep(1000); - console.info("logMessage contactCard_insert_test_2900: contactDataId =" + contactDataId); - expect(contactDataId > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId); - map.set("raw_contact_id", rawContactId.toString()); - map.set("detail_info", groupId.toString()); - await contactsQuery(map, "contactCard_insert_test_2900", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_insert_test_2900: contact_data insert error =" + error); - } - } - - /** - * @tc.number contactCard_delete_test_3000 - * @tc.name Delete contact group - * @tc.desc Function test - */ - it("contactCard_delete_test_3000", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_3000 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var groupValues = { - "group_name": "TestersFourth" - }; - try { - var groupId = await DAHelper.insert(profileGroupUri, groupValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_3000: groupId =" + groupId); - expect(groupId > 0).assertTrue(); - await groupAfterRawContactInsert(DAHelper); - await deleteRawContact("contactCard_delete_test_3000"); - await deleteAll(profileGroupUri, "contactCard_delete_test_3000"); - await deleteAll(profileContactDataUri, "contactCard_delete_test_3000"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_3000: group insert error =" + error); - done(); - } - }); - - async function groupAfterRawContactInsert(DAHelper) { - var rawContactValues = { - "display_name": "liyuchen" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_3000: rawContactId =" + rawContactId); - expect(rawContactId > 0).assertTrue(); - await deleteGroupContactDataInsert(DAHelper, rawContactId); - } catch (error) { - console.info("logMessage contactCard_delete_test_3000: raw_contact insert error =" + error); - } - } - - async function deleteGroupContactDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info("logMessage contactCard_delete_test_3000: contactDataId =" + contactDataId); - expect(contactDataId > 0).assertTrue(); - await deleteGroup(DAHelper, contactDataId); - } catch (error) { - console.info("logMessage contactCard_delete_test_3000: contact_data insert error =" + error); - } - } - - async function deleteGroup(DAHelper, contactDataId) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - try { - var deleteCode = await DAHelper.delete(profileContactDataUri, condition); - sleep(1000); - console.info("logMessage contactCard_delete_test_3000: deleteCode =" + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - await queryIdForDelete(map, "contactCard_delete_test_3000", profileContactDataUri); - } catch (error) { - console.info("logMessage contactCard_delete_test_3000: delete error =" + error); - } - } - - /** - * @tc.number contactCard_query_test_3100 - * @tc.name Query basic information of a single contact - * @tc.desc Function test - */ - it("contactCard_query_test_3100", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactQuery(DAHelper, rawContactId); - await deleteRawContact("contactCard_query_test_3100"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3100: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(2000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId).assertEqual(true); - console.info('logMessage contactCard_query_test_3100: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyu").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_3100: query error = " + error); - } - } - - /** - * @tc.number contactCard_query_test_3200 - * @tc.name Query basic information of multiple contacts - * @tc.desc Function test - */ - it("contactCard_query_test_3200", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues1 = { - "display_name": "xiaoyu" - }; - try { - var rawContactIdFirst = await DAHelper.insert(profileRawContactUri, rawContactValues1); - sleep(1000); - console.info("logMessage contactCard_query_test_3200: rawContactId = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3200: raw_contact_1 insert error = " + error); - done(); - } - - var rawContactValues2 = { - "display_name": "xiaohong" - }; - try { - var rawContactIdSecond = await DAHelper.insert(profileRawContactUri, rawContactValues2); - sleep(1000); - console.info("logMessage contactCard_query_test_3200: rawContactId = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await queryTwoRaw(DAHelper, rawContactIdFirst, rawContactIdSecond); - await deleteRawContact("contactCard_query_test_3200"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3200: raw_contact_2 insert error = " + error); - done(); - } - }); - - async function queryTwoRaw(DAHelper, rawContactIdFirst, rawContactIdSecond) { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactIdFirst.toString()); - condition.or(); - condition.equalTo("id", rawContactIdSecond.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - console.info('logMessage contactCard_query_test_3200: goToFirstRow' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow()).assertEqual(true); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage contactCard_query_test_3200: columnNames :" + resultSet.columnNames); - console.info("logMessage contactCard_query_test_3200: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_query_test_3200: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_query_test_3200: displayName = ' + resultSet.getString(1)); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_query_test_3200: query error' + error); - } - } - - /** - * @tc.number contactCard_query_test_3300 - * @tc.name Query basic information of all contacts - * @tc.desc Function test - */ - it("contactCard_query_test_3300", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3300 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues1 = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues1); - sleep(1000); - console.info("logMessage contactCard_query_test_3300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3300: raw_contact_1 insert error = " + error); - done(); - } - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contactCard_query_test_3300: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyu").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - await deleteRawContact("contactCard_query_test_3300"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3300: query error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_query_test_3400 - * @tc.name Query all information of a single contact - * @tc.desc Function test - */ - it("contactCard_query_test_3400", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3400 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyuzhou", - "company": "TT", - "position": "Testers", - "favorite": 1, - "phonetic_name": "xiaoyu||xy" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryAllInformation(DAHelper, rawContactId); - await deleteRawContact("contactCard_query_test_3400"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3400: raw_contact insert error = " + error); - done(); - } - }); - - async function queryAllInformation(DAHelper, rawContactId) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("id")); - console.info('logMessage contactCard_query_test_3400: id = ' + id); - expect(id == rawContactId).assertEqual(true); - var favorite = resultSet.getString(resultSet.getColumnIndex("favorite")); - console.info('logMessage contactCard_query_test_3400: favorite = ' + favorite); - expect(favorite == "1").assertEqual(true); - var phoneticName = resultSet.getString(resultSet.getColumnIndex("phonetic_name")); - console.info('logMessage contactCard_query_test_3400: phoneticName = ' + phonetic_name); - expect(phoneticName == "xiaoyu||xy").assertEqual(true); - var company = resultSet.getString(resultSet.getColumnIndex("company")); - console.info('logMessage contactCard_query_test_3400: company = ' + company); - expect(company == "TT").assertEqual(true); - var displayName = resultSet.getString(resultSet.getColumnIndex("display_name")); - console.info('logMessage contactCard_query_test_3400: displayName = ' + displayName); - expect(displayName == "xiaoyuzhou").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_query_test_3400: query error = ' + error); - } - } - - /** - * @tc.number contactCard_query_test_3500 - * @tc.name Query group member ability - * @tc.desc Function test - */ - it("contactCard_query_test_3500", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3500: raw_contact insert error = " + error); - done(); - } - var groupValues = { - "group_name": "BossBoard3500" - }; - try { - var groupId = await DAHelper.insert(profileGroupUri, groupValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3500: group insert error = " + error); - done(); - } - await groupBossBoardInsert(DAHelper, rawContactId, groupId); - await deleteRawContact("contactCard_query_test_3500"); - await deleteAll(profileGroupUri, "contactCard_query_test_3500"); - await deleteAll(profileContactDataUri, "contactCard_query_test_3500"); - done(); - }); - - async function groupBossBoardInsert(DAHelper, rawContactId, groupId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3500: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - await groupBossBoardQuery(DAHelper, rawContactId, groupId); - } catch (error) { - console.info("logMessage contactCard_query_test_3500: query error = " + error); - } - } - - async function groupBossBoardQuery(DAHelper, rawContactId, groupId) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 9 data is group - condition.equalTo("type_id", "9"); - condition.and(); - condition.equalTo("detail_info", groupId.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3500: raw_contact_id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId).assertEqual(true); - console.info('logMessage contactCard_query_test_3500: detail_info = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == groupId.toString()).assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_3500: query error :" + error); - } - } - - /** - * @tc.number contactCard_query_test_3600 - * @tc.name Query favorite contacts - * @tc.desc Function test - */ - it("contactCard_query_test_3600", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou", "favorite": 1 - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryFavorite(); - await deleteRawContact("contactCard_query_test_3600"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3600: raw_contact insert error = " + error); - done(); - } - - async function queryFavorite() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("favorite", "1"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3600: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_query_test_3600: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyuzhou").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_3600: query error :" + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_query_test_3700 - * @tc.name Query recent contact ability - * @tc.desc Function test - */ - it("contactCard_query_test_3700", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3700 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou", "lastest_contacted_time": 60 - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryContacted(); - await deleteRawContact("contactCard_query_test_3700"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3700: raw_contact insert error = " + error); - done(); - } - - async function queryContacted() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.lessThan("lastest_contacted_time", "100"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3700: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_query_test_3700: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyuzhou").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_query_test_3700: query error' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_query_test_3800 - * @tc.name Query recently deleted contacts - * @tc.desc Function test - */ - it("contactCard_query_test_3800", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3800 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaocai" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactDelete(DAHelper, rawContactId); - await deletedRawContactQuery(DAHelper, rawContactId); - await deleteAll(profileDeletedContactsUri, "contactCard_query_test_3800") - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3800: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profileRawContactUri, condition1); - sleep(1000); - console.info('logMessage contactCard_query_test_3800: deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3800: raw_contact delete error = " + error); - done(); - } - } - - async function deletedRawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "display_name", "is_deleted"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedprofileRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info('logMessage contactCard_query_test_3800: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_query_test_3800: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_query_test_3800: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaocai").assertTrue(); - console.info('logMessage contactCard_query_test_3800: is_deleted = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == "1").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_3800: query error :" + error); - done(); - } - } - - /** - * @tc.number contactCard_query_test_3900 - * @tc.name Query all mobile phone numbers - * @tc.desc Function test - */ - it("contactCard_query_test_3900", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_3900 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaocai" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryPhoneInsert(); - await phoneQuery(rawContactId); - await deleteRawContact("contactCard_query_test_3900"); - await deleteAll(profileContactDataUri, "contactCard_query_test_3900"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_3900: raw_contact insert error = " + error); - done(); - } - }); - - async function queryPhoneInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "1853696321" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_query_test_3900: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_3900: contact_data insert error = " + error); - } - } - - async function phoneQuery(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 5 data is phone - condition.equalTo("content_type", "phone"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_3900: raw_contact_id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_query_test_3900: detail_info = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "1853696321").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_query_test_3900: query error' + error); - } - } - - /** - * @tc.number contactCard_query_test_4000 - * @tc.name Query all mailbox capabilities - * @tc.desc Function test - */ - it("contactCard_query_test_4000", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_4000 is starting!------------"); - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_4000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryEmailInsert(DAHelper, rawContactId); - await emailQuery(DAHelper, contactDataId, rawContactId); - await deleteRawContact("contactCard_query_test_4000"); - await deleteAll(profileContactDataUri, "contactCard_query_test_4000"); - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_4000: raw_contact insert error = " + error); - done(); - } - }); - - async function queryEmailInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "16658@163.com" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_query_test_4000: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_4000: contact_data insert error = " + error); - } - } - - async function emailQuery(DAHelper, contactDataId, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data content_type is email - condition.equalTo("type_id", "1").limitAs(3).orderByDesc("id"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_query_test_4000: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contactCard_query_test_4000: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_query_test_4000: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "16658@163.com").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_4000: query error :" + error); - } - } - - /** - * @tc.number contactCard_query_test_4100 - * @tc.name Query data information of a single contact - * @tc.desc Function test - */ - it("contactCard_query_test_4100", 0, async function (done) { - console.info("-----------logMessage contactCard_query_test_4100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_query_test_4100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryTwoDataInsert(DAHelper, rawContactId); - await queryTwoDataInsertCompany(DAHelper, rawContactId); - await queryTwo(DAHelper, rawContactId); - await deleteRawContact("contactCard_query_test_4100"); - await deleteAll(profileContactDataUri, "contactCard_query_test_4100"); - del - done(); - } catch (error) { - console.info("logMessage contactCard_query_test_4100: raw_contact insert error = " + error); - done(); - } - }); - - async function queryTwoDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "xiaoyu" - }; - try { - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_query_test_4100: contactDataId = " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_4100: contact_data name insert error = " + error); - } - } - - async function queryTwoDataInsertCompany(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "OOOO", - "position": "Testers" - }; - try { - var contactDataId2 = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info("logMessage contactCard_query_test_4100: contactDataId = " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_query_test_4100: contact_data company insert error = " + error); - } - } - - async function queryTwo(DAHelper, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "detail_info", "position"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - var array = [{ - detail_info: "xiaoyu", position: "" - }, { - detail_info: "OOOO", position: "Testers" - }]; - var i = 0; - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage contactCard_query_test_4100: columnNames :" + resultSet.columnNames); - console.info("logMessage contactCard_query_test_4100: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_query_test_4100: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_query_test_4100: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contactCard_query_test_4100: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == array[i].detail_info).assertEqual(true); - console.info('logMessage contactCard_query_test_4100: position = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == array[i].position).assertEqual(true); - i++; - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_query_test_4100: query error :" + error); - } - } - - /** - * @tc.number contactCard_delete_test_4400 - * @tc.name Delete the basic raw data of the contact and record the deleted basic raw data - * @tc.desc Function test - */ - it("contactCard_delete_test_4400", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_4400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_4400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await deleteRaw(DAHelper, rawContactId); - await queryDelete(DAHelper, rawContactId); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4400: raw_contact insert error :" + error); - done(); - } - }); - - async function deleteRaw(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profileRawContactUri, condition1); - sleep(1000); - console.info("logMessage contactCard_delete_test_4400: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4400: delete error = " + error); - } - } - - async function queryDelete(DAHelper, rawContactId) { - var resultColumns = ["id", "delete_time", "display_name"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedprofileRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info("logMessage contactCard_delete_test_4400: columnNames:" + resultSet.columnNames); - console.info("logMessage contactCard_delete_test_4400: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_delete_test_4400: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_delete_test_4400: delete_time = ' + resultSet.getString(1)); - console.info('logMessage contactCard_delete_test_4400: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaoming").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4400: query error:" + error); - } - } - - /** - * @tc.number contactCard_delete_test_4700 - * @tc.name Delete detailed contact data and record detailed data - * @tc.desc Function test - */ - it("contactCard_delete_test_4700", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_4700 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaozhang", "company": "OOOO", "position": "TestManager" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_4700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryDeleteCompanyData(DAHelper, rawContactId); - await rawContactDelete(DAHelper, rawContactId); - await companyRawContactDeleteQuery(DAHelper, rawContactId); - await deleteAll(profileContactDataUri, "contactCard_delete_test_4700"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4700: raw_contact insert error:" + error); - done(); - } - }); - - async function queryDeleteCompanyData(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "OOOO", - "position": "TestManager" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_4700: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4700: contact_data insert error:" + error); - } - } - - async function rawContactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profileRawContactUri, condition1); - sleep(1000); - console.info("logMessage contactCard_delete_test_4700: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4700: delete error = " + error); - done(); - } - } - - async function companyRawContactDeleteQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name", "backup_data"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedprofileRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info("logMessage contactCard_delete_test_4700: columnNames:" + resultSet.columnNames); - console.info("logMessage contactCard_delete_test_4700: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_delete_test_4700: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_delete_test_4700: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaozhang").assertEqual(true); - console.info('logMessage contactCard_delete_test_4700: backup_data = ' + resultSet.getString(2)); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4700: query error:" + error); - } - } - - /** - * @tc.number contactCard_delete_test_4800 - * @tc.name Delete and record basic data of a single contact - * @tc.desc Function test - */ - it("contactCard_delete_test_4800", 0, async function (done) { - console.info("-------logMessage contactCard_delete_test_4800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaopeng" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contactCard_delete_test_4800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDelete(DAHelper, rawContactId); - await deletedRawContactQuery(DAHelper, rawContactId) - await deleteAll(profileContactDataUri, "contactCard_delete_test_4800"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4800: raw_contact insert error:" + error); - done(); - } - }); - - async function contactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("name_raw_contact_id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profilecontactUri, condition1); - sleep(1000); - console.info("logMessage contactCard_delete_test_4800: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4800: delete error = " + error); - } - } - - async function deletedRawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "delete_time", "display_name"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedprofileRawContactUri, resultColumns, condition2); - sleep(1000) - if (resultSet.goToFirstRow()) { - console.info("logMessage contactCard_delete_test_4800: columnNames:" + resultSet.columnNames); - console.info("logMessage contactCard_delete_test_4800: columnCount:" + resultSet.columnCount); - console.info('logMessage contactCard_delete_test_4800: id = ' + resultSet.getString(0)); - console.info('logMessage contactCard_delete_test_4800: delete_time = ' + resultSet.getString(1)); - console.info('logMessage contactCard_delete_test_4800: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaopeng").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contactCard_delete_test_4800: query error:" + error); - } - } - - /** - * @tc.number contactCard_batchinsert_test_4900 - * @tc.name Insert contacts in batches(raw_contact) - * @tc.desc Function test - */ - it("contactCard_batchinsert_test_4900", 0, async function (done) { - console.info("--------logMessage contactCard_batchinsert_test_4900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.batchInsert(profileRawContactUri, common.getContactBatchCompany()); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_4900: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("company", "TT4900"); - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - console.info( - 'contactCard_batchinsert_test_4900 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 5).assertEqual(true); - resultSet.close(); - await deleteRawContact("contactCard_batchinsert_test_4900"); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_4900: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_batchinsert_test_5000 - * @tc.name Insert contact_data in batches of address book - * @tc.desc Function test - */ - it("contactCard_batchinsert_test_5000", 0, async function (done) { - console.info("--------logMessage contactCard_batchinsert_test_5000 start!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaozhi" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataBatchInsert(rawContactId); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5000: raw_contact insert error = " + error); - done(); - } - async function contactDataBatchInsert(rawContactId) { - try { - var batchInsertCode = - await DAHelper.batchInsert(profileContactDataUri, common.getContactBatchCompanyTwo()); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5000: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var map = new Map(); - map.set("raw_contact_id", rawContactId.toString()); - await queryBatch(map, "contactCard_batchinsert_test_5000", 5); - await deleteRawContact("contactCard_batchinsert_test_5000"); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5000: batchInsert error = " + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_batchinsert_test_5400 - * @tc.name Batch operation of contact black list - * @tc.desc Function test - */ - it("contactCard_batchinsert_test_5400", 0, async function (done) { - console.info("--------logMessage contactCard_batchinsert_test_5400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.batchInsert(profileBlocklistUri, common.getPhoneNumberBatch()); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5400: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await query(5); - await blocklistDelete(); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5400: batchInsert error = " + error); - done(); - } - - async function blocklistDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "85525040585400"); - try { - var deleteCode = await DAHelper.delete(profileBlocklistUri, condition); - console.info("logMessage contactCard_batchinsert_test_5400: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - await query(0); - done(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5400: delete error = " + error); - done(); - } - } - - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "85525040585400"); - try { - var resultSet = await DAHelper.query(profileBlocklistUri, resultColumns, condition); - sleep(1000); - console.info('contactCard_batchinsert_test_5400 : queryBatch start ! resultSet.rowCount = ' + - resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contactCard_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - }); - - /** - * @tc.number contactCard_update_test_5300 - * @tc.name Bulk favorites and unfavorites of contacts - * @tc.desc Function test - */ - it("contactCard_update_test_5300", 0, async function (done) { - console.info("--------logMessage contactCard_update_test_5300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValuesOne = { - "display_name": "fengyuan", "favorite": 1 - }; - var rawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactValuesThree = { - "display_name": "xiaoma", "favorite": 1 - }; - var listAddBluk = [] - listAddBluk[0] = rawContactValuesOne; - listAddBluk[1] = rawContactValuesTwo; - listAddBluk[2] = rawContactValuesThree; - try { - var batchInsertCode = await DAHelper.batchInsert(profileRawContactUri, listAddBluk); - sleep(1000); - console.info("logMessage contactCard_update_test_5300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await rawContactUpdateUnFavorites(DAHelper); - await queryUnFavorites(DAHelper); - await deleteRawContact("contactCard_update_test_5300"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_5300: batchInsert error = " + error); - done(); - } - }); - - async function rawContactUpdateUnFavorites(DAHelper) { - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("display_name", "fengyuan"); - condition.or(); - condition.equalTo("display_name", "xiaoma"); - try { - var updateCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contactCard_update_test_5300: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_update_test_5300: update error = " + error); - } - } - - async function queryUnFavorites(DAHelper) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("display_name", "fengyuan"); - condition.or(); - condition.equalTo("display_name", "xiaoma"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - console.info( - 'contactCard_update_test_5300 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 2).assertEqual(true); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var dbresult = resultSet.getString(resultSet.getColumnIndex("favorite")); - console.info(' contactCard_update_test_5300 :logMessage contactsQuery dbresult :' + dbresult + - ' value : ' + value); - expect(dbresult == "0").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(" contactCard_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - - /** - * @tc.number contactCard_batchinsert_test_5500 - * @tc.name Contacts are added to and removed from groups in batches - * @tc.desc Function test - */ - it("contactCard_batchinsert_test_5500", 0, async function (done) { - console.info("--------logMessage contactCard_batchinsert_test_5500 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var groupValues = { - "group_name": "ManagerGroup" - }; - try { - var groupId = await DAHelper.insert(profileGroupUri, groupValues); - console.info("logMessage contactCard_batchinsert_test_5500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: group insert error = " + error); - done(); - } - - try { - var rawContactValues1 = { - "display_name": "xiaohuang" - }; - var rawContactIdFirst = await DAHelper.insert(profileRawContactUri, rawContactValues1); - console.info("logMessage contactCard_batchinsert_test_5500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: raw_contact_1 insert error = " + error); - done(); - } - - try { - var rawContactValues2 = { - "display_name": "xiaolv" - }; - var rawContactIdSecond = await DAHelper.insert(profileRawContactUri, rawContactValues2); - console.info("logMessage contactCard_batchinsert_test_5500: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: raw_contact_2 insert error = " + error); - done(); - } - - try { - var rawContactValues3 = { - "display_name": "xiaobai" - }; - var rawContactIdThird = await DAHelper.insert(profileRawContactUri, rawContactValues3); - console.info("logMessage contactCard_batchinsert_test_5500: rawContactIdThird = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: raw_contact_3 insert error = " + error); - done(); - } - await threeDataInsert(DAHelper, rawContactIdFirst, rawContactIdSecond, rawContactIdThird, groupId); - await deleteRawContact("contactCard_batchinsert_test_5500"); - await deleteAll(profileGroupUri, "contactCard_batchinsert_test_5500"); - await deleteAll(profileContactDataUri, "contactCard_batchinsert_test_5500"); - done(); - }); - - async function threeDataInsert(DAHelper, rawContactIdFirst, rawContactIdSecond, rawContactIdThird, groupId) { - var contactDataValues1 = { - "raw_contact_id": rawContactIdFirst, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var contactDataValues2 = { - "raw_contact_id": rawContactIdSecond, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var contactDataValues3 = { - "raw_contact_id": rawContactIdThird, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValues1; - listAddBluk[1] = contactDataValues2; - listAddBluk[2] = contactDataValues3; - try { - var batchInsertCode = await DAHelper.batchInsert(profileContactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await contactDataDelete(DAHelper, rawContactIdFirst, rawContactIdThird); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: batchInsert error = " + error); - } - } - - async function contactDataDelete(DAHelper, rawContactIdFirst, rawContactIdThird) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdThird.toString()); - try { - var deleteCode = await DAHelper.delete(profileContactDataUri, condition); - sleep(1000); - console.info("logMessage contactCard_batchinsert_test_5500: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - await queryTwoData(DAHelper, rawContactIdFirst, rawContactIdThird); - } catch (error) { - console.info("logMessage contactCard_batchinsert_test_5500: delete error = " + error); - } - } - - async function queryTwoData(DAHelper, rawContactIdFirst, rawContactIdThird) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdThird.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - console.info( - 'contactCard_batchinsert_test_5500 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contactCard_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - - /** - * @tc.number contactCard_pinyin_query_test_200 - * @tc.name Contact name to pinyin (Chinese Simplified) - * @tc.desc Function test - */ - it("contactCard_pinyin_query_test_200", 0, async function (done) { - console.info("--------logMessage contactCard_pinyin_query_test_200 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "小黄" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info('logMessage contactCard_pinyin_query_test_200 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contactCard_pinyin_query_test_100"); - await deleteAll(profileContactDataUri, "contactCard_pinyin_query_test_100"); - done(); - } catch (error) { - console.info("logMessage contactCard_pinyin_query_test_200: raw_contact insert error = " + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaohuang" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_pinyin_query_test_200 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchQuery(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_200 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profilesearchContactUri, resultColumns, condition); - var map = common.getSearchMap(); - map.set("raw_contact_id", rawContactId.toString()); - if (resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ':contactCard_pinyin_query_test_200 key = ' + key + - ' dbresult :' + dbresult + ' value : ' + value); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_200 query error = ' + error); - } - } - - /** - * @tc.number contactCard_pinyin_query_test_100 - * @tc.name Contact name to pinyin (Chinese Traditional) - * @tc.desc Function test - */ - it("contactCard_pinyin_query_test_100", 0, async function (done) { - console.info("--------logMessage contactCard_pinyin_query_test_100 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "鍵盤" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_pinyin_query_test_100 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contactCard_pinyin_query_test_100"); - await deleteAll(profileContactDataUri, "contactCard_pinyin_query_test_100"); - done(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_100 raw_contact insert error = ' + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "鍵盤" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_pinyin_query_test_100 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchContactQueryChinese(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_100 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchContactQueryChinese(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profilesearchContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_pinyin_query_test_100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_pinyin_query_test_100: search_name = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "鍵盤||jianpan||jp").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_100 query error = ' + error); - } - } - - /** - * @tc.number contactCard_pinyin_query_test_300 - * @tc.name Contact name to pinyin (English) - * @tc.desc Function test - */ - it("contactCard_pinyin_query_test_300", 0, async function (done) { - console.info("--------logMessage contactCard_pinyin_query_test_300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "Tom" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_pinyin_query_test_300 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contactCard_pinyin_query_test_300"); - done(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_300 raw_contact insert error = ' + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "Tom" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_pinyin_query_test_300 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchContactQuery(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_300 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchContactQuery(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profilesearchContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_pinyin_query_test_300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_pinyin_query_test_300: search_name = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "Tom||Tom||Tom").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_pinyin_query_test_300 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_400 - * @tc.name Contact fuzzy search query interface (name) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_400", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "400xiaoming400" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_400 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactNameQuery(); - await deleteRawContact("contactCard_fuzzyquery_test_400"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_400 raw_contact insert error = ' + error); - done(); - } - - async function rawContactNameQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("display_name", "%xiaoming40%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_400: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_400: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "400xiaoming400").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_400 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_fuzzyquery_test_500 - * @tc.name Contact fuzzy search query interface (name pinyin, pinyin name) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_500", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_500 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var rawContactValues = { - "display_name": "500xiaoming500", "phonetic_name": "500xiaoming500||xm" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_500 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactPhoneticNameQuery(); - await deleteRawContact("contactCard_fuzzyquery_test_500"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_500 raw_contact insert error = ' + error); - done(); - } - - async function rawContactPhoneticNameQuery() { - var resultColumns = ["id", "display_name", "phonetic_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phonetic_name", "%xiaoming%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - condition.or(); - condition.like("phonetic_name", "%xm%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_500: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_500: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "500xiaoming500").assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_500: phoneticName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "500xiaoming500||xm").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_500 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_fuzzyquery_test_600 - * @tc.name Contact fuzzy search query interface (company, position) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_600", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_600 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming", "company": "TT600", "position": "Testers600" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_600 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactCompanyQuery(DAHelper, rawContactId); - await deleteRawContact("contactCard_fuzzyquery_test_600"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_600 raw_contact insert error = ' + error); - done(); - } - }); - - async function rawContactCompanyQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name", "company", "position"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("company", "%TT6%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - condition.or(); - condition.like("position", "%Testers6%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_600: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_600: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoming").assertEqual(true); - console.info('logMessage contactCard_fuzzyquery_test_600: company = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "TT600").assertEqual(true); - console.info('logMessage contactCard_fuzzyquery_test_600: position = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == "Testers600").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_600 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_700 - * @tc.name Contact fuzzy search query interface (mobile phone number) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_700", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_700 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_700 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataPhoneInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_700"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_700"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_700 raw_contact insert error = ' + error); - done(); - } - - async function contactDataPhoneInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "14528963" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_700 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryPhone(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_700 contact_data insert error = ' + contactDataId); - done(); - } - } - }); - - async function fuzzyQueryPhone(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 5 data is phone - condition.like("detail_info", "%52896%"); - condition.and(); - condition.equalTo("type_id", "5"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_700: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_700: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contactCard_fuzzyquery_test_700: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "14528963").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_700 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_800 - * @tc.name Contact fuzzy search query interface (nickname) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_800", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_800 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactNickNameInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_800"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_800"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_800 raw_contact insert error = ' + error); - done(); - } - - async function contactNickNameInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "daming" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_fuzzyquery_test_800 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryPhoneNickName(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_800 contact_data insert error = ' + contactDataId); - done(); - } - } - }); - - async function fuzzyQueryPhoneNickName(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 3 data is nickname - condition.like("detail_info", "%daming%"); - condition.and(); - condition.equalTo("type_id", "3"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_800: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_800: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_fuzzyquery_test_800: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "daming").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_800 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_900 - * @tc.name Contact fuzzy search query interface (mailbox) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_900", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_900 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataEmailInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_900"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_900"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_900 raw_contact insert error = ' + error); - done(); - } - - async function contactDataEmailInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "1564@163.com" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_fuzzyquery_test_900 ; = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryEmail(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_900 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryEmail(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data is email - condition.like("detail_info", "%1564%"); - condition.and(); - condition.equalTo("type_id", "1"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_900: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_900: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contactCard_fuzzyquery_test_900: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "1564@163.com").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_900 query error = ' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_1000 - * @tc.name Contact fuzzy search query interface (residential) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_1000", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_1000 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_1000 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataPostalInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_1000"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_1000"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1000 raw_contact insert error = ' + error); - done(); - } - - async function contactDataPostalInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "nanjing1000" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_1000 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryAddress(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1000 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryAddress(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data is postal_address - condition.like("detail_info", "%nanjing10%"); - condition.and(); - condition.equalTo("type_id", "7"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_1000: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_1000: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contactCard_fuzzyquery_test_1000: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "nanjing1000").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1000: query error' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_1100 - * @tc.name Contact fuzzy search query interface (remarks) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_1100", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_1100 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_1100 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataNoteInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_1100"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_1100"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1100 raw_contact insert error = ' + error); - done(); - } - - async function contactDataNoteInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "note", - "detail_info": "java1100" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contactCard_fuzzyquery_test_1100 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryNote(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1100 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryNote(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 10 data is note - condition.like("detail_info", "%java11%"); - condition.and(); - condition.equalTo("type_id", "10"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_1100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_1100: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_1100: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "java1100").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1100: query error' + error); - } - } - - /** - * @tc.number contactCard_fuzzyquery_test_1200 - * @tc.name Contact fuzzy search query interface (AIM) - * @tc.desc Function test - */ - it("contactCard_fuzzyquery_test_1200", 0, async function (done) { - console.info("--------logMessage contactCard_fuzzyquery_test_1200 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info('logMessage contactCard_fuzzyquery_test_1200 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("contactCard_fuzzyquery_test_1200"); - await deleteAll(profileContactDataUri, "contactCard_fuzzyquery_test_1200"); - done(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1200 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "im", - "detail_info": "aaaa1200" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_fuzzyquery_test_1200 ; = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryIM(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1200 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryIM(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 10 data is im account number - condition.like("detail_info", "%aa12%"); - condition.and(); - condition.equalTo("type_id", "2"); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contactCard_fuzzyquery_test_1200: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_1200: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contactCard_fuzzyquery_test_1200: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "aaaa1200").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contactCard_fuzzyquery_test_1200: query error' + error); - } - } - - /** - * @tc.number abnormal_contactCard_insert_test_200 - * @tc.name Abnormal use case, an incorrect field is passed in when inserting - * @tc.desc Function test - */ - it("abnormal_contactCard_insert_test_200", 0, async function (done) { - console.info("------------abnormal_contactCard_insert_test_200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_names": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_insert_test_200: rawContactId = " + rawContactId); - expect(rawContactId).assertEqual(-1); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_test_200: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contactCard_insert_test_300 - * @tc.name Abnormal use case, an incorrect table name is passed in when inserting - * @tc.desc Function test - */ - it("abnormal_contactCard_insert_test_300", 0, async function (done) { - console.info("------------abnormal_contactCard_insert_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(errorUri, rawContactValues); - console.info("logMessage abnormal_contactCard_insert_test_300: rawContactId = " + rawContactId); - expect(rawContactId == -1).assertTrue(); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_test_300: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contactCard_update_test_1100 - * @tc.name Abnormal use case, an incorrect field is passed in when updating - * @tc.desc Function test - */ - it("abnormal_contactCard_update_test_1100", 0, async function (done) { - console.info("------------abnormal_contactCard_update_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_update_test_1100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalUpdate(); - await deleteRawContact("abnormal_contactCard_update_test_1100"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_update_test_1100: raw_contact insert error' + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "display_names": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var updataCode = await DAHelper.update(profileRawContactUri, updateValues, condition) - console.info("logMessage abnormal_contactCard_update_test_1100: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contactCard_update_test_1100", profileRawContactUri); - } catch (error) { - console.info('logMessage abnormal_contactCard_update_test_1100: update error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_update_test_1000 - * @tc.name Abnormal use case, an incorrect table name is passed in when updating - * @tc.desc Function test - */ - it("abnormal_contactCard_update_test_1000", 0, async function (done) { - console.info("------------abnormal_contactCard_update_test_1000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_update_test_1000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalUpdate(); - await deleteRawContact("abnormal_contactCard_update_test_1100"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_update_test_1000: raw_contact insert error' + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "display_name": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updataCode = await DAHelper.update(errorUri, updateValues, condition); - console.info("logMessage abnormal_contactCard_update_test_1000: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contactCard_update_test_1000", profileRawContactUri); - } catch (error) { - console.info("logMessage abnormal_contactCard_update_test_1000: updata error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_delete_test_4500 - * @tc.name Abnormal use case, an incorrect field is passed in when deleting - * @tc.desc Function test - */ - it("abnormal_contactCard_delete_test_4500", 0, async function (done) { - console.info("------------abnormal_contactCard_delete_test_4500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaozhi" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_delete_test_4500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalDelete(); - await deleteRawContact("abnormal_contactCard_delete_test_4500"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_delete_test_4500: raw_contact insert error' + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(profileRawContactUri, condition); - console.info("logMessage abnormal_contactCard_delete_test_4500: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaozhi"); - await contactsQuery(map, "abnormal_contactCard_delete_test_4500", profileRawContactUri); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_delete_test_4500: delete error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_delete_test_4600 - * @tc.name Abnormal use case, an incorrect table name is passed in when deleting - * @tc.desc Function test - */ - it("abnormal_contactCard_delete_test_4600", 0, async function (done) { - console.info("------------abnormal_contactCard_delete_test_4600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info("logMessage abnormal_contactCard_delete_test_4600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalDelete(); - await deleteRawContact("abnormal_contactCard_delete_test_4600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_delete_test_4600: raw_contact insert error' + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info("logMessage abnormal_contactCard_delete_test_4600: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contactCard_delete_test_4600", profileRawContactUri); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_delete_test_4600: delete error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_query_test_4200 - * @tc.name Abnormal use case, an incorrect field is passed in when querying - * @tc.desc Function test - */ - it("abnormal_contactCard_query_test_4200", 0, async function (done) { - console.info("------------abnormal_contactCard_query_test_4200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaozhicheng" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues) - console.info("logMessage abnormal_contactCard_query_test_4200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contactCard_query_test_4200"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_query_test_4200: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info( - 'logMessage abnormal_contactCard_query_test_4200: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contactCard_query_test_4200: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_batchinsert_test_5100 - * @tc.name Abnormal use cases, when adding data in batches, some of them failed, check the processing logic - * @tc.desc Function test - */ - it("abnormal_contactCard_batchinsert_test_5100", 0, async function (done) { - console.info("--------logMessage abnormal_contactCard_batchinsert_test_5100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "display_name": "zhangsan" - }; - var addBulkValue2 = { - "display_names": "lisi" - }; - var addBulkValue3 = { - "display_name": "wangwu" - }; - var addBulkValue4 = { - "display_names": "laoliu" - }; - var addBulkValue5 = { - "display_name": "xiaozhang" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(profileRawContactUri, listAddBluk); - console.info("logMessage abnormal_contactCard_batchinsert_test_5100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_contactCard_batchinsert_test_5100: batch insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contactCard_insert_data_5300 - * @tc.name insert_data error no rawContactId - * @tc.desc Function test - */ - it("abnormal_contactCard_insert_data_5300", 0, async function (done) { - console.info("--------logMessage abnormal_contactCard_insert_data_5300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaotian" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage abnormal_contactCard_insert_data_5300 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("abnormal_contactCard_insert_data_5300"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_data_5300 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "content_type": "im", "detail_info": "aaaa" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage abnormal_contactCard_insert_data_5300 ; = ' + contactDataId); - expect(contactDataId == -1).assertTrue(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_data_5300 contact_data insert error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contactCard_insert_data_5400 - * @tc.name insert_data error no content_type - * @tc.desc Function test - */ - it("abnormal_contactCard_insert_data_5400", 0, async function (done) { - console.info("--------logMessage abnormal_contactCard_insert_data_5400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaotian" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, rawContactValues); - console.info('logMessage abnormal_contactCard_insert_data_5400 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("abnormal_contactCard_insert_data_5400"); - done(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_data_5400 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "detail_info": "aaaa" - }; - try { - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage abnormal_contactCard_insert_data_5400 ; = ' + contactDataId); - expect(contactDataId == -1).assertTrue(); - } catch (error) { - console.info('logMessage abnormal_contactCard_insert_data_5400 contact_data insert error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contactCard_delete_test_5500 - * @tc.name batchDelete - * @tc.desc Function test - */ - it("contactCard_delete_test_5500", 0, async function (done) { - console.info("--------logMessage contactCard_delete_test_5500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - console.info("logMessage contactCard_delete_test_5500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_delete_test_5500", profileRawContactUri); - await executeBatch(); - } catch (error) { - console.info("logMessage contactCard_delete_test_5500: insert error = " + error); - done(); - } - async function executeBatch() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - DAHelper.executeBatch(URI_CONTACTS, [{ - uri: profileRawContactUri, - type: featureAbility.DataAbilityOperationType.TYPE_DELETE, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info( - "logMessage contactCard_delete_test_5500: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage contactCard_delete_test_5500: data_3 = " + data); - console.info("logMessage contactCard_delete_test_5500: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number contactCard_update_test_5600 - * @tc.name batchUpdate - * @tc.desc Function test - */ - it("contactCard_update_test_5600", 0, async function (done) { - console.info("--------logMessage contactCard_update_test_5600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - console.info("logMessage contactCard_update_test_5600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_update_test_5600", profileRawContactUri); - await executeBatch(); - } catch (error) { - console.info("logMessage contactCard_update_test_5600: insert error = " + error); - done(); - } - - async function executeBatch() { - var updateValues = { - "display_name": "xiaoxiaoxiao" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - DAHelper.executeBatch(URI_CONTACTS, [{ - uri: profileRawContactUri, - type: featureAbility.DataAbilityOperationType.TYPE_UPDATE, - valuesBucket: updateValues, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info( - "logMessage contactCard_update_test_5600: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage contactCard_update_test_5600: data_3 = " + data); - console.info("logMessage contactCard_update_test_5600: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number contactCard_insert_test_5700 - * @tc.name Insert Multiple raw_contact essential information - * @tc.desc Function test - */ - it("contactCard_insert_test_5700", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_5700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_insert_test_5700: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insert_test_5700", profileRawContactUri); - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_insert_test_5700: rawContactIdOne = ' + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactIdOne.toString()); - await contactsQuery(map, "contactCard_insert_test_5700", profileRawContactUri); - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_insert_test_5700: rawContactIdTwo = ' + rawContactIdTwo); - expect(rawContactIdTwo > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactIdTwo.toString()); - await contactsQuery(map, "contactCard_insert_test_5700", profileRawContactUri); - await deleteRawContact("contactCard_insert_test_5700"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_5700: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_insert_test_5800 - * @tc.name Add 20000 bytes of basic contact information and verify whether the text insertion is successful - * @tc.desc Function test - */ - it("contactCard_insert_test_5800", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_5800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var name; - for (var i = 0; i < 20000; i++) { - name += "i"; - } - var contcatvalues = { - "display_name": name - } - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, contcatvalues); - sleep(1000); - console.info('logMessage contactCard_insert_test_5800: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", name); - await contactsQuery(map, "contactCard_insert_test_5800", profileRawContactUri); - await deleteRawContact("contactCard_insert_test_5800"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_5800: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_insert_test_5900 - * @tc.name Add multiple contact details and verify that the insertion was successful - * @tc.desc Function test - */ - it("contactCard_insert_test_5900", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_5900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var contcatvalues = { - "display_name": "xiao5900" - } - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, contcatvalues); - console.info('logMessage contactCard_insert_test_5900: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "19960229" - }; - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues1); - console.info('logMessage contactCard_insert_test_5900: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "19960229"); - await contactsQuery(map, "contactCard_insert_test_5900", profileContactDataUri); - - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, contcatvalues); - console.info('logMessage contactCard_insert_test_5900: rawContactId = ' + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - var contactDataValues2 = { - "raw_contact_id": rawContactIdOne, - "content_type": "phone", - "detail_info": "111111032" - }; - var contactDataId1 = await DAHelper.insert(profileContactDataUri, contactDataValues2); - console.info('logMessage contactCard_insert_test_5900: contactDataId = ' + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "111111032"); - await contactsQuery(map, "contactCard_insert_test_5900", profileContactDataUri); - - await deleteRawContact("contactCard_insert_test_5900"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_5900"); - done(); - } catch (error) { - console.info('logMessage contactCard_insert_test_5900: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_insert_test_6000 - * @tc.name Add the basic information of a single contact and verify whether the insertion is successful (name, - * Pinyin, company, position, favorite) - * @tc.desc Function test - */ - it("contactCard_insert_test_6000", 0, async function (done) { - console.info("------logMessage contactCard_insert_test_6000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "licheng", - "company": "TT", - "position": "developer", - "favorite": 1, - "phonetic_name": "licheng||lc" - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insert_test_6000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "licheng"); - map.set("company", "TT"); - map.set("position", "developer"); - map.set("favorite", "1"); - map.set("phonetic_name", "licheng||lc"); - await contactsQuery(map, "contactCard_insert_test_6000", profileRawContactUri); - await deleteRawContact("contactCard_insert_test_6000"); - await deleteAll(profileContactDataUri, "contactCard_insert_test_6000"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_6000: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertData_test_6100 - * @tc.name To contact_data Add a full field data to the data table and verify whether the insertion is - * successful - * @tc.desc Function test - */ - it("contactCard_insertData_test_6100", 0, async function (done) { - console.info("------logMessage contactCard_insertData_test_6100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertData_test_6100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - console.info('logMessage contactCard_insertData_test_6100: contactDataValues["raw_contact_id"] = ' + - contactDataValues.raw_contact_id); - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_insertData_test_6100: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - var map = common.getProfileContactDataMap(); - map.set("id", contactDataId.toString()); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insertData_test_6100", profileContactDataUri); - await deleteRawContact("contactCard_insertData_test_6100"); - await deleteAll(profileContactDataUri, "contactCard_insertData_test_6100"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertData_test_6100: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_update_test_6200 - * @tc.name Modify the basic information of multiple contacts and verify whether the modification is successful - * @tc.desc Function test - */ - it("contactCard_update_test_6200", 0, async function (done) { - console.info("--------logMessage contactCard_update_test_6200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - expect(rawContactId > 0).assertTrue(); - console.info("logMessage contactCard_update_test_6200: rawContactId = " + rawContactId); - var insertRawContactValuesOne = { - "display_name": "xiaocai1", - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - expect(rawContactIdOne > 0).assertTrue(); - console.info("logMessage contactCard_update_test_6200: rawContactIdOne = " + rawContactIdOne); - var insertRawContactValuesTwo = { - "display_name": "xiaocai1", - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - expect(rawContactIdTwo > 0).assertTrue(); - console.info("logMessage contactCard_update_test_6200: rawContactIdTwo = " + rawContactIdTwo); - - var updateValues = { - "display_name": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - var updataCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - console.info("logMessage contactCard_update_test_6200: updataCode = " + updataCode); - expect(updataCode == 0).assertTrue(); - sleep(1000); - await queryUpdateThree( - "contactCard_update_test_6200", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contactCard_update_test_6200"); - done(); - } catch (error) { - console.info("logMessage contactCard_update_test_6200: insert error = " + error); - done(); - } - }); - - async function queryUpdateThree(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var name = resultSet.getString(resultSet.getColumnIndex("display_name")); - expect(name == "xiaosan").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - /** - * @tc.number contactCard_UpdateRawContcat_test_6300 - * @tc.name Update raw_contact The full field data of the contact table and verify whether the modification is - * successful - * @tc.desc Function test - */ - it("contactCard_UpdateRawContcat_test_6300", 0, async function (done) { - console.info("------logMessage contactCard_UpdateRawContcat_test_6300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - console.info("logMessage contactCard_UpdateRawContcat_test_6300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(2000); - var updateValues = common.getProfileRawContactUpdate(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var updataCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - console.info('logMessage contactCard_UpdateRawContcat_test_6300: updataCode = ' + updataCode); - sleep(3000); - var map = common.getProfileRawContactUpdateMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contactCard_UpdateRawContcat_test_6300", profileRawContactUri); - await deleteRawContact("contactCard_UpdateRawContcat_test_6300"); - await deleteAll(profileContactDataUri, "contactCard_UpdateRawContcat_test_6300"); - done(); - } catch (error) { - console.info("logMessage contactCard_UpdateRawContcat_test_6300: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertDataUpdate_test_6400 - * @tc.name Update contact_data table, and verify whether the modification is successful - * @tc.desc Function test - */ - it("contactCard_insertDataUpdate_test_6400", 0, async function (done) { - console.info("------logMessage contactCard_insertDataUpdate_test_6400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataUpdate_test_6400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - console.info('logMessage contactCard_insertDataUpdate_test_6400: contactDataValues.raw_contact_id = ' + - contactDataValues.raw_contact_id); - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_insertDataUpdate_test_6400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var updateValues = common.getProfileContactDataUpdate(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - var updataCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - console.info('logMessage contactCard_insertDataUpdate_test_6400: updataCode = ' + updataCode); - sleep(1000); - var map = common.getProfileContactDataUpdateMap(); - map.set("id", contactDataId.toString()); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contactCard_insertDataUpdate_test_6400", profileContactDataUri); - await deleteRawContact("contactCard_insertDataUpdate_test_6400"); - await deleteAll(profileContactDataUri, "contactCard_insertDataUpdate_test_6400"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataUpdate_test_6400: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertDataUpdateAll_test_6500 - * @tc.name Update all contact details and verify that the modification was successful - * @tc.desc Function test - */ - it("contactCard_insertDataUpdateAll_test_6500", 0, async function (done) { - console.info("------logMessage contactCard_insertDataUpdateAll_test_6500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataUpdateAll_test_6500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaocai", ""); - await insertData(rawContactId, "phone", "6500", ""); - await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await insertData(rawContactId, "nickname", "xxxxcai", ""); - await insertData(rawContactId, "email", "111@fox.com", ""); - await insertData(rawContactId, "postal_address", "dddd", ""); - await insertData(rawContactId, "note", "caicai", ""); - await insertData(rawContactId, "im", "999999999", ""); - await insertData(rawContactId, "contact_event", "1125", ""); - await insertData(rawContactId, "website", "wwww.xxx.com", ""); - await insertData(rawContactId, "relation", "xiaobai", ""); - await insertData(rawContactId, "group_membership", 1, ""); - await insertData(rawContactId, "contact_misc", "5678", ""); - var updateValues = { - "detail_info": "xiaocai" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - var updataCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - console.info('logMessage contactCard_insertDataUpdateAll_test_6500: updataCode = ' + updataCode); - sleep(1000); - await queryUpdateAllData("contactCard_insertDataUpdateAll_test_6500", DAHelper, rawContactId); - await deleteRawContact("contactCard_insertDataUpdateAll_test_6500"); - await deleteAll(profileContactDataUri, "contactCard_insertDataUpdateAll_test_6500"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataUpdateAll_test_6500: raw_contact insert error = " + error); - done(); - } - }); - - async function queryUpdateAllData(tag, DAHelper, rawContactId) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("row_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var detail_info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - expect(detail_info == "xiaocai").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - /** - * @tc.number contactCard_insertFavorite_test_6600 - * @tc.name Add multiple contacts to favorites and verify that the favorites field is changed - * @tc.desc Function test - */ - it("contactCard_insertFavorite_test_6600", 0, async function (done) { - console.info("------logMessage contactCard_insertFavorite_test_6600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertFavorite_test_6600: rawContactId = " + rawContactId); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", "favorite": 1 - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - console.info("logMessage contactCard_insertFavorite_test_6600: rawContactId = " + rawContactIdOne); - - var insertRawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - console.info("logMessage contactCard_insertFavorite_test_6600: rawContactId = " + rawContactIdTwo); - - sleep(1000); - await queryThreeFavorite( - "contactCard_insertFavorite_test_6600", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 1); - await deleteRawContact("contactCard_insertFavorite_test_6600"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertFavorite_test_6600: raw_contact insert error = " + error); - done(); - } - }); - - async function queryThreeFavorite(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, favoritevalue) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryThreeFavorite start ! DAHelper = ' + DAHelper); - var resultColumns = ["favorite"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var favorite = resultSet.getInt(resultSet.getColumnIndex("favorite")); - expect(favorite == favoritevalue).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryThreeFavorite: error = " + error); - } - } - - /** - * @tc.number contactCard_unFavorite_test_6700 - * @tc.name Remove favorites from multiple contacts and verify that the favorites field has changed - * @tc.desc Function test - */ - it("contactCard_unFavorite_test_6700", 0, async function (done) { - console.info("------logMessage contactCard_unFavorite_test_6700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_unFavorite_test_6700: rawContactId = " + rawContactId); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", "favorite": 1 - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - console.info("logMessage contactCard_unFavorite_test_6700: rawContactId = " + rawContactIdOne); - - var insertRawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - console.info("logMessage contactCard_unFavorite_test_6700: rawContactId = " + rawContactIdTwo); - - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - var updataCode = await DAHelper.update(profileRawContactUri, updateValues, condition); - console.info("logMessage contactCard_unFavorite_test_6700: updataCode = " + updataCode); - sleep(1000); - await queryThreeFavorite( - "contactCard_unFavorite_test_6700", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 0); - await deleteRawContact("contactCard_unFavorite_test_6700"); - done(); - } catch (error) { - console.info("logMessage contactCard_unFavorite_test_6700: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertContactBlocklist_test_6800 - * @tc.name Add multiple records to the black list and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contactCard_insertContactBlocklist_test_6800", 0, async function (done) { - console.info("--------logMessage contactCard_insertContactBlocklist_test_6800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_insertContactBlocklist_test_6800: insert = " + batchInsertCode); - var batchInsertCodeOne = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_insertContactBlocklist_test_6800: insert = " + batchInsertCodeOne); - var batchInsertCodeTwo = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_insertContactBlocklist_test_6800: insert = " + batchInsertCodeTwo); - sleep(1000); - expect(batchInsertCode > 0).assertTrue(); - await query(3); - await deleteAll(profileBlocklistUri, "contactCard_insertContactBlocklist_test_6800"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertContactBlocklist_test_6800: batchInsert error = " + error); - done(); - } - - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "123456789"); - try { - var resultSet = await DAHelper.query(profileBlocklistUri, resultColumns, condition); - sleep(1000); - console.info('contactCard_insertContactBlocklist_test_6800 :resultSet.goToFirstRow() = ' + - resultSet.goToFirstRow()); - console.info( - 'contactCard_insertContactBlocklist_test_6800 : query result is = ' + resultSet.rowCount == size); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contactCard_insertContactBlocklist_test_6800 error = " + error); - } - } - }); - - /** - * @tc.number contactCard_removeContactBlocklist_test_6900 - * @tc.name Delete multiple records from the black list and verify whether the deletion is successful - * @tc.desc Function test - */ - it("contactCard_removeContactBlocklist_test_6900", 0, async function (done) { - console.info("--------logMessage contactCard_removeContactBlocklist_test_6900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info( - "logMessage contactCard_removeContactBlocklist_test_6900: batchInsertCode = " + batchInsertCode); - var batchInsertCodeOne = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_removeContactBlocklist_test_6900: insert = " + batchInsertCodeOne); - var batchInsertCodeTwo = await DAHelper.insert(profileBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contactCard_removeContactBlocklist_test_6900: insert = " + batchInsertCodeTwo); - sleep(1000); - expect(batchInsertCode > 0).assertTrue(); - await deleteAll(profileBlocklistUri, "contactCard_removeContactBlocklist_test_6900"); - await query(0); - done(); - } catch (error) { - console.info("logMessage contactCard_removeContactBlocklist_test_6900: batchInsert error = " + error); - done(); - } - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "123456789"); - try { - var resultSet = await DAHelper.query(profileBlocklistUri, resultColumns, condition); - console.info('contactCard_removeContactBlocklist_test_6900 : resultSet = ' + resultSet); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contactCard_removeContactBlocklist_test_6900 error = " + error); - } - } - }); - - /** - * @tc.number contactCard_insertGroup_test_7000 - * @tc.name Add multiple contacts to favorites and verify that the favorites field is changed - * @tc.desc Function test - */ - it("contactCard_insertGroup_test_7000", 0, async function (done) { - console.info("------logMessage contactCard_insertGroup_test_7000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertGroup_test_7000: rawContactId = " + rawContactId); - await insertData(rawContactId, "group_membership", 1, ""); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - console.info("logMessage contactCard_insertGroup_test_7000: rawContactId = " + rawContactIdOne); - await insertData(rawContactIdOne, "group_membership", 1, ""); - var insertRawContactValuesTwo = { - "display_name": "xiaoli", - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - console.info("logMessage contactCard_insertGroup_test_7000: rawContactId = " + rawContactIdTwo); - await insertData(rawContactIdTwo, "group_membership", 1, ""); - sleep(1000); - await queryThreeGroup( - "contactCard_insertGroup_test_7000", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 1); - await deleteRawContact("contactCard_insertGroup_test_7000"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertGroup_test_7000: raw_contact insert error = " + error); - done(); - } - }); - - async function queryThreeGroup(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, groupId) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryThreeGroup start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var group = resultSet.getInt(resultSet.getColumnIndex("detail_info")); - expect(group == groupId).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryThreeGroup: error = " + error); - } - } - - /** - * @tc.number contactCard_insert_test_7100 - * @tc.name Add a full field data to the groups table and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contactCard_insert_test_7100", 0, async function (done) { - console.info("---------logMessage contactCard_insert_test_7100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(profileGroupUri, common.getProfileGroup()); - console.info("logMessage contactCard_insert_test_7100: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await contactsQuery(map, "contactCard_insert_test_7100", profileGroupUri); - await deleteAll(profileGroupUri, "contactCard_insert_test_7100"); - done(); - } catch (error) { - console.info("logMessage contactCard_insert_test_7100: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_delete_test_7200 - * @tc.name Add a full field data to the groups table and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contactCard_delete_test_7200", 0, async function (done) { - console.info("------logMessage contactCard_delete_test_7200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_delete_test_7200: rawContactId = " + rawContactId); - await insertData(rawContactId, "group_membership", 1, ""); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", - }; - var rawContactIdOne = await DAHelper.insert(profileRawContactUri, insertRawContactValuesOne); - console.info("logMessage contactCard_delete_test_7200: rawContactId = " + rawContactIdOne); - await insertData(rawContactIdOne, "group_membership", 1, ""); - var insertRawContactValuesTwo = { - "display_name": "xiaoli", - }; - var rawContactIdTwo = await DAHelper.insert(profileRawContactUri, insertRawContactValuesTwo); - console.info("logMessage contactCard_delete_test_7200: rawContactId = " + rawContactIdTwo); - await insertData(rawContactIdTwo, "group_membership", 1, ""); - sleep(1000); - await deleteAll(profileContactDataUri, "contactCard_delete_test_7200"); - sleep(1000); - await queryZeroGroup( - "contactCard_delete_test_7200", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contactCard_delete_test_7200"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_7200: raw_contact insert error = " + error); - done(); - } - }); - - async function queryZeroGroup(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryZeroGroup start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - console.info(tag + ': queryZeroGroup! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryZeroGroup: error = " + error); - } - } - - /** - * @tc.number contactCard_delete_test_7300 - * @tc.name Delete the full field data of a groups table and verify whether the deletion is successful - * @tc.desc Function test - */ - it("contactCard_delete_test_7300", 0, async function (done) { - console.info("---------logMessage contactCard_delete_test_7300 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(profileGroupUri, common.getProfileGroup()); - console.info("logMessage contactCard_delete_test_7300: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await contactsQuery(map, "contactCard_delete_test_7300", profileGroupUri); - await deleteAll(profileGroupUri, "contactCard_delete_test_7300"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_7300: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_delete_test_7400 - * @tc.name Add a raw_contact all fields, delete raw_contact - * @tc.desc Function test - */ - it("contactCard_delete_test_7400", 0, async function (done) { - console.info("------logMessage contactCard_delete_test_7400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contactCard_delete_test_7400: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - map.set("version", "2"); - map.set("is_deleted", "1"); - await deleteAll(profileRawContactUri, "contact_Delete_test_7400"); - sleep(1000); - await contactsQuery(map, "contactCard_delete_test_7400", profileRawContactUri); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - var code = await DAHelper.delete(profileDeletedContactsUri, conditionAll); - console.info('contactCard_delete_test_7400 : Completely delete code = ' + code); - expect(code == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contactCard_delete_test_7400: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contactCard_delete_test_7500 - * @tc.name Delete contact_data Single full field data in data table - * @tc.desc Function test - */ - it("contactCard_delete_test_7500", 0, async function (done) { - console.info("------logMessage contactCard_delete_test_7500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_delete_test_7500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - var contactDataId = await DAHelper.insert(profileContactDataUri, contactDataValues); - console.info('logMessage contactCard_delete_test_7500: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await deleteAll(profileContactDataUri, "contactCard_delete_test_7500"); - var map = new Map(); - map.set("id", contactDataId.toString()); - await queryIdForDelete(map, "contactCard_delete_test_7500", profileContactDataUri); - await deleteRawContact("contactCard_delete_test_7500"); - done(); - } catch (error) { - console.info("logMessage contactCard_delete_test_7500: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertDataAll_test_7600 - * @tc.name Add all details of a single contact and verify whether the insertion is successful (name, mobile - * number, company, position, nickname, email, home, remarks, aim) - * @tc.desc Function test - */ - it("contactCard_insertDataAll_test_7600", 0, async function (done) { - console.info("------logMessage contactCard_insertDataAll_test_7600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataAll_test_7600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactdata1 = await insertData(rawContactId, "name", "xiaocai", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdata1, "xiaocai"); - var contactdata2 = await insertData(rawContactId, "phone", "6500", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdata2, "6500"); - var contactdatd3 = await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd3, "TTTTT"); - var contactdatd4 = await insertData(rawContactId, "nickname", "xxxxcai", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd4, "xxxxcai"); - var contactdatd5 = await insertData(rawContactId, "email", "111@fox.com", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd5, "111@fox.com"); - var contactdatd6 = await insertData(rawContactId, "postal_address", "dddd", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd6, "dddd"); - var contactdatd7 = await insertData(rawContactId, "note", "caicai", ""); - await queryAlldata("contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd7, "caicai"); - var contactdatd8 = await insertData(rawContactId, "im", "999999999", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd8, "999999999"); - sleep(1000); - await deleteRawContact("contactCard_insertDataAll_test_7600"); - await deleteAll(profileContactDataUri, "contactCard_insertDataAll_test_7600"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataAll_test_7600: raw_contact insert error = " + error); - done(); - } - }); - - async function queryAlldata(tag, DAHelper, rawContactId, contactdata, values) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactdata.toString()); - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("raw_contact_id")); - console.info(tag + " result raw_contact_id = " + id); - expect(id == rawContactId).assertEqual(true); - var info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - console.info(tag + "result info = " + info + " value = " + values); - expect(info == values).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - /** - * @tc.number contactCard_insertDataAll_test_7700 - * @tc.name Add all details of a single contact and verify whether the insertion is successful (name, mobile - * number, company, position, nickname, email, home, remarks, aim, birthday, website, assistant, group, phone ring) - * @tc.desc Function test - */ - it("contactCard_insertDataAll_test_7700", 0, async function (done) { - console.info("------logMessage contactCard_insertDataAll_test_7700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataAll_test_7700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactdata1 = await insertData(rawContactId, "name", "xiaocai", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdata1, "xiaocai"); - var contactdata2 = await insertData(rawContactId, "phone", "6500", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdata2, "6500"); - var contactdatd3 = await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd3, "TTTTT"); - var contactdatd4 = await insertData(rawContactId, "nickname", "xxxxcai", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd4, "xxxxcai"); - var contactdatd5 = await insertData(rawContactId, "email", "111@fox.com", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd5, "111@fox.com"); - var contactdatd6 = await insertData(rawContactId, "postal_address", "dddd", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd6, "dddd"); - var contactdatd7 = await insertData(rawContactId, "note", "caicai", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd7, "caicai"); - var contactdatd8 = await insertData(rawContactId, "im", "999999999", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd8, "999999999"); - var contactdatd9 = await insertData(rawContactId, "contact_event", "1125", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd9, "1125"); - var contactdatd10 = await insertData(rawContactId, "website", "wwww.xxx.com", ""); - await queryAlldata( - "contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd10, "wwww.xxx.com"); - var contactdatd11 = await insertData(rawContactId, "relation", "xiaobai", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd11, "xiaobai"); - var contactdatd12 = await insertData(rawContactId, "group_membership", 1, ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd12, 1); - var contactdatd13 = await insertData(rawContactId, "contact_misc", "5678", ""); - await queryAlldata("contactCard_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd13, "5678"); - sleep(1000); - await deleteRawContact("contactCard_insertDataAll_test_7700"); - await deleteAll(profileContactDataUri, "contactCard_insertDataAll_test_7700"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataAll_test_7700: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contactCard_insertDataUpdateMore_test_7800 - * @tc.name Modify multiple contact details and verify whether the modification is successful - * @tc.desc Function test - */ - it("contactCard_insertDataUpdateMore_test_7800", 0, async function (done) { - console.info("------logMessage contactCard_insertDataUpdateMore_test_7800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xiaocai" - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataUpdateMore_test_7800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var insertRawContactValues = { - "display_name": "xiaotian" - }; - var rawContactIdFirst = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_insertDataUpdateMore_test_7800: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaotian", ""); - - var updateValues = { - "detail_info": "xiaocai7800" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()) - var updataCode = await DAHelper.update(profileContactDataUri, updateValues, condition); - console.info('logMessage contactCard_insertDataUpdateMore_test_7800: updataCode = ' + updataCode); - sleep(1000); - await insertDataUpdateMoreQuery( - "contactCard_insertDataUpdateMore_test_7800", DAHelper, rawContactId, rawContactIdFirst); - await deleteRawContact("contactCard_insertDataUpdateMore_test_7800"); - await deleteAll(profileContactDataUri, "contactCard_insertDataUpdateMore_test_7800"); - done(); - } catch (error) { - console.info("logMessage contactCard_insertDataUpdateMore_test_7800: raw_contact insert error = " + error); - done(); - } - }); - - async function insertDataUpdateMoreQuery(tag, DAHelper, rawContactId, rawContactIdFirst) { - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()) - try { - var resultSet = await DAHelper.query(profileContactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - console.info(tag + "result info = " + info); - expect(info == "xiaocai7800").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage : error = " + error); - } - } - - /** - * @tc.number contactCard_deleterestore_test_7900 - * @tc.name Modify multiple contact details and verify whether the modification is successful - * @tc.desc Function test - */ - it("contactCard_deleterestore_test_7900", 0, async function (done) { - console.info("------logMessage contactCard_deleterestore_test_7900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli7900" - }; - var rawContactId = await DAHelper.insert(profileRawContactUri, insertRawContactValues); - console.info("logMessage contactCard_deleterestore_test_7900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(1000); - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(profileRawContactUri, condition1); - console.info("contactCard_deleterestore_test_7900 : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - sleep(1000); - - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("id", rawContactId.toString()); - var updatevalue = { - "is_deleted": 0 - }; - var updateCode = await DAHelper.update(profileRawContactUri, updatevalue, condition2); - console.info('contactCard_deleterestore_test_7900 : update = ' + updateCode); - sleep(1000); - - var condition3 = new ohosDataAbility.DataAbilityPredicates(); - condition3.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(profileDeletedRawContactRecord, condition3); - - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("is_deleted", "0"); - await contactsQuery(map, "contactCard_deleterestore_test_7900", profileRawContactUri); - done(); - } catch (error) { - console.info("logMessage contactCard_deleterestore_test_7900: raw_contact insert error = " + error); - done(); - } - }); - - afterAll(async function () { - var tag = "Contacts_test_start_deleted"; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var DAHelperContact = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': start ! DAHelperContact = ' + DAHelperContact); - var deleteBlockList = await DAHelperContact.delete(profileBlocklistUri, condition); - console.info(tag + " : logMessage : deleteBlockList = " + deleteBlockList); - var deletedGroup = await DAHelperContact.delete(profileGroupUri, condition); - console.info(tag + " : logMessage : deletedGroup = " + deletedGroup); - var dataDeletedCode = await DAHelperContact.delete(profileContactDataUri, condition); - sleep(2000); - console.info(tag + " : logMessage : dataDeletedCode = " + dataDeletedCode); - var rawContactDeleted = await DAHelperContact.delete(profileRawContactUri, condition); - sleep(2000); - console.info(tag + " : logMessage : rawContactDeleted = " + rawContactDeleted); - var deleted = await DAHelperContact.delete(profileDeletedContactsUri, condition); - sleep(2000); - console.info(tag + " : logMessage : deleted = " + deleted); - }); - }); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactClass_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactClass_test.js deleted file mode 100644 index 38c4158bd6ed99d46cf9db4856f228f5d4b18ec8..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContactClass_test.js +++ /dev/null @@ -1,310 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContacterJsunit.ets b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContacterJsunit.ets deleted file mode 100644 index a5e2873bfab59f8bf597a1190f6839e92841e89c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ContacterJsunit.ets +++ /dev/null @@ -1,262 +0,0 @@ -// @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 diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Contacts_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Contacts_test.js deleted file mode 100644 index 420b2f75603bbfc5f12df6f707aeab9c245fbdec..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Contacts_test.js +++ /dev/null @@ -1,6306 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const contactUri = "dataability:///com.ohos.contactsdataability/contacts/contact"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; -const groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; -const contactBlocklistUri = "dataability:///com.ohos.contactsdataability/contacts/contact_blocklist"; -const deletedRawContactUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; -const searchContactUri = "dataability:///com.ohos.contactsdataability/contacts/search_contact"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; -const deletedRawContactRecord = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact_record"; - -export default function ContactsTest() { - describe('ContactsTest', function () { - console.info("-------ContactsTest is starting!--------"); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - async function contactsQuery(map, tag, uri) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - sleep(2000); - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' :logMessage contactsQuery key = ' + key + ' dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - async function queryBatch(map, tag, size) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryBatch start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", map.get("raw_contact_id")); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - console.info(tag + ': queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage resultSet.rowCount: error = " + error); - } - } - - async function queryIdForDelete(map, tag, uri) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryIdForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - sleep(1000); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage queryIdForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - async function deleteAll(uri, tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(uri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info(tag + ': deleteAll error = ' + error); - } - } - - async function deleteRawContact(tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - console.info(tag + ': deleteRawContact deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - sleep(1000); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - var code = await DAHelper.delete(deletedUri, conditionAll); - console.info(tag + ': Completely delete code = ' + code); - expect(code == 0).assertTrue(); - } catch (error) { - console.info(tag + ': deleteRawContact error = ' + error); - } - } - - async function insertData(rawContactId, type, value, position) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var contactDataValues1 = - { - "raw_contact_id": rawContactId, "content_type": type, "detail_info": value, "position": position - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("logMessage : contactDataId1 " + contactDataId1); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage : contact_data name insert error = " + error); - } - return contactDataId; - } - - /** - * @tc.number contact_insert_test_100 - * @tc.name Insert contact data - * @tc.desc Function test - */ - it("contact_insert_test_100", 0, async function (done) { - console.info("------logMessage contact_insert_test_100 is starting!-----"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_insert_test_100: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_insert_test_100", rawContactUri); - await deleteRawContact("contact_insert_test_100"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_100: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_insert_test_400 - * @tc.name Insert contact details (name, company, position, mobile phone number) - * @tc.desc Function test - */ - it("contact_insert_test_400", 0, async function (done) { - console.info("------logMessage contact_insert_test_400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataNameInsert(DAHelper, rawContactId); - await dataCompanyInsert(DAHelper, rawContactId); - await dataPhoneInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_400"); - await deleteAll(contactDataUri, "contact_insert_test_400"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_400: raw_contact insert error = " + error); - done(); - } - }); - - async function dataNameInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaocheng" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("logMessage contact_insert_test_400: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "xiaocheng"); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contact_insert_test_400", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_400: contact_data name insert error = " + error); - done(); - } - } - - async function dataCompanyInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "developer" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info("logMessage contact_insert_test_400: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "TT"); - map.set("position", "developer"); - contactsQuery(map, "contact_insert_test_400", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_400: contact_data company insert error = " + error); - done(); - } - } - - async function dataPhoneInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "12345678" - }; - try { - var contactDataId3 = await DAHelper.insert(contactDataUri, contactDataValues3); - sleep(1000); - console.info("logMessage contact_insert_test_400: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "12345678"); - await contactsQuery(map, "contact_insert_test_400", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_400: contact_data phone insert error = " + error); - done(); - } - } - - /** - * @tc.number contact_insert_test_500 - * @tc.name Insert contact details (nickname, email, home) - * @tc.desc Function test - */ - it("contact_insert_test_500", 0, async function (done) { - console.info("------logMessage contact_insert_test_500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataEmailInsert(DAHelper, rawContactId); - await dataNickNameInsert(DAHelper, rawContactId); - await dataPostalAddressInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_500"); - await deleteAll(contactDataUri, "contact_insert_test_500"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_500: raw_contact insert error = " + error); - done(); - } - }); - - async function dataEmailInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "166@163.com" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contact_insert_test_500: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "166@163.com"); - await contactsQuery(map, "contact_insert_test_500_1", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_500: contact_data email insert error = " + error); - } - } - - async function dataNickNameInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaocheng" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info("logMessage contact_insert_test_500: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "xiaocheng"); - await contactsQuery(map, "contact_insert_test_500_2", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_500: contact_data nickname insert error = " + error); - } - } - - async function dataPostalAddressInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "NanJingSoftRoad" - }; - try { - var contactDataId3 = await DAHelper.insert(contactDataUri, contactDataValues3); - console.info("logMessage contact_insert_test_500: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "NanJingSoftRoad"); - await contactsQuery(map, "contact_insert_test_500_3", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_500: contact_data postal_address insert error = " + error); - } - } - - /** - * @tc.number contact_insert_test_600 - * @tc.name Insert contact details (remarks, AIM, birthday) - * @tc.desc Function test - */ - it("contact_insert_test_600", 0, async function (done) { - console.info("------logMessage contact_insert_test_600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues) - console.info("logMessage contact_insert_test_600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataNoteInsert(DAHelper, rawContactId); - await dataAimInsert(DAHelper, rawContactId); - await dataEventInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_600"); - await deleteAll(contactDataUri, "contact_insert_test_600"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_600: raw_contact insert error = " + error); - done(); - } - }); - - async function dataNoteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "note", - "detail_info": "javaGangster" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("logMessage contact_insert_test_600: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "javaGangster"); - await contactsQuery(map, "contact_insert_test_600_1", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_600: contact_data note insert error = " + error); - done(); - } - } - - async function dataAimInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, "content_type": "im", "detail_info": "aaaaa" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info("logMessage contact_insert_test_600: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "aaaaa"); - await contactsQuery(map, "contact_insert_test_600_2", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_600: contact_data aim insert error = " + error); - } - } - - async function dataEventInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "contact_event", - "detail_info": "19960229" - }; - try { - var contactDataId3 = await DAHelper.insert(contactDataUri, contactDataValues3); - console.info("logMessage contact_insert_test_600: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "19960229"); - await contactsQuery(map, "contact_insert_test_600_3", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_600: contact_data event insert error = " + error); - } - } - - /** - * @tc.number contact_insert_test_700 - * @tc.name Insert contact details (URL, assistant, group) - * @tc.desc Function test - */ - it("contact_insert_test_700", 0, async function (done) { - console.info("------logMessage contact_insert_test_700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataWebsiteInsert(DAHelper, rawContactId); - await dataRelationInsert(DAHelper, rawContactId); - await dataWebsiteInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_700"); - await deleteAll(contactDataUri, "contact_insert_test_700"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_700: raw_contact insert error = " + error); - done(); - } - }); - - async function dataWebsiteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "website", - "detail_info": "www.com" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contact_insert_test_700: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "www.com"); - await contactsQuery(map, "contact_insert_test_700_1", contactDataUri); - await contactDataRelationInsert(); - } catch (error) { - console.info("logMessage contact_insert_test_700: contact_data website insert error = " + error); - } - } - - async function dataRelationInsert(DAHelper, rawContactId) { - var contactDataValues2 = { - "raw_contact_id": rawContactId, - "content_type": "relation", - "detail_info": "Secretary" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues2); - sleep(1000); - console.info("logMessage contact_insert_test_700: contactDataId2 " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId2.toString()); - map.set("detail_info", "Secretary"); - await contactsQuery(map, "contact_insert_test_700_2", contactDataUri); - await contactDataGroupInsert(); - } catch (error) { - console.info("logMessage contact_insert_test_700: contact_data relation insert error = " + error); - } - } - - async function dataGroupInsert(DAHelper, rawContactId) { - var contactDataValues3 = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": "1" - }; - try { - var contactDataId3 = await DAHelper.insert(contactDataUri, contactDataValues3); - sleep(1000); - console.info("logMessage contact_insert_test_700: contactDataId3 " + contactDataId3); - expect(contactDataId3 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId3.toString()); - map.set("detail_info", "1"); - await contactsQuery(map, "contact_insert_test_700_3", contactDataUri); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_700: contact_data group insert error = " + error); - } - } - - /** - * @tc.number contact_insert_test_800 - * @tc.name Insert contact details (phone ringtone) - * @tc.desc Function test - */ - it("contact_insert_test_800", 0, async function (done) { - console.info("------logMessage contact_insert_test_800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocheng", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await dataMiscInsert(DAHelper, rawContactId); - await deleteRawContact("contact_insert_test_800"); - await deleteAll(contactDataUri, "contact_insert_test_800"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_800: raw_contact insert error = " + error); - done(); - } - }); - - async function dataMiscInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_misc", - "detail_info": "1234" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info("logMessage contact_insert_test_800: contactDataId1 " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "1234"); - await contactsQuery(map, "contact_insert_test_800_1", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_800: contact_data misc insert error = " + error); - } - } - - /** - * @tc.number contact_update_test_900 - * @tc.name Update contact data - * @tc.desc Function test - */ - it("contact_update_test_900", 0, async function (done) { - console.info("------logMessage contact_update_test_900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "licheng", - "company": "TT", - "position": "developer", - "favorite": 1, - "phonetic_name": "licheng||lc" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_900"); - await deleteAll(contactDataUri, "contact_update_test_900"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_900: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactUpdate(DAHelper, rawContactId) { - var updateValues = { - "display_name": "dacheng", - "company": "oo", - "position": "Testers", - "favorite": 0, - "phonetic_name": "dacheng||dc" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_900: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "dacheng"); - map.set("company", "oo"); - map.set("position", "Testers"); - map.set("favorite", "0"); - map.set("phonetic_name", "dacheng||dc"); - await contactsQuery(map, "contact_update_test_900", rawContactUri); - } catch (error) { - console.info('logMessage contact_update_test_900: raw_contact update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1200 - * @tc.name Update contact details (name) - * @tc.desc Function test - */ - it("contact_update_test_1200", 0, async function (done) { - console.info("------logMessage contact_update_test_1200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNameInsert(DAHelper, rawContactId); - await dataNameUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1200"); - await deleteAll(contactDataUri, "contact_update_test_1200"); - done(); - } catch (error) { - console.info('logMessage contact_update_test_1200: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataNameInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "xiaoyuan" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1200: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1200: contact_data insert error = ' + error); - } - } - - async function dataNameUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "dayuan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1200: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "dayuan"); - await contactsQuery(map, "contact_update_test_1200", rawContactUri); - } catch (error) { - console.info('logMessage contact_update_test_1200: contact_data update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1300 - * @tc.name Update contact details (company, position) - * @tc.desc Function test - */ - it("contact_update_test_1300", 0, async function (done) { - console.info("------logMessage contact_update_test_1300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataCompanyInsert(DAHelper, rawContactId); - await dataCompanyUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1300"); - await deleteAll(contactDataUri, "contact_update_test_1300"); - done(); - } catch (error) { - console.info('logMessage contact_update_test_1300: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataCompanyInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "Testers", - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1300: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1300: contact_data insert error = ' + error); - } - } - - async function dataCompanyUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "OOOO", "position": "developer" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1300: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("company", "OOOO"); - map.set("position", "developer"); - await contactsQuery(map, "contact_update_test_1300", rawContactUri); - } catch (error) { - console.info('logMessage contact_update_test_1300: contact_data update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1400 - * @tc.name Update contact details (mobile phone number) - * @tc.desc Function test - */ - it("contact_update_test_1400", 0, async function (done) { - console.info("------logMessage contact_update_test_1400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataPhoneInsert(DAHelper, rawContactId); - await dataPhoneUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1400"); - await deleteAll(contactDataUri, "contact_update_test_1400"); - done(); - } catch (error) { - console.info('logMessage contact_update_test_1400: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforeDataPhoneInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "phone", "detail_info": "123456" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1400: contact_data insert error = ' + error); - } - } - - async function dataPhoneUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "99663355" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1400: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "99663355"); - await contactsQuery(map, "contact_update_test_1400", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1400: contact_data update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1500 - * @tc.name Update contact details (nickname) - * @tc.desc Function test - */ - it("contact_update_test_1500", 0, async function (done) { - console.info("------logMessage contact_update_test_1500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNickNameInsert(DAHelper, rawContactId); - await dataNickNameUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1500"); - await deleteAll(contactDataUri, "contact_update_test_1500"); - done(); - } catch (error) { - console.info('logMessage contact_update_test_1500: raw_contact insert error = ' + error); - done(); - } - }); - - async function beforedataNickNameInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaoyuan" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1500: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1500: contact_data insert error = ' + error); - } - } - - async function dataNickNameUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "fengyuan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1500: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "fengyuan"); - await contactsQuery(map, "contact_update_test_1500", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1500: contact_data update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1600 - * @tc.name Update contact details (email) - * @tc.desc Function test - */ - it("contact_update_test_1600", 0, async function (done) { - console.info("------logMessage contact_update_test_1600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataEmailInsert(DAHelper, rawContactId); - await dataEmailUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1600"); - await deleteAll(contactDataUri, "contact_update_test_1600"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_1600: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataEmailInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "166@163.com" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1600: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1600: contact_data insert error = ' + error); - } - } - - async function dataEmailUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "199@163.com" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition) - sleep(1000); - console.info('logMessage contact_update_test_1600: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "199@163.com"); - await contactsQuery(map, "contact_update_test_1600", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1600: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1700 - * @tc.name Update Contact Details (Residential) - * @tc.desc Function test - */ - it("contact_update_test_1700", 0, async function (done) { - console.info("------logMessage contact_update_test_1700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataPostalInsert(DAHelper, rawContactId); - await dataPostalUpdate(); - await deleteRawContact("contact_update_test_1700"); - await deleteAll(contactDataUri, "contact_update_test_1700"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_1700: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataPostalInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "NanJing" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1700: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_update_test_1700: contact_data insert error = " + error); - } - } - - async function dataPostalUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "BeiJing" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1700: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "BeiJing"); - await contactsQuery(map, "contact_update_test_1700", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1700: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1800 - * @tc.name Update contact details (remarks) - * @tc.desc Function test - */ - it("contact_update_test_1800", 0, async function (done) { - console.info("------logMessage contact_update_test_1800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_1800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforedataNoteInsert(DAHelper, rawContactId); - await dataNoteUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1800"); - await deleteAll(contactDataUri, "contact_update_test_1800"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_1800: raw_contact insert error = " + error); - done(); - } - }); - - async function beforedataNoteInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "note", "detail_info": "Gangster" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1800: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_1800: contact_data insert error = ' + error); - } - } - - async function dataNoteUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "God" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1800: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "God"); - await contactsQuery(map, "contact_update_test_1800", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1800: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_1900 - * @tc.name Update Contact Details (AIM) - * @tc.desc Function test - */ - it("contact_update_test_1900", 0, async function (done) { - console.info("------logMessage contact_update_test_1900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues) - console.info("logMessage contact_update_test_1900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataAimInsert(DAHelper, rawContactId); - await dataAimUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_1900"); - await deleteAll(contactDataUri, "contact_update_test_1900"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_1900: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataAimInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "im", "detail_info": "aaaaa" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_1900: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_update_test_1900: contact_data insert error = " + error); - } - } - - async function dataAimUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "bbbbb" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_1900: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "bbbbb"); - await contactsQuery(map, "contact_update_test_1900", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_1900: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2000 - * @tc.name Update Contact Details (Birthday) - * @tc.desc Function test - */ - it("contact_update_test_2000", 0, async function (done) { - console.info("------logMessage contact_update_test_2000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_2000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataEventInsert(DAHelper, rawContactId); - await dataEventUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2000"); - await deleteAll(contactDataUri, "contact_update_test_2000"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2000: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataEventInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_event", - "detail_info": "19960229" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contact_update_test_2000: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2000: contact_data insert error = ' + error); - } - } - - async function dataEventUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "19971021" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2000: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "19971021"); - await contactsQuery(map, "contact_update_test_2000", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2000: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2100 - * @tc.name Update contact details (website) - * @tc.desc Function test - */ - it("contact_update_test_2100", 0, async function (done) { - console.info("------logMessage contact_update_test_2100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_2100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataWebsiteInsert(DAHelper, rawContactId); - await dataWebsiteUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2100"); - await deleteAll(contactDataUri, "contact_update_test_2100"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2100: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataWebsiteInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "website", - "detail_info": "www.com" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contact_update_test_2100: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2100: contact_data insert error = ' + error); - } - } - - async function dataWebsiteUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "www.123.com" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2100: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "www.123.com"); - await contactsQuery(map, "contact_update_test_2100", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2100: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2200 - * @tc.name Update contact details (assistant) - * @tc.desc Function test - */ - it("contact_update_test_2200", 0, async function (done) { - console.info("------logMessage contact_update_test_2200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_2200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataRelationInsert(DAHelper, rawContactId); - await dataRelationUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2200"); - await deleteAll(contactDataUri, "contact_update_test_2200"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2200: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataRelationInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "relation", - "detail_info": "Secretary" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_update_test_2200: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2200: contact_data insert error = ' + error); - } - } - - async function dataRelationUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "spouse" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2200: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "spouse"); - await contactsQuery(map, "contact_update_test_2200", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2200: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2300 - * @tc.name Update contact detail data table (group) - * @tc.desc Function test - */ - it("contact_update_test_2300", 0, async function (done) { - console.info("------logMessage contact_update_test_2300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_update_test_2300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataGroupInsert(DAHelper, rawContactId); - await dataGroupUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2300"); - await deleteAll(contactDataUri, "contact_update_test_2300"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2300: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataGroupInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": "2" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_update_test_2300: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2300: contact_data insert error = ' + error); - } - } - - async function dataGroupUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "7" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2300: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "3"); - await contactsQuery(map, "contact_update_test_2300", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2300: update error = ' + error); - } - } - - /** - * @tc.number contact_update_test_2400 - * @tc.name Update contact detail data table (phone ringtone) - * @tc.desc Function test - */ - it("contact_update_test_2400", 0, async function (done) { - console.info("------logMessage contact_update_test_2400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoyuan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contact_update_test_2400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await beforeDataMiscInsert(DAHelper, rawContactId); - await dataMiscUpdate(DAHelper, rawContactId); - await deleteRawContact("contact_update_test_2400"); - await deleteAll(contactDataUri, "contact_update_test_2400"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_2400: raw_contact insert error = " + error); - done(); - } - }); - - async function beforeDataMiscInsert(DAHelper, rawContactId) { - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "contact_misc", - "detail_info": "1234" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - sleep(1000); - console.info('logMessage contact_update_test_2400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_update_test_2400: contact_data insert error = ' + error); - } - } - - async function dataMiscUpdate(DAHelper, rawContactId) { - var updateValues = { - "detail_info": "999" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(1000); - console.info('logMessage contact_update_test_2400: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "999"); - await contactsQuery(map, "contact_update_test_2300", contactDataUri); - } catch (error) { - console.info('logMessage contact_update_test_2400: update error = ' + error); - } - } - - /** - * @tc.number contact_favorite_test_2500 - * @tc.name Favorite contacts - * @tc.desc Function test - */ - it("contact_favorite_test_2500", 0, async function (done) { - console.info("-------logMessage contact_favorite_test_2500 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaocai", "company": "TT", "position": "Testers" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues) - console.info('logMessage contact_favorite_test_2500: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await updateFavorite(DAHelper, rawContactId); - await deleteRawContact("contact_favorite_test_2500"); - done(); - } catch (error) { - console.info('logMessage contact_favorite_test_2500: raw_contact insert error = ' + error); - done(); - } - }); - - async function updateFavorite(DAHelper, rawContactId) { - var updateValues = { - "favorite": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_favorite_test_2500: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaocai"); - map.set("company", "TT"); - map.set("position", "Testers"); - map.set("favorite", "1"); - await contactsQuery(map, "contact_favorite_test_2500", rawContactUri); - } catch (error) { - console.info('logMessage contact_favorite_test_2500: update error = ' + error); - } - } - - /** - * @tc.number contact_unfavorite_test_2600 - * @tc.name Unfavorite contacts - * @tc.desc Function test - */ - it("contact_unfavorite_test_2600", 0, async function (done) { - console.info("-------logMessage contact_unfavorite_test_2600 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaohong", "company": "TT", "position": "Testers", "favorite": 1 - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info('logMessage contact_unfavorite_test_2600: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await updateUnFavorite(DAHelper, rawContactId); - await deleteRawContact("contact_unfavorite_test_2600"); - done(); - } catch (error) { - console.info('logMessage contact_unfavorite_test_2600: raw_contact insert error = ' + error); - done(); - } - }); - - async function updateUnFavorite(DAHelper, rawContactId) { - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_unfavorite_test_2600: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaohong"); - map.set("company", "TT"); - map.set("position", "Testers"); - map.set("favorite", "0"); - await contactsQuery(map, "contact_favorite_test_2500", rawContactUri); - } catch (error) { - console.info("logMessage contact_unfavorite_test_2600: update error = " + error); - } - } - - /** - * @tc.number contact_insert_test_2700 - * @tc.name Insert contact black list - * @tc.desc Function test - */ - it("contact_insert_test_2700", 0, async function (done) { - console.info("-------logMessage contact_insert_test_2700 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var blocklistId = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - sleep(1000); - console.info('logMessage contact_insert_test_2700: blocklistId = ' + blocklistId); - expect(blocklistId > 0).assertTrue(); - var map = common.getProfileBlockListMap(); - map.set("id", blocklistId.toString()); - await contactsQuery(map, "contact_insert_test_2700", contactBlocklistUri); - await deleteAll(contactBlocklistUri, "contact_insert_test_2700"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_2700: blocklist insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_delete_test_2800 - * @tc.name Delete contact black list - * @tc.desc Function test - */ - it("contact_delete_test_2800", 0, async function (done) { - console.info("-------logMessage contact_delete_test_2800 is starting!------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var blocklistId = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - sleep(1000); - console.info('logMessage contact_delete_test_2800: blocklistId = ' + blocklistId); - expect(blocklistId > 0).assertTrue(); - await blocklistDelete(); - done(); - } catch (error) { - console.info('logMessage contact_delete_test_2800: blocklist insert error = ' + error); - done(); - } - - async function blocklistDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", blocklistId.toString()); - try { - var deleteCode = await DAHelper.delete(contactBlocklistUri, condition); - sleep(1000); - console.info("logMessage contact_delete_test_2800: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", blocklistId.toString()); - await queryIdForDelete(map, "contact_delete_test_2800", contactBlocklistUri); - } catch (error) { - console.info('logMessage contact_delete_test_2800: delete error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contact_insert_test_2900 - * @tc.name Insert contact group - * @tc.desc Function test - */ - it("contact_insert_test_2900", 0, async function (done) { - console.info("-------logMessage contact_insert_test_2900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var groupValues = { - "group_name": "TestersThird" - }; - try { - var groupId = await DAHelper.insert(groupUri, groupValues); - sleep(1000); - console.info("logMessage contact_insert_test_2900: groupId =" + groupId); - expect(groupId > 0).assertTrue(); - await groupRawContactInsert(DAHelper); - await deleteRawContact("contact_insert_test_2900"); - await deleteAll(groupUri, "contact_insert_test_2900"); - await deleteAll(contactDataUri, "contact_insert_test_2900"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_2900: group insert error =" + error); - done(); - } - }); - - async function groupRawContactInsert(DAHelper) { - var rawContactValues = { - "display_name": "liyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_insert_test_2900: rawContactId =" + rawContactId); - expect(rawContactId > 0).assertTrue(); - await groupDataInsert(DAHelper, rawContactId); - } catch (error) { - console.info("logMessage contact_insert_test_2900: raw_contact insert error =" + error); - } - } - - async function groupDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues) - sleep(1000); - console.info("logMessage contact_insert_test_2900: contactDataId =" + contactDataId); - expect(contactDataId > 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId); - map.set("raw_contact_id", rawContactId.toString()); - map.set("detail_info", groupId.toString()); - await contactsQuery(map, "contact_insert_test_2900", contactDataUri); - } catch (error) { - console.info("logMessage contact_insert_test_2900: contact_data insert error =" + error); - } - } - - /** - * @tc.number contact_delete_test_3000 - * @tc.name Delete contact group - * @tc.desc Function test - */ - it("contact_delete_test_3000", 0, async function (done) { - console.info("-------logMessage contact_delete_test_3000 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var groupValues = { - "group_name": "TestersFourth" - }; - try { - var groupId = await DAHelper.insert(groupUri, groupValues); - sleep(1000); - console.info("logMessage contact_delete_test_3000: groupId =" + groupId); - expect(groupId > 0).assertTrue(); - await groupAfterRawContactInsert(DAHelper); - await deleteRawContact("contact_delete_test_3000"); - await deleteAll(groupUri, "contact_delete_test_3000"); - await deleteAll(contactDataUri, "contact_delete_test_3000"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_3000: group insert error =" + error); - done(); - } - }); - - async function groupAfterRawContactInsert(DAHelper) { - var rawContactValues = { - "display_name": "liyuchen" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_delete_test_3000: rawContactId =" + rawContactId); - expect(rawContactId > 0).assertTrue(); - await deleteGroupContactDataInsert(DAHelper, rawContactId); - } catch (error) { - console.info("logMessage contact_delete_test_3000: raw_contact insert error =" + error); - } - } - - async function deleteGroupContactDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info("logMessage contact_delete_test_3000: contactDataId =" + contactDataId); - expect(contactDataId > 0).assertTrue(); - await deleteGroup(DAHelper, contactDataId); - } catch (error) { - console.info("logMessage contact_delete_test_3000: contact_data insert error =" + error); - } - } - - async function deleteGroup(DAHelper, contactDataId) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - try { - var deleteCode = await DAHelper.delete(contactDataUri, condition); - sleep(1000); - console.info("logMessage contact_delete_test_3000: deleteCode =" + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - await queryIdForDelete(map, "contact_delete_test_3000", contactDataUri); - } catch (error) { - console.info("logMessage contact_delete_test_3000: delete error =" + error); - } - } - - /** - * @tc.number contact_query_test_3100 - * @tc.name Query basic information of a single contact - * @tc.desc Function test - */ - it("contact_query_test_3100", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactQuery(DAHelper, rawContactId); - await deleteRawContact("contact_query_test_3100"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3100: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(2000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId).assertEqual(true); - console.info('logMessage contact_query_test_3100: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyu").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_3100: query error = " + error); - } - } - - /** - * @tc.number contact_query_test_3200 - * @tc.name Query basic information of multiple contacts - * @tc.desc Function test - */ - it("contact_query_test_3200", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues1 = { - "display_name": "xiaoyu" - }; - try { - var rawContactIdOne = await DAHelper.insert(rawContactUri, rawContactValues1); - sleep(1000); - console.info("logMessage contact_query_test_3200: rawContactId = " + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3200: raw_contact_1 insert error = " + error); - done(); - } - - var rawContactValues2 = { - "display_name": "xiaohong" - }; - try { - var rawContactIdTwo = await DAHelper.insert(rawContactUri, rawContactValues2); - sleep(1000); - console.info("logMessage contact_query_test_3200: rawContactId = " + rawContactIdTwo); - expect(rawContactIdTwo > 0).assertTrue(); - await queryTwoRaw(DAHelper, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contact_query_test_3200"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3200: raw_contact_2 insert error = " + error); - done(); - } - }); - - async function queryTwoRaw(DAHelper, rawContactIdOne, rawContactIdTwo) { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - console.info('logMessage contact_query_test_3200: goToFirstRow' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow()).assertEqual(true); - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage contact_query_test_3200: columnNames :" + resultSet.columnNames); - console.info("logMessage contact_query_test_3200: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_query_test_3200: id = ' + resultSet.getString(0)); - console.info('logMessage contact_query_test_3200: displayName = ' + resultSet.getString(1)); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_query_test_3200: query error' + error); - } - } - - /** - * @tc.number contact_query_test_3300 - * @tc.name Query basic information of all contacts - * @tc.desc Function test - */ - it("contact_query_test_3300", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3300 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues1 = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues1); - sleep(1000); - console.info("logMessage contact_query_test_3300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3300: raw_contact_1 insert error = " + error); - done(); - } - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(profileRawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_query_test_3300: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyu").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - await deleteRawContact("contact_query_test_3300"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3300: query error = " + error); - done(); - } - }); - - /** - * @tc.number contact_query_test_3400 - * @tc.name Query all information of a single contact - * @tc.desc Function test - */ - it("contact_query_test_3400", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3400 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyuzhou", - "company": "TT", - "position": "Testers", - "favorite": 1, - "phonetic_name": "xiaoyu||xy" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryAllInformation(DAHelper, rawContactId); - await deleteRawContact("contact_query_test_3400"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3400: raw_contact insert error = " + error); - done(); - } - }); - - async function queryAllInformation(DAHelper, rawContactId) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("id")); - console.info('logMessage contact_query_test_3400: id = ' + id); - expect(id == rawContactId).assertEqual(true); - var favorite = resultSet.getString(resultSet.getColumnIndex("favorite")); - console.info('logMessage contact_query_test_3400: favorite = ' + favorite); - expect(favorite == "1").assertEqual(true); - var phoneticName = resultSet.getString(resultSet.getColumnIndex("phonetic_name")); - console.info('logMessage contact_query_test_3400: phoneticName = ' + phonetic_name); - expect(phoneticName == "xiaoyu||xy").assertEqual(true); - var company = resultSet.getString(resultSet.getColumnIndex("company")); - console.info('logMessage contact_query_test_3400: company = ' + company); - expect(company == "TT").assertEqual(true); - var displayName = resultSet.getString(resultSet.getColumnIndex("display_name")); - console.info('logMessage contact_query_test_3400: displayName = ' + displayName); - expect(displayName == "xiaoyuzhou").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_query_test_3400: query error = ' + error); - } - } - - /** - * @tc.number contact_query_test_3500 - * @tc.name Query group member ability - * @tc.desc Function test - */ - it("contact_query_test_3500", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3500 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3500: raw_contact insert error = " + error); - done(); - } - var groupValues = { - "group_name": "BossBoard3500" - }; - try { - var groupId = await DAHelper.insert(groupUri, groupValues); - sleep(1000); - console.info("logMessage contact_query_test_3500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3500: group insert error = " + error); - done(); - } - await groupBossBoardInsert(DAHelper, rawContactId, groupId); - await deleteRawContact("contact_query_test_3500"); - await deleteAll(groupUri, "contact_query_test_3500"); - await deleteAll(contactDataUri, "contact_query_test_3500"); - done(); - }); - - async function groupBossBoardInsert(DAHelper, rawContactId, groupId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_test_3500: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - await groupBossBoardQuery(DAHelper, rawContactId, groupId); - } catch (error) { - console.info("logMessage contact_query_test_3500: query error = " + error); - } - } - - async function groupBossBoardQuery(DAHelper, rawContactId, groupId) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 9 data is group - condition.equalTo("type_id", "9"); - condition.and(); - condition.equalTo("detail_info", groupId.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3500: raw_contact_id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId).assertEqual(true); - console.info('logMessage contact_query_test_3500: detail_info = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == groupId.toString()).assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_3500: query error :" + error); - } - } - - /** - * @tc.number contact_query_test_3600 - * @tc.name Query favorite contacts - * @tc.desc Function test - */ - it("contact_query_test_3600", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3600 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou", "favorite": 1 - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryFavorite(); - await deleteRawContact("contact_query_test_3600"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3600: raw_contact insert error = " + error); - done(); - } - - async function queryFavorite() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("favorite", "1"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3600: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_3600: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyuzhou").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_3600: query error :" + error); - done(); - } - } - }); - - /** - * @tc.number contact_query_test_3700 - * @tc.name Query recent contact ability - * @tc.desc Function test - */ - it("contact_query_test_3700", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3700 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaoyuzhou", "lastest_contacted_time": 60 - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryContacted(); - await deleteRawContact("contact_query_test_3700"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3700: raw_contact insert error = " + error); - done(); - } - - async function queryContacted() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.lessThan("lastest_contacted_time", "100"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3700: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_3700: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoyuzhou").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_query_test_3700: query error' + error); - done(); - } - } - }); - - /** - * @tc.number contact_query_test_3800 - * @tc.name Query recently deleted contacts - * @tc.desc Function test - */ - it("contact_query_test_3800", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3800 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaocai" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactDelete(DAHelper, rawContactId); - await deletedRawContactQuery(DAHelper, rawContactId); - await deleteAll(deletedUri, "contact_query_test_3800") - done(); - } catch (error) { - console.info("logMessage contact_query_test_3800: raw_contact insert error = " + error); - done(); - } - }); - - async function rawContactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition1); - sleep(1000); - console.info('logMessage contact_query_test_3800: deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3800: raw_contact delete error = " + error); - done(); - } - } - - async function deletedRawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "display_name", "is_deleted"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info('logMessage contact_query_test_3800: id = ' + resultSet.getString(0)); - console.info('logMessage contact_query_test_3800: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_3800: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaocai").assertTrue(); - console.info('logMessage contact_query_test_3800: is_deleted = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == "1").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_3800: query error :" + error); - done(); - } - } - - /** - * @tc.number contact_query_test_3900 - * @tc.name Query all mobile phone numbers - * @tc.desc Function test - */ - it("contact_query_test_3900", 0, async function (done) { - console.info("-----------logMessage contact_query_test_3900 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaocai" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_3900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryPhoneInsert(); - await phoneQuery(rawContactId); - await deleteRawContact("contact_query_test_3900"); - await deleteAll(contactDataUri, "contact_query_test_3900"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_3900: raw_contact insert error = " + error); - done(); - } - }); - - async function queryPhoneInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "1853696321" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_test_3900: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_3900: contact_data insert error = " + error); - } - } - - async function phoneQuery(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 5 data is phone - condition.equalTo("content_type", "phone"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_3900: raw_contact_id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_3900: detail_info = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "1853696321").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_query_test_3900: query error' + error); - } - } - - /** - * @tc.number contact_query_test_4000 - * @tc.name Query all mailbox capabilities - * @tc.desc Function test - */ - it("contact_query_test_4000", 0, async function (done) { - console.info("-----------logMessage contact_query_test_4000 is starting!------------"); - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_4000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryEmailInsert(DAHelper, rawContactId); - await emailQuery(DAHelper, contactDataId, rawContactId); - await deleteRawContact("contact_query_test_4000"); - await deleteAll(contactDataUri, "contact_query_test_4000"); - done(); - } catch (error) { - console.info("logMessage contact_query_test_4000: raw_contact insert error = " + error); - done(); - } - }); - - async function queryEmailInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "16658@163.com" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_test_4000: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_4000: contact_data insert error = " + error); - } - } - - async function emailQuery(DAHelper, contactDataId, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data content_type is email - condition.equalTo("type_id", "1").limitAs(3).orderByDesc("id"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_query_test_4000: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contact_query_test_4000: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_query_test_4000: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "16658@163.com").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_4000: query error :" + error); - } - } - - /** - * @tc.number contact_query_test_4100 - * @tc.name Query data information of a single contact - * @tc.desc Function test - */ - it("contact_query_test_4100", 0, async function (done) { - console.info("-----------logMessage contact_query_test_4100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoyu" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_query_test_4100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryTwoDataInsert(DAHelper, rawContactId); - await queryTwoDataInsertCompany(DAHelper, rawContactId); - await queryTwo(DAHelper, rawContactId); - await deleteRawContact("contact_query_test_4100"); - await deleteAll(contactDataUri, "contact_query_test_4100"); - del - done(); - } catch (error) { - console.info("logMessage contact_query_test_4100: raw_contact insert error = " + error); - done(); - } - }); - - async function queryTwoDataInsert(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "xiaoyu" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_test_4100: contactDataId = " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_4100: contact_data name insert error = " + error); - } - } - - async function queryTwoDataInsertCompany(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "OOOO", - "position": "Testers" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues); - console.info("logMessage contact_query_test_4100: contactDataId = " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_query_test_4100: contact_data company insert error = " + error); - } - } - - async function queryTwo(DAHelper, rawContactId) { - var resultColumns = ["id", "raw_contact_id", "detail_info", "position"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - var array = [{ - detail_info: "xiaoyu", position: "" - }, { - detail_info: "OOOO", position: "Testers" - }]; - var i = 0; - if (resultSet.goToFirstRow()) { - do { - console.info("logMessage contact_query_test_4100: columnNames :" + resultSet.columnNames); - console.info("logMessage contact_query_test_4100: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_query_test_4100: id = ' + resultSet.getString(0)); - console.info('logMessage contact_query_test_4100: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_query_test_4100: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == array[i].detail_info).assertEqual(true); - console.info('logMessage contact_query_test_4100: position = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == array[i].position).assertEqual(true); - i++; - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_query_test_4100: query error :" + error); - } - } - - /** - * @tc.number contact_delete_test_4400 - * @tc.name Delete the basic raw data of the contact and record the deleted basic raw data - * @tc.desc Function test - */ - it("contact_delete_test_4400", 0, async function (done) { - console.info("-------logMessage contact_delete_test_4400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contact_delete_test_4400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await deleteRaw(DAHelper, rawContactId); - await queryDelete(DAHelper, rawContactId); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_4400: raw_contact insert error :" + error); - done(); - } - }); - - async function deleteRaw(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition1); - sleep(1000); - console.info("logMessage contact_delete_test_4400: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_delete_test_4400: delete error = " + error); - } - } - - async function queryDelete(DAHelper, rawContactId) { - var resultColumns = ["id", "delete_time", "display_name"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info("logMessage contact_delete_test_4400: columnNames:" + resultSet.columnNames); - console.info("logMessage contact_delete_test_4400: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_delete_test_4400: id = ' + resultSet.getString(0)); - console.info('logMessage contact_delete_test_4400: delete_time = ' + resultSet.getString(1)); - console.info('logMessage contact_delete_test_4400: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaoming").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_delete_test_4400: query error:" + error); - } - } - - /** - * @tc.number contact_delete_test_4700 - * @tc.name Delete detailed contact data and record detailed data - * @tc.desc Function test - */ - it("contact_delete_test_4700", 0, async function (done) { - console.info("-------logMessage contact_delete_test_4700 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaozhang", "company": "OOOO", "position": "TestManager" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contact_delete_test_4700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await queryDeleteCompanyData(DAHelper, rawContactId); - await rawContactDelete(DAHelper, rawContactId); - await companyRawContactDeleteQuery(DAHelper, rawContactId); - await deleteAll(contactDataUri, "contact_delete_test_4700"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_4700: raw_contact insert error:" + error); - done(); - } - }); - - async function queryDeleteCompanyData(DAHelper, rawContactId) { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "OOOO", - "position": "TestManager" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_delete_test_4700: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_delete_test_4700: contact_data insert error:" + error); - } - } - - async function rawContactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition1); - sleep(1000); - console.info("logMessage contact_delete_test_4700: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_delete_test_4700: delete error = " + error); - done(); - } - } - - async function companyRawContactDeleteQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name", "backup_data"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition2); - sleep(1000); - if (resultSet.goToFirstRow()) { - console.info("logMessage contact_delete_test_4700: columnNames:" + resultSet.columnNames); - console.info("logMessage contact_delete_test_4700: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_delete_test_4700: id = ' + resultSet.getString(0)); - console.info('logMessage contact_delete_test_4700: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaozhang").assertEqual(true); - console.info('logMessage contact_delete_test_4700: backup_data = ' + resultSet.getString(2)); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_delete_test_4700: query error:" + error); - } - } - - /** - * @tc.number contact_delete_test_4800 - * @tc.name Delete and record basic data of a single contact - * @tc.desc Function test - */ - it("contact_delete_test_4800", 0, async function (done) { - console.info("-------logMessage contact_delete_test_4800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaopeng" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - sleep(1000); - console.info("logMessage contact_delete_test_4800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDelete(DAHelper, rawContactId); - await deletedRawContactQuery(DAHelper, rawContactId) - await deleteAll(contactDataUri, "contact_delete_test_4800"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_4800: raw_contact insert error:" + error); - done(); - } - }); - - async function contactDelete(DAHelper, rawContactId) { - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("name_raw_contact_id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(contactUri, condition1); - sleep(1000); - console.info("logMessage contact_delete_test_4800: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_delete_test_4800: delete error = " + error); - } - } - - async function deletedRawContactQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "delete_time", "display_name"]; - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition2); - sleep(1000) - if (resultSet.goToFirstRow()) { - console.info("logMessage contact_delete_test_4800: columnNames:" + resultSet.columnNames); - console.info("logMessage contact_delete_test_4800: columnCount:" + resultSet.columnCount); - console.info('logMessage contact_delete_test_4800: id = ' + resultSet.getString(0)); - console.info('logMessage contact_delete_test_4800: delete_time = ' + resultSet.getString(1)); - console.info('logMessage contact_delete_test_4800: displayName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "xiaopeng").assertTrue(); - } - resultSet.close(); - } catch (error) { - console.info("logMessage contact_delete_test_4800: query error:" + error); - } - } - - /** - * @tc.number contact_batchinsert_test_4900 - * @tc.name Insert contacts in batches(raw_contact) - * @tc.desc Function test - */ - it("contact_batchinsert_test_4900", 0, async function (done) { - console.info("--------logMessage contact_batchinsert_test_4900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, common.getContactBatchCompany()); - sleep(1000); - console.info("logMessage contact_batchinsert_test_4900: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("company", "TT4900"); - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - console.info( - 'contact_batchinsert_test_4900 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 5).assertEqual(true); - resultSet.close(); - await deleteRawContact("contact_batchinsert_test_4900"); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_4900: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_batchinsert_test_5000 - * @tc.name Insert contact_data in batches of address book - * @tc.desc Function test - */ - it("contact_batchinsert_test_5000", 0, async function (done) { - console.info("--------logMessage contact_batchinsert_test_5000 start!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var rawContactValues = { - "display_name": "xiaozhi" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataBatchInsert(rawContactId); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5000: raw_contact insert error = " + error); - done(); - } - async function contactDataBatchInsert(rawContactId) { - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, common.getContactBatchCompanyTwo()); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5000: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var map = new Map(); - map.set("raw_contact_id", rawContactId.toString()); - await queryBatch(map, "contact_batchinsert_test_5000", 5); - await deleteRawContact("contact_batchinsert_test_5000"); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5000: batchInsert error = " + error); - done(); - } - } - }); - - /** - * @tc.number contact_batchinsert_test_5400 - * @tc.name Batch operation of contact black list - * @tc.desc Function test - */ - it("contact_batchinsert_test_5400", 0, async function (done) { - console.info("--------logMessage contact_batchinsert_test_5400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.batchInsert(contactBlocklistUri, common.getPhoneNumberBatch()); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5400: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await query(5); - await blocklistDelete(); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5400: batchInsert error = " + error); - done(); - } - - async function blocklistDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "85525040585400"); - try { - var deleteCode = await DAHelper.delete(contactBlocklistUri, condition); - console.info("logMessage contact_batchinsert_test_5400: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - await query(0); - done(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5400: delete error = " + error); - done(); - } - } - - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "85525040585400"); - try { - var resultSet = await DAHelper.query(contactBlocklistUri, resultColumns, condition); - sleep(1000); - console.info( - 'contact_batchinsert_test_5400 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contact_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - }); - - /** - * @tc.number contact_update_test_5300 - * @tc.name Bulk favorites and unfavorites of contacts - * @tc.desc Function test - */ - it("contact_update_test_5300", 0, async function (done) { - console.info("--------logMessage contact_update_test_5300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValuesOne = { - "display_name": "fengyuan", "favorite": 1 - }; - var rawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactValuesThree = { - "display_name": "xiaoma", "favorite": 1 - }; - var listAddBluk = [] - listAddBluk[0] = rawContactValuesOne; - listAddBluk[1] = rawContactValuesTwo; - listAddBluk[2] = rawContactValuesThree; - try { - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_update_test_5300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await rawContactUpdateUnFavorites(DAHelper); - await queryUnFavorites(DAHelper); - await deleteRawContact("contact_update_test_5300"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_5300: batchInsert error = " + error); - done(); - } - }); - - async function rawContactUpdateUnFavorites(DAHelper) { - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("display_name", "fengyuan"); - condition.or(); - condition.equalTo("display_name", "xiaoma"); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_update_test_5300: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_update_test_5300: update error = " + error); - } - } - - async function queryUnFavorites(DAHelper) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("display_name", "fengyuan"); - condition.or(); - condition.equalTo("display_name", "xiaoma"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - console.info('contact_update_test_5300 : queryBatch start ! resultSet.rowCount = ' - + resultSet.rowCount); - expect(resultSet.rowCount == 2).assertEqual(true); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var dbresult = resultSet.getString(resultSet.getColumnIndex("favorite")); - console.info(' contact_update_test_5300 :logMessage contactsQuery dbresult :' + dbresult + - ' value : ' + value); - expect(dbresult == "0").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(" contact_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - - /** - * @tc.number contact_batchinsert_test_5500 - * @tc.name Contacts are added to and removed from groups in batches - * @tc.desc Function test - */ - it("contact_batchinsert_test_5500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var groupValues = { - "group_name": "ManagerGroup" - }; - try { - var groupId = await DAHelper.insert(groupUri, groupValues); - console.info("logMessage contact_batchinsert_test_5500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: group insert error = " + error); - done(); - } - try { - var rawContactValues1 = { - "display_name": "xiaohuang" - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, rawContactValues1); - console.info("logMessage contact_batchinsert_test_5500: rawContactIdOne = " + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: raw_contact_1 insert error = " + error); - done(); - } - try { - var rawContactValues2 = { - "display_name": "xiaolv" - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, rawContactValues2); - console.info("logMessage contact_batchinsert_test_5500: rawContactIdTwo = " + rawContactIdTwo); - expect(rawContactIdTwo > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: raw_contact_2 insert error = " + error); - done(); - } - try { - var rawContactValues3 = { - "display_name": "xiaobai" - }; - var rawContactIdThird = await DAHelper.insert(rawContactUri, rawContactValues3); - console.info("logMessage contact_batchinsert_test_5500: rawContactIdThird = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: raw_contact_3 insert error = " + error); - done(); - } - await threeDataInsert(DAHelper, rawContactIdOne, rawContactIdTwo, rawContactIdThird, groupId); - await deleteRawContact("contact_batchinsert_test_5500"); - await deleteAll(groupUri, "contact_batchinsert_test_5500"); - await deleteAll(contactDataUri, "contact_batchinsert_test_5500"); - done(); - }); - - async function threeDataInsert(DAHelper, rawContactIdOne, rawContactIdTwo, rawContactIdThird, groupId) { - var contactDataValues1 = { - "raw_contact_id": rawContactIdOne, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var contactDataValues2 = { - "raw_contact_id": rawContactIdTwo, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var contactDataValues3 = { - "raw_contact_id": rawContactIdThird, - "content_type": "group_membership", - "detail_info": groupId.toString() - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValues1; - listAddBluk[1] = contactDataValues2; - listAddBluk[2] = contactDataValues3; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await contactDataDelete(DAHelper, rawContactIdOne, rawContactIdThird); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: batchInsert error = " + error); - } - } - - async function contactDataDelete(DAHelper, rawContactIdOne, rawContactIdThird) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdThird.toString()); - try { - var deleteCode = await DAHelper.delete(contactDataUri, condition); - sleep(1000); - console.info("logMessage contact_batchinsert_test_5500: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - await queryTwoData(DAHelper, rawContactIdOne, rawContactIdThird); - } catch (error) { - console.info("logMessage contact_batchinsert_test_5500: delete error = " + error); - } - } - - async function queryTwoData(DAHelper, rawContactIdOne, rawContactIdThird) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdThird.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - console.info( - 'contact_batchinsert_test_5500 : queryBatch start ! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contact_batchinsert_test_5400 logMessage resultSet.rowCount: error = " + error); - } - } - - /** - * @tc.number contact_pinyin_query_test_200 - * @tc.name Contact name to pinyin (Chinese Simplified) - * @tc.desc Function test - */ - it("contact_pinyin_query_test_200", 0, async function (done) { - console.info("--------logMessage contact_pinyin_query_test_200 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "小黄" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info('logMessage contact_pinyin_query_test_200 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contact_pinyin_query_test_100"); - await deleteAll(contactDataUri, "contact_pinyin_query_test_100"); - done(); - } catch (error) { - console.info("logMessage contact_pinyin_query_test_200: raw_contact insert error = " + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaohuang" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_pinyin_query_test_200 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchQuery(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_200 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - var map = common.getSearchMap(); - map.set("raw_contact_id", rawContactId.toString()); - if (resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ':contact_pinyin_query_test_200 key = ' + key + ' dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertEqual(true); - } - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_200 query error = ' + error); - } - } - - /** - * @tc.number contact_pinyin_query_test_100 - * @tc.name Contact name to pinyin (Chinese Traditional) - * @tc.desc Function test - */ - it("contact_pinyin_query_test_100", 0, async function (done) { - console.info("--------logMessage contact_pinyin_query_test_100 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "鍵盤" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_pinyin_query_test_100 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contact_pinyin_query_test_100"); - await deleteAll(contactDataUri, "contact_pinyin_query_test_100"); - done(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_100 raw_contact insert error = ' + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "鍵盤" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_pinyin_query_test_100 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchContactQueryChinese(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_100 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchContactQueryChinese(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_pinyin_query_test_100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_pinyin_query_test_100: search_name = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "鍵盤||jianpan||jp").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_100 query error = ' + error); - } - } - - /** - * @tc.number contact_pinyin_query_test_300 - * @tc.name Contact name to pinyin (English) - * @tc.desc Function test - */ - it("contact_pinyin_query_test_300", 0, async function (done) { - console.info("--------logMessage contact_pinyin_query_test_300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "Tom" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_pinyin_query_test_300 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataInsert(); - await deleteRawContact("contact_pinyin_query_test_300"); - done(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_300 raw_contact insert error = ' + error); - done(); - } - - async function contactDataInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": "name", "detail_info": "Tom" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_pinyin_query_test_300 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await searchContactQuery(DAHelper, rawContactId); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_300 contact_data insert error = ' + error); - done(); - } - } - }); - - async function searchContactQuery(DAHelper, rawContactId) { - var resultColumns = ["raw_contact_id", "search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_pinyin_query_test_300: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_pinyin_query_test_300: search_name = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "Tom||Tom||Tom").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_pinyin_query_test_300 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_400 - * @tc.name Contact fuzzy search query interface (name) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_400", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "400xiaoming400" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_400 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactNameQuery(); - await deleteRawContact("contact_fuzzyquery_test_400"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_400 raw_contact insert error = ' + error); - done(); - } - - async function rawContactNameQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("display_name", "%xiaoming40%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_400: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info( - 'logMessage contact_fuzzyquery_test_400: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "400xiaoming400").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_400 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contact_fuzzyquery_test_500 - * @tc.name Contact fuzzy search query interface (name pinyin, pinyin name) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_500", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_500 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var rawContactValues = { - "display_name": "500xiaoming500", "phonetic_name": "500xiaoming500||xm" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_500 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactPhoneticNameQuery(); - await deleteRawContact("contact_fuzzyquery_test_500"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_500 raw_contact insert error = ' + error); - done(); - } - - async function rawContactPhoneticNameQuery() { - var resultColumns = ["id", "display_name", "phonetic_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("phonetic_name", "%xiaoming%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - condition.or(); - condition.like("phonetic_name", "%xm%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_500: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertTrue(); - console.info( - 'logMessage contact_fuzzyquery_test_500: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "500xiaoming500").assertTrue(); - console.info( - 'logMessage contact_fuzzyquery_test_500: phoneticName = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "500xiaoming500||xm").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_500 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contact_fuzzyquery_test_600 - * @tc.name Contact fuzzy search query interface (company, position) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_600", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_600 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming", "company": "TT600", "position": "Testers600" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_600 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await rawContactCompanyQuery(DAHelper, rawContactId); - await deleteRawContact("contact_fuzzyquery_test_600"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_600 raw_contact insert error = ' + error); - done(); - } - }); - - async function rawContactCompanyQuery(DAHelper, rawContactId) { - var resultColumns = ["id", "display_name", "company", "position"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("company", "%TT6%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - condition.or(); - condition.like("position", "%Testers6%"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_600: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_600: displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoming").assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_600: company = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "TT600").assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_600: position = ' + resultSet.getString(3)); - expect(resultSet.getString(3) == "Testers600").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_600 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_700 - * @tc.name Contact fuzzy search query interface (mobile phone number) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_700", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_700 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_700 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataPhoneInsert(); - await deleteRawContact("contact_fuzzyquery_test_700"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_700"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_700 raw_contact insert error = ' + error); - done(); - } - - async function contactDataPhoneInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "14528963" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_700 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryPhone(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_700 contact_data insert error = ' + contactDataId); - done(); - } - } - }); - - async function fuzzyQueryPhone(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 5 data is phone - condition.like("detail_info", "%52896%"); - condition.and(); - condition.equalTo("type_id", "5"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_700: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_700: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_700: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "14528963").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_700 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_800 - * @tc.name Contact fuzzy search query interface (nickname) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_800", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_800 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactNickNameInsert(); - await deleteRawContact("contact_fuzzyquery_test_800"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_800"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_800 raw_contact insert error = ' + error); - done(); - } - - async function contactNickNameInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "daming" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_fuzzyquery_test_800 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryPhoneNickName(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_800 contact_data insert error = ' + contactDataId); - done(); - } - } - }); - - async function fuzzyQueryPhoneNickName(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 3 data is nickname - condition.like("detail_info", "%daming%"); - condition.and(); - condition.equalTo("type_id", "3"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_800: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_800: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_800: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "daming").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_800 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_900 - * @tc.name Contact fuzzy search query interface (mailbox) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_900", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_900 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataEmailInsert(); - await deleteRawContact("contact_fuzzyquery_test_900"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_900"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_900 raw_contact insert error = ' + error); - done(); - } - - async function contactDataEmailInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "1564@163.com" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_fuzzyquery_test_900 ; = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryEmail(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_900 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryEmail(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data is email - condition.like("detail_info", "%1564%"); - condition.and(); - condition.equalTo("type_id", "1"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_900: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_900: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_900: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "1564@163.com").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_900 query error = ' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_1000 - * @tc.name Contact fuzzy search query interface (residential) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_1000", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_1000 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_1000 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataPostalInsert(); - await deleteRawContact("contact_fuzzyquery_test_1000"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_1000"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1000 raw_contact insert error = ' + error); - done(); - } - - async function contactDataPostalInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "postal_address", - "detail_info": "nanjing1000" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_1000 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryAddress(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1000 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryAddress(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 1 data is postal_address - condition.like("detail_info", "%nanjing10%"); - condition.and(); - condition.equalTo("type_id", "7"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(1000); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_1000: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_1000: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertTrue(); - console.info('logMessage contact_fuzzyquery_test_1000: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "nanjing1000").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1000: query error' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_1100 - * @tc.name Contact fuzzy search query interface (remarks) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_1100", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_1100 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_1100 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataNoteInsert(); - await deleteRawContact("contact_fuzzyquery_test_1100"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_1100"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1100 raw_contact insert error = ' + error); - done(); - } - - async function contactDataNoteInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "note", - "detail_info": "java1100" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info('logMessage contact_fuzzyquery_test_1100 contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryNote(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1100 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryNote(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 10 data is note - condition.like("detail_info", "%java11%"); - condition.and(); - condition.equalTo("type_id", "10"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_1100: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_1100: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_1100: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "java1100").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1100: query error' + error); - } - } - - /** - * @tc.number contact_fuzzyquery_test_1200 - * @tc.name Contact fuzzy search query interface (AIM) - * @tc.desc Function test - */ - it("contact_fuzzyquery_test_1200", 0, async function (done) { - console.info("--------logMessage contact_fuzzyquery_test_1200 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoming" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info('logMessage contact_fuzzyquery_test_1200 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("contact_fuzzyquery_test_1200"); - await deleteAll(contactDataUri, "contact_fuzzyquery_test_1200"); - done(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1200 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, - "content_type": "im", - "detail_info": "aaaa1200" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_fuzzyquery_test_1200 ; = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await fuzzyQueryIM(DAHelper, rawContactId, contactDataId); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1200 contact_data insert error = ' + error); - done(); - } - } - }); - - async function fuzzyQueryIM(DAHelper, rawContactId, contactDataId) { - var resultColumns = ["id", "raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - // type_id = 10 data is im account number - condition.like("detail_info", "%aa12%"); - condition.and(); - condition.equalTo("type_id", "2"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('logMessage contact_fuzzyquery_test_1200: id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == contactDataId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_1200: raw_contact_id = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == rawContactId.toString()).assertEqual(true); - console.info('logMessage contact_fuzzyquery_test_1200: detail_info = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "aaaa1200").assertEqual(true); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info('logMessage contact_fuzzyquery_test_1200: query error' + error); - } - } - - /** - * @tc.number abnormal_contact_insert_test_200 - * @tc.name Abnormal use case, an incorrect field is passed in when inserting - * @tc.desc Function test - */ - it("abnormal_contact_insert_test_200", 0, async function (done) { - console.info("------------abnormal_contact_insert_test_200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_names": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insert_test_200: rawContactId = " + rawContactId); - expect(rawContactId).assertEqual(-1); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_test_200: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_insert_test_300 - * @tc.name Abnormal use case, an incorrect table name is passed in when inserting - * @tc.desc Function test - */ - it("abnormal_contact_insert_test_300", 0, async function (done) { - console.info("------------abnormal_contact_insert_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(errorUri, rawContactValues); - console.info("logMessage abnormal_contact_insert_test_300: rawContactId = " + rawContactId); - expect(rawContactId == -1).assertTrue(); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_test_300: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_update_test_1100 - * @tc.name Abnormal use case, an incorrect field is passed in when updating - * @tc.desc Function test - */ - it("abnormal_contact_update_test_1100", 0, async function (done) { - console.info("------------abnormal_contact_update_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_update_test_1100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalUpdate(); - await deleteRawContact("abnormal_contact_update_test_1100"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_update_test_1100: raw_contact insert error' + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "display_names": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var updataCode = await DAHelper.update(rawContactUri, updateValues, condition) - console.info("logMessage abnormal_contact_update_test_1100: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contact_update_test_1100", rawContactUri); - } catch (error) { - console.info('logMessage abnormal_contact_update_test_1100: update error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_update_test_1000 - * @tc.name Abnormal use case, an incorrect table name is passed in when updating - * @tc.desc Function test - */ - it("abnormal_contact_update_test_1000", 0, async function (done) { - console.info("------------abnormal_contact_update_test_1000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_update_test_1000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalUpdate(); - await deleteRawContact("abnormal_contact_update_test_1000"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_update_test_1000: raw_contact insert error' + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "display_name": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var updataCode = await DAHelper.update(errorUri, updateValues, condition); - console.info("logMessage abnormal_contact_update_test_1000: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contact_update_test_1000", rawContactUri); - } catch (error) { - console.info("logMessage abnormal_contact_update_test_1000: updata error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_delete_test_4500 - * @tc.name Abnormal use case, an incorrect field is passed in when deleting - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_4500", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_4500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaozhi" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_4500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalDelete(); - await deleteRawContact("abnormal_contact_delete_test_4500"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_4500: raw_contact insert error' + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition); - console.info("logMessage abnormal_contact_delete_test_4500: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaozhi"); - await contactsQuery(map, "abnormal_contact_delete_test_4500", rawContactUri); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_4500: delete error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_delete_test_4600 - * @tc.name Abnormal use case, an incorrect table name is passed in when deleting - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_4600", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_4600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/contacts/raw_contacts"; - - var rawContactValues = { - "display_name": "xiaoshan" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_4600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalDelete(); - await deleteRawContact("abnormal_contact_delete_test_4600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_4600: raw_contact insert error' + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info("logMessage abnormal_contact_delete_test_4600: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaoshan"); - await contactsQuery(map, "abnormal_contact_delete_test_4600", rawContactUri); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_4600: delete error' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_4200 - * @tc.name Abnormal use case, an incorrect field is passed in when querying - * @tc.desc Function test - */ - it("abnormal_contact_query_test_4200", 0, async function (done) { - console.info("------------abnormal_contact_query_test_4200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaozhicheng" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_4200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_4200"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_4200: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_4200: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_4200: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_batchinsert_test_5100 - * @tc.name Abnormal use cases, when adding data in batches, some of them failed, check the processing logic - * @tc.desc Function test - */ - it("abnormal_contact_batchinsert_test_5100", 0, async function (done) { - console.info("--------logMessage abnormal_contact_batchinsert_test_5100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "display_name": "zhangsan" - }; - var addBulkValue2 = { - "display_names": "lisi" - }; - var addBulkValue3 = { - "display_name": "wangwu" - }; - var addBulkValue4 = { - "display_names": "laoliu" - }; - var addBulkValue5 = { - "display_name": "xiaozhang" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - console.info("logMessage abnormal_contact_batchinsert_test_5100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_batchinsert_test_5100: batch insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_insert_data_5300 - * @tc.name insert_data error no rawContactId - * @tc.desc Function test - */ - it("abnormal_contact_insert_data_5300", 0, async function (done) { - console.info("--------logMessage abnormal_contact_insert_data_5300 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaotian" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage abnormal_contact_insert_data_5300 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("abnormal_contact_insert_data_5300"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_data_5300 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "content_type": "im", "detail_info": "aaaa" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage abnormal_contact_insert_data_5300 ; = ' + contactDataId); - expect(contactDataId == -1).assertTrue(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_data_5300 contact_data insert error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_insert_data_5400 - * @tc.name insert_data error no content_type - * @tc.desc Function test - */ - it("abnormal_contact_insert_data_5400", 0, async function (done) { - console.info("--------logMessage abnormal_contact_insert_data_5400 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaotian" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info('logMessage abnormal_contact_insert_data_5400 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - await contactDataAimInsert(); - await deleteRawContact("abnormal_contact_insert_data_5400"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_data_5400 raw_contact insert error = ' + error); - done(); - } - - async function contactDataAimInsert() { - var contactDataValues = { - "raw_contact_id": rawContactId, "detail_info": "aaaa" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage abnormal_contact_insert_data_5400 ; = ' + contactDataId); - expect(contactDataId == -1).assertTrue(); - } catch (error) { - console.info('logMessage abnormal_contact_insert_data_5400 contact_data insert error = ' + error); - done(); - } - } - }); - - /** - * @tc.number contact_delete_test_5500 - * @tc.name batchDelete - * @tc.desc Function test - */ - it("contact_delete_test_5500", 0, async function (done) { - console.info("--------logMessage contact_delete_test_5500 is starting!------------"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - console.info("logMessage contact_delete_test_5500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_delete_test_5500", rawContactUri); - await executeBatch(); - } catch (error) { - console.info("logMessage contact_delete_test_5500: insert error = " + error); - done(); - } - async function executeBatch() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - DAHelper.executeBatch(URI_CONTACTS, [{ - uri: rawContactUri, - type: featureAbility.DataAbilityOperationType.TYPE_DELETE, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage contact_delete_test_5500: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage contact_delete_test_5500: data_3 = " + data); - console.info("logMessage contact_delete_test_5500: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number contact_update_test_5600 - * @tc.name batchUpdate - * @tc.desc Function test - */ - it("contact_update_test_5600", 0, async function (done) { - console.info("--------logMessage contact_update_test_5600 is starting!------------"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - console.info("logMessage contact_update_test_5600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_update_test_5600", rawContactUri); - await executeBatch(); - } catch (error) { - console.info("logMessage contact_update_test_5600: insert error = " + error); - done(); - } - - async function executeBatch() { - var updateValues = { - "display_name": "xiaoxiaoxiao" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - DAHelper.executeBatch(URI_CONTACTS, [{ - uri: rawContactUri, - type: featureAbility.DataAbilityOperationType.TYPE_UPDATE, - valuesBucket: updateValues, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage contact_update_test_5600: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage contact_update_test_5600: data_3 = " + data); - console.info("logMessage contact_update_test_5600: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number contact_insert_test_5700 - * @tc.name Insert Multiple raw_contact essential information - * @tc.desc Function test - */ - it("contact_insert_test_5700", 0, async function (done) { - console.info("------logMessage contact_insert_test_5700 is starting!-----"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_insert_test_5700: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_insert_test_5700", rawContactUri); - var rawContactIdOne = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_insert_test_5700: rawContactIdOne = ' + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactIdOne.toString()); - await contactsQuery(map, "contact_insert_test_5700", rawContactUri); - var rawContactIdTwo = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_insert_test_5700: rawContactIdTwo = ' + rawContactIdTwo); - expect(rawContactIdTwo > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactIdTwo.toString()); - await contactsQuery(map, "contact_insert_test_5700", rawContactUri); - await deleteRawContact("contact_insert_test_5700"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_5700: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_insert_test_5800 - * @tc.name Add 20000 bytes of basic contact information and verify whether the text insertion is successful - * @tc.desc Function test - */ - it("contact_insert_test_5800", 0, async function (done) { - console.info("------logMessage contact_insert_test_5800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var name; - for (var i = 0; i < 20000; i++) { - name += "i"; - } - var contcatvalues = { - "display_name": name - } - try { - var rawContactId = await DAHelper.insert(rawContactUri, contcatvalues); - sleep(1000); - console.info('logMessage contact_insert_test_5800: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", name); - await contactsQuery(map, "contact_insert_test_5800", rawContactUri); - await deleteRawContact("contact_insert_test_5800"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_5800: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_insert_test_5900 - * @tc.name Add multiple contact details and verify that the insertion was successful - * @tc.desc Function test - */ - it("contact_insert_test_5900", 0, async function (done) { - console.info("------logMessage contact_insert_test_5900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var contcatvalues = { - "display_name": "xiao5900" - } - try { - var rawContactId = await DAHelper.insert(rawContactUri, contcatvalues); - console.info('logMessage contact_insert_test_5900: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "19960229" - }; - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info('logMessage contact_insert_test_5900: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("detail_info", "19960229"); - await contactsQuery(map, "contact_insert_test_5900", contactDataUri); - - var rawContactIdOne = await DAHelper.insert(rawContactUri, contcatvalues); - console.info('logMessage contact_insert_test_5900: rawContactId = ' + rawContactIdOne); - expect(rawContactIdOne > 0).assertTrue(); - var contactDataValues2 = { - "raw_contact_id": rawContactIdOne, - "content_type": "phone", - "detail_info": "111111032" - }; - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info('logMessage contact_insert_test_5900: contactDataId = ' + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - - var map = new Map(); - map.set("id", contactDataId1.toString()); - map.set("detail_info", "111111032"); - await contactsQuery(map, "contact_insert_test_5900", contactDataUri); - - await deleteRawContact("contact_insert_test_5900"); - await deleteAll(contactDataUri, "contact_insert_test_5900"); - done(); - } catch (error) { - console.info('logMessage contact_insert_test_5900: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_insert_test_6000 - * @tc.name Add the basic information of a single contact and verify whether the insertion is successful (name, - * Pinyin, company, position, favorite) - * @tc.desc Function test - */ - it("contact_insert_test_6000", 0, async function (done) { - console.info("------logMessage contact_insert_test_6000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "licheng", - "company": "TT", - "position": "developer", - "favorite": 1, - "phonetic_name": "licheng||lc" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insert_test_6000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "licheng"); - map.set("company", "TT"); - map.set("position", "developer"); - map.set("favorite", "1"); - map.set("phonetic_name", "licheng||lc"); - await contactsQuery(map, "contact_insert_test_6000", rawContactUri); - await deleteRawContact("contact_insert_test_6000"); - await deleteAll(contactDataUri, "contact_insert_test_6000"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_6000: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertData_test_6100 - * @tc.name To contact_data Add a full field data to the data table and verify whether the insertion is - * successful - * @tc.desc Function test - */ - it("contact_insertData_test_6100", 0, async function (done) { - console.info("------logMessage contact_insertData_test_6100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertData_test_6100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - console.info('logMessage contact_insertData_test_6100: contactDataValues["raw_contact_id"] = ' + - contactDataValues.raw_contact_id); - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_insertData_test_6100: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - var map = common.getProfileContactDataMap(); - map.set("id", contactDataId.toString()); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contact_insertData_test_6100", contactDataUri); - await deleteRawContact("contact_insertData_test_6100"); - await deleteAll(contactDataUri, "contact_insertData_test_6100"); - done(); - } catch (error) { - console.info("logMessage contact_insertData_test_6100: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_update_test_6200 - * @tc.name Modify the basic information of multiple contacts and verify whether the modification is successful - * @tc.desc Function test - */ - it("contact_update_test_6200", 0, async function (done) { - console.info("--------logMessage contact_update_test_6200 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - expect(rawContactId > 0).assertTrue(); - console.info("logMessage contact_update_test_6200: rawContactId = " + rawContactId); - var insertRawContactValuesOne = { - "display_name": "xiaocai1", - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - expect(rawContactIdOne > 0).assertTrue(); - console.info("logMessage contact_update_test_6200: rawContactIdOne = " + rawContactIdOne); - var insertRawContactValuesTwo = { - "display_name": "xiaocai1", - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - expect(rawContactIdTwo > 0).assertTrue(); - console.info("logMessage contact_update_test_6200: rawContactIdTwo = " + rawContactIdTwo); - - var updateValues = { - "display_name": "xiaosan" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - var updataCode = await DAHelper.update(rawContactUri, updateValues, condition); - console.info("logMessage contact_update_test_6200: updataCode = " + updataCode); - expect(updataCode == 0).assertTrue(); - sleep(1000); - await queryUpdateThree( - "contact_update_test_6200", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contact_update_test_6200"); - done(); - } catch (error) { - console.info("logMessage contact_update_test_6200: insert error = " + error); - done(); - } - }); - - async function queryUpdateThree(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var name = resultSet.getString(resultSet.getColumnIndex("display_name")); - expect(name == "xiaosan").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - /** - * @tc.number contact_UpdateRawContcat_test_6300 - * @tc.name Update raw_contact The full field data of the contact table and verify whether the modification is - * successful - * @tc.desc Function test - */ - it("contact_UpdateRawContcat_test_6300", 0, async function (done) { - console.info("------logMessage contact_UpdateRawContcat_test_6300 is starting!-----"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - console.info("logMessage contact_UpdateRawContcat_test_6300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(2000); - var updateValues = common.getProfileRawContactUpdate(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var updataCode = await DAHelper.update(rawContactUri, updateValues, condition); - console.info('logMessage contact_UpdateRawContcat_test_6300: updataCode = ' + updataCode); - sleep(3000); - var map = common.getProfileRawContactUpdateMap(); - map.set("id", rawContactId.toString()); - await contactsQuery(map, "contact_UpdateRawContcat_test_6300", rawContactUri); - await deleteRawContact("contact_UpdateRawContcat_test_6300"); - await deleteAll(contactDataUri, "contact_UpdateRawContcat_test_6300"); - done(); - } catch (error) { - console.info("logMessage contact_UpdateRawContcat_test_6300: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertDataUpdate_test_6400 - * @tc.name Update contact_data table, and verify whether the modification is successful - * @tc.desc Function test - */ - it("contact_insertDataUpdate_test_6400", 0, async function (done) { - console.info("------logMessage contact_insertDataUpdate_test_6400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataUpdate_test_6400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - console.info('logMessage contact_insertDataUpdate_test_6400: contactDataValues.raw_contact_id = ' + - contactDataValues.raw_contact_id); - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_insertDataUpdate_test_6400: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var updateValues = common.getProfileContactDataUpdate(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - var updataCode = await DAHelper.update(contactDataUri, updateValues, condition); - console.info('logMessage contact_insertDataUpdate_test_6400: updataCode = ' + updataCode); - sleep(1000); - var map = common.getProfileContactDataUpdateMap(); - map.set("id", contactDataId.toString()); - map.set("raw_contact_id", rawContactId.toString()); - await contactsQuery(map, "contact_insertDataUpdate_test_6400", contactDataUri); - await deleteRawContact("contact_insertDataUpdate_test_6400"); - await deleteAll(contactDataUri, "contact_insertDataUpdate_test_6400"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataUpdate_test_6400: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertDataUpdateAll_test_6500 - * @tc.name Update all contact details and verify that the modification was successful - * @tc.desc Function test - */ - it("contact_insertDataUpdateAll_test_6500", 0, async function (done) { - console.info("------logMessage contact_insertDataUpdateAll_test_6500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataUpdateAll_test_6500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaocai", ""); - await insertData(rawContactId, "phone", "6500", ""); - await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await insertData(rawContactId, "nickname", "xxxxcai", ""); - await insertData(rawContactId, "email", "111@fox.com", ""); - await insertData(rawContactId, "postal_address", "dddd", ""); - await insertData(rawContactId, "note", "caicai", ""); - await insertData(rawContactId, "im", "999999999", ""); - await insertData(rawContactId, "contact_event", "1125", ""); - await insertData(rawContactId, "website", "wwww.xxx.com", ""); - await insertData(rawContactId, "relation", "xiaobai", ""); - await insertData(rawContactId, "group_membership", 1, ""); - await insertData(rawContactId, "contact_misc", "5678", ""); - var updateValues = { - "detail_info": "xiaocai" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - var updataCode = await DAHelper.update(contactDataUri, updateValues, condition); - console.info('logMessage contact_insertDataUpdateAll_test_6500: updataCode = ' + updataCode); - sleep(1000); - await queryUpdateAllData("contact_insertDataUpdateAll_test_6500", DAHelper, rawContactId); - await deleteRawContact("contact_insertDataUpdateAll_test_6500"); - await deleteAll(contactDataUri, "contact_insertDataUpdateAll_test_6500"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataUpdateAll_test_6500: raw_contact insert error = " + error); - done(); - } - }); - - async function queryUpdateAllData(tag, DAHelper, rawContactId) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("row_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var detail_info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - expect(detail_info == "xiaocai").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - /** - * @tc.number contact_insertFavorite_test_6600 - * @tc.name Add multiple contacts to favorites and verify that the favorites field is changed - * @tc.desc Function test - */ - it("contact_insertFavorite_test_6600", 0, async function (done) { - console.info("------logMessage contact_insertFavorite_test_6600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertFavorite_test_6600: rawContactId = " + rawContactId); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", "favorite": 1 - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - console.info("logMessage contact_insertFavorite_test_6600: rawContactId = " + rawContactIdOne); - - var insertRawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - console.info("logMessage contact_insertFavorite_test_6600: rawContactId = " + rawContactIdTwo); - - sleep(1000); - await queryThreeFavorite( - "contact_insertFavorite_test_6600", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 1); - await deleteRawContact("contact_insertFavorite_test_6600"); - done(); - } catch (error) { - console.info("logMessage contact_insertFavorite_test_6600: raw_contact insert error = " + error); - done(); - } - }); - - async function queryThreeFavorite(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, favoritevalue) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryThreeFavorite start ! DAHelper = ' + DAHelper); - var resultColumns = ["favorite"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var favorite = resultSet.getInt(resultSet.getColumnIndex("favorite")); - expect(favorite == favoritevalue).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryThreeFavorite: error = " + error); - } - } - - /** - * @tc.number contact_unFavorite_test_6700 - * @tc.name Remove favorites from multiple contacts and verify that the favorites field has changed - * @tc.desc Function test - */ - it("contact_unFavorite_test_6700", 0, async function (done) { - console.info("------logMessage contact_unFavorite_test_6700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_unFavorite_test_6700: rawContactId = " + rawContactId); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", "favorite": 1 - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - console.info("logMessage contact_unFavorite_test_6700: rawContactId = " + rawContactIdOne); - - var insertRawContactValuesTwo = { - "display_name": "xiaoli", "favorite": 1 - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - console.info("logMessage contact_unFavorite_test_6700: rawContactId = " + rawContactIdTwo); - - var updateValues = { - "favorite": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - var updataCode = await DAHelper.update(rawContactUri, updateValues, condition); - console.info("logMessage contact_unFavorite_test_6700: updataCode = " + updataCode); - sleep(1000); - await queryThreeFavorite( - "contact_unFavorite_test_6700", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 0); - await deleteRawContact("contact_unFavorite_test_6700"); - done(); - } catch (error) { - console.info("logMessage contact_unFavorite_test_6700: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertContactBlocklist_test_6800 - * @tc.name Add multiple records to the black list and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contact_insertContactBlocklist_test_6800", 0, async function (done) { - console.info("--------logMessage contact_insertContactBlocklist_test_6800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_insertContactBlocklist_test_6800: insert = " + batchInsertCode); - var batchInsertCodeOne = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_insertContactBlocklist_test_6800: insert = " + batchInsertCodeOne); - var batchInsertCodeTwo = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_insertContactBlocklist_test_6800: insert = " + batchInsertCodeTwo); - sleep(1000); - expect(batchInsertCode > 0).assertTrue(); - await query(3); - await deleteAll(contactBlocklistUri, "contact_insertContactBlocklist_test_6800"); - done(); - } catch (error) { - console.info("logMessage contact_insertContactBlocklist_test_6800: insert error = " + error); - done(); - } - - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "123456789"); - try { - var resultSet = await DAHelper.query(contactBlocklistUri, resultColumns, condition); - sleep(1000); - console.info('contact_insertContactBlocklist_test_6800 :resultSet.goToFirstRow() = ' + - resultSet.goToFirstRow()); - console.info( - 'contact_insertContactBlocklist_test_6800 : query result is = ' + resultSet.rowCount == size); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contact_insertContactBlocklist_test_6800 error = " + error); - } - } - }); - - /** - * @tc.number contact_removeContactBlocklist_test_6900 - * @tc.name Delete multiple records from the black list and verify whether the deletion is successful - * @tc.desc Function test - */ - it("contact_removeContactBlocklist_test_6900", 0, async function (done) { - console.info("--------logMessage contact_removeContactBlocklist_test_6900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var batchInsertCode = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_removeContactBlocklist_test_6900: batchInsertCode = " + batchInsertCode); - var batchInsertCodeOne = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_removeContactBlocklist_test_6900: insert = " + batchInsertCodeOne); - var batchInsertCodeTwo = await DAHelper.insert(contactBlocklistUri, common.getProfileBlockList()); - console.info("logMessage contact_removeContactBlocklist_test_6900: insert = " + batchInsertCodeTwo); - sleep(1000); - expect(batchInsertCode > 0).assertTrue(); - await deleteAll(contactBlocklistUri, "contact_removeContactBlocklist_test_6900"); - await query(0); - done(); - } catch (error) { - console.info("logMessage contact_removeContactBlocklist_test_6900: batchInsert error = " + error); - done(); - } - async function query(size) { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", "123456789"); - try { - var resultSet = await DAHelper.query(contactBlocklistUri, resultColumns, condition); - console.info('contact_removeContactBlocklist_test_6900 : resultSet = ' + resultSet); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(" contact_removeContactBlocklist_test_6900 error = " + error); - } - } - }); - - /** - * @tc.number contact_insertGroup_test_7000 - * @tc.name Add multiple contacts to favorites and verify that the favorites field is changed - * @tc.desc Function test - */ - it("contact_insertGroup_test_7000", 0, async function (done) { - console.info("------logMessage contact_insertGroup_test_7000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertGroup_test_7000: rawContactId = " + rawContactId); - await insertData(rawContactId, "group_membership", 1, ""); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - console.info("logMessage contact_insertGroup_test_7000: rawContactId = " + rawContactIdOne); - await insertData(rawContactIdOne, "group_membership", 1, ""); - var insertRawContactValuesTwo = { - "display_name": "xiaoli", - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - console.info("logMessage contact_insertGroup_test_7000: rawContactId = " + rawContactIdTwo); - await insertData(rawContactIdTwo, "group_membership", 1, ""); - sleep(1000); - await queryThreeGroup( - "contact_insertGroup_test_7000", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, 1); - await deleteRawContact("contact_insertGroup_test_7000"); - done(); - } catch (error) { - console.info("logMessage contact_insertGroup_test_7000: raw_contact insert error = " + error); - done(); - } - }); - - async function queryThreeGroup(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo, groupId) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryThreeGroup start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var group = resultSet.getInt(resultSet.getColumnIndex("detail_info")); - expect(group == groupId).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryThreeGroup: error = " + error); - } - } - - /** - * @tc.number contact_insert_test_7100 - * @tc.name Add a full field data to the groups table and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contact_insert_test_7100", 0, async function (done) { - console.info("---------logMessage contact_insert_test_7100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage contact_insert_test_7100: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await contactsQuery(map, "contact_insert_test_7100", groupUri); - await deleteAll(groupUri, "contact_insert_test_7100"); - done(); - } catch (error) { - console.info("logMessage contact_insert_test_7100: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_delete_test_7200 - * @tc.name Add a full field data to the groups table and verify whether the insertion is successful - * @tc.desc Function test - */ - it("contact_delete_test_7200", 0, async function (done) { - console.info("------logMessage contact_delete_test_7200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var insertRawContactValues = { - "display_name": "xiaocai", - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_delete_test_7200: rawContactId = " + rawContactId); - await insertData(rawContactId, "group_membership", 1, ""); - - var insertRawContactValuesOne = { - "display_name": "xiaotian", - }; - var rawContactIdOne = await DAHelper.insert(rawContactUri, insertRawContactValuesOne); - console.info("logMessage contact_delete_test_7200: rawContactId = " + rawContactIdOne); - await insertData(rawContactIdOne, "group_membership", 1, ""); - var insertRawContactValuesTwo = { - "display_name": "xiaoli", - }; - var rawContactIdTwo = await DAHelper.insert(rawContactUri, insertRawContactValuesTwo); - console.info("logMessage contact_delete_test_7200: rawContactId = " + rawContactIdTwo); - await insertData(rawContactIdTwo, "group_membership", 1, ""); - sleep(1000); - await deleteAll(contactDataUri, "contact_delete_test_7200"); - sleep(1000); - await queryZeroGroup("contact_delete_test_7200", DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo); - await deleteRawContact("contact_delete_test_7200"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_7200: raw_contact insert error = " + error); - done(); - } - }); - - async function queryZeroGroup(tag, DAHelper, rawContactId, rawContactIdOne, rawContactIdTwo) { - - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryZeroGroup start ! DAHelper = ' + DAHelper); - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdOne.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdTwo.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - console.info(tag + ': queryZeroGroup! resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage queryZeroGroup: error = " + error); - } - } - - /** - * @tc.number contact_delete_test_7300 - * @tc.name Delete the full field data of a groups table and verify whether the deletion is successful - * @tc.desc Function test - */ - it("contact_delete_test_7300", 0, async function (done) { - console.info("---------logMessage contact_delete_test_7300 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage contact_delete_test_7300: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await contactsQuery(map, "contact_delete_test_7300", groupUri); - await deleteAll(groupUri, "contact_delete_test_7300"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_7300: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_delete_test_7400 - * @tc.name Add a raw_contact all fields, delete raw_contact - * @tc.desc Function test - */ - it("contact_delete_test_7400", 0, async function (done) { - console.info("------logMessage contact_Delete_test_7400 is starting!-----"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactId = await DAHelper.insert(rawContactUri, common.getProfileRawContact()); - sleep(1000); - console.info('logMessage contact_Delete_test_7400: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var map = common.getProfileRawContactMap(); - map.set("id", rawContactId.toString()); - map.set("version", "2"); - map.set("is_deleted", "1"); - await deleteAll(rawContactUri, "contact_Delete_test_7400"); - sleep(1000); - await contactsQuery(map, "contact_Delete_test_7400", rawContactUri); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - var code = await DAHelper.delete(deletedUri, conditionAll); - console.info('contact_Delete_test_7400 : Completely delete code = ' + code); - expect(code == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_Delete_test_7400: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_delete_test_7500 - * @tc.name Delete contact_data Single full field data in data table - * @tc.desc Function test - */ - it("contact_delete_test_7500", 0, async function (done) { - console.info("------logMessage contact_delete_test_7500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_delete_test_7500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues = common.getProfileContactData(); - contactDataValues["raw_contact_id"] = rawContactId; - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - console.info('logMessage contact_delete_test_7500: contactDataId = ' + contactDataId); - expect(contactDataId > 0).assertTrue(); - await deleteAll(contactDataUri, "contact_delete_test_7500"); - var map = new Map(); - map.set("id", contactDataId.toString()); - await queryIdForDelete(map, "contact_delete_test_7500", contactDataUri); - await deleteRawContact("contact_delete_test_7500"); - done(); - } catch (error) { - console.info("logMessage contact_delete_test_7500: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertDataAll_test_7600 - * @tc.name Add all details of a single contact and verify whether the insertion is successful (name, mobile - * number, company, position, nickname, email, home, remarks, aim) - * @tc.desc Function test - */ - it("contact_insertDataAll_test_7600", 0, async function (done) { - console.info("------logMessage contact_insertDataAll_test_7600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataAll_test_7600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactdata1 = await insertData(rawContactId, "name", "xiaocai", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdata1, "xiaocai"); - var contactdata2 = await insertData(rawContactId, "phone", "6500", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdata2, "6500"); - var contactdatd3 = await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd3, "TTTTT"); - var contactdatd4 = await insertData(rawContactId, "nickname", "xxxxcai", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd4, "xxxxcai"); - var contactdatd5 = await insertData(rawContactId, "email", "111@fox.com", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd5, "111@fox.com"); - var contactdatd6 = await insertData(rawContactId, "postal_address", "dddd", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd6, "dddd"); - var contactdatd7 = await insertData(rawContactId, "note", "caicai", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd7, "caicai"); - var contactdatd8 = await insertData(rawContactId, "im", "999999999", ""); - await queryAlldata("contact_insertDataAll_test_7600", DAHelper, rawContactId, contactdatd8, "999999999"); - sleep(1000); - await deleteRawContact("contact_insertDataAll_test_7600"); - await deleteAll(contactDataUri, "contact_insertDataAll_test_7600"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataAll_test_7600: raw_contact insert error = " + error); - done(); - } - }); - - async function queryAlldata(tag, DAHelper, rawContactId, contactdata, values) { - var resultColumns = ["raw_contact_id", "detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactdata.toString()); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("raw_contact_id")); - console.info(tag + " result raw_contact_id = " + id); - expect(id == rawContactId).assertEqual(true); - var info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - console.info(tag + " result info = " + info + " value = " + values); - expect(info == values).assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - /** - * @tc.number contact_insertDataAll_test_7700 - * @tc.name Add all details of a single contact and verify whether the insertion is successful (name, mobile - * number, company, position, nickname, email, home, remarks, aim, birthday, website, assistant, group, phone ring) - * @tc.desc Function test - */ - it("contact_insertDataAll_test_7700", 0, async function (done) { - console.info("------logMessage contact_insertDataAll_test_7700 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues = { - "display_name": "xiaocai", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataAll_test_7700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactdata1 = await insertData(rawContactId, "name", "xiaocai", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdata1, "xiaocai"); - var contactdata2 = await insertData(rawContactId, "phone", "6500", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdata2, "6500"); - var contactdatd3 = await insertData(rawContactId, "organization", "TTTTT", "Deve"); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd3, "TTTTT"); - var contactdatd4 = await insertData(rawContactId, "nickname", "xxxxcai", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd4, "xxxxcai"); - var contactdatd5 = await insertData(rawContactId, "email", "111@fox.com", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd5, "111@fox.com"); - var contactdatd6 = await insertData(rawContactId, "postal_address", "dddd", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd6, "dddd"); - var contactdatd7 = await insertData(rawContactId, "note", "caicai", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd7, "caicai"); - var contactdatd8 = await insertData(rawContactId, "im", "999999999", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd8, "999999999"); - var contactdatd9 = await insertData(rawContactId, "contact_event", "1125", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd9, "1125"); - var contactdatd10 = await insertData(rawContactId, "website", "wwww.xxx.com", ""); - await queryAlldata( - "contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd10, "wwww.xxx.com"); - var contactdatd11 = await insertData(rawContactId, "relation", "xiaobai", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd11, "xiaobai"); - var contactdatd12 = await insertData(rawContactId, "group_membership", 1, ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd12, 1); - var contactdatd13 = await insertData(rawContactId, "contact_misc", "5678", ""); - await queryAlldata("contact_insertDataAll_test_7700", DAHelper, rawContactId, contactdatd13, "5678"); - sleep(1000); - await deleteRawContact("contact_insertDataAll_test_7700"); - await deleteAll(contactDataUri, "contact_insertDataAll_test_7700"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataAll_test_7700: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number contact_insertDataUpdateMore_test_7800 - * @tc.name Modify multiple contact details and verify whether the modification is successful - * @tc.desc Function test - */ - it("contact_insertDataUpdateMore_test_7800", 0, async function (done) { - console.info("------logMessage contact_insertDataUpdateMore_test_7800 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xiaocai" - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_insertDataUpdateMore_test_7800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaotian", ""); - - var insertRawContactValues1 = { - "display_name": "xiaotian" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - console.info("logMessage contact_insertDataUpdateMore_test_7800: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await insertData(rawContactId, "name", "xiaotian", ""); - - var updateValues = { - "detail_info": "xiaocai7800" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()) - var updataCode = await DAHelper.update(contactDataUri, updateValues, condition); - console.info('logMessage contact_insertDataUpdateMore_test_7800: updataCode = ' + updataCode); - sleep(1000); - await insertDataUpdateMoreQuery( - "contact_insertDataUpdateMore_test_7800", DAHelper, rawContactId, rawContactIdFirst); - await deleteRawContact("contact_insertDataUpdateMore_test_7800"); - await deleteAll(contactDataUri, "contact_insertDataUpdateMore_test_7800"); - done(); - } catch (error) { - console.info("logMessage contact_insertDataUpdateMore_test_7800: raw_contact insert error = " + error); - done(); - } - }); - - async function insertDataUpdateMoreQuery(tag, DAHelper, rawContactId, rawContactIdFirst) { - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - condition.or(); - condition.equalTo("raw_contact_id", rawContactIdFirst.toString()) - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var info = resultSet.getString(resultSet.getColumnIndex("detail_info")); - console.info(tag + " result info = " + info); - expect(info == "xiaocai7800").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage : error = " + error); - } - } - - /** - * @tc.number contact_deleterestore_test_7900 - * @tc.name Delete contacts and restore - * @tc.desc Function test - */ - it("contact_deleterestore_test_7900", 0, async function (done) { - console.info("------logMessage contact_deleterestore_test_7900 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli7900" - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage contact_deleterestore_test_7900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(1000); - var condition1 = new ohosDataAbility.DataAbilityPredicates(); - condition1.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(rawContactUri, condition1); - console.info("contact_deleterestore_test_7900 " + - ': deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - sleep(1000); - - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.equalTo("id", rawContactId.toString()); - var updatevalue = { - "is_deleted": 0 - }; - var updateCode = await DAHelper.update(rawContactUri, updatevalue, condition2); - console.info('contact_deleterestore_test_7900 : update = ' + updateCode); - sleep(1000); - - var condition3 = new ohosDataAbility.DataAbilityPredicates(); - condition3.equalTo("id", rawContactId.toString()); - var code = await DAHelper.delete(deletedRawContactRecord, condition3); - console.info('contact_deleterestore_test_7900 : record code = ' + code); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("is_deleted", "0"); - await contactsQuery(map, "contact_deleterestore_test_7900", rawContactUri); - await deleteRawContact("contact_deleterestore_test_7900"); - done(); - } catch (error) { - console.info("logMessage contact_deleterestore_test_7900: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_updateData_test_8000 - * @tc.name When modifying contact_data table, incorrect field or table name or nonexistent value is passed in - * @tc.desc Function test - */ - it("abnormal_contact_updateData_test_8000", 0, async function (done) { - console.info("------logMessage abnormal_contact_updateData_test_8000 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli8000" - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage abnormal_contact_updateData_test_8000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - sleep(1000); - var contactDataId = await insertData(rawContactId, "name", "xaioli8000", ""); - console.info("logMessage abnormal_contact_updateData_test_8000: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = { - "display_namess": "xaioli80000000" - }; - condition.equalTo("id", contactDataId.toString()); - var code = await DAHelper.update(contactDataUri, updateValues, condition); - console.info('abnormal_contact_updateData_test_8000 : update code = ' + code); - expect(code == -1).assertTrue(); - var map = new Map(); - map.set("id", contactDataId.toString()); - map.set("display_name", "xaioli8000"); - await contactsQuery(map, "abnormal_contact_updateData_test_8000", contactDataUri); - await deleteRawContact("abnormal_contact_updateData_test_8000"); - await deleteAll(contactDataUri, "abnormal_contact_updateData_test_8000"); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_updateData_test_8000: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_favorite_test_8100 - * @tc.name When collecting contacts, an incorrect field was passed in - * @tc.desc Function test - */ - it("abnormal_contact_favorite_test_8100", 0, async function (done) { - console.info("------logMessage abnormal_contact_favorite_test_8100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli8100", "favoriteeee": 1 - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage abnormal_contact_favorite_test_8100: rawContactId = " + rawContactId); - expect(rawContactId == -1).assertTrue(); - sleep(1000); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_favorite_test_8100: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_blocklist_test_8200 - * @tc.name When adding to the blocklist, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_blocklist_test_8200", 0, async function (done) { - console.info("------logMessage abnormal_contact_blocklist_test_8200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertValues = { - "phone_numberss": "9999999", - }; - var id = await DAHelper.insert(contactBlocklistUri, insertValues); - console.info("logMessage abnormal_contact_blocklist_test_8200: id = " + id); - expect(id == -1).assertTrue(); - sleep(1000); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_blocklist_test_8200: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_group_test_8300 - * @tc.name When joining a group, an incorrect field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_group_test_8300", 0, async function (done) { - console.info("------logMessage abnormal_contact_group_test_8300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues = { - "display_name": "xaioli8100" - }; - var rawContactId = await DAHelper.insert(rawContactUri, insertRawContactValues); - console.info("logMessage abnormal_contact_group_test_8300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_typess": "group_membership", - "detail_info": 1 - }; - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("abnormal_contact_group_test_8300 logMessage : contactDataId " + contactDataId); - expect(contactDataId == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_contact_group_test_8300: raw_contact insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_query_test_8400 - * @tc.name When querying the basic information of multiple contacts, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8400", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8400" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli8400" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8400"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8400: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - condition.or(); - condition.equalTo("ids", rawContactIdFirst.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8400: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8400: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8500 - * @tc.name When querying the basic information of all contacts, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8500", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8500" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli8500" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8500"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8500: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("ids", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8500: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8500: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8600 - * @tc.name When querying all the information of a single contact, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8600", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8600" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8600: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "display_names"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8600: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8600: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8700 - * @tc.name An incorrect field was passed in when querying group members - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8700", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8700" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "group_membership", 1, ""); - console.info("logMessage abnormal_contact_query_test_8700: dataId = " + dataId); - expect(dataId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8700"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8700: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["raw_contact_id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("content_typess", "group_membership"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8700: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8700: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8800 - * @tc.name An incorrect field was passed in when querying favorite contacts - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8800", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian8700", "favorite": 1 - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8800: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8800"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8800: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8800: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8800: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_8900 - * @tc.name An incorrect field was passed in when querying recent contacts - * @tc.desc Function test - */ - it("abnormal_contact_query_test_8900", 0, async function (done) { - console.info("------------abnormal_contact_query_test_8900 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaoyuzhou", "lastest_contacted_time": 60 - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_8900: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_8900"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8900: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("lastest_contacted_timess", "50"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_8900: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_8900: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_9000 - * @tc.name An error field was passed in when querying the recently deleted contact - * @tc.desc Function test - */ - it("abnormal_contact_query_test_9000", 0, async function (done) { - console.info("------------abnormal_contact_query_test_9000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_9000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - console.info(tag + ': deleteRawContact deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_9000"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9000: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.orderByDesc("delete_timess"); - try { - var resultSet = await DAHelper.query(deletedRawContactUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_9000: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9000: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_9100 - * @tc.name When querying all mobile phone numbers, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_9100", 0, async function (done) { - console.info("------------abnormal_contact_query_test_9100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9100" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_9100: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "phone", "11159100", ""); - console.info("logMessage abnormal_contact_query_test_9100: dataId = " + dataId); - var dataId1 = await insertData(rawContactId, "phone", "111591009100", ""); - console.info("logMessage abnormal_contact_query_test_9100: dataId1 = " + dataId1); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_9100"); - await deleteAll(contactDataUri, "abnormal_contact_query_test_9100"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9100: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("content_typess", "phone"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_9100: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9100: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_9200 - * @tc.name When querying all mailboxes, an error field was passed in - * @tc.desc Function test - */ - it("abnormal_contact_query_test_9200", 0, async function (done) { - console.info("------------abnormal_contact_query_test_9200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9100" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_query_test_9200: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "email", "fox@1.com", ""); - console.info("logMessage abnormal_contact_query_test_9200: dataId = " + dataId); - var dataId1 = await insertData(rawContactId, "phone", "fox@2.com", ""); - console.info("logMessage abnormal_contact_query_test_9200: dataId1 = " + dataId1); - await abnormalQuery(); - await deleteRawContact("abnormal_contact_query_test_9200"); - await deleteAll(contactDataUri, "abnormal_contact_query_test_9200"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9200: raw_contact insert error' + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["detail_info"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("content_typess", "email"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - expect(resultSet.goToFirstRow()).assertEqual(false); - console.info('logMessage abnormal_contact_query_test_9200: goToFirstRow' + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9200: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_delete_test_10000 - * @tc.name When querying all mailboxes, an error field was passed in - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_10000", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_10000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9300" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_10000: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "email", "fox@1.com", ""); - console.info("logMessage abnormal_contact_delete_test_10000: dataId = " + dataId); - var dataId1 = await insertData(rawContactId, "phone", "fox@2.com", ""); - console.info("logMessage abnormal_contact_delete_test_10000: dataId1 = " + dataId1); - - var errorUri = "dataability:///com.ohos.contactsdataability/contacts/contact_datasss"; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", dataId.toString()); - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", dataId.toString()); - map.set("datail_info", "fox@1.com"); - await contactsQuery(map, "abnormal_contact_delete_test_10000", contactDataUri); - await deleteRawContact("abnormal_contact_delete_test_10000"); - await deleteAll(contactDataUri, "abnormal_contact_delete_test_10000"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_10000: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_delete_test_9300 - * @tc.name When deleting, an incorrect URI was passed in - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_9300", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_9300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9300" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_9300: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "email", "fox@1.com", ""); - console.info("logMessage abnormal_contact_delete_test_9300: dataId = " + dataId); - var dataId1 = await insertData(rawContactId, "phone", "fox@2.com", ""); - console.info("logMessage abnormal_contact_delete_test_9300: dataId1 = " + dataId1); - - var errorUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contactsss"; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactId.toString()); - map.set("display_name", "xiaotian9300"); - await contactsQuery(map, "abnormal_contact_delete_test_9300", rawContactUri); - await deleteRawContact("abnormal_contact_delete_test_9300"); - await deleteAll(contactDataUri, "abnormal_contact_delete_test_9300"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_9300: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_delete_test_9400 - * @tc.name When deleting contacts in batch, an error field is passed in - * @tc.desc Function test - */ - it("abnormal_contact_delete_test_9400", 0, async function (done) { - console.info("------------abnormal_contact_delete_test_9400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9400" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_9400: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli9400" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_delete_test_9400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", rawContactId.toString()); - condition.or(); - condition.equalTo("ids", rawContactIdFirst.toString()) - var deleteCode = await DAHelper.delete(rawContactUri, condition); - console.info('abnormal_contact_delete_test_9400 : deleteCode = ' + deleteCode); - expect(deleteCode == -1).assertTrue(); - await deleteRawContact("abnormal_contact_delete_test_9400"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_delete_test_9400: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_favorite_test_9500 - * @tc.name When collecting contacts in batch, the error field is transferred - * @tc.desc Function test - */ - it("abnormal_contact_favorite_test_9500", 0, async function (done) { - console.info("------------abnormal_contact_favorite_test_9500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9500", "favorite": 0 - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_favorite_test_9500: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli9500", "favorite": 0 - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_favorite_test_9500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = { - "favorites": 1 - }; - condition.equalTo("id", rawContactId.toString()); - condition.or(); - condition.equalTo("id", rawContactIdFirst.toString()) - var code = await DAHelper.update(rawContactUri, updateValues, condition); - console.info(' abnormal_contact_favorite_test_9500 : update code = ' + deleteCode); - expect(code == -1).assertTrue(); - await deleteRawContact("abnormal_contact_favorite_test_9500"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_favorite_test_9500: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_insertblocklist_test_9600 - * @tc.name When collecting contacts in batch, the error field is transferred - * @tc.desc Function test - */ - it("abnormal_contact_insertblocklist_test_9600", 0, async function (done) { - console.info("------------abnormal_contact_insertblocklist_test_9600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9600", - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insertblocklist_test_9600: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "phone", "1234567899600", ""); - console.info("logMessage abnormal_contact_insertblocklist_test_9600: dataId = " + dataId); - var rawContactValues = { - "display_name": "xiaoli9600", - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insertblocklist_test_9600: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var dataId1 = await insertData(rawContactIdFirst, "phone", "1234567899600", ""); - console.info("logMessage abnormal_contact_insertblocklist_test_9600: dataId1 = " + dataId1); - - var blist = { - "phone_numbers": "1234567899600" - }; - var code = await DAHelper.insert(contactBlocklistUri, blist); - expect(code == -1).assertTrue(); - await deleteRawContact("abnormal_contact_insertblocklist_test_9600"); - await deleteAll(contactDataUri, "abnormal_contact_insertblocklist_test_9600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insertblocklist_test_9600: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_insertGroup_test_9700 - * @tc.name When a contact joins a group in batch, an error field is passed - * @tc.desc Function test - */ - it("abnormal_contact_insertGroup_test_9700", 0, async function (done) { - console.info("------------abnormal_contact_insertGroup_test_9700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var rawContactValues = { - "display_name": "xiaotian9700" - }; - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insertGroup_test_9700: rawContactId = " + rawContactId); - expect(rawContactId > 0).assertTrue(); - var contactDataValues1 = { - "raw_contact_id": rawContactId, - "content_typess": "group_membership", - "detail_info": 1 - }; - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues1); - console.info("abnormal_contact_insertGroup_test_9700 logMessage : contactDataId " + contactDataId); - expect(contactDataId == -1).assertTrue(); - var rawContactValues = { - "display_name": "xiaoli9700" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, rawContactValues); - console.info("logMessage abnormal_contact_insertGroup_test_9700: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var contactDataValues2 = { - "raw_contact_id": rawContactIdFirst, - "content_typess": "group_membership", - "detail_info": 1 - }; - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues2); - console.info("abnormal_contact_insertGroup_test_9700 logMessage : contactDataId1 " + contactDataId1); - expect(contactDataId1 == -1).assertTrue(); - await deleteRawContact("abnormal_contact_insertblocklist_test_9600"); - done(); - } catch (error) { - console.info('logMessage abnormal_contact_insertblocklist_test_9600: raw_contact insert error' + error); - done(); - } - }); - - /** - * @tc.number abnormal_contact_pinyinquery_test_9800 - * @tc.name Insert a name with special characters to view the converted Pinyin - * @tc.desc Function test - */ - it("abnormal_contact_pinyinquery_test_9800", 0, async function (done) { - console.info("--------logMessage abnormal_contact_pinyinquery_test_9800 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "李bp玉成욱" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage abnormal_contact_pinyinquery_test_9800 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "name", "李bp玉成욱", ""); - console.info('logMessage abnormal_contact_pinyinquery_test_9800 dataId = ' + dataId); - expect(dataId > 0).assertTrue(); - await query(); - await deleteRawContact("abnormal_contact_pinyinquery_test_9800"); - await deleteAll(contactDataUri, "abnormal_contact_pinyinquery_test_9800") - done(); - } catch (error) { - console.info('logMessage abnormal_contact_pinyinquery_test_9800 raw_contact insert error = ' + error); - done(); - } - - async function query() { - var resultColumns = ["search_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("raw_contact_id", rawContactId.toString()); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var name = resultSet.getString(resultSet.getColumnIndex("search_name")); - console.info( - ' abnormal_contact_pinyinquery_test_9800 :logMessage contactsQuery name = ' + name); - expect(name == "李bp玉成욱||libpyucheng욱||lbpyc욱").assertEqual(true); - } while (resultSet.goToNextRow()); - } - } - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_pinyinquery_test_9800 query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_contact_query_test_9900 - * @tc.name An incorrect field name was passed in during retrieval - * @tc.desc Function test - */ - it("abnormal_contact_query_test_9900", 0, async function (done) { - console.info("--------logMessage abnormal_contact_query_test_9900 is starting!-------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "键盘" - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info('logMessage abnormal_contact_query_test_9900 rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - var dataId = await insertData(rawContactId, "name", "键盘", ""); - console.info('logMessage abnormal_contact_query_test_9900 dataId = ' + dataId); - expect(dataId > 0).assertTrue(); - await query(); - await deleteRawContact("abnormal_contact_query_test_9900"); - await deleteAll(contactDataUri, "abnormal_contact_query_test_9900") - done(); - } catch (error) { - console.info('logMessage abnormal_contact_query_test_9900 raw_contact insert error = ' + error); - done(); - } - - async function query() { - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.like("search_namesss", "%jp%"); - try { - var resultSet = await DAHelper.query(searchContactUri, resultColumns, condition); - console.info( - ' abnormal_contact_query_test_9900 :resultSet.goToFirstRow() = ' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow() == false).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_contact_pinyinquery_test_9800 query error = ' + error); - done(); - } - } - }); - - afterAll(async function () { - var tag = "Contacts_test_start_deleted"; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var DAHelperContact = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': start ! DAHelperContact = ' + DAHelperContact); - var deleteBlockList = await DAHelperContact.delete(contactBlocklistUri, condition); - console.info(tag + " : logMessage : deleteBlockList = " + deleteBlockList); - var deletedGroup = await DAHelperContact.delete(groupUri, condition); - console.info(tag + " : logMessage : deletedGroup = " + deletedGroup); - var dataDeletedCode = await DAHelperContact.delete(contactDataUri, condition); - sleep(2000); - console.info(tag + " : logMessage : dataDeletedCode = " + dataDeletedCode); - var rawContactDeleted = await DAHelperContact.delete(rawContactUri, condition); - sleep(2000); - console.info(tag + " : logMessage : rawContactDeleted = " + rawContactDeleted); - var deleted = await DAHelperContact.delete(deletedUri, condition); - sleep(2000); - console.info(tag + " : logMessage : deleted = " + deleted); - }); - }); -} diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Groups_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Groups_test.js deleted file mode 100644 index 7d6285b6fe388de712505a36eeefdf675a63b953..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Groups_test.js +++ /dev/null @@ -1,574 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; -import common from './common.js'; - -export default function GroupsTest() { - describe('GroupsTest', function () { - console.info('logMessage GroupsTest start! '); - - async function groupsQuery(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': groupsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ': logMessage groupsQuery key =' + key + 'dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertTrue(); - } - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info(tag + ': logMessage groupsQuery: error = ' + error); - } - } - - async function queryIdForDelete(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': queryIdForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage queryIdForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage queryIdForDelete: error = " + error); - } - } - - async function deleteAll(uri, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(uri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } - - /** - * @tc.number group_insert_test_100 - * @tc.name Insert group - * @tc.desc Function test - */ - it("group_insert_test_100", 0, async function (done) { - console.info("---------logMessage group_insert_test_100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage group_insert_test_100: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await groupsQuery(map, "group_insert_test_100"); - await deleteAll(groupUri, "group_insert_test_100"); - done(); - } catch (error) { - console.info("logMessage group_insert_test_100: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number group_update_test_500 - * @tc.name Update group - * @tc.desc Function test - */ - it("group_update_test_500", 0, async function (done) { - console.info("---------logMessage group_update_test_500 is starting!----------"); - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage group_update_test_500: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupUpdate(); - await deleteAll(groupUri, "group_update_test_500"); - done(); - } catch (error) { - console.info("logMessage group_update_test_500: group insert error = " + error); - done(); - } - - async function groupUpdate() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", groupId.toString()); - try { - var updateCode = await DAHelper.update(groupUri, common.getProfileUpdateGroup(), condition); - console.info("logMessage group_update_test_500: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = common.getProfileUpdateGroupMap(); - map.set("id", groupId.toStirng()); - await groupsQuery(map, "group_update_test_500"); - } catch (error) { - console.info("logMessage group_update_test_500: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number group_delete_test_200 - * @tc.name Delete group - * @tc.desc Function test - */ - it("group_delete_test_200", 0, async function (done) { - console.info("---------logMessage group_delete_test_200 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage group_delete_test_200: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupDelete(); - done(); - } catch (error) { - console.info("logMessage group_delete_test_200: group insert error = " + error); - done(); - } - async function groupDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", groupId.toString()); - try { - var deleteCode = await DAHelper.delete(groupUri, condition); - console.info("logMessage group_delete_test_200 : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", groupId.toString()); - await queryIdForDelete(map, "group_delete_test_200"); - } catch (error) { - console.info("logMessage group_delete_test_200 : delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number group_query_test_300 - * @tc.name Query a group - * @tc.desc Function test - */ - it("group_query_test_300", 0, async function (done) { - console.info("------------logMessage group_query_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage group_query_test_300: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - var map = common.getProfileGroupMap(); - map.set("id", groupId.toString()); - await groupsQuery(map, "logMessage group_query_test_300"); - await deleteAll(groupUri, "group_query_test_300"); - done(); - } catch (error) { - console.info("logMessage group_query_test_300: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number group_query_test_400 - * @tc.name Query all groups - * @tc.desc Function test - */ - it("group_query_test_400", 0, async function (done) { - console.info("------------logMessage group_query_test_400 is starting!-----------"); - console.info("---------logMessage getDbHelper start!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_CONTACTS); - var groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; - - var insertValues = { - "group_name": "ManagerSecondGroup" - }; - try { - var groupId = await DAHelper.insert(groupUri, insertValues); - console.info("logMessage group_query_test_400: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupQuery(); - await deleteAll(groupUri, "group_query_test_400"); - done(); - } catch (error) { - console.info("logMessage group_query_test_400: group insert error = " + error); - done(); - } - - async function groupQuery() { - var resultColumns = ["id", "group_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info("logMessage group_query_test_400: resultSet.rowCount = " + resultSet.rowCount); - expect(resultSet.rowCount == 1).assertTrue(); - resultSet.close(); - } catch (error) { - console.info("group_query_test_400 resultSet query error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_group_insert_test_600 - * @tc.name abnormal insert - * @tc.desc Function test - */ - it("abnormal_group_insert_test_600", 0, async function (done) { - console.info("---------logMessage abnormal_group_insert_test_600 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - const errorUri = "dataability:///com.ohos.contactsdataability/contacts/groupssss"; - try { - var groupId = await DAHelper.insert(errorUri, common.getProfileGroup()); - console.info("logMessage abnormal_group_insert_test_600: groupId = " + groupId); - expect(groupId == -1).assertTrue(); - done(); - } catch (error) { - console.info("logMessage abnormal_group_insert_test_600: group insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_group_update_test_700 - * @tc.name abnormal update - * @tc.desc Function test - */ - it("abnormal_group_update_test_700", 0, async function (done) { - console.info("---------logMessage abnormal_group_update_test_700 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage abnormal_group_update_test_700: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupUpdate(); - await deleteAll(groupUri, "abnormal_group_update_test_700"); - done(); - } catch (error) { - console.info("logMessage abnormal_group_update_test_700: group insert error = " + error); - done(); - } - - async function groupUpdate() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", groupId.toString()); - var updateValue = { - "group_notesss": "6666" - } - try { - var updateCode = await DAHelper.update(groupUri, updateValue, condition); - console.info("logMessage abnormal_group_update_test_700: updateCode = " + updateCode); - expect(updateCode == -1).assertTrue(); - var map = common.getProfileUpdateGroupMap(); - map.set("id", groupId.toStirng()); - await groupsQuery(map, "abnormal_group_update_test_700"); - } catch (error) { - console.info("logMessage abnormal_group_update_test_700: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_group_delete_test_800 - * @tc.name abnormal delete - * @tc.desc Function test - */ - it("abnormal_group_delete_test_800", 0, async function (done) { - console.info("---------logMessage abnormal_group_delete_test_800 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var groupId = await DAHelper.insert(groupUri, common.getProfileGroup()); - console.info("logMessage abnormal_group_delete_test_800: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupDelete(); - await deleteAll(groupUri, "abnormal_group_delete_test_800"); - done(); - } catch (error) { - console.info("logMessage abnormal_group_delete_test_800: group insert error = " + error); - done(); - } - async function groupDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("idss", groupId.toString()); - try { - var deleteCode = await DAHelper.delete(groupUri, condition); - console.info("logMessage abnormal_group_delete_test_800 : deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - var map = common.getProfileUpdateGroupMap(); - map.set("id", groupId.toStirng()); - await groupsQuery(map, "abnormal_group_delete_test_800"); - } catch (error) { - console.info("logMessage abnormal_group_delete_test_800 : delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_group_query_test_900 - * @tc.name abnormal query - * @tc.desc Function test - */ - it("abnormal_group_query_test_900", 0, async function (done) { - console.info("------------logMessage abnormal_group_insert_test_900 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "group_name": "PersonnelDepartment" - }; - try { - var groupId = await DAHelper.insert(groupUri, insertValues); - console.info("logMessage abnormal_group_insert_test_900: groupId = " + groupId); - expect(groupId > 0).assertTrue(); - await groupQuery(DAHelper); - await deleteAll(groupUri, "abnormal_group_insert_test_900"); - done(); - } catch (error) { - console.info("logMessage abnormal_group_insert_test_900: group insert error = " + error); - done(); - } - - async function groupQuery(DAHelper) { - var resultColumns = ["id", "group_namesss"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", groupId.toString()); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info('abnormal_group_insert_test_900 resultSet.goToFirstRow() = ' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow() == false).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('abnormal_group_insert_test_900 query error ' + error); - done(); - } - } - }); - - /** - * @tc.number group_insert_test_1000 - * @tc.name Adding multiple groups - * @tc.desc Function test - */ - it("group_insert_test_1000", 0, async function (done) { - console.info("------------logMessage group_insert_test_1000 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "group_name": "test1000" - }; - var insertValuesTwo = { - "group_name": "test1000" - }; - var insertValuesThree = { - "group_name": "test1000" - }; - var array = [] - array[0] = insertValuesOne; - array[1] = insertValuesTwo; - array[2] = insertValuesThree; - try { - var code = await DAHelper.batchInsert(groupUri, array); - console.info("logMessage group_insert_test_1000: batchInsert code = " + code); - expect(code == 0).assertTrue(); - await groupQuery(DAHelper); - await deleteAll(groupUri, "group_insert_test_1000"); - done(); - } catch (error) { - console.info("logMessage group_insert_test_1000: group insert error = " + error); - done(); - } - - async function groupQuery(DAHelper) { - var groupSize = 3; - var resultColumns = ["id", "group_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("group_name", "test1000"); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info('group_insert_test_1000 resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == groupSize).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('group_insert_test_1000 query error ' + error); - done(); - } - } - }); - - /** - * @tc.number group_delete_test_1100 - * @tc.name delete multiple groups - * @tc.desc Function test - */ - it("group_delete_test_1100", 0, async function (done) { - console.info("------------logMessage group_delete_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "group_name": "test1100" - }; - var insertValuesTwo = { - "group_name": "test1100" - }; - var insertValuesThree = { - "group_name": "test1100" - }; - var array = [] - array[0] = insertValuesOne; - array[1] = insertValuesTwo; - array[2] = insertValuesThree; - try { - var code = await DAHelper.batchInsert(groupUri, array); - console.info("logMessage group_delete_test_1100: batchInsert code = " + code); - expect(code == 0).assertTrue(); - await deleteAll(groupUri, "group_delete_test_1100"); - await groupQuery(DAHelper); - done(); - } catch (error) { - console.info("logMessage group_delete_test_1100: group insert error = " + error); - done(); - } - - async function groupQuery(DAHelper) { - var groupSize = 0; - var resultColumns = ["id", "group_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("group_name", "test1100"); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info('group_delete_test_1100 resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == groupSize).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('group_delete_test_1100 query error ' + error); - done(); - } - } - }); - - /** - * @tc.number group_update_test_1200 - * @tc.name update multiple groups - * @tc.desc Function test - */ - it("group_update_test_1200", 0, async function (done) { - console.info("------------logMessage group_update_test_1200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "group_name": "test1200" - }; - var insertValuesTwo = { - "group_name": "test1200" - }; - var insertValuesThree = { - "group_name": "test1200" - }; - var array = [] - array[0] = insertValuesOne; - array[1] = insertValuesTwo; - array[2] = insertValuesThree; - try { - var code = await DAHelper.batchInsert(groupUri, array); - console.info("logMessage group_update_test_1200: batchInsert code = " + code); - expect(code == 0).assertTrue(); - await groupUpdateThree(DAHelper); - await groupQuery(DAHelper); - await deleteAll(groupUri, "group_update_test_1200"); - done(); - } catch (error) { - console.info("logMessage group_update_test_1200: group insert error = " + error); - done(); - } - - async function groupQuery(DAHelper) { - var groupSize = 3; - var resultColumns = ["id", "group_name"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("group_name", "test120000"); - try { - var resultSet = await DAHelper.query(groupUri, resultColumns, condition); - console.info("logMessage group_update_test_1200: resultSet.rowCount = " + resultSet.rowCount); - expect(resultSet.rowCount == groupSize).assertTrue(); - resultSet.close(); - } catch (error) { - console.info('group_update_test_1200 query error ' + error); - done(); - } - } - }); - - async function groupUpdateThree(DAHelper) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("group_name", "test1200"); - var updateValue = { - "group_name": "test120000" - } - try { - var updateCode = await DAHelper.update(groupUri, updateValue, condition); - console.info("logMessage group_update_test_1200: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage group_update_test_1200: update error = " + error); - } - } - - afterAll(async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", "0"); - try { - var deleteCode = await DAHelper.delete(groupUri, condition); - console.info("logMessage group_deleted : deleteCode = " + deleteCode); - done(); - } catch (error) { - console.info("logMessage group_deleted: group insert error = " + error); - done(); - } - }); - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ObjectInterface_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ObjectInterface_test.js deleted file mode 100644 index 7c39baeda761de8880fbaa66e027cd6e59e0bced..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/ObjectInterface_test.js +++ /dev/null @@ -1,915 +0,0 @@ -/* - * 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 contactsapi from "@ohos.contact"; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const profileRawContactUri = "dataability:///com.ohos.contactsdataability/profile/raw_contact"; - -export default function ObjectInterfaceTest() { - describe('ObjectInterfaceTest', function () { - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - var contactData = { - id: 0, - key: "0", - contactAttributes: { - attributes: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] - }, - emails: [{ - email: "email", labelName: "自定义邮箱", labelId: 1, displayName: "emailDisplayName" - }], - events: [{ - eventDate: "event", labelName: "自定义event", labelId: 2 - }], - groups: [{ - groupId: 1, title: "群组" - }], - imAddresses: [{ - imAddress: "imAddress", labelName: "自定义", labelId: 3 - }], - phoneNumbers: [{ - phoneNumber: "183", labelName: "自定义phoneNumbers", labelId: 4 - }], - portrait: { - uri: "content://head/0" - }, - postalAddresses: [{ - city: "南京", - country: "中国", - labelName: "labelName", - neighborhood: "neighborhood", - pobox: "pobox", - postalAddress: "postalAddress", - postcode: "postcode", - region: "region", - street: "street", - labelId: 5 - }], - relations: [{ - relationName: "relationName", labelName: "自定义relationName", labelId: 6 - }], - sipAddresses: [{ - sipAddress: "sipAddress", labelName: "自定义sipAddress", labelId: 6 - }], - websites: [{ - website: "website" - }], - name: { - familyName: "familyName", - familyNamePhonetic: "familyNamePhonetic", - fullName: "小李", - givenName: "givenName", - givenNamePhonetic: "givenNamePhonetic", - middleName: "middleName", - middleNamePhonetic: "middleNamePhonetic", - namePrefix: "namePrefix", - nameSuffix: "nameSuffix" - }, - nickName: { - nickName: "nickName" - }, - note: { - noteContent: "note" - }, - organization: { - name: "TT", title: "开发" - } - }; - - var gRawContactId; - var gGroup; - - /** - * @tc.number contactsApi_insert_test_100 - * @tc.name Insert contact information - * @tc.desc Function test - */ - it("contactsApi_insert_test_100", 0, async function (done) { - try { - var rawContactId = await contactsapi.addContact(contactData); - console.info("contactsApi_insert_test_100 : rawContactId = " + rawContactId); - gRawContactId = rawContactId; - expect(gRawContactId > 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_insert_test_100 : raw_contact insert error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_delete_test_200 - * @tc.name Delete contact information - * @tc.desc Function test - */ - it("contactsApi_delete_test_200", 0, async function (done) { - var deleteId = gRawContactId; - try { - var deleteCode = await contactsapi.deleteContact(deleteId); - var gDelete = deleteCode; - console.info("contactsApi_delete_test_200 : deleteCode = " + deleteCode); - expect(gDelete == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_delete_test_200 : delete error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_update_test_300 - * @tc.name Update contact information - * @tc.desc Function test - */ - it("contactsApi_update_test_300", 0, async function (done) { - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var rawContactId = await contactsapi.addContact(contactData); - console.info("contactsApi_insert_test_300 : rawContactId = " + rawContactId); - gRawContactId = rawContactId; - expect(rawContactId > 0).assertTrue(); - - var updateValues = { - id: gRawContactId, name: { - fullName: "小红" - } - }; - var condition = { - attributes: [6] - } - try { - var updateCode = await contactsapi.updateContact(updateValues, condition); - console.info("contactsApi_update_test_300 : updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_update_test_300 : update error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contact_test_400 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contact_test_400", 0, async function (done) { - var queryId = gRawContactId; - try { - var resultSet = await contactsapi.queryContact(queryId); - console.info("contactsApi_query_contact_test_400 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contact_test_400 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contact_test_500 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contact_test_500", 0, async function (done) { - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - var queryId = gRawContactId.toString(); - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryContact(queryId, holder); - console.info("contactsApi_query_contact_test_500 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contact_test_500 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contact_test_600 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contact_test_600", 0, async function (done) { - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - var queryId = gRawContactId.toString(); - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - }; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContact(queryId, holder, ContactAttributes); - console.info("contactsApi_query_contact_test_600 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contact_test_600 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contacts_test_700 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contacts_test_700", 0, async function (done) { - try { - var resultSet = await contactsapi.queryContacts(); - console.info("contactsApi_query_contacts_test_700 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contacts_test_700 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contacts_test_800 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contacts_test_800", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryContacts(holder); - console.info("contactsApi_query_contacts_test_800 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contacts_test_800 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contacts_test_900 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contacts_test_900", 0, async function (done) { - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContacts(ContactAttributes); - console.info("contactsApi_query_contacts_test_900 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contacts_test_900 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_contacts_test_1000 - * @tc.name Query contacts information - * @tc.desc Function test - */ - it("contactsApi_query_contacts_test_1000", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - }; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContacts(holder, ContactAttributes); - console.info("contactsApi_query_contacts_test_1000 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_contacts_test_1000 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_email_test_1100 - * @tc.name Query email information - * @tc.desc Function test - */ - it("contactsApi_query_email_test_1100", 0, async function (done) { - var email = "email"; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryContactsByEmail(email, holder); - console.info("contactsApi_query_email_test_1100 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_email_test_1100 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_email_test_1200 - * @tc.name Query email information - * @tc.desc Function test - */ - it("contactsApi_query_email_test_1200", 0, async function (done) { - var email = "email"; - try { - var resultSet = await contactsapi.queryContactsByEmail(email); - console.info("contactsApi_query_email_test_1200 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_email_test_1200 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_email_test_1300 - * @tc.name Query email information - * @tc.desc Function test - */ - it("contactsApi_query_email_test_1300", 0, async function (done) { - var email = "email"; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - }; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContactsByEmail(email, holder, ContactAttributes); - console.info("contactsApi_query_email_test_1300 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_email_test_1300 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_email_test_1400 - * @tc.name Query email information - * @tc.desc Function test - */ - it("contactsApi_query_email_test_1400", 0, async function (done) { - var email = "email"; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContactsByEmail(email, ContactAttributes); - console.info("contactsApi_query_email_test_1400 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_email_test_1400 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_phoneNumber_test_1500 - * @tc.name Query phoneNumber information - * @tc.desc Function test - */ - it("contactsApi_query_phoneNumber_test_1500", 0, async function (done) { - var phoneNumber = "183"; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber, holder); - console.info("contactsApi_query_phoneNumber_test_1500 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_phoneNumber_test_1500 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_phoneNumber_test_1600 - * @tc.name Query phoneNumber information - * @tc.desc Function test - */ - it("contactsApi_query_phoneNumber_test_1600", 0, async function (done) { - var phoneNumber = "183"; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - }; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber, holder, ContactAttributes); - console.info("contactsApi_query_phoneNumber_test_1600 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_phoneNumber_test_1600 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_phoneNumber_test_1700 - * @tc.name Query phoneNumber information - * @tc.desc Function test - */ - it("contactsApi_query_phoneNumber_test_1700", 0, async function (done) { - var phoneNumber = "183"; - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber); - console.info("contactsApi_query_phoneNumber_test_1700 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_phoneNumber_test_1700 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_phoneNumber_test_1800 - * @tc.name Query phoneNumber information - * @tc.desc Function test - */ - it("contactsApi_query_phoneNumber_test_1800", 0, async function (done) { - var phoneNumber = "183"; - var ContactAttributes = { - attributes: [1, 5, 6] - } - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber, ContactAttributes); - console.info("contactsApi_query_phoneNumber_test_1800 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_phoneNumber_test_1800 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_group_test_1900 - * @tc.name Query group - * @tc.desc Function test - */ - it("contactsApi_query_group_test_1900", 0, async function (done) { - try { - var resultSet = await contactsapi.queryGroups(); - console.info("contactsApi_query_group_test_1900 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_group_test_1900 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_group_test_2000 - * @tc.name Query group - * @tc.desc Function test - */ - it("contactsApi_query_group_test_2000", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryGroups(holder); - console.info("contactsApi_query_group_test_2000 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_group_test_2000 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_holders_test_2200 - * @tc.name Query holders information - * @tc.desc Function test - */ - it("contactsApi_query_holders_test_2200", 0, async function (done) { - try { - var resultSet = await contactsapi.queryHolders(); - console.info("contactsApi_query_holders_test_2200 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet != null).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_holders_test_2200 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_key_test_2300 - * @tc.name Query key information - * @tc.desc Function test - */ - it("contactsApi_query_key_test_2300", 0, async function (done) { - var idtest = gRawContactId; - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryKey(idtest, holder); - console.info("contactsApi_query_key_test_2300 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length != 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_key_test_2300 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_key_test_2400 - * @tc.name Query key information - * @tc.desc Function test - */ - it("contactsApi_query_key_test_2400", 0, async function (done) { - var idtest = gRawContactId; - console.info("contactsApi_query_key_test_2400 : query gRawContactId = " + idtest); - try { - var resultSet = await contactsapi.queryKey(idtest); - console.info("contactsApi_query_key_test_2400 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length != 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_key_test_2400 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_query_mycard_test_2500 - * @tc.name Query mycard information - * @tc.desc Function test - */ - it("contactsApi_query_mycard_test_2500", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts", displayName: "phone", holderId: 1 - } - try { - var resultSet = await contactsapi.queryMyCard(holder); - console.info("contactsApi_query_mycard_test_2500 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_mycard_test_2500 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_isMyCard_test_2600 - * @tc.name Query mycard exist - * @tc.desc Function test - */ - it("contactsApi_isMyCard_test_2600", 0, async function (done) { - var id = 1; - try { - var isExist = await contactsapi.isMyCard(id); - console.info("contactsApi_isMyCard_test_2600 : query isExist = " + isExist); - expect(isExist == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_isMyCard_test_2600 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number contactsApi_isLocalContact_test_2700 - * @tc.name Query isLocalContact exist - * @tc.desc Function test - */ - it("contactsApi_isLocalContact_test_2700", 0, async function (done) { - var id = gRawContactId; - try { - var isExist = await contactsapi.isLocalContact(id); - console.info("logMessage contactsApi_isLocalContact_test_2700 isExist = " + isExist); - expect(isExist == 1).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_isLocalContact_test_2700 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_insert_test_2800 - * @tc.name contactsApi_insert error - * @tc.desc Function test - */ - it("abnormal_contactsApi_insert_test_2800", 0, async function (done) { - var contactDataError = {}; - try { - var rawContactId = await contactsapi.addContact(contactDataError); - console.info("abnormal_contactsApi_insert_test_2800 : rawContactId = " + rawContactId); - expect(rawContactId == -1).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_insert_test_100 : raw_contact insert error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_update_test_3000 - * @tc.name contactsApi_update error - * @tc.desc Function test - */ - it("abnormal_contactsApi_update_test_3000", 0, async function (done) { - var rawContactId = -1; - var updateValues = { - id: rawContactId, name: { - fullName: "小红" - } - }; - var condition = { - attributes: [6] - } - try { - var updateCode = await contactsapi.updateContact(updateValues, condition); - console.info("abnormal_contactsApi_update_test_3000 : updateCode = " + updateCode); - expect(updateCode == -1).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_update_test_3000 : update error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_contact_test_3100 - * @tc.name contactsApi_query_contact error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_contact_test_3100", 0, async function (done) { - var queryId = "-1"; - try { - var resultSet = await contactsapi.queryContact(queryId); - if (resultSet == null) { - console.info("abnormal_contactsApi_query_contact_test_3100 is null"); - } - if (resultSet == undefined) { - console.info("abnormal_contactsApi_query_contact_test_3100 is undefined"); - } - console.info("abnormal_contactsApi_query_contact_test_3100 : updateCode = " + JSON.stringify(resultSet)); - expect(resultSet == undefined).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_contact_test_3100 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_contacts_test_3200 - * @tc.name contactsApi_query_contacts error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_contacts_test_3200", 0, async function (done) { - var ContactAttributes = { - attributes: [100] - } - try { - var resultSet = await contactsapi.queryContacts(ContactAttributes); - if (resultSet == null) { - console.info("abnormal_contactsApi_query_contacts_test_3200 is null"); - } - if (resultSet == undefined) { - console.info("abnormal_contactsApi_query_contacts_test_3200 is undefined"); - } - console.info( - "abnormal_contactsApi_query_contacts_test_3200 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_contacts_test_3200 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_email_test_3300 - * @tc.name contactsApi_query_email error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_email_test_3300", 0, async function (done) { - var email = "email2222"; - try { - var resultSet = await contactsapi.queryContactsByEmail(email); - console.info("abnormal_contactsApi_query_email_test_3300 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_email_test_3300 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_phoneNumber_test_3400 - * @tc.name contactsApi_query_phoneNumber error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_phoneNumber_test_3400", 0, async function (done) { - var phoneNumber = "19999999"; - try { - var resultSet = await contactsapi.queryContactsByPhoneNumber(phoneNumber); - console.info( - "abnormal_contactsApi_query_phoneNumber_test_3400 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_phoneNumber_test_3400 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_group_test_3500 - * @tc.name contactsApi_query_group error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_group_test_3500", 0, async function (done) { - var holder = { - bundleName: "com.ohos.contacts2", displayName: "phone2", holderId: 2 - } - try { - var resultSet = await contactsapi.queryGroups(holder); - console.info("abnormal_contactsApi_query_group_test_3500 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("contactsApi_query_group_test_2000 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_key_test_3600 - * @tc.name contactsApi_query_key error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_key_test_3600", 0, async function (done) { - var idtest = -1; - try { - var resultSet = await contactsapi.queryKey(idtest); - console.info("abnormal_contactsApi_query_key_test_3600 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_key_test_3600 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_query_mycard_test_3700 - * @tc.name contactsApi_query_mycard error - * @tc.desc Function test - */ - it("abnormal_contactsApi_query_mycard_test_3700", 0, async function (done) { - var ContactAttributes = { - attributes: [100] - }; - try { - var resultSet = await contactsapi.queryMyCard(ContactAttributes); - console.info( - "abnormal_contactsApi_query_mycard_test_3700 : query resultSet = " + JSON.stringify(resultSet)); - expect(resultSet.length == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_query_mycard_test_3700 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_isMyCard_test_3800 - * @tc.name isMyCard is not exist - * @tc.desc Function test - */ - it("abnormal_contactsApi_isMyCard_test_3800", 0, async function (done) { - var id = 999; - try { - var isExist = await contactsapi.isMyCard(id); - console.info("abnormal_contactsApi_isMyCard_test_3800 : query isExist = " + isExist); - expect(isExist == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_isMyCard_test_3800 query error = " + error); - done(); - } - sleep(2000) - }); - - /** - * @tc.number abnormal_contactsApi_isLocalContact_test_3900 - * @tc.name contactsApi_isLocalContact is not exist - * @tc.desc Function test - */ - it("abnormal_contactsApi_isLocalContact_test_3900", 0, async function (done) { - var id = 999; - try { - var isExist = await contactsapi.isLocalContact(id); - console.info("abnormal_contactsApi_isLocalContact_test_3900 : query isExist = " + isExist); - expect(isExist == 0).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_contactsApi_isLocalContact_test_3900 query error = " + error); - done(); - } - sleep(2000) - }); - }); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Voicemail_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Voicemail_test.js deleted file mode 100644 index 81a54115772b3e4236fa812ec6c335a51ef6c176..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/Voicemail_test.js +++ /dev/null @@ -1,1329 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_VOICEMAIL = "dataability:///com.ohos.voicemailability"; -const voicemailUri = "dataability:///com.ohos.voicemailability/calls/voicemail"; - -export default function VoicemailTest() { - describe('VoicemailTest', function () { - console.log("----------VoicemailTest is starting!----------"); - - async function voiceMailQuery(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ':calllogInsertQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of map) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' :logMessage voiceMailQuery key = ' + key + ' dbresult :' + dbresult + - ' value : ' + value); - expect(value == dbresult).assertTrue(); - } - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info(tag + ":logMessage voiceMailQuery: error = " + error); - } - } - - async function voiceMailQueryForDelete(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': voiceMailQueryForDelete start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", map.get("id")); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage voiceMailQueryForDelete: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage voiceMailQueryForDelete: error = " + error); - } - } - - async function voiceMailQueryError(map, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': voiceMailQueryError start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", map.get("phone_number")); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.goToFirstRow() == false).assertTrue(); - console.info(tag + " :logMessage voiceMailQueryError: goToFirstRow " + resultSet.goToFirstRow()); - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage voiceMailQueryError: error = " + error); - } - } - - async function voiceMailQueryForBatchInsert(array, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': voiceMailQueryForBatchInsert start ! DAHelper = ' + DAHelper); - var resultColumns = common.getCallLogResultColumns(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("phone_number", array[0].get("phone_number")); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - var size = array.size(); - console.info(tag + ' : logMessage voiceMailQueryForBatchInsert: size' + size); - expect(resultSet.rowCount == size).assertEqual(true); - var i = 0; - if (resultSet.rowCount > 0 && resultSet.goToFirstRow()) { - do { - for (var [key, value] of array[i]) { - var dbresult = resultSet.getString(resultSet.getColumnIndex(key)); - console.info(tag + ' : logMessage voiceMailQueryForBatchInsert dbresult :' + dbresult + - ' value : ' + value); - console.info( - tag + ' : logMessage voiceMailQueryForBatchInsert value ' + (value == dbresult)); - expect(value == dbresult).assertTrue(); - } - i++; - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info(tag + " :logMessage calllogQueryByInsert: error = " + error); - } - } - - async function voiceMailDelete(tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info(tag + ': voiceMailDelete deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } - - /** - * @tc.number voicemail_insert_test_100 - * @tc.name Insert voicemail data - * @tc.desc Function test - */ - it("voicemail_insert_test_100", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_100 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var voicemailId = await DAHelper.insert(voicemailUri, common.getVoiceMail()); - console.info("logMessage voicemail_insert_test_100: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - var map = common.getVoiceMailMap(); - map.set("id", voicemailId.toString()); - await voiceMailQuery(map, "voicemail_insert_test_100"); - await voiceMailDelete("voicemail_insert_test_100"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_100: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_200 - * @tc.name Insert voicemail status - * @tc.desc Function test - */ - it("voicemail_insert_test_200", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_200 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "1557254", "voice_status": 1 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - console.info("logMessage voicemail_insert_test_200: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("phone_number", "1557254"); - map.set("voice_status", "1"); - await voiceMailQuery(map, "voicemail_insert_test_200"); - await voiceMailDelete("voicemail_insert_test_200"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_200: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_100000 - * @tc.name Insert voicemail status - * @tc.desc Function test - */ - it("voicemail_insert_test_100000", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_100000 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "1557254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - console.info("logMessage voicemail_insert_test_100000: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("phone_number", "1557254"); - map.set("voice_status", "0"); - await voiceMailQuery(map, "voicemail_insert_test_100000"); - await voiceMailDelete("voicemail_insert_test_100000"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_100000: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_update_test_1000 - * @tc.name Update voicemail data - * @tc.desc Function test - */ - it("voicemail_update_test_1000", 0, async function (done) { - console.info("------------logMessage voicemail_update_test_1000 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - try { - var voicemailId = await DAHelper.insert(voicemailUri, common.getVoiceMail()); - console.info("logMessage voicemail_update_test_1000: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await voicemailUpdate(); - await voiceMailDelete("voicemail_update_test_1000"); - done(); - } catch (error) { - console.info("logMessage voicemail_update_test_1000: voicemail insert error = " + error); - done(); - } - - async function voicemailUpdate() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var updateCode = await DAHelper.update(voicemailUri, common.getVoiceMailUpdate(), condition); - console.info("logMessage voicemail_update_test_1000: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = common.getVoiceMailUpdateMap(); - map.set("id", voicemailId.toString()); - await voiceMailQuery(map, "voicemail_update_test_1000"); - } catch (error) { - console.info("logMessage voicemail_update_test_1000: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_update_test_900 - * @tc.name Update voicemail status - * @tc.desc Function test - */ - it("voicemail_update_test_900", 0, async function (done) { - console.info("------------logMessage voicemail_update_test_900 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "18862013", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage voicemail_update_test_900: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await voicemailUpdate(); - await voiceMailDelete("voicemail_update_test_900"); - done(); - } catch (error) { - console.info("logMessage voicemail_update_test_900: voicemail insert error = " + error); - done(); - } - - async function voicemailUpdate() { - var updateValues = { - "voice_status": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - console.info("logMessage voicemail_update_test_900: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("voice_status", "1"); - await voiceMailQuery(map, "voicemail_update_test_900"); - } catch (error) { - console.info("logMessage voicemail_update_test_900: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_delete_test_500 - * @tc.name Delete voicemail data - * @tc.desc Function test - */ - it("voicemail_delete_test_500", 0, async function (done) { - console.info("-------------logMessage voicemail_delete_test_500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "100578615", "display_name": "zhangming" - }; - try { - var voiceMailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage voicemail_delete_test_500: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - await VoicemailDelete(); - await voiceMailDelete("voicemail_delete_test_500"); - done(); - } catch (error) { - console.info("logMessage voicemail_delete_test_500: voicemail insert error = " + error); - done(); - } - - async function VoicemailDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info('logMessage voicemail_delete_test_500: deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - await voiceMailQueryForDelete(map, "voicemail_delete_test_500"); - } catch (error) { - console.info("logMessage voicemail_delete_test_500: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_update_test_600 - * @tc.name Delete voicemail status - * @tc.desc Function test - */ - it("voicemail_update_test_600", 0, async function (done) { - console.info("-------------logMessage voicemail_update_test_600 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues1 = { - "phone_number": "100578615", "voice_status": 1 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues1); - console.info("logMessage voicemail_update_test_600: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await voicemailUpdate(); - await voiceMailDelete("voicemail_update_test_600"); - done(); - } catch (error) { - console.info("logMessage voicemail_update_test_600: voicemail insert error = " + error); - done(); - } - - async function voicemailUpdate() { - var updateValues = { - "voice_status": 0 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - console.info('logMessage voicemail_update_test_600: deleteCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("voice_status", "0"); - await voiceMailQuery(map, "voicemail_update_test_600"); - } catch (error) { - console.info("logMessage voicemail_update_test_600: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_batchInsert_test_1800 - * @tc.name Insert voicemail data in batches - * @tc.desc Function test - */ - it("voicemail_batchInsert_test_1800", 0, async function (done) { - console.info("-------------logMessage voicemail_batchInsert_test_1800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "phone_number": "10086", "display_name": "xiaoming" - }; - var insertValuesTwo = { - "phone_number": "12580", "display_name": "xiaohei" - }; - var insertValuesThree = { - "phone_number": "123456", "display_name": "xiaohong" - }; - var insertValuesFour = { - "phone_number": "9996325", "display_name": "xiaohei" - }; - var insertValuesFive = { - "phone_number": "18862013", "display_name": "xiaofen" - }; - var listAddBluk = []; - listAddBluk[0] = insertValuesOne; - listAddBluk[1] = insertValuesTwo; - listAddBluk[2] = insertValuesThree; - listAddBluk[3] = insertValuesFour; - listAddBluk[4] = insertValuesFive; - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - console.info("logMessage voicemail_batchInsert_test_1800: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await voiceMailDelete("voicemail_batchInsert_test_1800"); - done(); - } catch (error) { - console.info("logMessage voicemail_batchInsert_test_1800: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_batchInsert_test_1700 - * @tc.name Insert voicemail status in batches - * @tc.desc Function test - */ - it("voicemail_batchInsert_test_1700", 0, async function (done) { - console.info("-------------logMessage voicemail_batchInsert_test_1700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "phone_number": "1600", "display_name": "xiaoming", "voice_status": 0 - }; - var insertValuesTwo = { - "phone_number": "1600", "display_name": "xiaohei", "voice_status": 1 - }; - var insertValuesThree = { - "phone_number": "1600", "display_name": "xiaohong", "voice_status": 0 - }; - var insertValuesFour = { - "phone_number": "1600", "display_name": "xiaohei", "voice_status": 0 - }; - var insertValuesFive = { - "phone_number": "1600", "display_name": "xiaofen", "voice_status": 1 - }; - var listAddBluk = []; - listAddBluk[0] = insertValuesOne; - listAddBluk[1] = insertValuesTwo; - listAddBluk[2] = insertValuesThree; - listAddBluk[3] = insertValuesFour; - listAddBluk[4] = insertValuesFive; - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - console.info("logMessage voicemail_batchInsert_test_1700: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - var array = common.getvoiceMailBatchInsert(); - await voiceMailQueryForBatchInsert(array, "voicemail_batchInsert_test_1700"); - await voiceMailDelete("voicemail_batchInsert_test_1700"); - done(); - } catch (error) { - console.info("logMessage voicemail_batchInsert_test_1700: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_query_test_1400 - * @tc.name Query voicemail data - * @tc.desc Function test - */ - it("voicemail_query_test_1400", 0, async function (done) { - console.info("------------voicemail_query_test_1400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "8855220011", "display_name": "daming" - }; - try { - var voiceMailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage voicemail_query_test_1400: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - await voiceMailQuery(); - await voiceMailDelete("voicemail_query_test_1400"); - done(); - } catch (error) { - console.info("logMessage voicemail_query_test_1400: voicemial insert error = " + error); - done(); - } - async function voiceMailQuery() { - var resultColumns = ["id", "display_name", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('voicemail_query_test_1400 id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == voicemailId.toString()).assertTrue(); - console.info('voicemail_query_test_1400 displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "daming").assertTrue(); - console.info('voicemail_query_test_1400 phone_number = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "8855220011").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("voicemail_query_test_1400 query error = " + error); - done(); - } - } - }); - - /** - * @tc.number voicemail_query_test_1300 - * @tc.name Query voicemail's status - * @tc.desc Function test - */ - it("voicemail_query_test_1300", 0, async function (done) { - console.info("------------voicemail_query_test_1300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValues = { - "phone_number": "1158220165", "display_name": "xiaoming", "voice_status": 1 - }; - try { - var voiceMailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage voicemail_query_test_1300: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - await voiceMailQuery(); - await voiceMailDelete("voicemail_query_test_1300"); - done(); - } catch (error) { - console.info("logMessage voicemail_query_test_1300: voicemial insert error = " + error); - done(); - } - async function voiceMailQuery() { - var resultColumns = ["id", "display_name", "phone_number"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("voice_status", "1"); - condition.and(); - condition.equalTo("phone_number", "1158220165"); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - if (resultSet.goToFirstRow()) { - do { - console.info('voicemail_query_test_1300 id = ' + resultSet.getString(0)); - expect(resultSet.getString(0) == voicemailId.toString()).assertTrue(); - console.info('voicemail_query_test_1300 displayName = ' + resultSet.getString(1)); - expect(resultSet.getString(1) == "xiaoming").assertTrue(); - console.info('voicemail_query_test_1300 phone_number = ' + resultSet.getString(2)); - expect(resultSet.getString(2) == "1158220165").assertTrue(); - } while (resultSet.goToNextRow()); - } - resultSet.close(); - } catch (error) { - console.info("voicemail_query_test_1300 query error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_insert_test_300 - * @tc.name Abnormal use case, an incorrect field is passed in when inserting data - * @tc.desc Function test - */ - it("abnormal_voicemail_insert_test_300", 0, async function (done) { - console.info("------------abnormal_voicemail_insert_test_300 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_numbers": "18942010321", "display_name": "xiaoming" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_insert_test_300: voicemialId = " + voicemailId); - expect(voicemailId == -1).assertTrue(); - done(); - } catch (error) { - console.info("abnormal_voicemail_insert_test_300 insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_insert_test_400 - * @tc.name Exception use case, an incorrect table name is passed in when inserting data - * @tc.desc Function test - */ - it("abnormal_voicemail_insert_test_400", 0, async function (done) { - console.info("------------abnormal_voicemail_insert_test_400 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/voicemails"; - - var insertValues = { - "phone_number": "18942010321", "display_name": "xiaoming" - }; - try { - var voicemialId = await DAHelper.insert(errorUri, insertValues) - console.info("logMessage abnormal_voicemail_insert_test_400: voicemialId = " + voicemialId); - expect(voicemialId == -1).assertTrue(); - var map = new Map(); - map.set("phone_number", "18942010321"); - await voiceMailQueryError(map, "abnormal_voicemail_insert_test_400"); - done(); - } catch (error) { - console.info("abnormal_voicemail_insert_test_400 insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_update_test_1100 - * @tc.name Abnormal use case, passing in a wrong field when updating data - * @tc.desc Function test - */ - it("abnormal_voicemail_update_test_1100", 0, async function (done) { - console.info("------------abnormal_voicemail_update_test_1100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "18942010321" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_update_test_1100: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalUpdate(); - await voiceMailDelete("abnormal_voicemail_update_test_1100"); - done(); - } catch (error) { - console.info("abnormal_voicemail_update_test_1100 insert error = " + error); - done(); - } - async function abnormalUpdate() { - var updateValues = { - "phone_numbers": "11111111111111111" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", voicemailId.toString()); - try { - var updataCode = await DAHelper.update(voicemailUri, updateValues, condition); - console.info("logMessage abnormal_voicemail_update_test_1100: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("phone_number", "11111111111111111"); - await voiceMailQueryError(map, "abnormal_voicemail_insert_test_400"); - } catch (error) { - console.info("logMessage abnormal_voicemail_update_test_1100: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_update_test_1200 - * @tc.name Abnormal use case, an incorrect table name is passed in when updating data - * @tc.desc Function test - */ - it("abnormal_voicemail_update_test_1200", 0, async function (done) { - console.info("------------abnormal_voicemail_update_test_1200 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/voicemails"; - - var insertValues = { - "phone_number": "9952364" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_update_test_1200: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalUpdate(); - await voiceMailDelete("abnormal_voicemail_update_test_1200"); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_update_test_1200: insert error = " + error); - done(); - } - - async function abnormalUpdate() { - var updateValues = { - "phone_number": "22001122" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var updataCode = await DAHelper.update(errorUri, updateValues, condition) - console.info("logMessage abnormal_voicemail_update_test_1200: updataCode = " + updataCode); - expect(updataCode == -1).assertTrue(); - var map = new Map(); - map.set("phone_number", "22001122"); - await voiceMailQueryError(map, "abnormal_voicemail_insert_test_400"); - } catch (error) { - console.info("logMessage abnormal_voicemail_update_test_1200: update error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_delete_test_700 - * @tc.name Abnormal use case, passing in a wrong field when deleting data - * @tc.desc Function test - */ - it("abnormal_voicemail_delete_test_700", 0, async function (done) { - console.info("------------abnormal_voicemail_delete_test_700 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "789130" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_delete_test_700: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalDelete(); - await voiceMailDelete("abnormal_voicemail_delete_test_700"); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_delete_test_700: insert error = " + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", voicemailId.toString()); - try { - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info("logMessage abnormal_voicemail_delete_test_700: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - } catch (error) { - console.info("logMessage abnormal_voicemail_delete_test_700: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_delete_test_800 - * @tc.name Abnormal use case, passing in an incorrect table name when deleting data - * @tc.desc Function test - */ - it("abnormal_voicemail_delete_test_800", 0, async function (done) { - console.info("------------abnormal_voicemail_delete_test_800 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var errorUri = "dataability:///com.ohos.calllogability/calls/voicemails"; - - var insertValues = { - "phone_number": "1564721" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_delete_test_800: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalDelete(); - await voiceMailDelete("abnormal_voicemail_delete_test_800"); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_delete_test_800: insert error = " + error); - done(); - } - - async function abnormalDelete() { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - try { - var deleteCode = await DAHelper.delete(errorUri, condition); - console.info("logMessage abnormal_voicemail_delete_test_800: deleteCode = " + deleteCode); - expect(deleteCode == -1).assertTrue(); - } catch (error) { - console.info("logMessage abnormal_voicemail_delete_test_800: delete error = " + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_query_test_1500 - * @tc.name Abnormal use case, an incorrect field is passed in when querying - * @tc.desc Function test - */ - it("abnormal_voicemail_query_test_1500", 0, async function (done) { - console.info("------------abnormal_voicemail_query_test_1500 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValues = { - "phone_number": "1564721" - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - console.info("logMessage abnormal_voicemail_query_test_1500: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - await abnormalQuery(); - await voiceMailDelete("abnormal_voicemail_query_test_1500"); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_query_test_1500: insert error = " + error); - done(); - } - - async function abnormalQuery() { - var resultColumns = ["id", "phone_number"]; - - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", voicemailId.toString()); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition) - console.info('logMessage abnormal_voicemail_query_test_1500: goToFirstRow' + resultSet.goToFirstRow()); - expect(resultSet.goToFirstRow()).assertEqual(false); - resultSet.close(); - } catch (error) { - console.info('logMessage abnormal_voicemail_query_test_1500: query error = ' + error); - done(); - } - } - }); - - /** - * @tc.number abnormal_voicemail_batchinsert_test_1900 - * @tc.name Abnormal use cases, when inserting data in batches, some of them failed, check the processing logic - * @tc.desc Function test - */ - it("abnormal_voicemail_batchinsert_test_1900", 0, async function (done) { - console.info("--------logMessage abnormal_voicemail_batchinsert_test_1900 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var addBulkValue1 = { - "phone_number": "5555555555", "ring_duration": "500" - }; - var addBulkValue2 = { - "phone_number": "1511002", "ring_duration": "100" - }; - var addBulkValue3 = { - "phone_numbers": "1521003", "ring_duration": "100" - }; - var addBulkValue4 = { - "phone_number": "1521004", "ring_durations": "100" - }; - var addBulkValue5 = { - "phone_number": "1521005", "ring_duration": "100" - }; - var listAddBluk = []; - listAddBluk[0] = addBulkValue1; - listAddBluk[1] = addBulkValue2; - listAddBluk[2] = addBulkValue3; - listAddBluk[3] = addBulkValue4; - listAddBluk[4] = addBulkValue5; - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk) - console.info("logMessage abnormal_voicemail_batchinsert_test_1900: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - done(); - } catch (error) { - console.info('logMessage abnormal_voicemail_batchinsert_test_1900: batchInsert error = ' + error); - done(); - } - }); - - /** - * @tc.number voiceMail_delete_test_2000 - * @tc.name batchDelete - * @tc.desc Function test - */ - it("voiceMail_delete_test_2000", 0, async function (done) { - console.info("--------logMessage voiceMail_delete_test_2000 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var voiceMailId = await DAHelper.insert(voicemailUri, common.getVoiceMail()); - console.info("logMessage voiceMail_delete_test_2000: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - var map = common.getVoiceMailMap() - map.set("id", voiceMailId.toString()); - await voiceMailQuery(map, "voiceMail_delete_test_2000"); - await executeBatch(); - } catch (error) { - console.info("logMessage voiceMail_delete_test_2000: voiceMailId insert error = " + error); - done(); - } - async function executeBatch() { - console.info("logMessage voiceMail_delete_test_2000: executeBatch start "); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voiceMailId.toString()); - DAHelper.executeBatch(URI_VOICEMAIL, [{ - uri: voicemailUri, - type: featureAbility.DataAbilityOperationType.TYPE_DELETE, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage voiceMail_delete_test_2000: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage voiceMail_delete_test_2000: data_3 = " + data); - console.info("logMessage voiceMail_delete_test_2000: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number voiceMail_update_test_2100 - * @tc.name batchUpdate - * @tc.desc Function test - */ - it("voiceMail_update_test_2100", 0, async function (done) { - console.info("--------logMessage voiceMail_update_test_2100 is starting!------------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var voiceMailId = await DAHelper.insert(voicemailUri, common.getVoiceMail()); - console.info("logMessage voiceMail_update_test_2100: voiceMailId = " + voiceMailId); - expect(voiceMailId > 0).assertTrue(); - var map = common.getVoiceMailMap(); - map.set("id", voiceMailId.toString()); - await voiceMailQuery(map, "voiceMail_update_test_2100"); - await executeBatch(); - } catch (error) { - console.info("logMessage voiceMail_update_test_2100: calllog insert error = " + error); - done(); - } - async function executeBatch() { - var updateValues = { - "phone_number": "123456789" - }; - console.info("logMessage voiceMail_update_test_2100: executeBatch start "); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voiceMailId.toString()); - DAHelper.executeBatch(URI_VOICEMAIL, [{ - uri: voicemailUri, - type: featureAbility.DataAbilityOperationType.TYPE_UPDATE, - valuesBucket: updateValues, - predicates: condition, - expectedCount: 0, - PredicatesBackReferences: {}, - interrupted: true, - }], - (error, data) => { - console.info("logMessage voiceMail_update_test_2100: executeBatch data = " + JSON.stringify(data)); - console.info("logMessage voiceMail_update_test_2100: data_3 = " + data); - console.info("logMessage voiceMail_update_test_2100: data_1= " + data[0].count); - expect(data[0].count == 0).assertTrue(); - done(); - }); - } - }); - - /** - * @tc.number voicemail_insert_test_2200 - * @tc.name Insert voicemail status 0 - * @tc.desc Function test - */ - it("voicemail_insert_test_2200", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_2200 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "1557544452542200", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - console.info("logMessage voicemail_insert_test_2200: voicemailId = " + voicemailId); - expect(voicemailId > 0).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("phone_number", "1557544452542200"); - map.set("voice_status", "0"); - await voiceMailQuery(map, "voicemail_insert_test_2200"); - await voiceMailDelete("voicemail_insert_test_2200"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_2200: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_2300 - * @tc.name Insert 3 pieces of voice mail data first, then delete 2 pieces of data, - * and verify whether the deletion is successful - * @tc.desc Function test - */ - it("voicemail_insert_test_2300", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_2300 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "155754445254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdOne = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdTwo = await DAHelper.insert(voicemailUri, stringValue) - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - condition.or(); - condition.equalTo("id", voicemailIdOne.toString()); - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info("logMessage voicemail_insert_test_2300: deleteCode = " + deleteCode); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - await voiceMailDelete("voicemail_insert_test_2300"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_2300: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_2400 - * @tc.name Insert 3 pieces of voice mail data first, then update 2 pieces of data, - * and verify whether the deletion is successful - * @tc.desc Function test - */ - it("voicemail_insert_test_2400", 0, async function (done) { - console.info("---------logMessage voicemail_insert_test_2400 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - - var stringValue = { - "phone_number": "155754445254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdOne = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdTwo = await DAHelper.insert(voicemailUri, stringValue) - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - condition.or(); - condition.equalTo("id", voicemailIdOne.toString()); - var updateValue = { - "phone_number": "14541555754445254", "voice_status": 1 - }; - var updateCode = await DAHelper.update(voicemailUri, updateValue, condition); - console.info("logMessage voicemail_insert_test_2400: deleteCode = " + updateCode); - - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("phone_number", "14541555754445254"); - map.set("voice_status", "1"); - await voiceMailQuery(map, "voicemail_insert_test_2400"); - - var mapOne = new Map(); - mapOne.set("id", voicemailIdOne.toString()); - mapOne.set("phone_number", "14541555754445254"); - mapOne.set("voice_status", "1"); - await voiceMailQuery(mapOne, "voicemail_insert_test_2400"); - await voiceMailDelete("voicemail_insert_test_2400"); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_test_2400: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_insert_test_2500 - * @tc.name Query the voice mailbox with status 0 or id and return the query result - * @tc.desc Function test - */ - it("voicemail_query_test_2500", 0, async function (done) { - console.info("---------logMessage voicemail_query_test_2500 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - var stringValue = { - "phone_number": "4454445254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue) - var voicemailIdOne = await DAHelper.insert(voicemailUri, stringValue) - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.beginWrap(); - condition.equalTo("id", voicemailId.toString()); - condition.or(); - condition.equalTo("id", voicemailIdOne.toString()); - condition.endWrap(); - condition.and(); - condition.equalTo("voice_status", "0"); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 2).assertTrue(); - resultSet.close(); - await voiceMailDelete("voicemail_query_test_2500"); - done(); - } catch (error) { - console.info("logMessage voicemail_query_test_2500: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_query_test_2600 - * @tc.name Query the voice mailbox and return the query result - * @tc.desc Function test - */ - it("voicemail_query_test_2600", 0, async function (done) { - console.info("---------logMessage voicemail_query_test_2600 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - var stringValue = { - "phone_number": "445444445254", "voice_status": 0 - }; - try { - var voicemailId = await DAHelper.insert(voicemailUri, stringValue); - console.info('voicemail_query_test_2600 voicemailId = ' + voicemailId); - var voicemailIdOne = await DAHelper.insert(voicemailUri, stringValue); - console.info('voicemail_query_test_2600 voicemailIdOne = ' + voicemailIdOne); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 2).assertTrue(); - resultSet.close(); - await voiceMailDelete("voicemail_query_test_2600"); - done(); - } catch (error) { - console.info("logMessage voicemail_query_test_2600: voicemail insert error = " + error); - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_insert_test_2700 - * @tc.name When the voicemail status is added, a non-existent field is passed in - * @tc.desc Function test - */ - it("abnormal_voicemail_insert_test_2700", 0, async function (done) { - console.info("---------logMessage abnormal_voicemail_insert_test_2700 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var insertValues = { - display_name: "2700name", voice_statuss: "1" - }; - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - expect(voicemailId == -1).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - await voiceMailDelete("abnormal_voicemail_insert_test_2700"); - done(); - } catch (error) { - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_delete_test_2800 - * @tc.name When deleting the voicemail status, pass in a non-existent field - * @tc.desc Function test - */ - it("abnormal_voicemail_delete_test_2800", 0, async function (done) { - console.info("---------logMessage abnormal_voicemail_delete_test_2800 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var insertValues = { - display_name: "2800name", voice_status: "1" - }; - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - expect(voicemailId > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - var updateValues = { - display_name: "2800name", voice_statuss: "0" - }; - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - expect(updateCode == -1).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("display_name", "2800name"); - map.set("voice_status", "1"); - await voiceMailQuery(map, "abnormal_voicemail_delete_test_2800"); - await voiceMailDelete("abnormal_voicemail_delete_test_2800"); - done(); - } catch (error) { - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_update_test_2900 - * @tc.name When update the voicemail status, pass in a non-existent field - * @tc.desc Function test - */ - it("abnormal_voicemail_update_test_2900", 0, async function (done) { - console.info("---------logMessage abnormal_voicemail_update_test_2900 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var insertValues = { - display_name: "2900name", voice_status: "1" - }; - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - expect(voicemailId > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", voicemailId.toString()); - var updateValues = { - display_name: "2900name", voice_statuss: "0" - }; - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - expect(updateCode == -1).assertTrue(); - var map = new Map(); - map.set("id", voicemailId.toString()); - map.set("display_name", "2900name"); - map.set("voice_status", "1"); - await voiceMailQuery(map, "abnormal_voicemail_update_test_2900"); - await voiceMailDelete("abnormal_voicemail_update_test_2900"); - done(); - } catch (error) { - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_update_test_3000 - * @tc.name When update the voicemail status, pass in a non-existent field - * @tc.desc Function test - */ - it("abnormal_voicemail_update_test_3000", 0, async function (done) { - console.info("---------logMessage abnormal_voicemail_update_test_3000 is starting!---------") - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - console.info('logMessage uri = ' + URI_VOICEMAIL) - try { - var insertValues = { - display_name: "2900name", voice_status: "1" - }; - var voicemailId = await DAHelper.insert(voicemailUri, insertValues); - expect(voicemailId > 0).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("ids", voicemailId.toString()); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == -1).assertTrue(); - resultSet.close(); - await voiceMailDelete("abnormal_voicemail_update_test_3000"); - done(); - } catch (error) { - done(); - } - }); - - /** - * @tc.number abnormal_voicemail_batchInsert_test_3100 - * @tc.name Insert voicemail data in batches , pass in a non-existent field - * @tc.desc Function test - */ - it("abnormal_voicemail_batchInsert_test_3100", 0, async function (done) { - console.info("-------------logMessage abnormal_voicemail_batchInsert_test_3100 is starting!-----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertValuesOne = { - "voice_status": "0", "display_name": "xiaoming" - }; - var insertValuesTwo = { - "voice_status": "1", "display_name": "xiaohei" - }; - var insertValuesThree = { - "voice_statusss": "1", "display_name": "xiaohong" - }; - var insertValuesFour = { - "voice_status": "0", "display_name": "xiaohei" - }; - var insertValuesFive = { - "voice_status": "0", "display_name": "xiaofen" - }; - var listAddBluk = []; - listAddBluk[0] = insertValuesOne; - listAddBluk[1] = insertValuesTwo; - listAddBluk[2] = insertValuesThree; - listAddBluk[3] = insertValuesFour; - listAddBluk[4] = insertValuesFive; - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - console.info("logMessage abnormal_voicemail_batchInsert_test_3100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == -1).assertTrue(); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var resultColumns = []; - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage abnormal_voicemail_batchInsert_test_3100: batchInsert error = " + error); - done(); - } - }); - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('voicemai afterAll logMessage get DAHelper success! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(voicemailUri, condition); - console.info('voicemai afterAll logMessage deleteCode = ' + deleteCode); - }); - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/common.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/common.js deleted file mode 100644 index 2baf2262c2f528455b609f5c593ba85cbad226ce..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/common.js +++ /dev/null @@ -1,726 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const contactUri = "dataability:///com.ohos.contactsdataability/contacts/contact"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; -const groupUri = "dataability:///com.ohos.contactsdataability/contacts/groups"; -const contactBlocklistUri = "dataability:///com.ohos.contactsdataability/contacts/contact_blocklist"; -const deletedRawContactUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; -const profileRawContactUri = "dataability:///com.ohos.contactsdataability/profile/raw_contact"; -const profilecontactUri = "dataability:///com.ohos.contactsdataability/profile/contact"; -const profileContactDataUri = "dataability:///com.ohos.contactsdataability/profile/contact_data"; -const profileGroupUri = "dataability:///com.ohos.contactsdataability/profile/groups"; -const profileBlocklistUri = "dataability:///com.ohos.contactsdataability/profile/contact_blocklist"; -const profileDeletedContactsUri = "dataability:///com.ohos.contactsdataability/profile/deleted_raw_contact"; - -const URI_CALLLOG = "dataability:///com.ohos.calllogability"; -const calllogUri = "dataability:///com.ohos.calllogability/calls/calllog"; - -export default { - data: {}, - getCallLogInsertMap: - function () { - var calllogInsert100Map = new Map([ - ["phone_number", "123456789"], ["display_name", "xxw"], ["voicemail_uri", "uri"], - ["sim_type", "1"], ["is_hd", "2"], ["is_read", "1"], ["ring_duration", "900"], - ["talk_duration", "200"], ["format_number", "123 456 789"], ["quicksearch_key", "2"], - ["number_type", "2"], ["number_type_name", "tian"], ["begin_time", "200"], ["end_time", "300"], - ["answer_state", "1"], ["create_time", "400"], ["number_location", "dizhi"], ["photo_id", "1"], - ["photo_uri", "666"], ["country_iso_code", "2"], ["extra1", "test1"], ["extra2", "test2"], - ["extra3", "test3"], ["extra4", "test4"], ["extra5", "test5"], ["extra6", "test6"] - ]); - return calllogInsert100Map; - }, - getCallLogInsert: - function () { - var calllogInsert100 = { - "phone_number": "123456789", - "display_name": "xxw", - "voicemail_uri": "uri", - "sim_type": 1, - "is_hd": 2, - "is_read": 1, - "ring_duration": 900, - "talk_duration": 200, - "format_number": "123 456 789", - "quicksearch_key": "2", - "number_type": 2, - "number_type_name": "tian", - "begin_time": 200, - "end_time": 300, - "answer_state": 1, - "create_time": 400, - "number_location": "dizhi", - "photo_id": 1, - "photo_uri": "666", - "country_iso_code": 2, - "extra1": "test1", - "extra2": "test2", - "extra3": "test3", - "extra4": "test4", - "extra5": "test5", - "extra6": "test6", - }; - return calllogInsert100; - }, - getCallLogResultColumns: - function () { - var resultColumns = [ - "id", "phone_number", "display_name", "call_direction", "voicemail_uri", "sim_type", "is_hd", "is_read", - "ring_duration", "talk_duration", "format_number", "quicksearch_key", "number_type", "number_type_name", - "begin_time", "end_time", "answer_state", "create_time", "number_location", "photo_id", "photo_uri", - "country_iso_code", "extra1", "extra2", "extra3", "extra4", "extra5", "extra6" - ]; - return resultColumns; - }, - getCallLogUpdate: - function () { - var updateValues = { - "phone_number": "987654321", - "display_name": "6666", - "voicemail_uri": "7777", - "sim_type": 4, - "is_hd": 4, - "is_read": 4, - "ring_duration": 400, - "talk_duration": 400, - "format_number": "987 654 321", - "quicksearch_key": "4", - "number_type": 4, - "number_type_name": "4tian", - "begin_time": 400, - "end_time": 400, - "answer_state": 4, - "create_time": 40000, - "number_location": "4dizhi", - "photo_id": 4, - "photo_uri": "4444", - "country_iso_code": 4, - "extra1": "test7", - "extra2": "test7", - "extra3": "test7", - "extra4": "test7", - "extra5": "test7", - "extra6": "test7", - }; - return updateValues; - }, - getCallLogUpdateMap: - function () { - var calllogInsert100Map = new Map([ - ["phone_number", "987654321"], ["display_name", "6666"], ["voicemail_uri", "7777"], - ["sim_type", "4"], ["is_hd", "4"], ["is_read", "4"], ["ring_duration", "400"], - ["talk_duration", "400"], ["format_number", "987 654 321"], ["quicksearch_key", "4"], - ["number_type", "4"], ["number_type_name", "4tian"], ["begin_time", "400"], ["end_time", "400"], - ["answer_state", "4"], ["create_time", "40000"], ["number_location", "4dizhi"], - ["photo_id", "4"], ["photo_uri", "4444"], ["country_iso_code", "4"], ["extra1", "test7"], - ["extra2", "test7"], ["extra3", "test7"], ["extra4", "test7"], ["extra5", "test7"], - ["extra6", "test7"] - ]); - return calllogInsert100Map; - }, - getCallLogBatchInsert: - function () { - var map = new Map([["phone_number", "1600"], ["ring_duration", "333"]]); - var map2 = new Map([["phone_number", "1600"], ["ring_duration", "600"]]); - var map3 = new Map([["phone_number", "1600"], ["ring_duration", "600"]]); - var map4 = new Map([["phone_number", "1600"], ["ring_duration", "600"]]); - var map5 = new Map([["phone_number", "1600"], ["ring_duration", "600"]]); - var array = [map, map2, map3, map4, map5]; - return array; - }, - getProfileRawContact: - function () { - var rawContact = { - "photo_id": 2, - "photo_file_id": 3, - "is_transfer_voicemail": 1, - "personal_ringtone": "test", - "is_deleted": 0, - "personal_notification_ringtone": "666", - "photo_first_name": "7777", - "account_id": 1, - "version": 1, - "sort": "6666", - "contacted_count": 2, - "lastest_contacted_time": 2, - "favorite": 1, - "favorite_order": "test", - "phonetic_name": "testname", - "phonetic_name_type": 1, - "display_name": "licheng", - "company": "TTTTT", - "position": "Developer", - "read_only": 2, - "sort_first_letter": "testsort", - "sync_id": 8, - "syn_1": "syn_1", - "syn_2": "syn_2", - "syn_3": "syn_3", - }; - return rawContact; - }, - getProfileRawContactMap: - function () { - var rawContactMap = new Map([ - ["photo_id", "2"], ["photo_file_id", "3"], ["is_transfer_voicemail", "1"], - ["personal_ringtone", "test"], ["is_deleted", "0"], - [ - "personal_notification_ringtone", - "666", - ], - [ - "photo_first_name", - "7777", - ], - ["account_id", "1"], ["version", "1"], ["sort", "6666"], ["contacted_count", "2"], - ["lastest_contacted_time", "2"], ["favorite", "1"], ["favorite_order", "test"], - ["phonetic_name", "testname"], ["phonetic_name_type", "1"], ["display_name", "licheng"], - ["company", "TTTTT"], ["position", "Developer"], ["read_only", "2"], - ["sort_first_letter", "testsort"], ["merge_mode", "0"], ["is_need_merge", "1"], - ["merge_status", "1"], ["is_merge_target", "0"], ["vibration_setting", "0"], ["sync_id", "8"], - ["syn_1", "syn_1"], ["syn_2", "syn_2"], ["syn_3", "syn_3"] - ]); - return rawContactMap; - }, - getProfileRawContactUpdate: - function () { - var rawContact = { - "photo_id": 21, - "photo_file_id": 31, - "is_transfer_voicemail": 11, - "personal_ringtone": "test1", - "is_deleted": 0, - "personal_notification_ringtone": "6661", - "photo_first_name": "77771", - "account_id": 1, - "sort": "66661", - "contacted_count": 21, - "lastest_contacted_time": 21, - "favorite": 11, - "favorite_order": "test1", - "phonetic_name": "testname1", - "phonetic_name_type": 11, - "display_name": "licheng1", - "company": "TTTTT1", - "position": "Developer1", - "read_only": 21, - "sort_first_letter": "testsort1", - "sync_id": 81, - "syn_1": "syn_11", - "syn_2": "syn_21", - "syn_3": "syn_31", - }; - return rawContact; - }, - getProfileRawContactUpdateMap: - function () { - var rawContactMap = new Map([ - ["photo_id", "21"], ["photo_file_id", "31"], ["is_transfer_voicemail", "11"], - ["personal_ringtone", "test1"], ["is_deleted", "0"], - [ - "personal_notification_ringtone", - "6661", - ], - [ - "photo_first_name", - "77771", - ], - ["account_id", "1"], ["version", "1"], ["sort", "66661"], ["contacted_count", "21"], - ["lastest_contacted_time", "21"], ["favorite", "11"], ["favorite_order", "test1"], - ["phonetic_name", "testname1"], ["phonetic_name_type", "11"], ["display_name", "licheng1"], - ["company", "TTTTT1"], ["position", "Developer1"], ["read_only", "21"], - ["sort_first_letter", "testsort1"], ["merge_mode", "0"], ["is_need_merge", "1"], - ["merge_status", "1"], ["is_merge_target", "0"], ["vibration_setting", "0"], ["sync_id", "81"], - ["syn_1", "syn_11"], ["syn_2", "syn_21"], ["syn_3", "syn_31"] - ]); - return rawContactMap; - }, - getProfileContactData: - function () { - var contactData = { - "content_type": "name", - "detail_info": "xiaocai", - "family_name": "family_name", - "middle_name_phonetic": "middle_name_phonetic", - "given_name": "given_name", - "given_name_phonetic": "given_name_phonetic", - "alias_detail_info": "alias_detail_info", - "phonetic_name": "phonetic_name", - "position": "Developer", - "extend1": "extend1", - "extend2": "extend2", - "extend3": "extend3", - "extend4": "extend4", - "city": "city", - "country": "country", - "neighborhood": "neighborhood", - "pobox": "pobox", - "postcode": "postcode", - "region": "region", - "street": "street", - "alpha_name": "alpha_name", - "other_lan_last_name": "other_lan_last_name", - "other_lan_first_name": "other_lan_first_name", - "extend5": "extend5", - "lan_style": "lan_style", - "custom_data": "custom_data", - "extend6": "extend6", - "extend7": "extend7", - "blob_data": "blob_data", - "syn_1": "syn_1", - "syn_2": "syn_2", - "syn_3": "syn_3", - }; - return contactData; - }, - getProfileContactDataMap: - function () { - var ContactDataMap = new Map([ - ["detail_info", "xiaocai"], ["family_name", "family_name"], - ["middle_name_phonetic", "middle_name_phonetic"], ["given_name", "given_name"], - ["given_name_phonetic", "given_name_phonetic"], ["alias_detail_info", "alias_detail_info"], - ["phonetic_name", "phonetic_name"], ["position", "position"], ["extend1", "extend1"], - ["extend2", "extend2"], ["pobox", "pobox"], ["postcode", "postcode"], ["city", "city"], - ["country", "country"], ["neighborhood", "neighborhood"], - [ - "position", - "Developer", - ], - ["region", "region"], ["street", "street"], ["alpha_name", "alpha_name"], - ["other_lan_last_name", "other_lan_last_name"], ["other_lan_first_name", "other_lan_first_name"], - ["extend5", "extend5"], ["lan_style", "lan_style"], ["custom_data", "custom_data"], - ["extend6", "extend6"], ["extend7", "extend7"], ["blob_data", "blob_data"], ["syn_1", "syn_1"], - [ - "syn_2", - "syn_2", - ], - [ - "syn_3", - "syn_3", - ], - ["read_only", "0"], ["version", "0"], ["is_preferred_number", "0"] - ]); - return ContactDataMap; - }, - getProfileContactDataUpdate: - function () { - var contactData = { - "detail_info": "xiaocai1", - "family_name": "family_name1", - "middle_name_phonetic": "middle_name_phonetic1", - "given_name": "given_name1", - "given_name_phonetic": "given_name_phonetic1", - "alias_detail_info": "alias_detail_info1", - "phonetic_name": "phonetic_name1", - "position": "Developer1", - "extend1": "extend11", - "extend2": "extend21", - "extend3": "extend31", - "extend4": "extend41", - "city": "city1", - "country": "country1", - "neighborhood": "neighborhood1", - "pobox": "pobox1", - "postcode": "postcode1", - "region": "region1", - "street": "street1", - "alpha_name": "alpha_name1", - "other_lan_last_name": "other_lan_last_name1", - "other_lan_first_name": "other_lan_first_name1", - "extend5": "extend51", - "lan_style": "lan_style1", - "custom_data": "custom_data1", - "extend6": "extend61", - "extend7": "extend71", - "blob_data": "blob_data1", - "syn_1": "syn_11", - "syn_2": "syn_21", - "syn_3": "syn_31", - }; - return contactData; - }, - getProfileContactDataUpdateMap: - function () { - var ContactDataMap = new Map([ - ["detail_info", "xiaocai1"], ["family_name", "family_name1"], - ["middle_name_phonetic", "middle_name_phonetic1"], ["given_name", "given_name1"], - ["given_name_phonetic", "given_name_phonetic1"], ["alias_detail_info", "alias_detail_info1"], - ["phonetic_name", "phonetic_name1"], ["position", "position1"], ["extend1", "extend11"], - ["extend2", "extend21"], ["pobox", "pobox1"], ["postcode", "postcode1"], ["city", "city1"], - ["country", "country1"], ["neighborhood", "neighborhood1"], - [ - "position", - "Developer1", - ], - ["region", "region1"], ["street", "street1"], ["alpha_name", "alpha_name1"], - ["other_lan_last_name", "other_lan_last_name1"], ["other_lan_first_name", "other_lan_first_name1"], - ["extend5", "extend51"], ["lan_style", "lan_style1"], ["custom_data", "custom_data1"], - ["extend6", "extend61"], ["extend7", "extend71"], ["blob_data", "blob_data1"], - ["syn_1", "syn_11"], - [ - "syn_2", - "syn_21", - ], - [ - "syn_3", - "syn_31", - ], - ["read_only", "0"], ["version", "1"], ["is_preferred_number", "0"] - ]); - return ContactDataMap; - }, - getProfileGroup: - function () { - var group = { - "account_id": 1, - "group_name": "DeveloperFirsthGroup", - "group_notes": "note", - "group_ringtone": "test" - }; - return group; - }, - getProfileGroupMap: - function () { - var groupMap = new Map([ - ["account_id", "1"], ["group_name", "DeveloperFirsthGroup"], ["group_notes", "note"], - ["is_deleted", "0"], ["group_ringtone", "test"], ["ringtone_modify_time", "0"], - ["lastest_modify_time", "0"] - ]); - return groupMap; - }, - getProfileBlockList: - function () { - var blockList = { - "phone_number": "123456789", "content": "heimingdan" - }; - return blockList; - }, - getProfileBlockListMap: - function () { - var blockListMap = new Map([ - ["types", "0"], ["phone_number", "123456789"], ["content", "heimingdan"], ["time_stamp", "0"] - ]); - return blockListMap; - }, - getProfileUpdateRawContact: - function () { - var rawContact = { - "photo_id": 8, - "photo_file_id": 8, - "is_transfer_voicemail": 8, - "personal_ringtone": "test8", - "is_deleted": 1, - "personal_notification_ringtone": "888", - "photo_first_name": "9999", - "account_id": 8, - "version": 2, - "sort": "8888", - "contacted_count": 8, - "lastest_contacted_time": 8, - "favorite": 0, - "favorite_order": "test8", - "phonetic_name": "testname8", - "phonetic_name_type": 8, - "display_name": "licheng8", - "company": "TTTTT8", - "position": "Developer8", - "read_only": 8, - "sort_first_letter": "testsort8", - "sync_id": 888, - "syn_1": "syn_8", - "syn_2": "syn_8", - "syn_3": "syn_8", - }; - return rawContact; - }, - getProfileUpdateRawContactMap: - function () { - var rawContactMap = new Map([ - ["photo_id", "8"], ["photo_file_id", "8"], ["is_transfer_voicemail", "8"], - ["personal_ringtone", "test8"], ["is_deleted", "1"], - [ - "personal_notification_ringtone", - "888", - ], - [ - "photo_first_name", - "9999", - ], - ["account_id", "8"], ["version", "2"], ["sort", "8888"], ["contacted_count", "8"], - ["lastest_contacted_time", "8"], ["favorite", "0"], ["favorite_order", "test8"], - ["phonetic_name", "testname8"], ["phonetic_name_type", "8"], ["display_name", "licheng8"], - ["company", "TTTTT8"], ["position", "Developer8"], ["read_only", "8"], - ["sort_first_letter", "testsort8"], ["merge_mode", "0"], ["is_need_merge", "1"], - ["merge_status", "1"], ["is_merge_target", "0"], ["vibration_setting", "0"], ["sync_id", "888"], - ["syn_1", "syn_8"], ["syn_2", "syn_8"], ["syn_3", "syn_8"] - ]); - return rawContactMap; - }, - getProfileUpdateContactData: - function () { - var contactData = { - "detail_info": "BossCai", - "family_name": "family_name8", - "middle_name_phonetic": "middle_name_phonetic8", - "given_name": "given_name8", - "given_name_phonetic": "given_name_phonetic8", - "alias_detail_info": "alias_detail_info8", - "phonetic_name": "phonetic_name8", - "position": "position8", - "extend1": "extend8", - "extend2": "extend8", - "extend3": "extend8", - "extend4": "extend8", - "country": "country8", - "neighborhood": "neighborhood8", - "pobox": "pobox8", - "city": "city8", - "postcode": "postcode8", - "region": "region8", - "street": "street8", - "alpha_name": "alpha_name8", - "other_lan_last_name": "other_lan_last_name8", - "other_lan_first_name": "other_lan_first_name8", - "extend5": "extend8", - "lan_style": "lan_style8", - "custom_data": "custom_data8", - "extend6": "extend8", - "extend7": "extend8", - "blob_data": "blob_data8", - "syn_1": "syn_8", - "syn_2": "syn_8", - "syn_3": "syn_8" - }; - return contactData; - }, - getProfileUpdateContactDataMap: - function () { - var ContactDataMap = new Map([ - ["detail_info", "BossCai"], ["family_name", "family_name8"], - ["middle_name_phonetic", "middle_name_phonetic8"], ["given_name", "given_name8"], - ["given_name_phonetic", "given_name_phonetic8"], ["alias_detail_info", "alias_detail_info8"], - ["phonetic_name", "phonetic_name8"], ["position", "position8"], ["extend1", "extend8"], - ["extend2", "extend8"], ["pobox", "pobox8"], ["postcode", "postcode8"], ["city", "city8"], - ["country", "country8"], ["neighborhood", "neighborhood8"], - [ - "position", - "position8", - ], - ["region", "region8"], ["street", "street8"], ["alpha_name", "alpha_name8"], - ["other_lan_last_name", "other_lan_last_name8"], ["other_lan_first_name", "other_lan_first_name8"], - ["extend5", "extend8"], ["lan_style", "lan_style8"], ["custom_data", "custom_data8"], - ["extend6", "extend8"], ["extend7", "extend8"], ["blob_data", "blob_data8"], ["syn_1", "syn_8"], - [ - "syn_2", - "syn_8", - ], - [ - "syn_3", - "syn_8", - ], - ["read_only", "0"], ["version", "1"], ["is_preferred_number", "0"] - ]); - return ContactDataMap; - }, - getProfileUpdateGroup: - function () { - var group = { - "account_id": 8, - "group_name": "TestFifthGroup", - "group_notes": "note8", - "group_ringtone": "test8" - }; - return group; - }, - getProfileUpdateGroupMap: - function () { - var groupMap = new Map([ - ["account_id", "8"], ["group_name", "TestFifthGroup"], ["group_notes", "note8"], - ["is_deleted", "0"], ["group_ringtone", "test8"], ["ringtone_modify_time", "0"], - ["lastest_modify_time", "0"] - ]); - return groupMap; - }, - getProfileUpdateBlockList: - function () { - var blockList = { - "phone_number": "987654321", - "content": "danminghei", - }; - return blockList; - }, - getProfileUpdateBlockListMap: - function () { - var blockListMap = new Map([ - ["types", "0"], ["phone_number", "987654321"], ["content", "danminghei"], ["time_stamp", "0"] - ]); - return blockListMap; - }, - getVoiceMail: - function () { - var voicemail = { - "phone_number": "66666", - "quicksearch_key": "777", - "display_name": "xiaoli", - "voicemail_uri": "XXXX", - "origin_type": "xxxxx", - "create_time": 0 - }; - return voicemail; - }, - getVoiceMailMap: - function () { - var map = new Map([ - ["phone_number", "66666"], ["quicksearch_key", "777"], ["display_name", "xiaoli"], - ["voicemail_uri", "XXXX"], ["origin_type", "xxxxx"], ["create_time", "0"], - ["voicemail_type", "0"], ["voice_file_size", "0"], ["voice_duration", "0"], - ["voice_status", "0"] - ]); - return map; - }, - getVoiceMailUpdate: - function () { - var voicemail = { - "phone_number": "9999999", - "quicksearch_key": "999", - "display_name": "xiaocai", - "voicemail_uri": "uuuu", - "origin_type": "iiiii", - "create_time": "999" - }; - return voicemail; - }, - getVoiceMailUpdateMap: - function () { - var map = new Map([ - ["phone_number", "9999999"], ["quicksearch_key", "999"], ["display_name", "xiaocai"], - ["voicemail_uri", "uuuu"], ["origin_type", "iiiii"], ["create_time", "999"], - ["voicemail_type", "0"], ["voice_file_size", "0"], ["voice_duration", "0"], - ["voice_status", "0"] - ]); - return map; - }, - getvoiceMailBatchInsert: - function () { - var map = new Map([["phone_number", "1600"], ["display_name", "xiaoming"], ["voice_status", "0"]]); - var map2 = new Map([["phone_number", "1600"], ["display_name", "xiaohei"], ["voice_status", "1"]]); - var map3 = new Map([["phone_number", "1600"], ["display_name", "xiaohong"], ["voice_status", "0"]]); - var map4 = new Map([["phone_number", "1600"], ["display_name", "xiaohei"], ["voice_status", "0"]]); - var map5 = new Map([["phone_number", "1600"], ["display_name", "xiaofen"], ["voice_status", "0"]]); - var array = [map, map2, map3, map4, map5]; - return array; - }, - getContactBatchCompany: - function () { - var rawContactValuesOne = { - "display_name": "fengyuanyuan", "company": "TT4900", "position": "Testers" - }; - var rawContactValuesTwo = { - "display_name": "caiboss", "company": "TT4900", "position": "developer" - }; - var rawContactValuesThree = { - "display_name": "zhangsan", "company": "TT4900", "position": "developer" - }; - var rawContactValuesFour = { - "display_name": "lisi", "company": "TT4900", "position": "developer" - }; - var rawContactValuesFive = { - "display_name": "wangwu", "company": "TT4900", "position": "developer" - }; - var listAddBluk = []; - listAddBluk[0] = rawContactValuesOne; - listAddBluk[1] = rawContactValuesTwo; - listAddBluk[2] = rawContactValuesThree; - listAddBluk[3] = rawContactValuesFour; - listAddBluk[4] = rawContactValuesFive; - return listAddBluk; - }, - getContactBatchCompanyTwo: - function () { - var contactDataValuesOne = { - "raw_contact_id": rawContactId, - "content_type": "name", - "detail_info": "xiaozhi" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactId, - "content_type": "organization", - "detail_info": "TT", - "position": "Testers" - }; - var contactDataValuesThree = { - "raw_contact_id": rawContactId, - "content_type": "email", - "detail_info": "15844@163.com" - }; - var contactDataValuesFour = { - "raw_contact_id": rawContactId, - "content_type": "nickname", - "detail_info": "xiaozhicheng" - }; - var contactDataValuesFive = { - "raw_contact_id": rawContactId, - "content_type": "phone", - "detail_info": "111885566" - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - listAddBluk[2] = contactDataValuesThree; - listAddBluk[3] = contactDataValuesFour; - listAddBluk[4] = contactDataValuesFive; - return listAddBluk; - }, - getPhoneNumberBatch: - function () { - var contactBlacklistValuesOne = { - "phone_number": "85525040585400" - }; - var contactBlacklistValuesTwo = { - "phone_number": "85525040585400" - }; - var contactBlacklistValuesThree = { - "phone_number": "85525040585400" - }; - var contactBlacklistValuesFour = { - "phone_number": "85525040585400" - }; - var contactBlacklistValuesFive = { - "phone_number": "85525040585400" - }; - var listAddBluk = [] - listAddBluk[0] = contactBlacklistValuesOne; - listAddBluk[1] = contactBlacklistValuesTwo; - listAddBluk[2] = contactBlacklistValuesThree; - listAddBluk[3] = contactBlacklistValuesFour; - listAddBluk[4] = contactBlacklistValuesFive; - return listAddBluk; - }, - getSearchMap: - function () { - var map = new Map([ - ["account_id", "1"], ["search_name", "小黄||xiaohuang||xh"], ["display_name", "小黄"], - ["phonetic_name", ""], ["photo_id", ""], ["photo_file_id", ""] - ]); - return map; - } -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/recovery_test.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/recovery_test.js deleted file mode 100644 index 36c5d3b6607d504f29dabec2fd115dbc9f00bbfa..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/contact/recovery_test.js +++ /dev/null @@ -1,156 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' -import common from './common.js'; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const backup = "dataability:///com.ohos.contactsdataability/contacts/backup"; -const recover = "dataability:///com.ohos.contactsdataability/contacts/recover"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; - -export default function RecoveryTest() { - describe('RecoveryTest', function () { - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - async function contactsQuery(tag, uri, size) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': contactsQuery start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(uri, resultColumns, condition); - console.info(tag + ' contactsQuery resultSet.rowCount is = ' + resultSet.rowCount); - console.info(tag + ' contactsQuery size is = ' + size); - expect(resultSet.rowCount == size).assertEqual(true); - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var id = resultSet.getString(resultSet.getColumnIndex("id")); - console.info(tag + ':logMessage contactsQuery id = ' + id); - var name = resultSet.getString(resultSet.getColumnIndex("display_name")); - console.info(tag + ':logMessage contactsQuery name = ' + name); - } while (resultSet.goToNextRow()) - } - } - resultSet.close(); - } catch (error) { - console.info(tag + "logMessage contactsQuery: error = " + error); - } - } - - async function rawContactInsert(name) { - console.info("------logMessage rawContactInsert is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var insertValue = { - "display_name": name, - } - try { - var rawContactId = await DAHelper.insert(rawContactUri, insertValue); - console.info('logMessage rawContactInsert: rawContactId = ' + rawContactId); - expect(rawContactId > 0).assertTrue(); - } catch (error) { - console.info('logMessage rawContactInsert: insert error = ' + error); - } - return rawContactId; - } - - async function deleteRawContact(tag) { - try { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - await DAHelper.delete(rawContactUri, condition); - sleep(5000); - var conditionAll = new ohosDataAbility.DataAbilityPredicates(); - conditionAll.greaterThan("id", "0"); - await DAHelper.delete(deletedUri, conditionAll); - } catch (error) { - console.info(tag + ': deleteRawContact error = ' + error); - } - } - - /** - * @tc.number recovery_test_100 - * @tc.name backup database - * @tc.desc Function test - */ - it("recovery_test_100", 0, async function (done) { - await deleteRawContact("recovery_test_100"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var updateValues = {}; - var condition = new ohosDataAbility.DataAbilityPredicates(); - try { - var updateCode = await DAHelper.update(backup, updateValues, condition); - sleep(2000); - console.info('logMessage recovery_test_100: updateCode = ' + updateCode); - expect(updateCode == 0).assertTrue(); - sleep(2000); - await contactsQuery("recovery_test_100", rawContactUri, 0); - done(); - } catch (error) { - console.info('logMessage recovery_test_100: raw_contact update error = ' + error); - done(); - } - }); - - /** - * @tc.number recovery_test_200 - * @tc.n ame recovery database - * @tc.desc Function test - */ - it("recovery_test_200", 0, async function (done) { - await deleteRawContact("recovery_test_200"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var updateValues = {}; - var condition = new ohosDataAbility.DataAbilityPredicates(); - rawContactInsert("liming"); - rawContactInsert("xiaolilili"); - sleep(2000); - var updateCode = await DAHelper.update(backup, updateValues, condition); - sleep(2000); - console.info(' recovery_test_200: backup = ' + updateCode); - expect(updateCode == 0).assertTrue(); - sleep(1000); - try { - var updateCode = await DAHelper.update(recover, updateValues, condition); - sleep(3000); - console.info('logMessage recovery_test_200: recover = ' + updateCode); - expect(updateCode == 0).assertTrue(); - await contactsQuery("recovery_test_200", rawContactUri, 2); - await deleteRawContact("recovery_test_200"); - done(); - } catch (error) { - console.info('logMessage recovery_test_200: raw_contact update error = ' + error); - done(); - } - }); - }); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/lib/Const.js deleted file mode 100644 index f9263cd46dee1a0ffdfaa1e5ef5c29755c7e13f7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/ets/MainAbility/test/lib/Const.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/contact_function/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 03b8532c53ca563f8ed6b1e21d20ad3f67a68906..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/contact_function/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/hand.png b/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/hand.png deleted file mode 100644 index 9f1fa16ee073093b40920e273502513fa66fa980..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/hand.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/icon.png b/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/images.jpg b/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/images.jpg deleted file mode 100644 index c75ddfc5ead15e8d49ca7cae9f97c03585565be1..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/images.jpg and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/person.png b/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/person.png deleted file mode 100644 index f0f540d078e6c0441a763ca2cc375a551d6cf736..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/person.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-1.png b/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-1.png deleted file mode 100644 index 990c5e5ad20698c7701faf641bc80eb004a127b7..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-1.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-2.png b/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-2.png deleted file mode 100644 index 450c3dd3ca68bf601bd08e5f41797d376e20d00d..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-2.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-3.png b/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-3.png deleted file mode 100644 index 1044869832b423a5dfc2559a395529377bd34f0c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/star-1-3.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/video/show.mp4 b/telephony/telephonyjstest/contact_function/entry/src/main/resources/rawfile/video/show.mp4 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/telephony/telephonyjstest/contact_function/signature/openharmony_sx.p7b b/telephony/telephonyjstest/contact_function/signature/openharmony_sx.p7b deleted file mode 100644 index 66b4457a8a81fb8d3356cf46d67226c850944858..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function/signature/openharmony_sx.p7b and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function_merge/BUILD.gn b/telephony/telephonyjstest/contact_function_merge/BUILD.gn deleted file mode 100644 index 9203b26a2d6201bf440011a333b0f908d73ca8d3..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# 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("ActsContactFunctionMergeEtsTest") { - 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 = "ActsContactFunctionMergeEtsTest" -} -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" -} diff --git a/telephony/telephonyjstest/contact_function_merge/Test.json b/telephony/telephonyjstest/contact_function_merge/Test.json deleted file mode 100644 index a7eacfaa16f1ff1f427b1e024f93329c62c16f4f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1800000", - "package": "com.ohos.contactfunctionmerge", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsContactFunctionMergeEtsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/config.json b/telephony/telephonyjstest/contact_function_merge/entry/src/main/config.json deleted file mode 100644 index e8a1f4a83de0e2f3ef323c1fb537fb726b72b187..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/config.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.contactfunctionmerge", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.contactfunctionmerge", - "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" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.LOCATION", - "reason": "need use ohos.permission.LOCATION" - }, - { - "name":"ohos.permission.SET_TELEPHONY_STATE", - "reason":"need use ohos.permission.SET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.GET_TELEPHONY_STATE", - "reason":"need use ohos.permission.GET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.PLACE_CALL", - "reason":"need use ohos.permission.PLACE_CALL" - }, - { - "name":"ohos.permission.READ_CONTACTS", - "reason":"need use ohos.permission.READ_CONTACTS" - }, - { - "name":"ohos.permission.WRITE_CONTACTS", - "reason":"need use ohos.permission.WRITE_CONTACTS" - }, - { - "name":"ohos.permission.SEND_MESSAGES", - "reason":"need use ohos.permission.SEND_MESSAGES" - }, - { - "name":"ohos.permission.RECEIVE_SMS", - "reason":"need use ohos.permission.RECEIVE_SMS" - }, - { - "name":"ohos.permission.READ_CALL_LOG", - "reason":"need use ohos.permission.READ_CALL_LOG" - }, - { - "name":"ohos.permission.GET_NETWORK_INFO", - "reason":"need use ohos.permission.GET_NETWORK_INFO" - }, - { - "name":"ohos.permission.INTERNET", - "reason":"need use ohos.permission.INTERNET" - } - ], - "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 diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/app.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 261fadca29ff0ea310a8bc105ddd1af65e2dd2f6..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Badge.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Badge.ets deleted file mode 100644 index 66de6f8e3b9c0360931602dd25d1511878ac63ab..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Badge.ets +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Blank.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Blank.ets deleted file mode 100644 index a50fc719e09ab27c91f9705ac06008e936830f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Blank.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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%') - - - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Button.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Button.ets deleted file mode 100644 index ac2271ea3a13664bbbb6afe4f173abae9e66f867..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Button.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Column.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Column.ets deleted file mode 100644 index b9e5c84e21ccf25419be432d8f95418fac82070a..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Column.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 }) - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets deleted file mode 100644 index cb0597310a15be8ab4503a3ae89385e3708fac96..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Counter.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Counter.ets deleted file mode 100644 index ecdbfaf10393e7a348fd76098868e6455505b07f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Counter.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/DataPanel.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/DataPanel.ets deleted file mode 100644 index 3c624848482b22998b2a1d137796ddaedbcf198c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/DataPanel.ets +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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%') - - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Divider.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Divider.ets deleted file mode 100644 index 02bf60779418674d1fd58127907fdb3915bd8f8f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Divider.ets +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Flex.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Flex.ets deleted file mode 100644 index a0e21251e80008c5be9f29aa52074acc5eb24a78..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Flex.ets +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/GridContainer.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/GridContainer.ets deleted file mode 100644 index 57358110413406263e70a2a5f650cbfeb22a4387..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/GridContainer.ets +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Image.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Image.ets deleted file mode 100644 index 5cc583e931f51aa8e4f2bd55decfeeb14a40afb4..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Image.ets +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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) - } - } -} - - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Navigator.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Navigator.ets deleted file mode 100644 index 6c50769cf2ab045cbe48b52e294b4105a21e1c3d..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Navigator.ets +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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) - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Panel.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Panel.ets deleted file mode 100644 index 32ddabbd1ccbae3805dd462e6f04b28364d6a1e7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Panel.ets +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Progress.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Progress.ets deleted file mode 100644 index c8608089fe51e1988fd305fc49db028b6c2efe76..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Progress.ets +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Qrcode.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Qrcode.ets deleted file mode 100644 index 5c0dd84eff5a6653ee5fd940662d141025a1bb4e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Qrcode.ets +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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') - } - } -} - - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Rating.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Rating.ets deleted file mode 100644 index b29e26a392fca6f15a5b7f0eb4156dd3bc767c3f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Rating.ets +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/RowSplit.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/RowSplit.ets deleted file mode 100644 index 0f4f397b13b83e98ac643633309b02858f337eb0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/RowSplit.ets +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Scroll.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Scroll.ets deleted file mode 100644 index 363089d22580febed16b983d8a4b2877cde52bec..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Scroll.ets +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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 = [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') - - } -} diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Slider.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Slider.ets deleted file mode 100644 index 625cd02874f16e9debb7638322624f890e08fa62..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Slider.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Span.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Span.ets deleted file mode 100644 index df5a71043f1ae000b822646f6b56df7ae103fa1f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Span.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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) - } - } -} - - - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Stack.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Stack.ets deleted file mode 100644 index 2a694889f0e768afbd3e3af6a17c3af9d8738cfb..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Stack.ets +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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%') - - } -} - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Text.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Text.ets deleted file mode 100644 index fbd1415dc815b0f1966476c430f7d69e28e587ee..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/Text.ets +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 10359134da915c9b44b0836ba4881bca71f43f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,65 +0,0 @@ -// @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%') - } -} - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 33a58e6a8de77a60e1d785efeecc9d736c7f8634..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 ContactMergeTest from './contact/ContactMerge_test.js' - -export default function testsuite() { - //contact - ContactMergeTest(); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/Utils.ets deleted file mode 100644 index 65f70088ddb62bcf80f4e0ec07dc841a8ab033f0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/Utils.ets +++ /dev/null @@ -1,119 +0,0 @@ -// @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) - } -} - - - - diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/contact/ContactMerge_test.js b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/contact/ContactMerge_test.js deleted file mode 100644 index d67f66e69af1832e4a456bbfc150b532f44d9e46..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/contact/ContactMerge_test.js +++ /dev/null @@ -1,1873 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; - -const autoMergeUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact/auto_merge"; -const splitUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact/split_contact"; -const manualMergeUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact/manual_merge"; -const uriQueryMergeList = "dataability:///com.ohos.contactsdataability/contacts/raw_contact/query_merge_list"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; - -export default function ContactMergeTest() { - describe('ContactMergeTest', function () { - console.info("ContactMergeTest start!"); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - async function contactDataInsert1(DAHelper, rawContactIdFirst) { - var contactDataValues = { - "raw_contact_id": rawContactIdFirst, "content_type": "name", "detail_info": "xiaoli" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_auto_merge_and_spilt_test_100: contactDataId1 = " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100: contact_data_1 insert error = ' + error); - } - } - - async function contactDataInsert2(DAHelper, rawContactIdSecond) { - var contactDataValues = { - "raw_contact_id": rawContactIdSecond, "content_type": "name", "detail_info": "xiaoli" - }; - try { - var contactDataId2 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_auto_merge_and_spilt_test_100: contactDataId2 = " + contactDataId2); - expect(contactDataId2 > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100: contact_data_2 insert error = ' + error); - } - } - - async function autoMerge(DAHelper, rawContactIdFirst) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - sleep(4000); - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - console.info("logMessage contact_auto_merge_and_spilt_test_100: autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_auto_merge_and_spilt_test_100", 2); - sleep(2000); - await contactSplit(DAHelper, rawContactIdFirst); - await deleteAll(rawContactUri, "contact_auto_merge_and_spilt_test_100"); - await deleteAll(contactDataUri, "contact_auto_merge_and_spilt_test_100"); - } catch (error) { - console.info("logMessage contact_auto_merge_and_spilt_test_100: auto_merge error = " + error); - } - } - - async function contactSplit(DAHelper, rawContactIdFirst) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var array = [rawContactIdFirst.toString()]; - condition2.in("raw_contact_id", array); - var updateValues2 = {}; - try { - var splitCode = await DAHelper.update(splitUri, updateValues2, condition2); - sleep(4000); - console.info('logMessage contact_auto_merge_and_spilt_test_100 splitCode = ' + splitCode); - expect(splitCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_auto_merge_and_spilt_test_100", 1); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100 split error = ' + error); - } - } - - async function deleteAll(uri, tag) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(uri, condition); - console.info(tag + ': deleteAll deleteCode = ' + deleteCode); - expect(deleteCode == 0).assertTrue(); - } - - async function contactMergeQuery(map, tag, size) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ' : contactMergeQuery start ! DAHelper = ' + DAHelper); - var resultColumns = ["contact_id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - console.info(tag + ' : map_id = ' + map.get("id")); - condition.equalTo("id", map.get("id")); - try { - var resultSetID = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - var conatctID; - if (resultSetID.goToFirstRow()) { - do { - conatctID = resultSetID.getString(resultSetID.getColumnIndex("contact_id")); - console.info(tag + ' : contact_id = ' + conatctID); - } while (resultSetID.goToNextRow()); - } - resultSetID.close(); - var pre = new ohosDataAbility.DataAbilityPredicates(); - pre.equalTo("contact_id", conatctID); - var newResultColumns = []; - var resultSet = await DAHelper.query(rawContactUri, newResultColumns, pre); - sleep(1000); - console.info(tag + ' : contactMergeQuery start ! rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == size).assertEqual(true); - resultSet.close(); - } catch (error) { - console.info(tag + " : logMessage contactMergeQuery: error = " + error); - } - } - - async function updateContactData(updateDataValue, contactDataId, testName) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - var updateValues = { - "detail_info": updateDataValue - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", contactDataId.toString()); - var code = await DAHelper.update(contactDataUri, updateValues, condition); - console.info(testName + " updateContactData: code = " + code); - sleep(3000); - } - - async function insertContactData(DAHelper, rawContactId, detailInfo, types, tag) { - var size = detailInfo.length; - for (var i = 0; i < size; i++) { - var contactDataValues = { - "raw_contact_id": rawContactId.toString(), - "content_type": types[i], - "detail_info": detailInfo[i] - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(2000); - expect(contactDataId > 0).assertTrue(); - console.info(tag + ' logMessage : insert contactDataId = ' + contactDataId); - } catch (error) { - console.info('logMessage : contact_data_1 insert error = ' + error); - } - } - } - - async function insertContactDataSingle(DAHelper, rawContactId, detailInfo, type) { - var size = detailInfo.length; - var contactDataValues = { - "raw_contact_id": rawContactId, "content_type": type, "detail_info": detailInfo - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info('logMessage : contact_data_1 insert error = ' + error); - } - return contactDataId1; - } - - async function manualMergeList(DAHelper, rawContactList, testName) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - condition2.in("raw_contact_id", rawContactList); - var updateValues2 = {}; - try { - var ManualMergeCode = await DAHelper.update(manualMergeUri, updateValues2, condition2); - sleep(1000); - console.info("logMessage " + testName + " ManualMergeCode = " + ManualMergeCode); - expect(ManualMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactList[0].toString()); - await contactMergeQuery(map, testName, rawContactList.length); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info("logMessage " + testName + " manual_merge error = " + error); - } - } - - /** - * @tc.number contact_autoMerge_and_spilt_test_100 - * @tc.name Two contacts without mobile phone number with the same name are automatically merged and split - * @tc.desc Function test - */ - it("contact_autoMerge_and_spilt_test_100", 0, async function (done) { - console.info("------logMessage contact_auto_merge_and_spilt_test_100 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaoli" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_auto_merge_and_spilt_test_100: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await contactDataInsert1(DAHelper, rawContactIdFirst); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaoli" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_auto_merge_and_spilt_test_100: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await contactDataInsert2(DAHelper, rawContactIdSecond); - } catch (error) { - console.info('logMessage contact_auto_merge_and_spilt_test_100: raw_contact_2 insert error = ' + error); - done(); - } - - await autoMerge(DAHelper, rawContactIdFirst); - done(); - }); - - /** - * @tc.number contact_manualMerge_test_200 - * @tc.name Two contacts with the same name, one with a mobile phone number and the other without a mobile phone - * number, call the manual merge interface - * @tc.desc Function test - */ - it("contact_manualMerge_test_200", 0, async function (done) { - console.info("------logMessage contact_manualMerge_test_200 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaoming" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_manualMerge_test_200: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await manualMergeDataInsert(DAHelper, rawContactIdFirst); - } catch (error) { - console.info('logMessage contact_manualMerge_test_200: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaoming" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_200: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await manualMergeDataInsertTwo(DAHelper, rawContactIdSecond); - } catch (error) { - console.info('logMessage contact_manualMerge_test_200: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_2000"); - done(); - }); - - async function manualMergeDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdFirst, - "content_type": "name", - "detail_info": "xiaoming" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "123456789", - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_manualMerge_test_200: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_200: batch insert error = " + error) - } - } - - async function manualMergeDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValues = { - "raw_contact_id": rawContactIdSecond, "content_type": "name", "detail_info": "xiaoming" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_manualMerge_test_200: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_200: contact_data_2 insert error = " + error) - } - } - - /** - * @tc.number contact_autoMerge_test_300 - * @tc.name Two contacts with the same name have a mobile phone number, and the mobile phone numbers are the - * same. Call the automatic merge interface - * @tc.desc Function test - */ - it("contact_autoMerge_test_300", 0, async function (done) { - console.info("------logMessage contact_autoMerge_test_300 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaohong" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_autoMerge_test_300: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await autoMergeDataInsert(DAHelper, rawContactIdFirst); - } catch (error) { - console.info('logMessage contact_autoMerge_test_300: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaohong" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_autoMerge_test_300: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await autoMergeDataInsertTwo(DAHelper, rawContactIdSecond); - } catch (error) { - console.info('logMessage contact_autoMerge_test_300: raw_contact_2 insert error = ' + error); - done(); - } - - await autoMerger(DAHelper, rawContactIdFirst, "contact_autoMerge_test_300"); - done(); - }); - - async function autoMergeDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdFirst, - "content_type": "name", - "detail_info": "xiaohong" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "123465", - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_autoMerge_test_300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_autoMerge_test_300: batch insert1 error = " + error) - } - } - - async function autoMergeDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValuesThree = { - "raw_contact_id": rawContactIdSecond, - "content_type": "name", - "detail_info": "xiaohong" - }; - var contactDataValuesFour = { - "raw_contact_id": rawContactIdSecond, - "content_type": "phone", - "detail_info": "123465", - }; - var listAddBluk2 = []; - listAddBluk2[0] = contactDataValuesThree; - listAddBluk2[1] = contactDataValuesFour; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk2); - sleep(1000); - console.info("logMessage contact_autoMerge_test_300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_autoMerge_test_300: batch insert2 error = " + error) - } - } - - async function autoMerger(DAHelper, rawContactIdFirst, testName) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage " + testName + "autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, testName, 2); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info("logMessage " + testName + "auto_merge error =" + error); - } - } - - async function autoNotMerger(DAHelper, rawContactIdFirst, testName) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - sleep(2000); - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - console.info("logMessage " + testName + "autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, testName, 1); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info("logMessage " + testName + "auto_merge error =" + error); - } - } - - /** - * @tc.number contact_manualMerge_test_400 - * @tc.name Two contacts with the same name have a mobile phone number, and the mobile phone numbers are - * different. Call the manual merge interface - * @tc.desc Function test - */ - it("contact_manualMerge_test_400", 0, async function (done) { - console.info("------logMessage contact_manualMerge_test_400 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaozhang" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await noequalPhoneDataInsert(DAHelper, rawContactIdFirst) - } catch (error) { - console.info('logMessage contact_manualMerge_test_400: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaozhang" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await noequalPhoneDataInsertTwo(DAHelper, rawContactIdSecond) - } catch (error) { - console.info('logMessage contact_manualMerge_test_400: raw_contact_2 insert error = ' + error); - done(); - } - - await noequalManualMerge(DAHelper, rawContactIdFirst, rawContactIdSecond); - done(); - }); - - async function noequalPhoneDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdFirst, - "content_type": "name", - "detail_info": "xiaozhang" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "147852", - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_400: batch insert1 error = " + error) - } - } - - async function noequalPhoneDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValuesThree = { - "raw_contact_id": rawContactIdSecond, - "content_type": "name", - "detail_info": "xiaozhang" - }; - var contactDataValuesFour = { - "raw_contact_id": rawContactIdSecond, - "content_type": "phone", - "detail_info": "996369", - }; - var listAddBluk2 = []; - listAddBluk2[0] = contactDataValuesThree; - listAddBluk2[1] = contactDataValuesFour; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_400: batch insert2 error = " + error) - } - } - - async function noequalManualMerge(DAHelper, rawContactIdFirst, rawContactIdSecond) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var id = [rawContactIdFirst.toString(), rawContactIdSecond.toString()]; - condition2.in("raw_contact_id", id); - var updateValues2 = {}; - try { - var ManualMergeCode = await DAHelper.update(manualMergeUri, updateValues2, condition2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_400 ManualMergeCode = " + ManualMergeCode); - expect(ManualMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_manualMerge_test_400", 2); - await deleteAll(rawContactUri, "contact_manualMerge_test_400"); - await deleteAll(contactDataUri, "contact_manualMerge_test_400"); - } catch (error) { - console.info("logMessage contact_manualMerge_test_400 manual_merge error = " + error); - } - } - - /** - * @tc.number contact_manualMerge_test_500 - * @tc.name Two contacts with the same name, one with two mobile phone numbers and the other without mobile phone - * numbers, call the manual merge interface - * @tc.desc Function test - */ - it("contact_manualMerge_test_500", 0, async function (done) { - console.info("------logMessage contact_manualMerge_test_500 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var insertRawContactValues1 = { - "display_name": "xiaozhou" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await manualDataInsert(DAHelper, rawContactIdFirst) - } catch (error) { - console.info('logMessage contact_manualMerge_test_500: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaozhou" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await manualDataInsertTwo(DAHelper, rawContactIdSecond) - } catch (error) { - console.info('logMessage contact_manualMerge_test_500: raw_contact_2 insert error = ' + error); - done(); - } - await hasOneNoPhoneManualMerge(DAHelper, rawContactIdFirst, rawContactIdSecond); - done(); - }); - - async function manualDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdFirst, - "content_type": "name", - "detail_info": "xiaozhou" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "123456789", - }; - var contactDataValuesThree = { - "raw_contact_id": rawContactIdFirst, - "content_type": "phone", - "detail_info": "996632", - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - listAddBluk[2] = contactDataValuesThree; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_500: batch insert1 error = " + error) - } - } - - async function manualDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValuesFour = { - "raw_contact_id": rawContactIdSecond, - "content_type": "name", - "detail_info": "xiaozhou" - }; - try { - var contactDataId = await DAHelper.insert(contactDataUri, contactDataValuesFour); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500: contactDataId = " + contactDataId); - expect(contactDataId > 0).assertTrue(); - } catch (error) { - console.info("logMessage contact_manualMerge_test_500: contact_data insert error = " + error) - } - } - - async function hasOneNoPhoneManualMerge(DAHelper, rawContactIdFirst, rawContactIdSecond) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var id = [rawContactIdFirst.toString(), rawContactIdSecond.toString()]; - condition2.in("raw_contact_id", id); - var updateValues2 = {}; - try { - var ManualMergeCode = await DAHelper.update(manualMergeUri, updateValues2, condition2); - sleep(1000); - console.info("logMessage contact_manualMerge_test_500 ManualMergeCode = " + ManualMergeCode); - expect(ManualMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_manualMerge_test_500", 2); - await deleteAll(rawContactUri, "contact_manualMerge_test_500"); - await deleteAll(contactDataUri, "contact_manualMerge_test_500"); - } catch (error) { - console.info("logMessage contact_manualMerge_test_500 manual_merge error = " + error); - } - } - - /** - * @tc.number contact_autoMerge_test_600 - * @tc.name Batch add contacts, then call auto merge interface. - * @tc.desc Function test - */ - it("contact_autoMerge_test_600", 0, async function (done) { - console.info("------logMessage contact_autoMerge_test_600 is starting!-----"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - try { - var insertRawContactValues1 = { - "display_name": "xiaoliu" - }; - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_autoMerge_test_600: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_autoMerge_test_600: raw_contact_1 insert error = ' + error); - done(); - } - - try { - var insertRawContactValues2 = { - "display_name": "xiaoliu" - }; - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_autoMerge_test_600: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_autoMerge_test_600: raw_contact_2 insert error = ' + error); - done(); - } - - try { - var insertRawContactValues3 = { - "display_name": "xiaoliu" - }; - var rawContactIdThird = await DAHelper.insert(rawContactUri, insertRawContactValues3); - sleep(1000); - console.info("logMessage contact_autoMerge_test_600: rawContactIdThird = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_autoMerge_test_600: raw_contact_3 insert error = ' + error); - done(); - } - - await contactDataBatchInsert(); - done(); - }); - - async function contactDataBatchInsert(DAHelper, rawContactIdFirst, rawContactIdSecond, rawContactIdThird) { - var contactDataValues1 = { - "raw_contact_id": rawContactIdFirst, "content_type": "name", "detail_info": "xiaoliu" - }; - var contactDataValues2 = { - "raw_contact_id": rawContactIdSecond, "content_type": "name", "detail_info": "xiaoliu" - }; - var contactDataValues3 = { - "raw_contact_id": rawContactIdThird, "content_type": "name", "detail_info": "xiaoliu" - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValues1; - listAddBluk[1] = contactDataValues2; - listAddBluk[2] = contactDataValues3; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(2000); - console.info("logMessage contact_autoMerge_test_600: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - await threeAutoMerger(); - await deleteAll(rawContactUri, "contact_autoMerge_test_600"); - await deleteAll(contactDataUri, "contact_autoMerge_test_600"); - } catch (error) { - console.info('logMessage contact_autoMerge_test_600: raw_contact insert error = ' + error); - } - } - - async function threeAutoMerger(DAHelper, rawContactIdFirst) { - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_autoMerge_test_600 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_autoMerge_test_600", 3); - } catch (error) { - console.info("logMessage contact_autoMerge_test_600 auto_merge error = " + error); - } - } - - /** - * @tc.number contact_query_merge_list_test_700 - * @tc.name Query contacts to be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_700", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_700 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaowu" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_700: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await queryContactDataInsert(DAHelper, rawContactIdFirst); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_700: raw_contact_1 insert error = ' + error); - done(); - } - - var insertRawContactValues2 = { - "display_name": "xiaowu" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_700: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await queryContactDataInsertTwo(DAHelper, rawContactIdSecond); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_700: raw_contact_2 insert error = ' + error); - done(); - } - await queryMergeList(DAHelper, rawContactIdFirst, rawContactIdSecond, "contact_query_merge_list_test_700"); - done(); - }); - - async function queryContactDataInsert(DAHelper, rawContactIdFirst) { - var contactDataValues = { - "raw_contact_id": rawContactIdFirst, "content_type": "name", "detail_info": "xiaowu" - }; - try { - var contactDataId1 = await DAHelper.insert(contactDataUri, contactDataValues); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_700: contactDataId1 = " + contactDataId1); - expect(contactDataId1 > 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_700: contact_data_1 insert error = ' + error); - } - } - - async function queryContactDataInsertTwo(DAHelper, rawContactIdSecond) { - var contactDataValuesOne = { - "raw_contact_id": rawContactIdSecond, - "content_type": "name", - "detail_info": "xiaowu" - }; - var contactDataValuesTwo = { - "raw_contact_id": rawContactIdSecond, - "content_type": "phone", - "detail_info": "002563" - }; - var listAddBluk = []; - listAddBluk[0] = contactDataValuesOne; - listAddBluk[1] = contactDataValuesTwo; - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_700: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_700: contact_data_2 insert error = ' + error); - } - } - - async function queryMergeList(DAHelper, rawContactIdFirst, rawContactIdSecond, testName) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var columns = []; - var predicates = new ohosDataAbility.DataAbilityPredicates(); - try { - sleep(3000); - var resultSet = await DAHelper.query(uriQueryMergeList, columns, predicates); - var array = [rawContactIdFirst, rawContactIdSecond]; - var i = 0; - if (resultSet.rowCount > 0) { - if (resultSet.goToFirstRow()) { - do { - var rawContactId = resultSet.getInt(resultSet.getColumnIndex("raw_contact_id")); - console.info(testName + (array[i] == rawContactId)); - expect(array[i] == rawContactId).assertTrue(); - console.info(testName + rawContactId); - i++; - } while (resultSet.goToNextRow()) - } - } - resultSet.close(); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info(testName + ": query error = " + error); - } - } - - /** - * @tc.number contact_query_merge_list_test_800 - * @tc.name Insert contacts with the same name and different mobile phone numbers, - * and check whether the database can query contacts that can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_800", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_800 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaowuu" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_800: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["xiaowuu", "1854154"]; - var types = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_800: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "xiaowuu" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_800: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["xiaowuu", "1854154414242"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_800: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_800"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_900 - * @tc.name Insert two contacts with different names to see if the database can - * query contacts that can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_900", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_900 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaowusu" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_900: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["xiaowusu"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_900"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_900: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "kxiaowusu" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_900: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["kxiaowusu"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_900"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_900: raw_contact_2 insert error = ' + error); - done(); - } - await manualNotMerge(DAHelper, rawContactIdFirst, rawContactIdSecond, "contact_query_merge_list_test_900"); - done(); - }); - - async function manualNotMerge(DAHelper, rawContactIdFirst, rawContactIdSecond, tag) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var id = [rawContactIdFirst.toString(), rawContactIdSecond.toString()]; - condition2.in("raw_contact_id", id); - var updateValues2 = {}; - try { - var ManualMergeCode = await DAHelper.update(manualMergeUri, updateValues2, condition2); - sleep(1000); - console.info(tag + "logMessage ManualMergeCode = " + ManualMergeCode); - expect(ManualMergeCode == -1).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, tag, 1); - await deleteAll(rawContactUri, tag); - await deleteAll(contactDataUri, tag); - } catch (error) { - console.info(tag + "logMessage manual_merge error = " + error); - } - } - - /** - * @tc.number contact_query_merge_list_test_1000 - * @tc.name Insert contacts with the same name and phone number, and check whether - * the database can query contacts that can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1000", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1000 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaotiantian" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1000: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["xiaotiantian", "1854154414242441"]; - var types = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1000"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1000: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "xiaotiantian" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1000: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["xiaotiantian", "1854154414242441"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1000"); - sleep(2000); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1000: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - sleep(4000); - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - console.info("logMessage contact_query_merge_list_test_1000: autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_query_merge_list_test_1000", 2); - await deleteAll(rawContactUri, "contact_query_merge_list_test_1000"); - await deleteAll(contactDataUri, "contact_query_merge_list_test_1000"); - done(); - } catch (error) { - console.info("logMessage contact_auto_merge_and_spilt_test_100: auto_merge error = " + error); - } - }); - - /** - * @tc.number contact_query_merge_list_test_1100 - * @tc.name Insert contacts with different names and different mobile phone numbers, - and check whether the database can query contacts that can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1100", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1100 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "wsxiuklkk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1100: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["wsxiuklkk", "56465465"]; - var types = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1100"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1100: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "xiaolilili" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1100: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["xiaolilili", "8954598595"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1100"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1100: raw_contact_2 insert error = ' + error); - done(); - } - await manualNotMerge(DAHelper, rawContactIdFirst, rawContactIdSecond, "contact_query_merge_list_test_1100"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1200 - * @tc.name Insert two contacts with the same name. Contacts A and B have two - same mobile phone numbers, and check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1200 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "lwsxiuklkk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1200: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["lwsxiuklkk", "122504", "122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1200"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1200: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "lwsxiuklkk" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1200: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["lwsxiuklkk", "122504", "122505"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1200"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1200: raw_contact_2 insert error = ' + error); - done(); - } - await autoMerger(DAHelper, rawContactIdFirst, "contact_query_merge_list_test_1200"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1300 - * @tc.name Insert two contacts with the same name. Contacts A and B have two - * identical mobile phone numbers. Check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1300", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1300 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "xiaowuuklkk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1300: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["xiaowuuklkk", "56465465", "122504"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1300"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1300: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "xiaowuuklkk" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1300: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["xiaowuuklkk", "8954598595", "1225054"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1300"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1300: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1300"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1400 - * @tc.name Insert two contacts with the same name. Contacts A and B have two mobile phone - * numbers, one of which is the same. Check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1400", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1400 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "limingm" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["limingm", "122504555", "1122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1400"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1400: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "limingm" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1400: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["limingm", "122504555", "1225056"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1400"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1400: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1400"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1500 - * @tc.name Insert two contacts with the same name, contact A has two mobile phone numbers, - * and contact B has one mobile phone number which is the same as one of the mobile phone - * numbers of A, and check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1500 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "kplimingm" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["kplimingm", "7122504555", "1122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1500"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1500: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "kplimingm" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1500: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["kplimingm", "7122504555"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1500"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1500: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1500"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1600 - * @tc.name Insert two contacts with the same name, contact A has two mobile phone numbers, - * and contact B has a mobile phone number different from that of A, check whether - * the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1600 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "pkplimingm" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1600: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["pkplimingm", "87122504555", "11122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1600"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1600: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "pkplimingm" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1600: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["pkplimingm", "7122554504555", "11122505"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1600"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1600: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1600"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1700 - * @tc.name Insert multiple manually merged contacts to check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1700", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1700 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "llllllk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1700: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["llllllk", "87122504555", "11122505"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1700"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1700: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "llllllk" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1700: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["llllllk", "7555", "02505"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1700"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1700: raw_contact_2 insert error = ' + error); - done(); - } - var insertRawContactValues3 = { - "display_name": "llllllk" - }; - try { - var rawContactIdThird = await DAHelper.insert(rawContactUri, insertRawContactValues3); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1700: rawContactIdSecond = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - var detailInfo1 = ["llllllk", "87555", "002505"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdThird, detailInfo1, types1, "contact_query_merge_list_test_1700"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1700: raw_contact_2 insert error = ' + error); - done(); - } - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + "", rawContactIdThird + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_1700"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1800 - * @tc.name Import multiple automatically merged contacts to check whether the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1800", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1800 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "jggbgbk" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1800: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["jggbgbk", "85555", "996174"]; - var types = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "contact_query_merge_list_test_1800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1800: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "jggbgbk" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1800: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["jggbgbk", "85555", "996174"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "contact_query_merge_list_test_1800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1800: raw_contact_2 insert error = ' + error); - done(); - } - var insertRawContactValues3 = { - "display_name": "jggbgbk" - }; - try { - var rawContactIdThird = await DAHelper.insert(rawContactUri, insertRawContactValues3); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1800: rawContactIdSecond = " + rawContactIdThird); - expect(rawContactIdThird > 0).assertTrue(); - var detailInfo1 = ["jggbgbk", "85555", "996174"]; - var types1 = ["name", "phone", "phone"]; - await insertContactData(DAHelper, rawContactIdThird, detailInfo1, types1, "contact_query_merge_list_test_1800"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1800: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - try { - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1800 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactMergeQuery(map, "contact_query_merge_list_test_1800", 3); - await deleteAll(rawContactUri, "contact_query_merge_list_test_1800"); - await deleteAll(contactDataUri, "contact_query_merge_list_test_1800"); - } catch (error) { - console.info("contact_query_merge_list_test_1800 auto_merge error =" + error); - } - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_1900 - * @tc.name Insert two contacts with the same name, contact A has two mobile phone numbers, - * and contact B has a mobile phone number different from that of A, check whether - * the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_1900", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_1900 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "owjiuh" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1900: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var dataId = insertContactDataSingle(DAHelper, rawContactIdFirst, "owjiuh", "name"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1900: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "owjiuh" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_1900: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var dataId = insertContactDataSingle(DAHelper, rawContactIdFirst, "owjiuh", "name"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_1900: raw_contact_2 insert error = ' + error); - done(); - } - await updateContactData("owjiuh111", dataId, "contact_query_merge_list_test_1900"); - await autoNotMerger(DAHelper, rawContactIdFirst, "contact_query_merge_list_test_1900"); - done(); - }); - - /** - * @tc.number contact_query_merge_list_test_2000 - * @tc.name Insert two automatically merged contacts, modify the phone number of A, and then - * merge the contacts manually to check whether the database can be merged - * the database can be merged - * @tc.desc Function test - */ - it("contact_query_merge_list_test_2000", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage contact_query_merge_list_test_2000 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "ollwjiuh" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_2000: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - await insertContactDataSingle(DAHelper, rawContactIdFirst, "ollwjiuh", "name"); - var dataIdTwo = await insertContactDataSingle(DAHelper, rawContactIdFirst, "8554544", "phone"); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_2000: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "ollwjiuh" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage contact_query_merge_list_test_2000: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - await insertContactDataSingle(DAHelper, rawContactIdSecond, "ollwjiuh", "name"); - await insertContactDataSingle(DAHelper, rawContactIdSecond, "8554544", "phone"); - sleep(2000); - } catch (error) { - console.info('logMessage contact_query_merge_list_test_2000: raw_contact_2 insert error = ' + error); - done(); - } - await updateContactData("8554544444", dataIdTwo, "contact_query_merge_list_test_2000"); - sleep(3000); - var rawContactIds = [rawContactIdFirst + "", rawContactIdSecond + ""]; - await manualMergeList(DAHelper, rawContactIds, "contact_query_merge_list_test_2000"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2100 - * @tc.name Insert two contacts with different names for automatic and manual merging operations - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2100", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2100 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2100mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2100: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2100mergeTest"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2100"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2100: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2100mergeTestTwo" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2100: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2100mergeTestTwo"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2100"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2100: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - console.info("logMessage abnormal_merge_Update_test_2100 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == -1).assertTrue(); - await manualNotMerge(DAHelper, rawContactIdFirst, rawContactIdSecond, "abnormal_merge_Update_test_2100"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2200 - * @tc.name Insert two contacts with same names for automatic and manual merging operations - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2200 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2200mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2200: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2200mergeTest", "45544"]; - var types = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2200"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2200: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2200mergeTestTwo" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2200: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2200mergeTestTwo", "55134865"]; - var types1 = ["name", "phone"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2200"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2200: raw_contact_2 insert error = ' + error); - done(); - } - await queryMergeListError(DAHelper, rawContactIdFirst, rawContactIdSecond, "abnormal_merge_Update_test_2200"); - done(); - }); - - async function queryMergeListError(DAHelper, rawContactIdFirst, rawContactIdSecond, testName) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var columns = ["display_names"]; - var predicates = new ohosDataAbility.DataAbilityPredicates(); - try { - sleep(3000); - var resultSet = await DAHelper.query(uriQueryMergeList, columns, predicates); - console.info(testName + 'resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 0).assertTrue(); - resultSet.close(); - await deleteAll(rawContactUri, testName); - await deleteAll(contactDataUri, testName); - } catch (error) { - console.info(testName + ": query error = " + error); - } - } - - /** - * @tc.number abnormal_merge_Update_test_2300 - * @tc.name Insert two contacts with different names, and then automatically merge them to - * see if the database can be merged - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2300", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2300 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2300mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2300: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2300mergeTest"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2300"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2300: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2300mergeTestName" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2300: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2300mergeTestName"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2300"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2300: raw_contact_2 insert error = ' + error); - done(); - } - await autoNotMerger(DAHelper, rawContactIdFirst, "abnormal_merge_Update_test_2300"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2400 - * @tc.name Insert two contacts with different names, and then automatically merge them to - * see if the database can be merged - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2400", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2400 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2400mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2400: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2400mergeTest"]; - var types = ["namee"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2400"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2400: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2400mergeTest" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2400: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2400mergeTest"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2400"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2400: raw_contact_2 insert error = ' + error); - done(); - } - await autoNotMerger(DAHelper, rawContactIdFirst, "abnormal_merge_Update_test_2400"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2500 - * @tc.name Pass 0 after merging to split - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2500 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2500mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2500: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2500mergeTest"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2500"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2500: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2500mergeTest" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2500: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2500mergeTest"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2500"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2500: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2500 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactNotSplit(DAHelper, 0, "abnormal_merge_Update_test_2500"); - await contactMergeQuery(map, "abnormal_merge_Update_test_2500", 2); - await deleteAll(rawContactUri, "abnormal_merge_Update_test_2500"); - await deleteAll(contactDataUri, "abnormal_merge_Update_test_2500"); - done(); - }); - - /** - * @tc.number abnormal_merge_Update_test_2600 - * @tc.name Pass -1 after merging to split - * @tc.desc Function test - */ - it("abnormal_merge_Update_test_2600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('before delete_all: start ! DAHelper = ' + DAHelper); - console.info("------logMessage abnormal_merge_Update_test_2600 is starting!-----"); - var insertRawContactValues1 = { - "display_name": "2600mergeTest" - }; - try { - var rawContactIdFirst = await DAHelper.insert(rawContactUri, insertRawContactValues1); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2600: rawContactIdFirst = " + rawContactIdFirst); - expect(rawContactIdFirst > 0).assertTrue(); - var detailInfo = ["2600mergeTest"]; - var types = ["name"]; - await insertContactData(DAHelper, rawContactIdFirst, detailInfo, types, "abnormal_merge_Update_test_2600"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2600: raw_contact_1 insert error = ' + error); - done(); - } - var insertRawContactValues2 = { - "display_name": "2600mergeTest" - }; - try { - var rawContactIdSecond = await DAHelper.insert(rawContactUri, insertRawContactValues2); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2600: rawContactIdSecond = " + rawContactIdSecond); - expect(rawContactIdSecond > 0).assertTrue(); - var detailInfo1 = ["2600mergeTest"]; - var types1 = ["name"]; - await insertContactData(DAHelper, rawContactIdSecond, detailInfo1, types1, "abnormal_merge_Update_test_2600"); - } catch (error) { - console.info('logMessage abnormal_merge_Update_test_2600: raw_contact_2 insert error = ' + error); - done(); - } - var condition = new ohosDataAbility.DataAbilityPredicates(); - var updateValues = {}; - var autoMergeCode = await DAHelper.update(autoMergeUri, updateValues, condition); - sleep(1000); - console.info("logMessage abnormal_merge_Update_test_2600 autoMergeCode = " + autoMergeCode); - expect(autoMergeCode == 0).assertTrue(); - var map = new Map(); - map.set("id", rawContactIdFirst.toString()); - await contactNotSplit(DAHelper, -1, "abnormal_merge_Update_test_2600"); - await contactMergeQuery(map, "abnormal_merge_Update_test_2600", 2); - await deleteAll(rawContactUri, "abnormal_merge_Update_test_2600"); - await deleteAll(contactDataUri, "abnormal_merge_Update_test_2600"); - done(); - }); - - async function contactNotSplit(DAHelper, rawContactIdFirst, testName) { - var condition2 = new ohosDataAbility.DataAbilityPredicates(); - var array = [rawContactIdFirst.toString()]; - condition2.in("raw_contact_id", array); - var updateValues2 = {}; - try { - var splitCode = await DAHelper.update(splitUri, updateValues2, condition2); - sleep(4000); - console.info(testName + 'logMessage splitCode = ' + splitCode); - expect(splitCode == -1).assertTrue(); - } catch (error) { - console.info(testName + 'logMessage split error = ' + error); - } - } - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('merge afterAll delete_All: start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - var deletedAll = await DAHelper.delete(deletedUri, condition); - sleep(4000); - console.info('merge afterAll delete_All : deletedAll ! DAHelper = ' + deletedAll); - }); - }); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/lib/Const.js deleted file mode 100644 index f9263cd46dee1a0ffdfaa1e5ef5c29755c7e13f7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/ets/MainAbility/test/lib/Const.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 03b8532c53ca563f8ed6b1e21d20ad3f67a68906..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/hand.png b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/hand.png deleted file mode 100644 index 9f1fa16ee073093b40920e273502513fa66fa980..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/hand.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/icon.png b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/images.jpg b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/images.jpg deleted file mode 100644 index c75ddfc5ead15e8d49ca7cae9f97c03585565be1..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/images.jpg and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/person.png b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/person.png deleted file mode 100644 index f0f540d078e6c0441a763ca2cc375a551d6cf736..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/person.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-1.png b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-1.png deleted file mode 100644 index 990c5e5ad20698c7701faf641bc80eb004a127b7..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-1.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-2.png b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-2.png deleted file mode 100644 index 450c3dd3ca68bf601bd08e5f41797d376e20d00d..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-2.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-3.png b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-3.png deleted file mode 100644 index 1044869832b423a5dfc2559a395529377bd34f0c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/star-1-3.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/video/show.mp4 b/telephony/telephonyjstest/contact_function_merge/entry/src/main/resources/rawfile/video/show.mp4 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/telephony/telephonyjstest/contact_function_merge/signature/openharmony_sx.p7b b/telephony/telephonyjstest/contact_function_merge/signature/openharmony_sx.p7b deleted file mode 100644 index 66b4457a8a81fb8d3356cf46d67226c850944858..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_function_merge/signature/openharmony_sx.p7b and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/BUILD.gn b/telephony/telephonyjstest/contact_performance/BUILD.gn deleted file mode 100644 index cf8ca1bec9d0bbac3223badffee69c1ee166d2c3..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# 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("ActsContactPerformanceEtsTest") { - 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 = "ActsContactPerformanceEtsTest" -} -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" -} diff --git a/telephony/telephonyjstest/contact_performance/Test.json b/telephony/telephonyjstest/contact_performance/Test.json deleted file mode 100644 index 1ac6ac21a7f0ae6c1cf5da562d43b809cf54cd2c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1800000", - "package": "com.ohos.contactperformance", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsContactPerformanceEtsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/config.json b/telephony/telephonyjstest/contact_performance/entry/src/main/config.json deleted file mode 100644 index 7cc6935940243610c3b69fb871ccb88485bee48c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/config.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.contactperformance", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.contactperformance", - "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" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.LOCATION", - "reason": "need use ohos.permission.LOCATION" - }, - { - "name":"ohos.permission.SET_TELEPHONY_STATE", - "reason":"need use ohos.permission.SET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.GET_TELEPHONY_STATE", - "reason":"need use ohos.permission.GET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.PLACE_CALL", - "reason":"need use ohos.permission.PLACE_CALL" - }, - { - "name":"ohos.permission.READ_CONTACTS", - "reason":"need use ohos.permission.READ_CONTACTS" - }, - { - "name":"ohos.permission.WRITE_CONTACTS", - "reason":"need use ohos.permission.WRITE_CONTACTS" - }, - { - "name":"ohos.permission.SEND_MESSAGES", - "reason":"need use ohos.permission.SEND_MESSAGES" - }, - { - "name":"ohos.permission.RECEIVE_SMS", - "reason":"need use ohos.permission.RECEIVE_SMS" - }, - { - "name":"ohos.permission.READ_CALL_LOG", - "reason":"need use ohos.permission.READ_CALL_LOG" - }, - { - "name":"ohos.permission.GET_NETWORK_INFO", - "reason":"need use ohos.permission.GET_NETWORK_INFO" - }, - { - "name":"ohos.permission.INTERNET", - "reason":"need use ohos.permission.INTERNET" - } - ], - "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 diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/app.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 261fadca29ff0ea310a8bc105ddd1af65e2dd2f6..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Badge.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Badge.ets deleted file mode 100644 index 66de6f8e3b9c0360931602dd25d1511878ac63ab..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Badge.ets +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Blank.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Blank.ets deleted file mode 100644 index a50fc719e09ab27c91f9705ac06008e936830f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Blank.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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%') - - - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Button.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Button.ets deleted file mode 100644 index ac2271ea3a13664bbbb6afe4f173abae9e66f867..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Button.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Column.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Column.ets deleted file mode 100644 index b9e5c84e21ccf25419be432d8f95418fac82070a..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Column.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 }) - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets deleted file mode 100644 index cb0597310a15be8ab4503a3ae89385e3708fac96..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Counter.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Counter.ets deleted file mode 100644 index ecdbfaf10393e7a348fd76098868e6455505b07f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Counter.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/DataPanel.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/DataPanel.ets deleted file mode 100644 index 3c624848482b22998b2a1d137796ddaedbcf198c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/DataPanel.ets +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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%') - - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Divider.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Divider.ets deleted file mode 100644 index 02bf60779418674d1fd58127907fdb3915bd8f8f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Divider.ets +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Flex.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Flex.ets deleted file mode 100644 index a0e21251e80008c5be9f29aa52074acc5eb24a78..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Flex.ets +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/GridContainer.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/GridContainer.ets deleted file mode 100644 index 57358110413406263e70a2a5f650cbfeb22a4387..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/GridContainer.ets +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Image.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Image.ets deleted file mode 100644 index 5cc583e931f51aa8e4f2bd55decfeeb14a40afb4..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Image.ets +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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) - } - } -} - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Navigator.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Navigator.ets deleted file mode 100644 index 6c50769cf2ab045cbe48b52e294b4105a21e1c3d..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Navigator.ets +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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) - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Panel.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Panel.ets deleted file mode 100644 index 32ddabbd1ccbae3805dd462e6f04b28364d6a1e7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Panel.ets +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Progress.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Progress.ets deleted file mode 100644 index c8608089fe51e1988fd305fc49db028b6c2efe76..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Progress.ets +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Qrcode.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Qrcode.ets deleted file mode 100644 index 5c0dd84eff5a6653ee5fd940662d141025a1bb4e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Qrcode.ets +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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') - } - } -} - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Rating.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Rating.ets deleted file mode 100644 index b29e26a392fca6f15a5b7f0eb4156dd3bc767c3f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Rating.ets +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/RowSplit.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/RowSplit.ets deleted file mode 100644 index 0f4f397b13b83e98ac643633309b02858f337eb0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/RowSplit.ets +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Scroll.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Scroll.ets deleted file mode 100644 index 363089d22580febed16b983d8a4b2877cde52bec..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Scroll.ets +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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 = [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') - - } -} diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Slider.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Slider.ets deleted file mode 100644 index 625cd02874f16e9debb7638322624f890e08fa62..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Slider.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Span.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Span.ets deleted file mode 100644 index df5a71043f1ae000b822646f6b56df7ae103fa1f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Span.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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) - } - } -} - - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Stack.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Stack.ets deleted file mode 100644 index 2a694889f0e768afbd3e3af6a17c3af9d8738cfb..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Stack.ets +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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%') - - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Text.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Text.ets deleted file mode 100644 index fbd1415dc815b0f1966476c430f7d69e28e587ee..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/Text.ets +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 10359134da915c9b44b0836ba4881bca71f43f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,65 +0,0 @@ -// @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%') - } -} - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index 19c443805757f1926834fd2f8244eccf1c1bf585..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 PerformanceTest from './contact/Performance_test.js' - -export default function testsuite() { - //contact - PerformanceTest(); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/Utils.ets deleted file mode 100644 index 65f70088ddb62bcf80f4e0ec07dc841a8ab033f0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/Utils.ets +++ /dev/null @@ -1,119 +0,0 @@ -// @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) - } -} - - - - diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/contact/Performance_test.js b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/contact/Performance_test.js deleted file mode 100644 index 7301973fb73211f4b236c4b0ea4d1e59e79ec8f5..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/contact/Performance_test.js +++ /dev/null @@ -1,627 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CALLLOG = "dataability:///com.ohos.calllogability"; -const calllogUri = "dataability:///com.ohos.calllogability/calls/calllog"; -const URI_VOICEMAIL = "dataability:///com.ohos.voicemailability"; -const voicemailUri = "dataability:///com.ohos.voicemailability/calls/voicemail"; -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; - -export default function PerformanceTest() { - describe('PerformanceTest', function () { - console.log(' PerformanceTest is start'); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - /** - * @tc.number raw_contact_insert_performance_test_900 - * @tc.name The raw_contact table adds 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("raw_contact_insert_performance_test_900", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "display_name": "xiaoli" + i, "company": "testCompany" + i, "position": "testPosition" + i - }; - listAddBluk[i] = add; - } - try { - let old = new Date(); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - let now = new Date(); - let usedTime = now - old; - console.info('raw_contact_insert_performance_test_900 usedTime = ' + usedTime); - expect(usedTime < 70000).assertTrue(); - sleep(5000); - console.info("logMessage raw_contact_insert_performance_test_900: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage raw_contact_insert_performance_test_900: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number raw_contact_update_performance_test_1000 - * @tc.name The raw_contact table updates data whose ID is not equal to 0, and the time consumption is calculated - * according to the running time of the use case - * @tc.desc Function test - */ - it("raw_contact_update_performance_test_1000", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "favorite": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - let old = new Date(); - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - let now = new Date(); - let usedTime = now - old; - console.info('raw_contact_update_performance_test_1000 usedTime = ' + usedTime); - expect(usedTime < 3000).assertTrue(); - sleep(5000); - console.info("logMessage raw_contact_update_performance_test_1000: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage raw_contact_update_performance_test_1000: update error = " + error); - done(); - } - }); - - /** - * @tc.number raw_contact_query_performance_test_1100 - * @tc.name The raw_ contact table queries 10000 pieces of data and calculates the time consumption according to - * the running time of the use case - * @tc.desc Function test - */ - it("raw_contact_query_performance_test_1100", 0, async function (done) { - var tag = "raw_contact_query_performance_test_1100"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - let old = new Date(); - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - let now = new Date(); - let usedTime = now - old; - console.info('raw_contact_query_performance_test_1100 usedTime = ' + usedTime); - expect(usedTime < 2000).assertTrue(); - sleep(5000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info(tag + " :logMessage : error = " + error); - done(); - } - }); - - /** - * @tc.number raw_contact_delete_performance_test_1200 - * @tc.name The raw_contact table deletes 10000 pieces of data, and the time consumption is calculated according - * to the running time of the use case - * @tc.desc Function test - */ - it("raw_contact_delete_performance_test_1200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('raw_contact_delete_performance_test_1200 : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - let old = new Date(); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - let now = new Date(); - let usedTime = now - old; - console.info('raw_contact_delete_performance_test_1200 usedTime = ' + usedTime); - expect(usedTime < 10000).assertTrue(); - sleep(5000); - console.info("logMessage raw_contact_delete_performance_test_1200: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage raw_contact_delete_performance_test_1200: delete error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_data_insert_performance_test_1300 - * @tc.name The contact_data table adds 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("contact_data_insert_performance_test_1300", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoli", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_data_insert_performance_test_1300: rawContactId = " + rawContactId); - } catch (error) { - console.info("logMessage contact_data_insert_performance_test_1300: raw_contact insert error = " + error); - } - - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - sleep(1000); - console.info("logMessage contact_data_insert_performance_test_1300: deleteCode = " + deleteCode); - - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "raw_contact_id": rawContactId, "detail_info": "xxx" + i, "content_type": "name" - }; - listAddBluk[i] = add; - } - try { - let old = new Date(); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - let now = new Date(); - let usedTime = now - old; - console.info('contact_data_insert_performance_test_1300 usedTime = ' + usedTime); - expect(usedTime < 70000).assertTrue(); - sleep(5000); - console.info("logMessage contact_data_insert_performance_test_1300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_data_insert_performance_test_1300: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_data_update_performance_test_1400 - * @tc.name The contact_data table updates data whose ID is not equal to 0, and the time consumption is - * calculated according to the running time of the use case - * @tc.desc Function test - */ - it("contact_data_update_performance_test_1400", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage contact_data_update_performance_test_1400 DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "syn_1": "test" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - let now = new Date(); - let usedTime = now - old; - console.info('contact_data_update_performance_test_1400 usedTime = ' + usedTime); - expect(usedTime < 50000).assertTrue(); - sleep(8000); - console.info("logMessage contact_data_update_performance_test_1400: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage contact_data_update_performance_test_1400: update error = " + error); - done(); - } - }); - - /** - * @tc.number contact_data_query_performance_test_1500 - * @tc.name The contact_datat table queries 10000 pieces of data and calculates the time consumption according to - * the running time of the use case - * @tc.desc Function test - */ - it("contact_data_query_performance_test_1500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('contact_data_query_performance_test_1500 start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - let now = new Date(); - let usedTime = now - old; - console.info('contact_data_query_performance_test_1500 usedTime = ' + usedTime); - expect(usedTime < 4000).assertTrue(); - sleep(5000); - console.info('logMessage contact_data_query_performance_test_1500: goToFirstRow' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertEqual(true); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage contact_data_query_performance_test_1500: error = " + error); - done(); - } - }); - - /** - * @tc.number contact_data_delete_performance_test_1600 - * @tc.name The contact_data table deletes 10000 pieces of data, and the time consumption is calculated according - * to the running time of the use case - * @tc.desc Function test - */ - it("contact_data_delete_performance_test_1600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('contact_data_delete_performance_test_1600 : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var deleteCode = await DAHelper.delete(contactDataUri, condition); - let now = new Date(); - let usedTime = now - old; - console.info('contact_data_delete_performance_test_1600 usedTime = ' + usedTime); - expect(usedTime < 40000).assertTrue(); - sleep(5000); - console.info("logMessage contact_data_delete_performance_test_1600: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_data_delete_performance_test_1600: delete error = ' + error); - done(); - } - }); - - /** - * @tc.number calllog_insert_performance_test_100 - * @tc.name The callog table adds 10000 pieces of data, and the time consumption is calculated according to the - * running time of the use case - * @tc.desc Function test - */ - it("calllog_insert_performance_test_100", 0, async function (done) { - console.info("---------logMessage calllog_insert_performance_test_100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "phone_number": "1511002" + i - }; - listAddBluk[i] = add; - } - try { - let old = new Date(); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - let now = new Date(); - let usedTime = now - old; - console.info('calllog_insert_performance_test_100 usedTime = ' + usedTime); - expect(usedTime < 100000).assertTrue(); - sleep(5000); - console.info("logMessage calllog_insert_performance_test_100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage calllog_insert_performance_test_100: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_update_performance_test_200 - * @tc.name The callog table updates data whose ID is not equal to 0, and the time consumption is calculated - * according to the running time of the use case - * @tc.desc Function test - */ - it("calllog_update_performance_test_200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "answer_state": "1" - }; - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - let old = new Date(); - var updateCode = await DAHelper.update(calllogUri, updateValues, condition); - let now = new Date(); - let usedTime = now - old; - console.info('calllog_update_performance_test_200 usedTime = ' + usedTime); - expect(usedTime < 1000).assertTrue(); - sleep(5000); - console.info("logMessage calllog_update_performance_test_200: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage calllog_update_performance_test_200: update error = " + error); - done(); - } - ; - }); - - /** - * @tc.number calllog_query_performance_test_300 - * @tc.name The callog table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("calllog_query_performance_test_300", 0, async function (done) { - var tag = "calllog_query_performance_test_300"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - - try { - let old = new Date(); - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - let now = new Date(); - let usedTime = now - old; - console.info('calllog_query_performance_test_300 usedTime = ' + usedTime); - expect(usedTime < 1000).assertTrue(); - sleep(5000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage calllog_query_performance_test_300: error = " + error); - done() - } - }); - - /** - * @tc.number calllog_delete_performance_test_400 - * @tc.name The callog table deletes 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("calllog_delete_performance_test_400", 0, async function (done) { - var tag = "calllog_delete_performance_test_400"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - let old = new Date(); - var deleteCode = await DAHelper.delete(calllogUri, condition); - let now = new Date(); - let usedTime = now - old; - console.info('calllog_delete_performance_test_400 usedTime = ' + usedTime); - expect(usedTime < 10000).assertTrue(); - sleep(5000); - console.info(tag + " : logMessage : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - }); - - /** - * @tc.number voicemail_insert_performance_test_500 - * @tc.name The voicemail table adds 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("voicemail_insert_performance_test_500", 0, async function (done) { - console.info("---------logMessage voicemail_insert_performance_test_500 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "phone_number": "12345" + i - }; - listAddBluk[i] = add; - } - try { - let old = new Date(); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - let now = new Date(); - let usedTime = now - old; - console.info('voicemail_insert_performance_test_500 usedTime = ' + usedTime); - expect(usedTime < 100000).assertTrue(); - sleep(5000); - console.info("logMessage voicemail_insert_performance_test_500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_performance_test_500: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_update_performance_test_600 - * @tc.name The voicemail table updates data whose ID is not equal to 0, and the time consumption is calculated - * according to the running time of the use case - * @tc.desc Function test - */ - it("voicemail_update_performance_test_600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "origin_type": "test" - }; - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - let old = new Date(); - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - let now = new Date(); - let usedTime = now - old; - console.info('voicemail_update_performance_test_600 usedTime = ' + usedTime); - expect(usedTime < 10000).assertTrue(); - sleep(5000); - console.info("logMessage voicemail_update_performance_test_600: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_update_performance_test_600: update error = " + error); - done(); - } - ; - }); - - /** - * @tc.number voicemail_query_performance_test_700 - * @tc.name The voicemail table queries 10000 items, and the time consumption is calculated according to the - * running time of the use case - * @tc.desc Function test - */ - it("voicemail_query_performance_test_700", 0, async function (done) { - var tag = "voicemail_query_performance_test_700"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = []; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - let now = new Date(); - let usedTime = now - old; - console.info('voicemail_query_performance_test_700 usedTime = ' + usedTime); - expect(usedTime < 500).assertTrue(); - sleep(5000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage voicemail_query_performance_test_700: error = " + error); - done() - } - }); - - /** - * @tc.number voicemail_delete_performance_test_800 - * @tc.name The voicemail table deletes 10000 pieces of data, and the time consumption is calculated according to - * the running time of the use case - * @tc.desc Function test - */ - it("voicemail_delete_performance_test_800", 0, async function (done) { - if (utils.notCheck) { - expect(true).assertTrue(); - done(); - return; - } - var tag = "voicemail_delete_performance_test_800"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - let old = new Date(); - var deleteCode = await DAHelper.delete(voicemailUri, condition); - let now = new Date(); - let usedTime = now - old; - console.info('voicemail_delete_performance_test_800 usedTime = ' + usedTime); - expect(usedTime < 500).assertTrue(); - sleep(5000); - console.info(tag + " : logMessage : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_delete_performance_test_800: error = " + error); - done(); - } - }); - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('DeleteContact : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", "0"); - try { - var resultColumns = ["id"]; - var conditionDelete = new ohosDataAbility.DataAbilityPredicates(); - conditionDelete.greaterThan("id", "0"); - var count = 0; - var deleteCount = 9999; - while (count < deleteCount) { - var result = await DAHelper.query(deletedUri, resultColumns, conditionDelete); - console.info("performance : result.rowCount = " + result.rowCount); - count = result.rowCount; - result.close(); - sleep(5000); - } - var deleteCode = await DAHelper.delete(deletedUri, condition); - console.info("afterAll logMessage DeleteContact: deleteCode = " + deleteCode); - } catch (error) { - console.info('afterAll logMessage DeleteContact: delete error = ' + error); - } - }); - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/lib/Const.js deleted file mode 100644 index f9263cd46dee1a0ffdfaa1e5ef5c29755c7e13f7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/ets/MainAbility/test/lib/Const.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 03b8532c53ca563f8ed6b1e21d20ad3f67a68906..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/hand.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/hand.png deleted file mode 100644 index 9f1fa16ee073093b40920e273502513fa66fa980..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/hand.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/icon.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/images.jpg b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/images.jpg deleted file mode 100644 index c75ddfc5ead15e8d49ca7cae9f97c03585565be1..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/images.jpg and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/person.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/person.png deleted file mode 100644 index f0f540d078e6c0441a763ca2cc375a551d6cf736..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/person.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-1.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-1.png deleted file mode 100644 index 990c5e5ad20698c7701faf641bc80eb004a127b7..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-1.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-2.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-2.png deleted file mode 100644 index 450c3dd3ca68bf601bd08e5f41797d376e20d00d..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-2.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-3.png b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-3.png deleted file mode 100644 index 1044869832b423a5dfc2559a395529377bd34f0c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/star-1-3.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/video/show.mp4 b/telephony/telephonyjstest/contact_performance/entry/src/main/resources/rawfile/video/show.mp4 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/telephony/telephonyjstest/contact_performance/signature/openharmony_sx.p7b b/telephony/telephonyjstest/contact_performance/signature/openharmony_sx.p7b deleted file mode 100644 index 66b4457a8a81fb8d3356cf46d67226c850944858..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_performance/signature/openharmony_sx.p7b and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/BUILD.gn b/telephony/telephonyjstest/contact_stability/BUILD.gn deleted file mode 100644 index 0bd78c4a9e52f801324579297cd904a706c29f1e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/BUILD.gn +++ /dev/null @@ -1,32 +0,0 @@ -# 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("ActsContactStabilityEtsTest") { - 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 = "ActsContactStabilityEtsTest" -} -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" -} diff --git a/telephony/telephonyjstest/contact_stability/Test.json b/telephony/telephonyjstest/contact_stability/Test.json deleted file mode 100644 index 197a0b94631dfda2c74fd236e8f2bd1b336ce0fd..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/Test.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "description": "Configuration for hjunit demo Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "1800000", - "package": "com.ohos.contactstability", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": [ - "ActsContactStabilityEtsTest.hap" - ], - "type": "AppInstallKit", - "cleanup-apps": true - } - ] -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/config.json b/telephony/telephonyjstest/contact_stability/entry/src/main/config.json deleted file mode 100644 index 099318a01e1201eaae8941bf4d92d8b31711687d..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/config.json +++ /dev/null @@ -1,139 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.contactstability", - "vendor": "open", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 7, - "releaseType": "Release", - "target": 7 - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.contactstability", - "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" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.LOCATION", - "reason": "need use ohos.permission.LOCATION" - }, - { - "name":"ohos.permission.SET_TELEPHONY_STATE", - "reason":"need use ohos.permission.SET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.GET_TELEPHONY_STATE", - "reason":"need use ohos.permission.GET_TELEPHONY_STATE" - }, - { - "name":"ohos.permission.PLACE_CALL", - "reason":"need use ohos.permission.PLACE_CALL" - }, - { - "name":"ohos.permission.READ_CONTACTS", - "reason":"need use ohos.permission.READ_CONTACTS" - }, - { - "name":"ohos.permission.WRITE_CONTACTS", - "reason":"need use ohos.permission.WRITE_CONTACTS" - }, - { - "name":"ohos.permission.SEND_MESSAGES", - "reason":"need use ohos.permission.SEND_MESSAGES" - }, - { - "name":"ohos.permission.RECEIVE_SMS", - "reason":"need use ohos.permission.RECEIVE_SMS" - }, - { - "name":"ohos.permission.READ_CALL_LOG", - "reason":"need use ohos.permission.READ_CALL_LOG" - }, - { - "name":"ohos.permission.GET_NETWORK_INFO", - "reason":"need use ohos.permission.GET_NETWORK_INFO" - }, - { - "name":"ohos.permission.INTERNET", - "reason":"need use ohos.permission.INTERNET" - } - ], - "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 diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/app.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/app.ets deleted file mode 100644 index 261fadca29ff0ea310a8bc105ddd1af65e2dd2f6..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/app.ets +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Badge.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Badge.ets deleted file mode 100644 index 66de6f8e3b9c0360931602dd25d1511878ac63ab..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Badge.ets +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Blank.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Blank.ets deleted file mode 100644 index a50fc719e09ab27c91f9705ac06008e936830f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Blank.ets +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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%') - - - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Button.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Button.ets deleted file mode 100644 index ac2271ea3a13664bbbb6afe4f173abae9e66f867..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Button.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Column.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Column.ets deleted file mode 100644 index b9e5c84e21ccf25419be432d8f95418fac82070a..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Column.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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 }) - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets deleted file mode 100644 index cb0597310a15be8ab4503a3ae89385e3708fac96..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/ColumnSplit.ets +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Counter.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Counter.ets deleted file mode 100644 index ecdbfaf10393e7a348fd76098868e6455505b07f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Counter.ets +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/DataPanel.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/DataPanel.ets deleted file mode 100644 index 3c624848482b22998b2a1d137796ddaedbcf198c..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/DataPanel.ets +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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%') - - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Divider.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Divider.ets deleted file mode 100644 index 02bf60779418674d1fd58127907fdb3915bd8f8f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Divider.ets +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Flex.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Flex.ets deleted file mode 100644 index a0e21251e80008c5be9f29aa52074acc5eb24a78..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Flex.ets +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/GridContainer.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/GridContainer.ets deleted file mode 100644 index 57358110413406263e70a2a5f650cbfeb22a4387..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/GridContainer.ets +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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%') - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Image.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Image.ets deleted file mode 100644 index 5cc583e931f51aa8e4f2bd55decfeeb14a40afb4..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Image.ets +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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) - } - } -} - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Navigator.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Navigator.ets deleted file mode 100644 index 6c50769cf2ab045cbe48b52e294b4105a21e1c3d..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Navigator.ets +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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) - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Panel.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Panel.ets deleted file mode 100644 index 32ddabbd1ccbae3805dd462e6f04b28364d6a1e7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Panel.ets +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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 diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Progress.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Progress.ets deleted file mode 100644 index c8608089fe51e1988fd305fc49db028b6c2efe76..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Progress.ets +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Qrcode.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Qrcode.ets deleted file mode 100644 index 5c0dd84eff5a6653ee5fd940662d141025a1bb4e..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Qrcode.ets +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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') - } - } -} - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Rating.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Rating.ets deleted file mode 100644 index b29e26a392fca6f15a5b7f0eb4156dd3bc767c3f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Rating.ets +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/RowSplit.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/RowSplit.ets deleted file mode 100644 index 0f4f397b13b83e98ac643633309b02858f337eb0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/RowSplit.ets +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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%') - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Scroll.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Scroll.ets deleted file mode 100644 index 363089d22580febed16b983d8a4b2877cde52bec..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Scroll.ets +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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 = [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') - - } -} diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Slider.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Slider.ets deleted file mode 100644 index 625cd02874f16e9debb7638322624f890e08fa62..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Slider.ets +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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) - } - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Span.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Span.ets deleted file mode 100644 index df5a71043f1ae000b822646f6b56df7ae103fa1f..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Span.ets +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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) - } - } -} - - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Stack.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Stack.ets deleted file mode 100644 index 2a694889f0e768afbd3e3af6a17c3af9d8738cfb..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Stack.ets +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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%') - - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Text.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Text.ets deleted file mode 100644 index fbd1415dc815b0f1966476c430f7d69e28e587ee..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/Text.ets +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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%') - } -} - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/index.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/index.ets deleted file mode 100644 index 10359134da915c9b44b0836ba4881bca71f43f33..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/pages/index.ets +++ /dev/null @@ -1,65 +0,0 @@ -// @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%') - } -} - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/List.test.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/List.test.ets deleted file mode 100644 index a51a5eab339f7e06b653f7c64ef0586165fa2d0b..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/List.test.ets +++ /dev/null @@ -1,22 +0,0 @@ -/** - * 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 StabilityTest from './contact/Stability_test.js' - -export default function testsuite() { - //contact - StabilityTest(); -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/Utils.ets b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/Utils.ets deleted file mode 100644 index 65f70088ddb62bcf80f4e0ec07dc841a8ab033f0..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/Utils.ets +++ /dev/null @@ -1,119 +0,0 @@ -// @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) - } -} - - - - diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/contact/Stability_test.js b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/contact/Stability_test.js deleted file mode 100644 index e4639c4ac74592869af17d3f0259a57ea412b7b8..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/contact/Stability_test.js +++ /dev/null @@ -1,538 +0,0 @@ -/* - * 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 featureAbility from '@ohos.ability.featureAbility'; -import ohosDataAbility from '@ohos.data.dataAbility'; -import utils from '../Utils.ets' -import {afterAll, afterEach, beforeAll, beforeEach, describe, expect, it} from 'deccjsunit/index' - -const URI_CALLLOG = "dataability:///com.ohos.calllogability"; -const calllogUri = "dataability:///com.ohos.calllogability/calls/calllog"; - -const URI_VOICEMAIL = "dataability:///com.ohos.voicemailability"; -const voicemailUri = "dataability:///com.ohos.voicemailability/calls/voicemail"; - -const URI_CONTACTS = "dataability:///com.ohos.contactsdataability"; -const rawContactUri = "dataability:///com.ohos.contactsdataability/contacts/raw_contact"; -const contactDataUri = "dataability:///com.ohos.contactsdataability/contacts/contact_data"; -const deletedUri = "dataability:///com.ohos.contactsdataability/contacts/deleted_raw_contact"; - -export default function StabilityTest() { - describe('StabilityTest', function () { - console.log(' StabilityTest is start'); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - /** - * @tc.number raw_contact_insert_stability_test_900 - * @tc.name Add 10000 pieces of data to the raw_contact table to see if they can be successfully inserted - * @tc.desc Function test - */ - it("raw_contact_insert_stability_test_900", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "display_name": "xiaoli" + i, "company": "testCompany" + i, "position": "testPosition" + i - }; - listAddBluk[i] = add; - } - try { - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(rawContactUri, listAddBluk); - sleep(1000); - console.info("logMessage raw_contact_insert_stability_test_900: contactDataId1 = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage raw_contact_insert_stability_test_900: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number raw_contact_update_stability_test_1000 - * @tc.name The raw_contact table updates the data whose ID is not equal to 0 to see whether they can be updated - * successfully - * @tc.desc Function test - */ - it("raw_contact_update_stability_test_1000", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "favorite": 1 - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var updateCode = await DAHelper.update(rawContactUri, updateValues, condition); - sleep(1000); - console.info("logMessage raw_contact_update_stability_test_1000: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage raw_contact_update_stability_test_1000: update error = " + error); - done(); - } - }); - - /** - * @tc.number raw_contact_query_stability_test_1100 - * @tc.name The raw_contact table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("raw_contact_query_stability_test_1100", 0, async function (done) { - var tag = "raw_contact_query_stability_test_1100"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = ["id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var resultSet = await DAHelper.query(rawContactUri, resultColumns, condition); - sleep(1000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info(tag + " :logMessage : error = " + error); - done(); - } - }); - - /** - * @tc.number raw_contact_delete_stability_test_1200 - * @tc.name Delete 10000 pieces of data in raw_contact table to see if they can be deleted successfully - * @tc.desc Function test - */ - it("raw_contact_delete_stability_test_1200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('raw_contact_delete_stability_test_1200 : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - condition.and(); - condition.equalTo("is_deleted", "0"); - try { - var deleteCode = await DAHelper.delete(rawContactUri, condition); - sleep(1000); - console.info("logMessage raw_contact_delete_stability_test_1200: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage raw_contact_delete_stability_test_1200: delete error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_data_insert_stability_test_1300 - * @tc.name Add 10000 pieces of data to the contact_data table to see if they can be successfully inserted - * @tc.desc Function test - */ - it("contact_data_insert_stability_test_1300", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var rawContactValues = { - "display_name": "xiaoli", - }; - try { - var rawContactId = await DAHelper.insert(rawContactUri, rawContactValues); - sleep(1000); - console.info("logMessage contact_data_insert_stability_test_1300: rawContactId = " + rawContactId); - } catch (error) { - console.info("logMessage contact_data_insert_stability_test_1300: raw_contact insert error = " + error); - } - - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.equalTo("id", rawContactId.toString()); - var deleteCode = await DAHelper.delete(rawContactUri, condition); - sleep(1000); - console.info("logMessage contact_data_insert_stability_test_1300: deleteCode = " + deleteCode); - - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "raw_contact_id": rawContactId, "detail_info": "xxx" + i, "content_type": "name" - }; - listAddBluk[i] = add; - } - try { - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(contactDataUri, listAddBluk); - sleep(2000); - console.info("logMessage contact_data_insert_stability_test_1300: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_data_insert_stability_test_1300: insert error = ' + error); - done(); - } - }); - - /** - * @tc.number contact_data_update_stability_test_1400 - * @tc.name The contact_data table updates the data whose ID is not equal to 0 to see whether they can be updated - * successfully - * @tc.desc Function test - */ - it("contact_data_update_stability_test_1400", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('logMessage contact_data_update_stability_test_1400 DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "syn_1": "test" - }; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var updateCode = await DAHelper.update(contactDataUri, updateValues, condition); - sleep(2000); - console.info("logMessage contact_data_update_stability_test_1400: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage contact_data_update_stability_test_1400: update error = " + error); - done(); - } - }); - - /** - * @tc.number contact_data_query_stability_test_1500 - * @tc.name The contact_data table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("contact_data_query_stability_test_1500", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('contact_data_query_stability_test_1500 start ! DAHelper = ' + DAHelper); - var resultColumns = ["id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(contactDataUri, resultColumns, condition); - sleep(2000); - console.info(' contact_data_query_stability_test_1500 : resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertEqual(true); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage contact_data_query_stability_test_1500: error = " + error); - done(); - } - }); - - /** - * @tc.number contact_data_delete_stability_test_1600 - * @tc.name Delete 10000 pieces of data in contact_data table to see if they can be deleted successfully - * @tc.desc Function test - */ - it("contact_data_delete_stability_test_1600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('contact_data_delete_stability_test_1600 : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var deleteCode = await DAHelper.delete(contactDataUri, condition); - sleep(2000); - console.info("logMessage contact_data_delete_stability_test_1600: deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info('logMessage contact_data_delete_stability_test_1600: delete error = ' + error); - done(); - } - }); - - /** - * @tc.number calllog_insert_stability_test_100 - * @tc.name Add 10000 pieces of data to the callog table to see if they can be successfully inserted - * @tc.desc Function test - */ - it("calllog_insert_stability_test_100", 0, async function (done) { - console.info("---------logMessage calllog_insert_stability_test_100 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "phone_number": "1511002" + i - }; - listAddBluk[i] = add; - } - try { - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(calllogUri, listAddBluk); - sleep(1000); - console.info("logMessage calllog_insert_stability_test_100: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage calllog_insert_stability_test_100: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number calllog_update_stability_test_200 - * @tc.name The callog table updates the data whose ID is not equal to 0 to see whether they can be updated - * successfully - * @tc.desc Function test - */ - it("calllog_update_stability_test_200", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "answer_state": "1" - }; - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var updateCode = await DAHelper.update(calllogUri, updateValues, condition); - sleep(1000); - console.info("logMessage calllog_update_stability_test_200: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage calllog_update_stability_test_200: update error = " + error); - done(); - } - ; - }); - - /** - * @tc.number calllog_query_stability_test_300 - * @tc.name The callog table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("calllog_query_stability_test_300", 0, async function (done) { - var tag = "calllog_query_stability_test_300"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = ["id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - - try { - var resultSet = await DAHelper.query(calllogUri, resultColumns, condition); - sleep(5000); - console.info(tag + ' : logMessage : rowCount' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertTrue(); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage calllog_query_stability_test_300: error = " + error); - done() - } - }); - - /** - * @tc.number calllog_delete_stability_test_400 - * @tc.name Delete 10000 pieces of data in callog table to see if they can be deleted successfully - * @tc.desc Function test - */ - it("calllog_delete_stability_test_400", 0, async function (done) { - var tag = "calllog_delete_stability_test_400"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CALLLOG); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - var deleteCode = await DAHelper.delete(calllogUri, condition); - sleep(5000); - console.info(tag + " : logMessage : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - }); - - /** - * @tc.number voicemail_insert_stability_test_500 - * @tc.name Add 10000 pieces of data to the voicemail table to see if they can be successfully inserted - * @tc.desc Function test - */ - it("voicemail_insert_stability_test_500", 0, async function (done) { - console.info("---------logMessage voicemail_insert_stability_test_500 is starting!----------"); - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - - var listAddBluk = []; - for (var i = 0; i < 1000; i++) { - var add = { - "phone_number": "12345" + i - }; - listAddBluk[i] = add; - } - try { - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - var batchInsertCode = await DAHelper.batchInsert(voicemailUri, listAddBluk); - sleep(1000); - console.info("logMessage voicemail_insert_stability_test_500: batchInsertCode = " + batchInsertCode); - expect(batchInsertCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_insert_stability_test_500: batchInsert error = " + error); - done(); - } - }); - - /** - * @tc.number voicemail_update_stability_test_600 - * @tc.name The voicemail table updates the data whose ID is not equal to 0 to see whether they can be updated - * successfully - * @tc.desc Function test - */ - it("voicemail_update_stability_test_600", 0, async function (done) { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info('logMessage get DAHelper success! DAHelper = ' + DAHelper); - var updateValues = { - "origin_type": "test" - }; - try { - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", 0); - var updateCode = await DAHelper.update(voicemailUri, updateValues, condition); - sleep(1000); - console.info("logMessage voicemail_update_stability_test_600: updateCode = " + updateCode); - expect(updateCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_update_stability_test_600: update error = " + error); - done(); - } - ; - }); - - /** - * @tc.number voicemail_query_stability_test_700 - * @tc.name The voicemail table queries 10000 pieces of data to see whether they can be queried successfully - * @tc.desc Function test - */ - it("voicemail_query_stability_test_700", 0, async function (done) { - if(utils.notCheck){ - expect(true).assertTrue(); - done(); - return; - } - var tag = "voicemail_query_stability_test_700"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var resultColumns = ["id"]; - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var resultSet = await DAHelper.query(voicemailUri, resultColumns, condition); - sleep(1000); - console.info(tag + ' : resultSet.rowCount = ' + resultSet.rowCount); - expect(resultSet.rowCount == 10000).assertEqual(true); - resultSet.close(); - done(); - } catch (error) { - console.info("logMessage voicemail_query_stability_test_700: error = " + error); - done() - } - }); - - /** - * @tc.number voicemail_delete_stability_test_800 - * @tc.name Delete 10000 pieces of data in voicemail table to see if they can be deleted successfully - * @tc.desc Function test - */ - it("voicemail_delete_stability_test_800", 0, async function (done) { - var tag = "voicemail_delete_stability_test_800"; - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_VOICEMAIL); - console.info(tag + ': start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.greaterThan("id", "0"); - try { - var deleteCode = await DAHelper.delete(voicemailUri, condition); - sleep(2000); - console.info(tag + " : logMessage : deleteCode = " + deleteCode); - expect(deleteCode == 0).assertTrue(); - done(); - } catch (error) { - console.info("logMessage voicemail_delete_stability_test_800: error = " + error); - done(); - } - }); - - afterAll(async function () { - var DAHelper = featureAbility.acquireDataAbilityHelper(URI_CONTACTS); - console.info('Stability : start ! DAHelper = ' + DAHelper); - var condition = new ohosDataAbility.DataAbilityPredicates(); - condition.notEqualTo("id", "0"); - try { - var resultColumns = ["id"]; - var conditionDelete = new ohosDataAbility.DataAbilityPredicates(); - conditionDelete.greaterThan("id", "0"); - var count = 0; - var deleteCount = 9999; - while (count < deleteCount) { - var result = await DAHelper.query(deletedUri, resultColumns, conditionDelete); - console.info("Stability : result.rowCount = " + result.rowCount); - count = result.rowCount; - result.close(); - sleep(5000); - } - var deleteCode = await DAHelper.delete(deletedUri, condition); - console.info("Stability afterAll logMessage DeleteContact: deleteCode = " + deleteCode); - } catch (error) { - console.info('Stability afterAll logMessage DeleteContact: delete error = ' + error); - } - }); - }) -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/lib/Const.js b/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/lib/Const.js deleted file mode 100644 index f9263cd46dee1a0ffdfaa1e5ef5c29755c7e13f7..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/ets/MainAbility/test/lib/Const.js +++ /dev/null @@ -1,36 +0,0 @@ -/** - * 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 diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/element/string.json b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 03b8532c53ca563f8ed6b1e21d20ad3f67a68906..0000000000000000000000000000000000000000 --- a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "description_mainability", - "value": "ETS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/media/icon.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/media/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/base/media/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/hand.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/hand.png deleted file mode 100644 index 9f1fa16ee073093b40920e273502513fa66fa980..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/hand.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/icon.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/icon.png deleted file mode 100644 index ce307a8827bd75456441ceb57d530e4c8d45d36c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/icon.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/images.jpg b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/images.jpg deleted file mode 100644 index c75ddfc5ead15e8d49ca7cae9f97c03585565be1..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/images.jpg and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/person.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/person.png deleted file mode 100644 index f0f540d078e6c0441a763ca2cc375a551d6cf736..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/person.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-1.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-1.png deleted file mode 100644 index 990c5e5ad20698c7701faf641bc80eb004a127b7..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-1.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-2.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-2.png deleted file mode 100644 index 450c3dd3ca68bf601bd08e5f41797d376e20d00d..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-2.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-3.png b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-3.png deleted file mode 100644 index 1044869832b423a5dfc2559a395529377bd34f0c..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/star-1-3.png and /dev/null differ diff --git a/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/video/show.mp4 b/telephony/telephonyjstest/contact_stability/entry/src/main/resources/rawfile/video/show.mp4 deleted file mode 100644 index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..0000000000000000000000000000000000000000 diff --git a/telephony/telephonyjstest/contact_stability/signature/openharmony_sx.p7b b/telephony/telephonyjstest/contact_stability/signature/openharmony_sx.p7b deleted file mode 100644 index 66b4457a8a81fb8d3356cf46d67226c850944858..0000000000000000000000000000000000000000 Binary files a/telephony/telephonyjstest/contact_stability/signature/openharmony_sx.p7b and /dev/null differ