diff --git a/distributeddatamgr/BUILD.gn b/distributeddatamgr/BUILD.gn index 48e438d3d1ff1bd04f2710e3778782e4697ebb3b..ce3728a7921c01f0b65d70e6a98960e68af55a57 100644 --- a/distributeddatamgr/BUILD.gn +++ b/distributeddatamgr/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (C) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -16,16 +16,15 @@ group("distributeddatamgr") { testonly = true if (is_standard_system) { deps = [ - "dataObjectjstest/hap:dataObject_js_test", - "dataShare:dataShare", - "kvStorejstest/hap:kvStore_js_test", - "preferencesjstest/hap:preferences_js_test", - "relationalStorejstest/hap:relationalstore_js_test", + "appdatamgrjstest/hap:appdatamgr_js_test", + "distributeddataObjectjstest/hap:distributeddataObject_js_test", + "distributeddatamgrjstest/hap:distributeddatamgr_js_test", + "windowStage:windowStage", ] } else { deps = [ - "kvStorejstest/hap:distributeddatamgrfunctest_hap", - "relationalStorejstest/hap:appdatamgrfunctest_hap", + "appdatamgrtest/hap:appdatamgrfunctest_hap", + "distributeddatamgrtest/hap:distributeddatamgrfunctest_hap", "searchtest/hap:searchfunctest_hap", ] } @@ -33,5 +32,5 @@ group("distributeddatamgr") { group("pasteboard") { testonly = true - deps = [ "Pasteboardjsapitest:ActsPasteBoardJSApiTest" ] + deps = [ "Pasteboardjsapitest:ActsPasteBoardETSApiTest" ] } diff --git a/distributeddatamgr/Pasteboardjsapitest/BUILD.gn b/distributeddatamgr/Pasteboardjsapitest/BUILD.gn index fd76856ccf1c105d7c1f624a23911bc7e5b73b40..742a464b5958946d1eaf3222306dbd0195201c59 100644 --- a/distributeddatamgr/Pasteboardjsapitest/BUILD.gn +++ b/distributeddatamgr/Pasteboardjsapitest/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -11,21 +11,29 @@ # See the License for the specific language governing permissions and # limitations under the License. +import("//build/ohos.gni") import("//test/xts/tools/build/suite.gni") - -ohos_js_hap_suite("ActsPasteBoardJSApiTest") { +ohos_js_hap_suite("ActsPasteBoardETSApiTest") { hap_profile = "./entry/src/main/config.json" deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", + ":pasteBoard_ets_assets", + ":pasteBoard_ets_resources", + ":pasteBoard_ets_test_assets", ] + ets2abc = true + subsystem_name = "distributeddatamgr" + part_name = "pasteboard" certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsPasteBoardJSApiTest" + hap_name = "ActsPasteBoardETSApiTest" +} + +ohos_js_assets("pasteBoard_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" } -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./entry/src/main/js/default" +ohos_js_assets("pasteBoard_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" } -ohos_resources("hjs_demo_resources") { - sources = [ "./entry/src/main/js/resources" ] +ohos_resources("pasteBoard_ets_resources") { + sources = [ "./entry/src/main/resources" ] hap_profile = "./entry/src/main/config.json" } diff --git a/distributeddatamgr/Pasteboardjsapitest/Test.json b/distributeddatamgr/Pasteboardjsapitest/Test.json index 95e9b24bfee3842ea62434b4452ee09458f98b51..543a646e8c37e12f762ffd61bf04d3024819bde8 100644 --- a/distributeddatamgr/Pasteboardjsapitest/Test.json +++ b/distributeddatamgr/Pasteboardjsapitest/Test.json @@ -1,18 +1,21 @@ { "description": "Configuration for PasteBoard js api Tests", "driver": { - "type": "JSUnitTest", - "test-timeout": "1800000", - "package": "com.open.harmony.pasteboard", - "shell-timeout": "1800000" + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.acts.distributeddatamgr.pasteboardtest", + "package-name": "com.acts.distributeddatamgr.pasteboardtest", + "shell-timeout": "60000" }, "kits": [ { - "test-file-name": [ - "ActsPasteBoardJSApiTest.hap" - ], + "test-file-name": ["ActsPasteBoardETSApiTest.hap"], "type": "AppInstallKit", "cleanup-apps": true + }, + { + "type": "ShellKit", + "cleanup-apps": true } ] -} +} \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json index ad13dfb0e4eed7721630a839c32077c35308a4f8..54d1cf250dd5e0d46cf961e27411950028bb1feb 100644 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/config.json @@ -1,28 +1,28 @@ { "app": { - "bundleName": "com.open.harmony.pasteboard", - "vendor": "open", + "bundleName": "com.acts.distributeddatamgr.pasteboardtest", + "vendor": "example", "version": { - "code": 1000000, + "code": 1, "name": "1.0.0" }, "apiVersion": { - "compatible": 4, - "releaseType": "Beta1", - "target": 5 + "compatible": 7, + "target": 9, + "releaseType": "Release" } }, "deviceConfig": {}, "module": { - "package": "com.open.harmony.pasteboard", + "package": "com.acts.distributeddatamgr.pasteboardtest", "name": ".MyApplication", - "deviceType": [ - "phone" - ], + "mainAbility": "com.acts.distributeddatamgr.pasteboardtest.MainAbility", + "deviceType": ["phone"], "distro": { "deliveryWithInstall": true, "moduleName": "entry", - "moduleType": "entry" + "moduleType": "entry", + "installationFree": true }, "abilities": [ { @@ -36,21 +36,56 @@ ] } ], - "name": "com.open.harmony.pasteboard.MainAbility", + "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" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:app_name", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", "type": "page", - "launchType": "standard", - "visible": true + "launchType": "standard" } ], "js": [ { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, "pages": [ - "pages/index/index" + "pages/index" ], - "name": "default", + "name": ".TestAbility", "window": { "designWidth": 720, "autoDesignWidth": false @@ -58,4 +93,4 @@ } ] } -} \ No newline at end of file +} diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/MainAbility/app.ets b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e4e48f739b88cd4fbcc15d4e54b244d5af51d90 --- /dev/null +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/theme/screenlock_js/src/main/js/default/app.js b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/MainAbility/pages/index.ets similarity index 57% rename from theme/screenlock_js/src/main/js/default/app.js rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/MainAbility/pages/index.ets index 4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5..9967afbd1963bbe4b701a8f2a971a26bf2a9684e 100644 --- a/theme/screenlock_js/src/main/js/default/app.js +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/MainAbility/pages/index.ets @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,11 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('PASTEBOARD ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) } -}; + .width('100%') + .height('100%') + } +} + diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/TestAbility/app.ets b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e4e48f739b88cd4fbcc15d4e54b244d5af51d90 --- /dev/null +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/TestAbility/pages/index.ets b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2497c3b2774b09a40f0db535735f3dbe5e6cb6e --- /dev/null +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,50 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..07cb0b784984c6c4cc6d911c3c82643bff9df263 --- /dev/null +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +// @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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/List.test.js b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets similarity index 76% rename from distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/List.test.js rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets index 7518e7b60ab3ca6dc8b55918b34fe7546fde584e..2645795bb8fdb4a1a29ad872f1215e6dad059171 100644 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/List.test.js +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,5 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - -require('./PasteBoardJsunit.test.js') \ No newline at end of file + +import pasteBoardJEtsunitTest from './PasteBoardEtsunitTest'; + +export default function testsuite() { + pasteBoardJEtsunitTest() +} \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardEtsunitTest.ets b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardEtsunitTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..fe992165d2ccff4a508af22730d9d3354e503635 --- /dev/null +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardEtsunitTest.ets @@ -0,0 +1,3695 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// @ts-nocheck +import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from 'deccjsunit/index' +import pasteboard from '@ohos.pasteboard' + +export default function pasteBoardJEtsunitTest() { + describe('PasteBoardTest', function () { + console.info('start################################start'); + + /** + * @tc.number SUB_pasteBoard_function_JS_API_0100 + * @tc.name Adds PlainTextData + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test1', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_0100 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test1: stemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test1: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test1: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test1: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test1: systemPasteboard.setPasteData promise'); + + console.info('f_test1: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test1: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + var types = pasteData.getMimeTypes(); + console.info('f_test1: getMimeTypes = ' + types); + console.info('f_test1: getMimeTypes = ' + typeof (types)); + expect("text/plain").assertEqual(types[0]); + + console.info('f_test1: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test1: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test1: Checks the pasteboard content'); + var primaryText = pasteData1.getPrimaryText() + console.info('f_test1: primaryText = ' + primaryText); + + console.info('Checks pasteboard MAX_RECORD_NUM' + pasteboard.MAX_RECORD_NUM); + expect(pasteboard.MAX_RECORD_NUM == 128).assertTrue(); + + console.info('Checks PasteDataProperty.localOnly') + var pasteDataProperty = pasteData1.getProperty() + console.info('Checks: localOnly = ' + pasteDataProperty.localOnly) + + + console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); + console.info('f_test1: getPrimaryMimeType = ' + pasteData1.getPrimaryMimeType()); + + console.info('f_test1: SUB_pasteBoard_function_JS_API_0100 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_0200 + * @tc.name Adds PlainTextData = '' + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test2', 0, async function (done) { + console.info('f_test2: SUB_pasteBoard_function_JS_API_0200 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test2: systemPasteboard.clear promise'); + + var textData = ''; + console.info('f_test2: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test2: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test2: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test2: systemPasteboard.setPasteData promise'); + + console.info('f_test2: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test2: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test2: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + var recordCount = pasteData1.getRecordCount(); + console.info('f_test2: recordCount=' + recordCount); + expect(recordCount == 1).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_0200 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_0300 + * @tc.name Adds PlainTextData = 'Hello 中国!@#$%^&*()_+{}\?.' + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test3', 0, async function (done) { + console.info('f_test3: SUB_pasteBoard_function_JS_API_0300 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test3: systemPasteboard.clear promise'); + + var textData = 'Hello 中国!@#$%^&*()_+{}\?.'; + console.info('f_test3: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test3: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test3: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test3: systemPasteboard.setPasteData promise'); + + console.info('f_test3: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test3: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test3: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test3: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test3: Checks the pasteboard content'); + var primaryText = pasteData1.getPrimaryText() + console.info('f_test3: primaryText = ' + primaryText); + + console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); + expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true || + pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_0300 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_0400 + * @tc.name Adds 300K PlainTextData + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test4', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_0400 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test4: systemPasteboard.clear promise'); + + var textData = '' + for (var i = 0; i < 300; i++) { + textData = textData + "A"; + } + console.info('f_test4: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test4: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test4: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test4: systemPasteboard.setPasteData promise'); + + console.info('f_test4: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test4: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test4: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test4: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test4: Checks the pasteboard content'); + var primaryText = pasteData1.getPrimaryText() + console.info('f_test4: primaryText = ' + primaryText); + + console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); + expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true || + pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === false).assertTrue(); + expect(pasteData1.getPrimaryMimeType() == pasteboard.MIMETYPE_TEXT_PLAIN).assertTrue(); + + console.info('f_test4: SUB_pasteBoard_function_JS_API_0400 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_0500 + * @tc.name Adds 301K PlainTextData + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test5', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_0500 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test5: systemPasteboard.clear promise'); + + var textData = '' + for (var i = 0; i < 301; i++) { + textData = textData + "A"; + } + console.info('f_test5: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test5: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test5: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test5: systemPasteboard.setPasteData promise'); + + console.info('f_test5: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test5: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test5: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test5: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test5: Checks the pasteboard content'); + var primaryText = pasteData1.getPrimaryText() + console.info('f_test5: primaryText = ' + primaryText); + + console.info('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); + expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true || + pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_0500 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_0600 + * @tc.name Adds htmlText + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test6', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_0600 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test6: systemPasteboard.clear promise'); + + var htmlText = 'Hello World!' + console.info('f_test6: createHtmlData htmlText = ' + htmlText); + var pasteData = pasteboard.createHtmlData(htmlText); + console.info('f_test6: createHtmlData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test6: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test6: systemPasteboard.setPasteData promise'); + + console.info('f_test6: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test6: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test6: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test6: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test6: Checks the pasteboard content'); + var primaryHtml = pasteData1.getPrimaryHtml() + console.info('f_test6: getPrimaryHtml = ' + primaryHtml); + expect(primaryHtml == htmlText).assertTrue(); + + console.info('Checks there is a MIMETYPE_TEXT_HTML MIME type of data' + pasteboard.MIMETYPE_TEXT_HTML); + expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === true || + pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === false).assertTrue(); + console.info('f_test6: getPrimaryMimeType = ' + pasteData1.getPrimaryMimeType()); + + console.info('SUB_pasteBoard_function_JS_API_0600 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_0700 + * @tc.name Adds htmlText = '' + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test7', 0, async function (done) { + console.info('f_test7: SUB_pasteBoard_function_JS_API_0700 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test7: systemPasteboard.clear promise'); + + var htmlText = '' + console.info('f_test7: createHtmlData htmlText = ' + htmlText); + var pasteData = pasteboard.createHtmlData(htmlText); + console.info('f_test7: createHtmlData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test7: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test7: systemPasteboard.setPasteData promise'); + + console.info('f_test7: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test7: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test7: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_0700 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_0800 + * @tc.name Adds htmlText = 'Hello 中国!@#$%^&*()_+{}\?.' + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test8', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_0800 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test8: systemPasteboard.clear promise'); + + var htmlText = 'Hello 中国!@#$%^&*()_+{}\?.' + console.info('f_test8: createHtmlData htmlText = ' + htmlText); + var pasteData = pasteboard.createHtmlData(htmlText); + console.info('f_test8: createHtmlData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test8: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test8: systemPasteboard.setPasteData promise'); + + console.info('f_test8: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test8: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test8: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test8: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('Checks there is a MIMETYPE_TEXT_HTML MIME type of data' + pasteboard.MIMETYPE_TEXT_HTML); + expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === true || + pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_0800 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_0900 + * @tc.name Adds uriText + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test9', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_0900 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test9: systemPasteboard.clear promise'); + + var uriText = 'https://www.baidu.com/' + console.info('f_test9: createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test9: createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test9: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test9: systemPasteboard.setPasteData promise'); + + console.info('f_test9: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test9: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test9: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test9: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test9: Checks the pasteboard content'); + var primaryUri = pasteData1.getPrimaryUri() + console.info('f_test9: getPrimaryUri = ' + primaryUri); + expect(primaryUri == uriText).assertTrue(); + + console.info('Checks there is a MIMETYPE_TEXT_URI MIME type of data' + pasteboard.MIMETYPE_TEXT_URI); + expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === true || + pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_0900 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1000 + * @tc.name Adds uriText = '' + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test10', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1000 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test10: systemPasteboard.clear promise'); + + var uriText = '' + console.info('f_test10: createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test10: createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test10: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test10: systemPasteboard.setPasteData promise'); + + console.info('f_test10: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test10: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test10: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test10: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_1000 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1100 + * @tc.name Set uriText = 'Hello //' + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test11', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1100 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test11: systemPasteboard.clear promise'); + + var uriText = 'Hello//' + console.info('f_test11: createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test11: createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test11: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test11: systemPasteboard.setPasteData promise'); + + console.info('f_test11: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test11: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test11: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test11: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('Checks there is a MIMETYPE_TEXT_URI MIME type of data' + pasteboard.MIMETYPE_TEXT_URI); + expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === true || + pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_1100 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1200 + * @tc.name Adds want + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test12', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1200 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test12: systemPasteboard.clear promise'); + + var want = { + bundleName: "com.example.myapplication8", + abilityName: "com.example.myapplication8.MainAbility" + } + console.info('f_test12: createWantData want.bundleName = ' + want.bundleName); + console.info('f_test12: createWantData want.bundleName = ' + want.abilityName); + + + var pasteData = pasteboard.createWantData(want); + + console.info('f_test12: createWantData pasteData = ' + pasteData); + + console.info('f_test12: createWantData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test12: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test12: systemPasteboard.setPasteData promise'); + + console.info('f_test12: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test12: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test12: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test12: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test12: Checks the pasteboard content'); + var primaryWant = pasteData1.getPrimaryWant() + console.info('f_test12: createWantData want.bundleName = ' + primaryWant.bundleName); + console.info('f_test12: createWantData want.bundleName = ' + primaryWant.abilityName); + expect(want.bundleName).assertEqual(primaryWant.bundleName); + expect(want.abilityName).assertEqual(primaryWant.abilityName); + + console.info('Checks there is a MIMETYPE_TEXT_WANT MIME type of data' + pasteboard.MIMETYPE_TEXT_WANT); + expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_WANT) === true || + pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_WANT) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_1200 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1300 + * @tc.name Adds one record(s) + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test13', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1300 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test13: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test13: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test13: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test13: systemPasteboard.setPasteData promise'); + + console.info('f_test13: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test13: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test13: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test13: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test13: Checks the pasteboard content'); + var recordText = pasteData1.getRecordAt(0).plainText + console.info('f_test13: recordText = ' + recordText); + + console.info('SUB_pasteBoard_function_JS_API_1300 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1400 + * @tc.name Adds 2 record(s) + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test14', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1400 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test14: systemPasteboard.clear promise'); + + var textData0 = 'Hello World!'; + console.info('f_test14: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test14: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData1 = 'Hello World1' + console.info('f_test14: addTextRecord = ' + textData1) + pasteData.addTextRecord(textData1) + + console.info('f_test14: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test14: systemPasteboard.setPasteData promise'); + + console.info('f_test14: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test14: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test14: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test14: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 2).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_1400 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1500 + * @tc.name Adds 15 record(s) + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test15', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1500 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test15: systemPasteboard.clear promise'); + + var textData0 = 'Hello World!'; + console.info('f_test15: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test15: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData = '' + for (var i = 1; i < 15; i++) { + textData = 'Hello World' + textData = textData + i + console.info('f_test15: addTextRecord = ' + textData) + pasteData.addTextRecord(textData) + } + + console.info('f_test15: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test15: systemPasteboard.setPasteData promise'); + + console.info('f_test15: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test15: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test15: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test15: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 15).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_1500 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1600 + * @tc.name Adds 30 record(s) + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test16', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1600 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test16: systemPasteboard.clear promise'); + + var textData0 = 'Hello World!'; + console.info('f_test16: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test16: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData = '' + for (var i = 1; i < 30; i++) { + textData = 'Hello World' + textData = textData + i + console.info('f_test16: addTextRecord = ' + textData) + pasteData.addTextRecord(textData) + } + + console.info('f_test16: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test16: systemPasteboard.setPasteData promise'); + + console.info('f_test16: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test16: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test16: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test16: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 30).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_1600 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1700 + * @tc.name Adds 31 record(s) + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test17', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1700 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test17: systemPasteboard.clear promise'); + + var textData0 = 'Hello World!'; + console.info('f_test17: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test17: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData = '' + for (var i = 1; i < 31; i++) { + textData = 'Hello World' + textData = textData + i + console.info('f_test17: addTextRecord = ' + textData) + pasteData.addTextRecord(textData) + } + + console.info('f_test17: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test17: systemPasteboard.setPasteData promise'); + + console.info('f_test17: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test17: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test17: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test17: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + var recordCount = pasteData1.getRecordCount() + console.info('f_test17: recordCount = ' + recordCount); + expect(pasteData1.getRecordCount() == 31).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_1700 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1800 + * @tc.name Adds PlainText,HtmlText,UriText + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test18', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1800 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test18: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test18: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test18: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var htmlText = 'Hello World!' + console.info('f_test18: addHtmlRecord = ' + htmlText) + pasteData.addHtmlRecord(htmlText) + + var uriText = 'https://www.baidu.com/' + console.info('f_test18: addUriRecord = ' + uriText) + pasteData.addUriRecord(uriText) + + var want = { + bundleName: "com.example.myapplication8", + abilityName: "com.example.myapplication8.MainAbility" + } + console.info('f_test18: addWantRecord = ' + want) + pasteData.addWantRecord(want) + + + console.info('f_test18: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test18: systemPasteboard.setPasteData promise'); + + console.info('f_test18: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test18: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test18: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test18: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 4).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_1800 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_1900 + * @tc.name Delete one PlainTextData + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test19', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_1900 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test19: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test19: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test19: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test19: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test19: systemPasteboard.setPasteData promise'); + + console.info('f_test19: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test19: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test19: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test19: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test19: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('f_test19: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData1).then(() => { + console.info('f_test19: systemPasteboard.setPasteData promise'); + + console.info('f_test19: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test19: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test19: recordCount = ' + recordCount); + + console.info('SUB_pasteBoard_function_JS_API_1900 end'); + done(); + + }); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2000 + * @tc.name Delete one htmlText + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test20', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2000 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test20: systemPasteboard.clear promise'); + + var htmlText = 'Hello World!' + console.info('f_test20: createHtmlData htmlText = ' + htmlText); + var pasteData = pasteboard.createHtmlData(htmlText); + console.info('f_test20: createHtmlData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test20: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test20: systemPasteboard.setPasteData promise'); + + console.info('f_test20: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test20: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test20: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test20: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test20: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('f_test20: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData1).then(() => { + console.info('f_test20: systemPasteboard.setPasteData promise'); + + console.info('f_test20: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test20: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test20: recordCount = ' + recordCount); + + console.info('SUB_pasteBoard_function_JS_API_2000 end'); + done(); + + }); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2100 + * @tc.name Delete one uriText + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test21', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2100 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test21: systemPasteboard.clear promise'); + + var uriText = 'https://www.baidu.com/' + console.info('f_test21: createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test21: createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test21: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test21: systemPasteboard.setPasteData promise'); + + console.info('f_test21: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test21: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test21: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test21: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test21: f_test21: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('f_test21: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData1).then(() => { + console.info('f_test21: systemPasteboard.setPasteData promise'); + + console.info('f_test21: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test21: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test21: recordCount = ' + recordCount); + + console.info('SUB_pasteBoard_function_JS_API_2100 end'); + done(); + + }); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2200 + * @tc.name Delete one want + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test22', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2200 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test22: systemPasteboard.clear promise'); + + var want = { + bundleName: "com.example.myapplication8", + abilityName: "com.example.myapplication8.MainAbility" + } + console.info('f_test22: createWantData = ' + want) + var pasteData = pasteboard.createWantData(want); + console.info('f_test22: createWantData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test22: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test22: systemPasteboard.setPasteData promise'); + + console.info('f_test22: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test22: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test22: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test22: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test22: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('f_test22: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData1).then(() => { + console.info('f_test22: systemPasteboard.setPasteData promise'); + + console.info('f_test22: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test22: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test22: recordCount = ' + recordCount); + + console.info('SUB_pasteBoard_function_JS_API_2200 end'); + done(); + + }); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2300 + * @tc.name Deletes 300K PlainTextData + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test23', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2300 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test23: systemPasteboard.clear promise'); + + var textData = '' + for (var i = 0; i < 300; i++) { + textData = textData + "A"; + } + console.info('f_test23: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test23: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test23: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test23: systemPasteboard.setPasteData promise'); + + console.info('f_test23: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test23: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test23: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test23: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test23: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('f_test23: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData1).then(() => { + console.info('f_test23: systemPasteboard.setPasteData promise'); + + console.info('f_test23: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test23: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test23: recordCount = ' + recordCount); + + console.info('SUB_pasteBoard_function_JS_API_2300 end'); + done(); + + }); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2400 + * @tc.name Deletes 30 record(s) + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test24', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2400 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test24: systemPasteboard.clear promise'); + + var textData0 = 'Hello World' + console.info('f_test24: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test24: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData = '' + for (var i = 1; i < 30; i++) { + textData = 'Hello World' + textData = textData + i + pasteData.addTextRecord(textData) + } + + systemPasteboard.setPasteData(pasteData).then(() => { + + console.info('f_test24: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test24: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + systemPasteboard.getPasteData().then((data) => { + console.info('f_test24: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 30).assertTrue(); + + console.info('f_test24: Removes the Record') + for (var i = 0; i < 30; i++) { + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + } + + systemPasteboard.setPasteData(pasteData1).then(() => { + console.info('f_test24: systemPasteboard.setPasteData promise'); + + systemPasteboard.getPasteData().then((data) => { + console.info('f_test24: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test24: recordCount = ' + recordCount); + + console.info('SUB_pasteBoard_function_JS_API_2400 end'); + done(); + + }); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2500 + * @tc.name Deletes replaced record + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test25', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2500 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test25: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test25: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test25: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test25: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test25: systemPasteboard.setPasteData promise'); + + console.info('f_test25: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test25: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test25: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test25: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + var textData1 = 'Hello World1' + console.info('f_test25: Replaces the Record = ' + textData1) + var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) + var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); + console.info('f_test25: replace = ' + replace) + + console.info('f_test25: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('f_test25: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData1).then(() => { + console.info('f_test25: systemPasteboard.setPasteData promise'); + + console.info('f_test25: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test25: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test25: recordCount = ' + recordCount); + + console.info('SUB_pasteBoard_function_JS_API_2500 end'); + done(); + + }); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2600 + * @tc.name Deletes 文本、uri、html + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test26', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2600 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test26: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test26: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test26: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var htmlText = 'Hello World!' + console.info('f_test26: addHtmlRecord = ' + htmlText) + pasteData.addHtmlRecord(htmlText) + + var uriText = 'https://www.baidu.com/' + console.info('f_test26: addUriRecord = ' + uriText) + pasteData.addUriRecord(uriText) + + console.info('f_test26: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test26: systemPasteboard.setPasteData promise'); + + console.info('f_test26: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test26: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test26: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test26: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 3).assertTrue(); + + console.info('f_test26: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('f_test26: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData1).then(() => { + console.info('f_test26: systemPasteboard.setPasteData promise'); + + console.info('f_test26: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test26: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test26: recordCount = ' + recordCount); + + console.info('SUB_pasteBoard_function_JS_API_2600 end'); + done(); + + }); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2700 + * @tc.name Replaces 文本 record + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test27', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2700 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test27: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test27: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test27: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test27: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test27: systemPasteboard.setPasteData promise'); + + console.info('f_test27: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test27: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test27: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test27: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + var textData1 = 'Hello World1' + console.info('f_test27: Replaces the Record = ' + textData1) + var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) + var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); + console.info('f_test27: replace = ' + replace) + + console.info('f_test27: Checks the pasteboard content'); + var primaryText = pasteData1.getPrimaryText(); + console.info('f_test27: primaryText = ' + primaryText); + + console.info('SUB_pasteBoard_function_JS_API_2700 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2800 + * @tc.name Replaces htmlText record + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test28', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2800 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test28: systemPasteboard.clear promise'); + + var htmlText = 'Hello World!' + console.info('f_test28: createHtmlData htmlText = ' + htmlText); + var pasteData = pasteboard.createHtmlData(htmlText); + console.info('f_test28: createHtmlData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test28: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test28: systemPasteboard.setPasteData promise'); + + console.info('f_test28: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test28: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test28: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test28: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + var htmlText1 = 'Hello World 1' + console.info('f_test28: Replaces the htmlText = ' + htmlText1) + var pasteDataRecord = pasteboard.createHtmlTextRecord(htmlText1) + var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); + console.info('f_test28: replace = ' + replace) + + console.info('SUB_pasteBoard_function_JS_API_2800 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_2900 + * @tc.name Replaces uri record + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test29', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_2900 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test29: systemPasteboard.clear promise'); + + var uriText = 'https://www.baidu.com/' + console.info('f_test29: createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test29: createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test29: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test29: systemPasteboard.setPasteData promise'); + + console.info('f_test29: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test29: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test29: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test29: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + var uriText1 = 'https://www.baidu.com/1' + console.info('f_test29: Replaces the uriText = ' + uriText1) + var pasteDataRecord = pasteboard.createUriRecord(uriText1) + var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); + console.info('f_test29: replace = ' + replace) + + console.info('SUB_pasteBoard_function_JS_API_2900 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3000 + * @tc.name Replaces want record + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test30', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3000 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test30: systemPasteboard.clear promise'); + + var wantText0 = { + bundleName: "com.example.myapplication3", + abilityName: "com.example.myapplication3.MainAbility" + } + console.info('f_test30: createWantData want = ' + wantText0); + var pasteData = pasteboard.createWantData(wantText0); + console.info('f_test30: createWantData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test30: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test30: systemPasteboard.setPasteData promise'); + + console.info('f_test30: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test30: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test30: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test30: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + var wantText1 = { + bundleName: "com.example.myapplication30", + abilityName: "com.example.myapplication30.MainAbility" + } + console.info('f_test30: Replaces the wantText = ' + wantText1) + var pasteDataRecord = pasteboard.createWantRecord(wantText1) + var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); + console.info('f_test30: replace = ' + replace) + + console.info('SUB_pasteBoard_function_JS_API_3000 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3100 + * @tc.name Replaces 300k文本 record + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test31', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3100 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test31: systemPasteboard.clear promise'); + + var textData = '' + for (var i = 0; i < 300; i++) { + textData = textData + "A"; + } + console.info('f_test31: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test31: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test31: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test31: systemPasteboard.setPasteData promise'); + + console.info('f_test31: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test31: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test31: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test31: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + var textData1 = 'Hello World1' + console.info('f_test31: Replaces the Record = ' + textData1) + var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) + var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); + console.info('f_test31: replace = ' + replace) + + console.info('f_test31: Checks the pasteboard content'); + var primaryText = pasteData1.getPrimaryText(); + console.info('f_test31: primaryText = ' + primaryText); + + console.info('SUB_pasteBoard_function_JS_API_3100 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3200 + * @tc.name Adds one record(s), gets record count + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test32', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3200 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test32: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test32: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test32: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test32: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test32: systemPasteboard.setPasteData promise'); + + console.info('Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test32: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test32: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test32: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_3200 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3300 + * @tc.name Adds 2 record(s), gets record count + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test33', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3300 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test33: systemPasteboard.clear promise'); + + var textData0 = 'Hello World!'; + console.info('f_test33: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test33: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData = '' + for (var i = 1; i < 2; i++) { + textData = 'Hello World' + textData = textData + i + console.info('f_test33: addTextRecord = ' + textData) + pasteData.addTextRecord(textData) + } + + console.info('f_test33: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test33: systemPasteboard.setPasteData promise'); + + console.info('f_test33: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test33: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test33: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test33: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 2).assertTrue(); + + console.info('SUB_pasteBoard_function_.' + 'JS_API_3300 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3400 + * @tc.name Adds 15 record(s), gets record count + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test34', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3400 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test34: systemPasteboard.clear promise'); + + var textData0 = 'Hello World!'; + console.info('f_test34: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test34: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData = '' + for (var i = 1; i < 15; i++) { + textData = 'Hello World' + textData = textData + i + console.info('f_test34: addTextRecord = ' + textData) + pasteData.addTextRecord(textData) + } + + console.info('f_test34: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test34: systemPasteboard.setPasteData promise'); + + console.info('f_test34: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test34: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test34: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test34: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 15).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_3400 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3500 + * @tc.name Adds 30 record(s), gets record count + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test35', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3500 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test35: systemPasteboard.clear promise'); + + var textData0 = 'Hello World!'; + console.info('f_test35: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test35: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData = '' + for (var i = 1; i < 30; i++) { + textData = 'Hello World' + textData = textData + i + console.info('f_test35: addTextRecord = ' + textData) + pasteData.addTextRecord(textData) + } + + console.info('f_test35: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test35: systemPasteboard.setPasteData promise'); + + console.info('f_test35: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test35: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test35: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test35: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 30).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_3500 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3600 + * @tc.name Adds 31 record(s), gets record count + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test36', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3600 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test36: systemPasteboard.clear promise'); + + var textData0 = 'Hello World!'; + console.info('f_test36: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test36: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData = '' + for (var i = 1; i < 31; i++) { + textData = 'Hello World' + textData = textData + i + console.info('f_test36: addTextRecord = ' + textData) + pasteData.addTextRecord(textData) + } + + console.info('f_test36: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test36: systemPasteboard.setPasteData promise'); + + console.info('f_test36: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test36: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test36: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test36: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 31).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_3600 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3700 + * @tc.name Replaces one record, gets record count + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test37', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3700 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test37: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test37: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test37: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test37: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test37: systemPasteboard.setPasteData promise'); + + console.info('f_test37: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test37: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test37: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test37: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + var textData1 = 'Hello World1' + console.info('f_test37: Replaces the Record = ' + textData1) + var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) + var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); + console.info('f_test37: replace = ' + replace) + + console.info('f_test37: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test37: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + expect(pasteData2.getRecordCount() == 1).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_3700 end'); + done(); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3800 + * @tc.name Clears pasteBoard, gets record count + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test38', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3800 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test38: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test38: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test38: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test38: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test38: systemPasteboard.setPasteData promise'); + + console.info('f_test38: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test38: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test38: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test38: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test38: Clears the pasteBoard') + systemPasteboard.clear() + + console.info('f_test38: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test38: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test38 recordCount = ' + recordCount); + + console.info('SUB_pasteBoard_function_JS_API_3800 end'); + done(); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_3900 + * @tc.name Adds Property + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test39', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_3900 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test39: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test39: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test39: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test39: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test39: systemPasteboard.setPasteData promise'); + + console.info('f_test39: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test39: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test39: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test39: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test39: Sets the Property') + var pasteDataProperty = pasteData1.getProperty() + console.info('f_test39: timestamp = ' + pasteDataProperty.timestamp) + pasteDataProperty.additions["one"] = "Hello" + + console.info('f_test39: Checks the Property') + var pasteDataProperty1 = pasteData1.getProperty() + console.info('f_test39: timestamp = ' + pasteDataProperty1.timestamp) + console.info('f_test39: additions = ' + pasteDataProperty1.additions["one"]) + + console.info('SUB_pasteBoard_function_JS_API_3900 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4000 + * @tc.name Set Property's tags + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test40', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4000 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test40: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test40: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test40: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test40: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test40: systemPasteboard.setPasteData promise'); + + console.info('f_test40: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test40: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test40: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test40: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test40: Sets the Property') + var pasteDataProperty = pasteData1.getProperty() + console.info('f_test40: timestamp = ' + pasteDataProperty.timestamp) + pasteDataProperty.additions["one"] = "Hello" + pasteDataProperty.tag = "Test" + + console.info('f_test40: Checks the Property') + var pasteDataProperty1 = pasteData1.getProperty() + console.info('f_test40: timestamp = ' + pasteDataProperty1.timestamp) + console.info('f_test40: additions = ' + pasteDataProperty1.additions["one"]) + console.info('f_test40: tag = ' + pasteDataProperty1.tag) + console.info('f_test40: getTag = ' + pasteData1.getTag()) + + console.info('SUB_pasteBoard_function_JS_API_4000 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4100 + * @tc.name Clears pasteBoard and check property + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test41', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4100 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test41: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test41: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test41: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test41: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test41: systemPasteboard.setPasteData promise'); + + console.info('f_test41: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test41: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test41: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test41: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test41: Clears the pasteBoard') + systemPasteboard.clear() + + console.info('f_test41: Checks the Property') + var pasteDataProperty1 = pasteData1.getProperty() + console.info('f_test41: timestamp = ' + pasteDataProperty1.timestamp) + console.info('f_test41: tag = ' + pasteDataProperty1.tag) + + console.info('SUB_pasteBoard_function_JS_API_4100 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4200 + * @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等文本数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test42', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4200 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test42: systemPasteboard.clear promise'); + + console.info('f_test42: Open the infor for pasteboard content changes') + systemPasteboard.on('update', contentChanges) + + var textData = 'Hello World!'; + console.info('f_test42: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test42: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test42: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test42: systemPasteboard.setPasteData promise'); + + console.info('f_test42: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test42: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test42: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test42: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test42: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_4200 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4300 + * @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等html数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test43', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4300 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test43: systemPasteboard.clear promise'); + + console.info('f_test43: Open the infor for pasteboard content changes') + systemPasteboard.on('update', contentChanges) + + var htmlText = 'Hello World!' + console.info('f_test43: createHtmlData htmlText = ' + htmlText); + var pasteData = pasteboard.createHtmlData(htmlText); + console.info('f_test43: createHtmlData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test43: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test43: systemPasteboard.setPasteData promise'); + + console.info('f_test43: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test43: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test43: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test43: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test43: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_4300 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4400 + * @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等uri数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test44', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4400 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test44: systemPasteboard.clear promise'); + + console.info('f_test44: Open the infor for pasteboard content changes') + systemPasteboard.on('update', contentChanges) + + var uriText = 'https://www.baidu.com/' + console.info('f_test44: createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test44: createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test44: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test44: systemPasteboard.setPasteData promise'); + + console.info('f_test44: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test44: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test44: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test44: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test44: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_4400 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4500 + * @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等want数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test45', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4500 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test45: systemPasteboard.clear promise'); + + console.info('f_test45: Open the infor for pasteboard content changes') + systemPasteboard.on('update', contentChanges) + + var want = { + bundleName: "com.example.myapplication45", + abilityName: "com.example.myapplication45.MainAbility" + } + console.info('f_test45: createWantData = ' + want) + var pasteData = pasteboard.createWantData(want); + console.info('f_test45: createWantData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test45: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test45: systemPasteboard.setPasteData promise'); + + console.info('f_test45: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test45: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test45: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test45: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test45: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_4500 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4600 + * @tc.name 打开内容变化通知功能:清除剪切板内容 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test46', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4600 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test46: systemPasteboard.clear promise'); + + console.info('f_test46: Open the infor for pasteboard content changes') + systemPasteboard.on('update', contentChanges) + + var textData = 'Hello World!'; + console.info('f_test46: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test46: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test46: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test46: systemPasteboard.setPasteData promise'); + + console.info('f_test46: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test46: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test46: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test46: Clears the pasteBoard') + systemPasteboard.clear() + + console.info('SUB_pasteBoard_function_JS_API_4600 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4700 + * @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等文本数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test47', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4700 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test47: systemPasteboard.clear promise'); + + console.info('f_test47: Close the infor for pasteboard content changes') + systemPasteboard.off('update', contentChanges) + + var textData = 'Hello World!'; + console.info('f_test47: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test47: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test47: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test47: systemPasteboard.setPasteData promise'); + + console.info('f_test47: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test47: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test47: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test47: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test47: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_4700 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4800 + * @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等html数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test48', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4800 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test48: systemPasteboard.clear promise'); + + console.info('f_test48: Close the infor for pasteboard content changes') + systemPasteboard.off('update', contentChanges) + + var htmlText = 'Hello World!' + console.info('f_test48: createHtmlData htmlText = ' + htmlText); + var pasteData = pasteboard.createHtmlData(htmlText); + console.info('f_test48: createHtmlData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test48: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test48: systemPasteboard.setPasteData promise'); + + console.info('f_test48: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test48: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test48: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test48: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test48: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_4800 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_4900 + * @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等uri数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test49', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_4900 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test49: systemPasteboard.clear promise'); + + console.info('f_test49: Close the infor for pasteboard content changes') + systemPasteboard.off('update', contentChanges) + + var uriText = 'https://www.baidu.com/' + console.info('f_test49: createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test49: createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test49: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test49: systemPasteboard.setPasteData promise'); + + console.info('f_test49: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test49: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test49: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test49: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test49: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_4900 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5000 + * @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等want数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test50', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5000 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test50: systemPasteboard.clear promise'); + + console.info('f_test50: Open the infor for pasteboard content changes') + systemPasteboard.off('update', contentChanges) + + var want = { + bundleName: "com.example.myapplication45", + abilityName: "com.example.myapplication45.MainAbility" + } + console.info('f_test50: createWantData = ' + want) + var pasteData = pasteboard.createWantData(want); + console.info('f_test50: createWantData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test50: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test50: systemPasteboard.setPasteData promise'); + + console.info('f_test50: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test50: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test50: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test50: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test50: Removes the Record') + expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_5000 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5100 + * @tc.name 关闭内容变化通知功能:清除剪切板内容 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test51', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5100 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test51: systemPasteboard.clear promise'); + + console.info('f_test51: Close the infor for pasteboard content changes') + systemPasteboard.off('update', contentChanges) + + var textData = 'Hello World!'; + console.info('f_test51: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test51: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test51: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test51: systemPasteboard.setPasteData promise'); + + console.info('f_test51: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test51: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test51: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test51: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test51: Clears the pasteBoard') + systemPasteboard.clear() + + console.info('SUB_pasteBoard_function_JS_API_5100 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5200 + * @tc.name 清除剪切板内的文本数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test52', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5200 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test52: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test52: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test52: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test52: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test52: systemPasteboard.setPasteData promise'); + + console.info('f_test52: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test52: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test52: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test52: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test52: Clears the pasteBoard') + systemPasteboard.clear() + + console.info('f_test52: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test52: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test52 recordCount = ' + recordCount); + }) + + console.info('SUB_pasteBoard_function_JS_API_5200 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5300 + * @tc.name 清除剪切板内的uri数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test53', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5300 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test53: systemPasteboard.clear promise'); + + var uriText = 'https://www.baidu.com/' + console.info('f_test53: createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test53: createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test53: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test53: systemPasteboard.setPasteData promise'); + + console.info('f_test53: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test53: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test53: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test53: Clears the pasteBoard') + systemPasteboard.clear() + + console.info('f_test53: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test53: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test38 recordCount = ' + recordCount); + }) + + console.info('SUB_pasteBoard_function_JS_API_5300 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5400 + * @tc.name 清除剪切板内的html数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test54', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5400 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test54: systemPasteboard.clear promise'); + + var htmlText = 'Hello World!' + console.info('f_test54: createHtmlData htmlText = ' + htmlText); + var pasteData = pasteboard.createHtmlData(htmlText); + console.info('f_test54: createHtmlData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test54: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test54: systemPasteboard.setPasteData promise'); + + console.info('f_test54: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test54: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test54: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test54: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test54: Clears the pasteBoard') + systemPasteboard.clear() + + console.info('f_test54: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test54: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test38 recordCount = ' + recordCount); + }) + + console.info('SUB_pasteBoard_function_JS_API_5400 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5500 + * @tc.name 清除剪切板内的want数据项 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test55', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5500 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test55: systemPasteboard.clear promise'); + + var myWant = { + bundleName: "com.example.myapplication55", + abilityName: "com.example.myapplication55.MainAbility" + } + console.info('f_test01: createWantData want = ' + myWant); + var pasteData = pasteboard.createWantData(myWant); + console.info('f_test01: createWantData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test55: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test55: systemPasteboard.setPasteData promise'); + + console.info('f_test55: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test55: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test55: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test55: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test55: Clears the pasteBoard') + systemPasteboard.clear() + + console.info('f_test55: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test55: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test38 recordCount = ' + recordCount); + }) + + console.info('SUB_pasteBoard_function_JS_API_5500 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5600 + * @tc.name 向剪切板内增加30条数据项,然后清除 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test56', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5600 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test56: systemPasteboard.clear promise'); + + var textData0 = 'Hello World!'; + console.info('f_test56: createPlainTextData textData = ' + textData0); + var pasteData = pasteboard.createPlainTextData(textData0); + console.info('f_test56: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + var textData = '' + for (var i = 1; i < 30; i++) { + textData = 'Hello World' + textData = textData + i + console.info('f_test56: addTextRecord = ' + textData) + pasteData.addTextRecord(textData) + } + + console.info('f_test56: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test56: systemPasteboard.setPasteData promise'); + + console.info('f_test56: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test56: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test56: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test56: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 30).assertTrue(); + + console.info('f_test56: Clears the pasteBoard') + systemPasteboard.clear() + + console.info('f_test56: Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test56: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test38 recordCount = ' + recordCount); + }) + + console.info('SUB_pasteBoard_function_JS_API_5600 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5700 + * @tc.name 向剪贴板数据各增加5条文本、uri、html数据,然后清除 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test57', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5700 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + + var textData0 = 'Hello World0' + console.info('f_test57: createPlainTextData = ' + textData0) + var pasteData = pasteboard.createPlainTextData(textData0) + + var textData = '' + for (var i = 1; i < 5; i++) { + textData = 'Hello World' + textData = textData + i + pasteData.addTextRecord(textData) + } + + var htmlText = '' + for (var i = 0; i < 5; i++) { + htmlText = 'Hello World!' + htmlText = htmlText + i + pasteData.addHtmlRecord(htmlText) + } + + var uriText = '' + for (var i = 0; i < 5; i++) { + uriText = 'https://www.baidu.com/' + uriText = uriText + i + pasteData.addUriRecord(uriText) + } + + systemPasteboard.setPasteData(pasteData).then(() => { + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test57: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + systemPasteboard.getPasteData().then((data) => { + console.info('f_test57: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 15).assertTrue(); + systemPasteboard.clear() + systemPasteboard.getPasteData().then((data) => { + console.info('f_test57: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData2 = data; + var recordCount = pasteData2.getRecordCount(); + console.info('f_test38 recordCount = ' + recordCount); + }) + + console.info('SUB_pasteBoard_function_JS_API_5700 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5800 + * @tc.name 向剪贴板数据增加文本数据项,查询剪贴板存在剪贴板数据 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test58', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5800 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test58: systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test58: createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test58: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test58: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test58: systemPasteboard.setPasteData promise'); + + console.info('f_test58: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test58: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_5800 end') + done(); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_5900 + * @tc.name 向剪贴板数据增加uri数据项,查询剪贴板存在剪贴板数据 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test59', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_5900 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('systemPasteboard.clear promise'); + + var uriText = 'https://www.baidu.com/' + console.info('f_test59: createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test59: createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test59: Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test59: systemPasteboard.setPasteData promise'); + + console.info('f_test59: Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test59: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_5900 end') + done(); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6000 + * @tc.name 向剪贴板数据增加html数据项,查询剪贴板存在剪贴板数据 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test60', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6000 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test60 systemPasteboard.clear promise'); + + var htmlText = 'Hello World!' + console.info('f_test60createHtmlData htmlText = ' + htmlText); + var pasteData = pasteboard.createHtmlData(htmlText); + console.info('f_test60createHtmlData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test60Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test60systemPasteboard.setPasteData promise'); + + console.info('f_test60Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test60systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_6000 end') + done(); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6100 + * @tc.name 向剪贴板数据增加want数据项,查询剪贴板存在剪贴板数据 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test61', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6100 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test61 systemPasteboard.clear promise'); + + var myWant = { + bundleName: "com.example.myapplication8", + abilityName: "com.example.myapplication8.MainAbility" + } + console.info('f_test01: createWantData want = ' + myWant); + var pasteData = pasteboard.createWantData(myWant); + console.info('f_test01: createWantData pasteData = ' + JSON.stringify(pasteData)); + + console.info('Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('systemPasteboard.setPasteData promise'); + + console.info('Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_6100 end') + done(); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6200 + * @tc.name 向剪贴板数据各增加5条文本、uri、html,查询剪贴板存在剪贴板数据 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test62', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6200 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test62 systemPasteboard.clear promise'); + + var textData0 = 'Hello World0' + console.info('f_test62 createPlainTextData = ' + textData0) + var pasteData = pasteboard.createPlainTextData(textData0) + + var textData = '' + for (var i = 1; i < 5; i++) { + textData = 'Hello World' + textData = textData + i + console.info('f_test62 addTextRecord = ' + textData) + pasteData.addTextRecord(textData) + } + + var htmlText = '' + for (var i = 0; i < 5; i++) { + htmlText = 'Hello World!' + htmlText = htmlText + i + console.info('f_test62 addHtmlRecord = ' + htmlText) + pasteData.addHtmlRecord(htmlText) + } + + var uriText = '' + for (var i = 0; i < 5; i++) { + uriText = 'https://www.baidu.com/' + uriText = uriText + i + console.info('f_test62 addUriRecord = ' + uriText) + pasteData.addUriRecord(uriText) + } + + console.info('f_test62 Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test62 systemPasteboard.setPasteData promise'); + + console.info('f_test62 Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test62 systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_6200 end') + done(); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6300 + * @tc.name 更新剪贴板数据,查询剪贴板存在剪贴板数据 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test63', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6300 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test63 systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test63 createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test63 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test63 systemPasteboard.setPasteData promise'); + + console.info('f_test63 Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test63 systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test63 Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test63 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + var textData1 = 'Hello World1' + console.info('f_test63 Replaces the Record = ' + textData1) + var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) + pasteData1.replaceRecordAt(0, pasteDataRecord) + + console.info('f_test63 Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test63 systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + }) + + console.info('SUB_pasteBoard_function_JS_API_6300 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6400 + * @tc.name 删除所有的剪贴板数据,查询剪贴板不存在剪贴板数据 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test64', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6400 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test64 systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test64 createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test64 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test64 Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test64 systemPasteboard.setPasteData promise'); + + console.info('f_test64 Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test64 systemPasteboard.hasPasteData promise data = ' + data); + + console.info('f_test64 Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test64 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + var recordCount = pasteData1.getRecordCount(); + console.info('f_test64 recordCount = ' + recordCount); + + console.info('f_test64 Removes the Record') + pasteData1.removeRecordAt(0) + + console.info('f_test64 Checks the number of records'); + var recordCount1 = pasteData1.getRecordCount(); + console.info('f_test64 recordCount = ' + recordCount1); + + console.info('SUB_pasteBoard_function_JS_API_6400 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6500 + * @tc.name 清除剪贴板数据,查询剪贴板不存在剪贴板数据 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test65', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6500 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test65 systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test65 createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test65 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test65 Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test65 systemPasteboard.setPasteData promise'); + + console.info('f_test65 Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test65 systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test65 Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test65 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test65 Clears the pasteBoard') + systemPasteboard.clear() + + console.info('f_test65 Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData1).then(() => { + console.info('f_test65 systemPasteboard.setPasteData promise'); + + console.info('f_test65 Checks there is no content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test65 systemPasteboard.hasPasteData promise data = ' + data); + + console.info('SUB_pasteBoard_function_JS_API_6400 end'); + done(); + }); + }); + }); + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6600 + * @tc.name 将文本数据强制转换为文本 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test66', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6600 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test66 systemPasteboard.clear promise'); + + var textData = 'Hello World!'; + console.info('f_test66 createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test66 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test66 Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test66 systemPasteboard.setPasteData promise'); + + console.info('f_test66 Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test66 systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test66 Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test66 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test66 Converts the PlainTextData to text') + var pasteDataRecord = pasteData1.getRecordAt(0) + console.info('checks pasteDataRecord.mimeType = ' + pasteDataRecord.mimeType) + + console.info('f_test66 pasteDataRecord.convertToText = ' + pasteDataRecord.convertToText); + + console.info('f_test66 SUB_pasteBoard_function_JS_API_6600 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6700 + * @tc.name 将一条含有特殊字符、中英混杂的文本数据强制转换为文本 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test67', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6700 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test67 systemPasteboard.clear promise'); + + var textData = 'Hello 中国!@#$%^&*()_+{}\?.'; + console.info('f_test67 createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test67 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test67 Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test67 systemPasteboard.setPasteData promise'); + + console.info('f_test67 Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test67 systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test67 Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test67 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test67 Converts the PlainTextData to text') + var pasteDataRecord = pasteData1.getRecordAt(0) + console.info('f_test67 pasteDataRecord.convertToText = ' + pasteDataRecord.convertToText); + + console.info('SUB_pasteBoard_function_JS_API_6700 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6800 + * @tc.name 将一条超长文本数据 (大小为301K)强制转换为文本 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test68', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6800 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test68 systemPasteboard.clear promise'); + + var textData = '' + for (var i = 0; i < 301; i++) { + textData = textData + "A"; + } + console.info('f_test68 createPlainTextData textData = ' + textData); + var pasteData = pasteboard.createPlainTextData(textData); + console.info('f_test68 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test68 Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test68 systemPasteboard.setPasteData promise'); + + console.info('f_test68 Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test68 systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test68 Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test68 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test68 Converts the PlainTextData to text') + var pasteDataRecord = pasteData1.getRecordAt(0) + console.info('f_test68 pasteDataRecord.convertToText = ' + pasteDataRecord.convertToText); + + console.info('SUB_pasteBoard_function_JS_API_6800 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_6900 + * @tc.name 将uri数据强制转换为文本 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test69', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_6900 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + console.info('f_test69 systemPasteboard.clear promise'); + + var uriText = 'https://www.baidu.com/' + console.info('f_test69 createUriData uriText = ' + uriText); + var pasteData = pasteboard.createUriData(uriText); + console.info('f_test69 createUriData pasteData = ' + JSON.stringify(pasteData)); + + console.info('f_test69 Writes PasteData to the pasteboard'); + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('f_test69 systemPasteboard.setPasteData promise'); + + console.info('f_test69 Checks there is content in the pasteboard') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test69 systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + console.info('f_test69 Checks the number of records'); + systemPasteboard.getPasteData().then((data) => { + console.info('f_test69 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + expect(pasteData1.getRecordCount() == 1).assertTrue(); + + console.info('f_test69 Converts the PlainTextData to text') + var pasteDataRecord = pasteData1.getRecordAt(0) + + pasteDataRecord.convertToText().then((data) => { + console.info('convertToText success data : ' + JSON.stringify(data)); + }).catch((error) => { + console.error('convertToText failed because ' + JSON.stringify(error)); + }); + ; + + console.info('SUB_pasteBoard_function_JS_API_6900 end'); + done(); + }) + }); + }); + }); + }) + + /** + * @tc.number SUB_pasteBoard_function_JS_API_7000 + * @tc.name 复制文本、uri格式 + * @tc.desc Test pasteBoard API functionality. + * @tc.size : MEDIUM + * @tc.type : Function + * @tc.level : Level 0 + */ + it('pasteboard_function_test70', 0, async function (done) { + console.info('SUB_pasteBoard_function_JS_API_7000 start') + + var systemPasteboard = pasteboard.getSystemPasteboard(); + systemPasteboard.clear().then(() => { + + var textData0 = 'Hello World0' + console.info('f_test70: createPlainTextData = ' + textData0) + + var pasteData = pasteboard.createPlainTextData(textData0) + console.info('f_test70: createPlainTextData = ' + JSON.stringify(pasteData)) + + var uriText = pasteboard.createUriRecord("https://www.baidu.com/"); + pasteData.addRecord(uriText); + console.info('f_test70: addRecord(uriText) = ' + pasteData) + console.info('f_test70: addRecord(uriText) = ' + JSON.stringify(pasteData)) + + + systemPasteboard.setPasteData(pasteData).then(() => { + console.info('---------------------------->1') + systemPasteboard.hasPasteData().then((data) => { + console.info('f_test70: systemPasteboard.hasPasteData promise data = ' + data); + expect(data === true || data === false).assertTrue(); + + systemPasteboard.getPasteData().then((data) => { + console.info('f_test70: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); + var pasteData1 = data; + var recordCount = pasteData1.getRecordCount(); + console.info('f_test70: recordCount=' + recordCount); + expect(pasteData1.getRecordCount() == 2).assertTrue(); + + console.info('SUB_pasteBoard_function_JS_API_7000 end'); + done(); + }) + }); + }); + }); + }) + + + /** + * The callback function is used for pasteboard content changes + */ + function contentChanges() { + console.info('#EVENT: The content is changed in the pasteboard') + } + }); +} + diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/en-US.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/zh-CN.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.css b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 01ad739b27f208ff04f21924695104bd27c59df0..0000000000000000000000000000000000000000 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,24 +0,0 @@ -/* -* Copyright (c) 2022 Huawei Device Co., Ltd. -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -.container { - flex-direction: column; - justify-content: center; - align-items: center; -} - -.title { - font-size: 100px; -} diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.hml b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f99407c7e17ea547a58e64b3ef573867ebcb6918..0000000000000000000000000000000000000000 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,20 +0,0 @@ - - -
- - {{ title }} - -
diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.js b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index 7efe936172fa961d82be642ce2aceff08a8cc275..0000000000000000000000000000000000000000 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,45 +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 {Core, ExpectExtend} from 'deccjsunit' - -const injectRef = Object.getPrototypeOf(global) || global -injectRef.regeneratorRuntime = require('@babel/runtime/regenerator') - -export default { - data: { - title: '' - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - - require('../../test/List.test') - core.execute() - }, - onReady() { - }, - onBackPress(){ - } -} diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/PasteBoardJsunit.test.js b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/PasteBoardJsunit.test.js deleted file mode 100644 index 8386280a15514eadbd3ef66fcf5c374af9f45008..0000000000000000000000000000000000000000 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/test/PasteBoardJsunit.test.js +++ /dev/null @@ -1,3703 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -import pasteboard from '@ohos.pasteboard' - -describe('PasteBoardTest', function() { - console.log('start################################start'); - - /** - * @tc.number SUB_pasteBoard_function_JS_API_0100 - * @tc.name Adds PlainTextData - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test1',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_0100 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test1: stemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test1: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test1: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test1: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test1: systemPasteboard.setPasteData promise'); - - console.log('f_test1: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test1: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - var types = pasteData.getMimeTypes(); - console.info('f_test1: getMimeTypes = ' + types); - console.info('f_test1: getMimeTypes = ' + typeof (types)); - expect("text/plain").assertEqual(types[0]); - - console.log('f_test1: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test1: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test1: Checks the pasteboard content'); - var primaryText = pasteData1.getPrimaryText() - console.log('f_test1: primaryText = ' + primaryText); - - console.info('Checks pasteboard MAX_RECORD_NUM' + pasteboard.MAX_RECORD_NUM); - expect(pasteboard.MAX_RECORD_NUM == 128).assertTrue(); - - console.info('Checks PasteDataProperty.localOnly') - var pasteDataProperty = pasteData1.getProperty() - console.info('Checks: localOnly = ' + pasteDataProperty.localOnly) - - - - console.log('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); - console.log('f_test1: getPrimaryMimeType = ' + pasteData1.getPrimaryMimeType()); - - console.log('f_test1: SUB_pasteBoard_function_JS_API_0100 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_0200 - * @tc.name Adds PlainTextData = '' - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test2',0, async function (done) { - console.log('f_test2: SUB_pasteBoard_function_JS_API_0200 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test2: systemPasteboard.clear promise'); - - var textData = ''; - console.log('f_test2: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test2: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test2: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test2: systemPasteboard.setPasteData promise'); - - console.log('f_test2: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test2: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test2: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - var recordCount = pasteData1.getRecordCount(); - console.log('f_test2: recordCount=' + recordCount); - expect(recordCount == 1).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_0200 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_0300 - * @tc.name Adds PlainTextData = 'Hello 中国!@#$%^&*()_+{}\?.' - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test3',0, async function (done) { - console.log('f_test3: SUB_pasteBoard_function_JS_API_0300 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test3: systemPasteboard.clear promise'); - - var textData = 'Hello 中国!@#$%^&*()_+{}\?.'; - console.log('f_test3: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test3: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test3: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test3: systemPasteboard.setPasteData promise'); - - console.log('f_test3: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test3: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test3: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test3: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test3: Checks the pasteboard content'); - var primaryText = pasteData1.getPrimaryText() - console.log('f_test3: primaryText = ' + primaryText); - - console.log('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); - expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true || - pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_0300 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_0400 - * @tc.name Adds 300K PlainTextData - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test4',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_0400 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test4: systemPasteboard.clear promise'); - - var textData = '' - for (var i = 0; i < 300; i++){ - textData=textData + "A"; - } - console.log('f_test4: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test4: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test4: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test4: systemPasteboard.setPasteData promise'); - - console.log('f_test4: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test4: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test4: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test4: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test4: Checks the pasteboard content'); - var primaryText = pasteData1.getPrimaryText() - console.log('f_test4: primaryText = ' + primaryText); - - console.log('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); - expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true || - pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === false).assertTrue(); - expect(pasteData1.getPrimaryMimeType() == pasteboard.MIMETYPE_TEXT_PLAIN).assertTrue(); - - console.log('f_test4: SUB_pasteBoard_function_JS_API_0400 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_0500 - * @tc.name Adds 301K PlainTextData - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test5',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_0500 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test5: systemPasteboard.clear promise'); - - var textData = '' - for (var i = 0; i < 301; i++){ - textData=textData + "A"; - } - console.log('f_test5: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test5: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test5: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test5: systemPasteboard.setPasteData promise'); - - console.log('f_test5: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test5: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test5: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test5: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test5: Checks the pasteboard content'); - var primaryText = pasteData1.getPrimaryText() - console.log('f_test5: primaryText = ' + primaryText); - - console.log('Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data' + pasteboard.MIMETYPE_TEXT_PLAIN); - expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === true || - pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_PLAIN) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_0500 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_0600 - * @tc.name Adds htmlText - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test6',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_0600 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test6: systemPasteboard.clear promise'); - - var htmlText = 'Hello World!' - console.log('f_test6: createHtmlData htmlText = ' + htmlText); - var pasteData = pasteboard.createHtmlData(htmlText); - console.log('f_test6: createHtmlData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test6: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test6: systemPasteboard.setPasteData promise'); - - console.log('f_test6: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test6: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test6: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test6: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.info('f_test6: Checks the pasteboard content'); - var primaryHtml = pasteData1.getPrimaryHtml() - console.info('f_test6: getPrimaryHtml = ' + primaryHtml); - expect(primaryHtml == htmlText).assertTrue(); - - console.log('Checks there is a MIMETYPE_TEXT_HTML MIME type of data' + pasteboard.MIMETYPE_TEXT_HTML); - expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === true || - pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === false).assertTrue(); - console.log('f_test6: getPrimaryMimeType = ' + pasteData1.getPrimaryMimeType()); - - console.log('SUB_pasteBoard_function_JS_API_0600 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_0700 - * @tc.name Adds htmlText = '' - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test7',0, async function (done) { - console.log('f_test7: SUB_pasteBoard_function_JS_API_0700 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test7: systemPasteboard.clear promise'); - - var htmlText = '' - console.log('f_test7: createHtmlData htmlText = ' + htmlText); - var pasteData = pasteboard.createHtmlData(htmlText); - console.log('f_test7: createHtmlData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test7: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test7: systemPasteboard.setPasteData promise'); - - console.log('f_test7: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test7: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test7: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_0700 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_0800 - * @tc.name Adds htmlText = 'Hello 中国!@#$%^&*()_+{}\?.' - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test8',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_0800 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test8: systemPasteboard.clear promise'); - - var htmlText = 'Hello 中国!@#$%^&*()_+{}\?.' - console.log('f_test8: createHtmlData htmlText = ' + htmlText); - var pasteData = pasteboard.createHtmlData(htmlText); - console.log('f_test8: createHtmlData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test8: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test8: systemPasteboard.setPasteData promise'); - - console.log('f_test8: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test8: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test8: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test8: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('Checks there is a MIMETYPE_TEXT_HTML MIME type of data' + pasteboard.MIMETYPE_TEXT_HTML); - expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === true || - pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_HTML) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_0800 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_0900 - * @tc.name Adds uriText - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test9',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_0900 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test9: systemPasteboard.clear promise'); - - var uriText = 'https://www.baidu.com/' - console.log('f_test9: createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test9: createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test9: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test9: systemPasteboard.setPasteData promise'); - - console.log('f_test9: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test9: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test9: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test9: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.info('f_test9: Checks the pasteboard content'); - var primaryUri = pasteData1.getPrimaryUri() - console.info('f_test9: getPrimaryUri = ' + primaryUri); - expect(primaryUri == uriText).assertTrue(); - - console.log('Checks there is a MIMETYPE_TEXT_URI MIME type of data' + pasteboard.MIMETYPE_TEXT_URI); - expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === true || - pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_0900 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1000 - * @tc.name Adds uriText = '' - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test10',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1000 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test10: systemPasteboard.clear promise'); - - var uriText = '' - console.log('f_test10: createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test10: createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test10: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test10: systemPasteboard.setPasteData promise'); - - console.log('f_test10: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test10: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test10: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test10: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_1000 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1100 - * @tc.name Set uriText = 'Hello //' - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test11',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1100 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test11: systemPasteboard.clear promise'); - - var uriText = 'Hello//' - console.log('f_test11: createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test11: createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test11: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test11: systemPasteboard.setPasteData promise'); - - console.log('f_test11: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test11: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test11: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test11: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('Checks there is a MIMETYPE_TEXT_URI MIME type of data' + pasteboard.MIMETYPE_TEXT_URI); - expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === true || - pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_URI) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_1100 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1200 - * @tc.name Adds want - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test12',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1200 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test12: systemPasteboard.clear promise'); - - var want = { - bundleName: "com.example.myapplication8", - abilityName: "com.example.myapplication8.MainAbility" - } - console.info('f_test12: createWantData want.bundleName = ' + want.bundleName); - console.info('f_test12: createWantData want.bundleName = ' + want.abilityName); - - - var pasteData = pasteboard.createWantData(want); - - console.info('f_test12: createWantData pasteData = ' + pasteData); - - console.info('f_test12: createWantData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test12: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test12: systemPasteboard.setPasteData promise'); - - console.log('f_test12: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test12: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test12: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test12: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.info('f_test12: Checks the pasteboard content'); - var primaryWant = pasteData1.getPrimaryWant() - console.info('f_test12: createWantData want.bundleName = ' + primaryWant.bundleName); - console.info('f_test12: createWantData want.bundleName = ' + primaryWant.abilityName); - expect(want.bundleName).assertEqual(primaryWant.bundleName); - expect(want.abilityName).assertEqual(primaryWant.abilityName); - - console.log('Checks there is a MIMETYPE_TEXT_WANT MIME type of data' + pasteboard.MIMETYPE_TEXT_WANT); - expect(pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_WANT) === true || - pasteData1.hasMimeType(pasteboard.MIMETYPE_TEXT_WANT) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_1200 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1300 - * @tc.name Adds one record(s) - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test13',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1300 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test13: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test13: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test13: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test13: systemPasteboard.setPasteData promise'); - - console.log('f_test13: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test13: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test13: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test13: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test13: Checks the pasteboard content'); - var recordText = pasteData1.getRecordAt(0).plainText - console.log('f_test13: recordText = ' + recordText); - - console.log('SUB_pasteBoard_function_JS_API_1300 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1400 - * @tc.name Adds 2 record(s) - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test14',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1400 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test14: systemPasteboard.clear promise'); - - var textData0 = 'Hello World!'; - console.log('f_test14: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.log('f_test14: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData1 = 'Hello World1' - console.log('f_test14: addTextRecord = ' + textData1) - pasteData.addTextRecord(textData1) - - console.log('f_test14: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test14: systemPasteboard.setPasteData promise'); - - console.log('f_test14: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test14: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test14: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test14: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 2).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_1400 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1500 - * @tc.name Adds 15 record(s) - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test15',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1500 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test15: systemPasteboard.clear promise'); - - var textData0 = 'Hello World!'; - console.log('f_test15: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.log('f_test15: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData = '' - for(var i = 1; i < 15; i++) - { - textData = 'Hello World' - textData = textData + i - console.log('f_test15: addTextRecord = ' + textData) - pasteData.addTextRecord(textData) - } - - console.log('f_test15: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test15: systemPasteboard.setPasteData promise'); - - console.log('f_test15: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test15: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test15: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test15: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 15).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_1500 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1600 - * @tc.name Adds 30 record(s) - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test16',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1600 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test16: systemPasteboard.clear promise'); - - var textData0 = 'Hello World!'; - console.log('f_test16: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.log('f_test16: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData = '' - for(var i = 1; i < 30; i++) - { - textData = 'Hello World' - textData = textData + i - console.log('f_test16: addTextRecord = ' + textData) - pasteData.addTextRecord(textData) - } - - console.log('f_test16: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test16: systemPasteboard.setPasteData promise'); - - console.log('f_test16: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test16: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test16: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test16: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 30).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_1600 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1700 - * @tc.name Adds 31 record(s) - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test17',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1700 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test17: systemPasteboard.clear promise'); - - var textData0 = 'Hello World!'; - console.log('f_test17: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.log('f_test17: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData = '' - for(var i = 1; i < 31; i++) - { - textData = 'Hello World' - textData = textData + i - console.log('f_test17: addTextRecord = ' + textData) - pasteData.addTextRecord(textData) - } - - console.log('f_test17: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test17: systemPasteboard.setPasteData promise'); - - console.log('f_test17: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test17: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test17: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test17: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - var recordCount = pasteData1.getRecordCount() - console.log('f_test17: recordCount = ' + recordCount); - expect(pasteData1.getRecordCount() == 31).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_1700 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1800 - * @tc.name Adds PlainText,HtmlText,UriText - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test18',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1800 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test18: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test18: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test18: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var htmlText = 'Hello World!' - console.log('f_test18: addHtmlRecord = ' + htmlText) - pasteData.addHtmlRecord(htmlText) - - var uriText = 'https://www.baidu.com/' - console.log('f_test18: addUriRecord = ' + uriText) - pasteData.addUriRecord(uriText) - - var want = { - bundleName: "com.example.myapplication8", - abilityName: "com.example.myapplication8.MainAbility" - } - console.info('f_test18: addWantRecord = ' + want) - pasteData.addWantRecord(want) - - - console.log('f_test18: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test18: systemPasteboard.setPasteData promise'); - - console.log('f_test18: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test18: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test18: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test18: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 4).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_1800 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_1900 - * @tc.name Delete one PlainTextData - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test19',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_1900 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test19: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test19: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test19: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test19: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test19: systemPasteboard.setPasteData promise'); - - console.log('f_test19: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test19: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test19: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test19: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test19: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('f_test19: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData1).then(() => { - console.log('f_test19: systemPasteboard.setPasteData promise'); - - console.log('f_test19: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test19: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test19: recordCount = ' + recordCount); - - console.log('SUB_pasteBoard_function_JS_API_1900 end'); - done(); - - }); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2000 - * @tc.name Delete one htmlText - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test20',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2000 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test20: systemPasteboard.clear promise'); - - var htmlText = 'Hello World!' - console.log('f_test20: createHtmlData htmlText = ' + htmlText); - var pasteData = pasteboard.createHtmlData(htmlText); - console.log('f_test20: createHtmlData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test20: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test20: systemPasteboard.setPasteData promise'); - - console.log('f_test20: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test20: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test20: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test20: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test20: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('f_test20: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData1).then(() => { - console.log('f_test20: systemPasteboard.setPasteData promise'); - - console.log('f_test20: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test20: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test20: recordCount = ' + recordCount); - - console.log('SUB_pasteBoard_function_JS_API_2000 end'); - done(); - - }); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2100 - * @tc.name Delete one uriText - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test21',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2100 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test21: systemPasteboard.clear promise'); - - var uriText = 'https://www.baidu.com/' - console.log('f_test21: createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test21: createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test21: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test21: systemPasteboard.setPasteData promise'); - - console.log('f_test21: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test21: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test21: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test21: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test21: f_test21: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('f_test21: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData1).then(() => { - console.log('f_test21: systemPasteboard.setPasteData promise'); - - console.log('f_test21: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test21: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test21: recordCount = ' + recordCount); - - console.log('SUB_pasteBoard_function_JS_API_2100 end'); - done(); - - }); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2200 - * @tc.name Delete one want - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test22',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2200 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test22: systemPasteboard.clear promise'); - - var want = { - bundleName: "com.example.myapplication8", - abilityName: "com.example.myapplication8.MainAbility" - } - console.log('f_test22: createWantData = ' + want) - var pasteData = pasteboard.createWantData(want); - console.log('f_test22: createWantData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test22: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test22: systemPasteboard.setPasteData promise'); - - console.log('f_test22: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test22: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test22: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test22: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test22: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('f_test22: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData1).then(() => { - console.log('f_test22: systemPasteboard.setPasteData promise'); - - console.log('f_test22: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test22: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test22: recordCount = ' + recordCount); - - console.log('SUB_pasteBoard_function_JS_API_2200 end'); - done(); - - }); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2300 - * @tc.name Deletes 300K PlainTextData - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test23',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2300 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test23: systemPasteboard.clear promise'); - - var textData = '' - for (var i = 0; i < 300; i++){ - textData=textData + "A"; - } - console.log('f_test23: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test23: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test23: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test23: systemPasteboard.setPasteData promise'); - - console.log('f_test23: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test23: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test23: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test23: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test23: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('f_test23: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData1).then(() => { - console.log('f_test23: systemPasteboard.setPasteData promise'); - - console.log('f_test23: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test23: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test23: recordCount = ' + recordCount); - - console.log('SUB_pasteBoard_function_JS_API_2300 end'); - done(); - - }); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2400 - * @tc.name Deletes 30 record(s) - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test24',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2400 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test24: systemPasteboard.clear promise'); - - var textData0 = 'Hello World' - console.log('f_test24: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.log('f_test24: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData = '' - for(var i = 1; i < 30; i++) - { - textData = 'Hello World' - textData = textData + i - pasteData.addTextRecord(textData) - } - - systemPasteboard.setPasteData(pasteData).then(() => { - - console.log('f_test24: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test24: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - systemPasteboard.getPasteData().then((data) => { - console.log('f_test24: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 30).assertTrue(); - - console.log('f_test24: Removes the Record') - for(var i = 0; i < 30; i++) - { - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - } - - systemPasteboard.setPasteData(pasteData1).then(() => { - console.log('f_test24: systemPasteboard.setPasteData promise'); - - systemPasteboard.getPasteData().then((data) => { - console.log('f_test24: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test24: recordCount = ' + recordCount); - - console.log('SUB_pasteBoard_function_JS_API_2400 end'); - done(); - - }); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2500 - * @tc.name Deletes replaced record - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test25',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2500 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test25: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test25: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test25: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test25: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test25: systemPasteboard.setPasteData promise'); - - console.log('f_test25: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test25: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test25: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test25: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - var textData1 = 'Hello World1' - console.log('f_test25: Replaces the Record = ' + textData1) - var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) - var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); - console.log('f_test25: replace = ' + replace) - - console.log('f_test25: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('f_test25: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData1).then(() => { - console.log('f_test25: systemPasteboard.setPasteData promise'); - - console.log('f_test25: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test25: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test25: recordCount = ' + recordCount); - - console.log('SUB_pasteBoard_function_JS_API_2500 end'); - done(); - - }); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2600 - * @tc.name Deletes 文本、uri、html - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test26',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2600 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test26: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test26: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test26: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var htmlText = 'Hello World!' - console.log('f_test26: addHtmlRecord = ' + htmlText) - pasteData.addHtmlRecord(htmlText) - - var uriText = 'https://www.baidu.com/' - console.log('f_test26: addUriRecord = ' + uriText) - pasteData.addUriRecord(uriText) - - console.log('f_test26: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test26: systemPasteboard.setPasteData promise'); - - console.log('f_test26: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test26: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test26: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test26: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 3).assertTrue(); - - console.log('f_test26: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('f_test26: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData1).then(() => { - console.log('f_test26: systemPasteboard.setPasteData promise'); - - console.log('f_test26: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test26: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test26: recordCount = ' + recordCount); - - console.log('SUB_pasteBoard_function_JS_API_2600 end'); - done(); - - }); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2700 - * @tc.name Replaces 文本 record - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test27',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2700 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test27: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test27: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test27: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test27: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test27: systemPasteboard.setPasteData promise'); - - console.log('f_test27: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test27: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test27: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test27: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - var textData1 = 'Hello World1' - console.log('f_test27: Replaces the Record = ' + textData1) - var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) - var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); - console.log('f_test27: replace = ' + replace) - - console.log('f_test27: Checks the pasteboard content'); - var primaryText = pasteData1.getPrimaryText(); - console.log('f_test27: primaryText = ' + primaryText); - - console.log('SUB_pasteBoard_function_JS_API_2700 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2800 - * @tc.name Replaces htmlText record - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test28',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2800 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test28: systemPasteboard.clear promise'); - - var htmlText = 'Hello World!' - console.log('f_test28: createHtmlData htmlText = ' + htmlText); - var pasteData = pasteboard.createHtmlData(htmlText); - console.log('f_test28: createHtmlData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test28: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test28: systemPasteboard.setPasteData promise'); - - console.log('f_test28: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test28: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test28: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test28: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - var htmlText1 = 'Hello World 1' - console.log('f_test28: Replaces the htmlText = ' + htmlText1) - var pasteDataRecord = pasteboard.createHtmlTextRecord(htmlText1) - var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); - console.log('f_test28: replace = ' + replace) - - console.log('SUB_pasteBoard_function_JS_API_2800 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_2900 - * @tc.name Replaces uri record - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test29',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_2900 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test29: systemPasteboard.clear promise'); - - var uriText = 'https://www.baidu.com/' - console.log('f_test29: createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test29: createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test29: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test29: systemPasteboard.setPasteData promise'); - - console.log('f_test29: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test29: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test29: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test29: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - var uriText1 = 'https://www.baidu.com/1' - console.log('f_test29: Replaces the uriText = ' + uriText1) - var pasteDataRecord = pasteboard.createUriRecord(uriText1) - var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); - console.log('f_test29: replace = ' + replace) - - console.log('SUB_pasteBoard_function_JS_API_2900 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3000 - * @tc.name Replaces want record - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test30',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_3000 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test30: systemPasteboard.clear promise'); - - var wantText0 = { - bundleName: "com.example.myapplication3", - abilityName: "com.example.myapplication3.MainAbility" - } - console.log('f_test30: createWantData want = ' + wantText0); - var pasteData = pasteboard.createWantData(wantText0); - console.log('f_test30: createWantData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test30: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test30: systemPasteboard.setPasteData promise'); - - console.log('f_test30: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test30: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test30: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test30: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - var wantText1 = { - bundleName: "com.example.myapplication30", - abilityName: "com.example.myapplication30.MainAbility" - } - console.log('f_test30: Replaces the wantText = ' + wantText1) - var pasteDataRecord = pasteboard.createWantRecord(wantText1) - var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); - console.log('f_test30: replace = ' + replace) - - console.log('SUB_pasteBoard_function_JS_API_3000 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3100 - * @tc.name Replaces 300k文本 record - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test31',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_3100 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test31: systemPasteboard.clear promise'); - - var textData = '' - for (var i = 0; i < 300; i++){ - textData=textData + "A"; - } - console.log('f_test31: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test31: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test31: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test31: systemPasteboard.setPasteData promise'); - - console.log('f_test31: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test31: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test31: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test31: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - var textData1 = 'Hello World1' - console.log('f_test31: Replaces the Record = ' + textData1) - var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) - var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); - console.log('f_test31: replace = ' + replace) - - console.log('f_test31: Checks the pasteboard content'); - var primaryText = pasteData1.getPrimaryText(); - console.log('f_test31: primaryText = ' + primaryText); - - console.log('SUB_pasteBoard_function_JS_API_3100 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3200 - * @tc.name Adds one record(s), gets record count - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test32',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_3200 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test32: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test32: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test32: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test32: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test32: systemPasteboard.setPasteData promise'); - - console.log('Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test32: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test32: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test32: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_3200 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3300 - * @tc.name Adds 2 record(s), gets record count - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test33',0, async function (done) { - console.info('SUB_pasteBoard_function_JS_API_3300 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.info('f_test33: systemPasteboard.clear promise'); - - var textData0 = 'Hello World!'; - console.info('f_test33: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.info('f_test33: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData = '' - for(var i = 1; i < 2; i++) - { - textData = 'Hello World' - textData = textData + i - console.info('f_test33: addTextRecord = ' + textData) - pasteData.addTextRecord(textData) - } - - console.info('f_test33: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.info('f_test33: systemPasteboard.setPasteData promise'); - - console.info('f_test33: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.info('f_test33: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.info('f_test33: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.info('f_test33: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 2).assertTrue(); - - console.info('SUB_pasteBoard_function_.' + 'JS_API_3300 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3400 - * @tc.name Adds 15 record(s), gets record count - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test34',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_3400 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test34: systemPasteboard.clear promise'); - - var textData0 = 'Hello World!'; - console.log('f_test34: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.log('f_test34: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData = '' - for(var i = 1; i < 15; i++) - { - textData = 'Hello World' - textData = textData + i - console.log('f_test34: addTextRecord = ' + textData) - pasteData.addTextRecord(textData) - } - - console.log('f_test34: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test34: systemPasteboard.setPasteData promise'); - - console.log('f_test34: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test34: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test34: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test34: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 15).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_3400 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3500 - * @tc.name Adds 30 record(s), gets record count - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test35',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_3500 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test35: systemPasteboard.clear promise'); - - var textData0 = 'Hello World!'; - console.log('f_test35: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.log('f_test35: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData = '' - for(var i = 1; i < 30; i++) - { - textData = 'Hello World' - textData = textData + i - console.log('f_test35: addTextRecord = ' + textData) - pasteData.addTextRecord(textData) - } - - console.log('f_test35: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test35: systemPasteboard.setPasteData promise'); - - console.log('f_test35: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test35: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test35: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test35: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 30).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_3500 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3600 - * @tc.name Adds 31 record(s), gets record count - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test36',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_3600 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test36: systemPasteboard.clear promise'); - - var textData0 = 'Hello World!'; - console.log('f_test36: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.log('f_test36: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData = '' - for(var i = 1; i < 31; i++) - { - textData = 'Hello World' - textData = textData + i - console.log('f_test36: addTextRecord = ' + textData) - pasteData.addTextRecord(textData) - } - - console.log('f_test36: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test36: systemPasteboard.setPasteData promise'); - - console.log('f_test36: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test36: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test36: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test36: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 31).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_3600 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3700 - * @tc.name Replaces one record, gets record count - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test37',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_3700 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test37: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test37: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test37: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test37: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test37: systemPasteboard.setPasteData promise'); - - console.log('f_test37: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test37: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test37: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test37: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - var textData1 = 'Hello World1' - console.log('f_test37: Replaces the Record = ' + textData1) - var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) - var replace = pasteData1.replaceRecordAt(0, pasteDataRecord); - console.log('f_test37: replace = ' + replace) - - console.log('f_test37: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test37: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - expect(pasteData2.getRecordCount() == 1).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_3700 end'); - done(); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3800 - * @tc.name Clears pasteBoard, gets record count - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test38',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_3800 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test38: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test38: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test38: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test38: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test38: systemPasteboard.setPasteData promise'); - - console.log('f_test38: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test38: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test38: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test38: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test38: Clears the pasteBoard') - systemPasteboard.clear() - - console.log('f_test38: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test38: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test38 recordCount = ' + recordCount); - - console.log('SUB_pasteBoard_function_JS_API_3800 end'); - done(); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_3900 - * @tc.name Adds Property - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test39',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_3900 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test39: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test39: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test39: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test39: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test39: systemPasteboard.setPasteData promise'); - - console.log('f_test39: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test39: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test39: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test39: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test39: Sets the Property') - var pasteDataProperty = pasteData1.getProperty() - console.log('f_test39: timestamp = ' + pasteDataProperty.timestamp) - pasteDataProperty.additions["one"] = "Hello" - - console.log('f_test39: Checks the Property') - var pasteDataProperty1 = pasteData1.getProperty() - console.log('f_test39: timestamp = ' + pasteDataProperty1.timestamp) - console.log('f_test39: additions = ' + pasteDataProperty1.additions["one"]) - - console.log('SUB_pasteBoard_function_JS_API_3900 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4000 - * @tc.name Set Property's tags - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test40',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4000 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test40: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test40: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test40: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test40: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test40: systemPasteboard.setPasteData promise'); - - console.log('f_test40: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test40: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test40: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test40: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test40: Sets the Property') - var pasteDataProperty = pasteData1.getProperty() - console.log('f_test40: timestamp = ' + pasteDataProperty.timestamp) - pasteDataProperty.additions["one"] = "Hello" - pasteDataProperty.tag = "Test" - - console.log('f_test40: Checks the Property') - var pasteDataProperty1 = pasteData1.getProperty() - console.log('f_test40: timestamp = ' + pasteDataProperty1.timestamp) - console.log('f_test40: additions = ' + pasteDataProperty1.additions["one"]) - console.log('f_test40: tag = ' + pasteDataProperty1.tag) - console.log('f_test40: getTag = ' + pasteData1.getTag()) - - console.log('SUB_pasteBoard_function_JS_API_4000 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4100 - * @tc.name Clears pasteBoard and check property - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test41',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4100 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test41: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test41: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test41: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test41: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test41: systemPasteboard.setPasteData promise'); - - console.log('f_test41: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test41: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test41: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test41: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test41: Clears the pasteBoard') - systemPasteboard.clear() - - console.log('f_test41: Checks the Property') - var pasteDataProperty1 = pasteData1.getProperty() - console.log('f_test41: timestamp = ' + pasteDataProperty1.timestamp) - console.log('f_test41: tag = ' + pasteDataProperty1.tag) - - console.log('SUB_pasteBoard_function_JS_API_4100 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4200 - * @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等文本数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test42',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4200 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test42: systemPasteboard.clear promise'); - - console.log('f_test42: Open the infor for pasteboard content changes') - systemPasteboard.on('update', contentChanges) - - var textData = 'Hello World!'; - console.log('f_test42: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test42: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test42: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test42: systemPasteboard.setPasteData promise'); - - console.log('f_test42: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test42: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test42: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test42: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test42: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_4200 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4300 - * @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等html数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test43',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4300 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test43: systemPasteboard.clear promise'); - - console.log('f_test43: Open the infor for pasteboard content changes') - systemPasteboard.on('update', contentChanges) - - var htmlText = 'Hello World!' - console.log('f_test43: createHtmlData htmlText = ' + htmlText); - var pasteData = pasteboard.createHtmlData(htmlText); - console.log('f_test43: createHtmlData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test43: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test43: systemPasteboard.setPasteData promise'); - - console.log('f_test43: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test43: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test43: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test43: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test43: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_4300 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4400 - * @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等uri数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test44',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4400 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test44: systemPasteboard.clear promise'); - - console.log('f_test44: Open the infor for pasteboard content changes') - systemPasteboard.on('update', contentChanges) - - var uriText = 'https://www.baidu.com/' - console.log('f_test44: createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test44: createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test44: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test44: systemPasteboard.setPasteData promise'); - - console.log('f_test44: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test44: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test44: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test44: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test44: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_4400 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4500 - * @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等want数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test45',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4500 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test45: systemPasteboard.clear promise'); - - console.log('f_test45: Open the infor for pasteboard content changes') - systemPasteboard.on('update', contentChanges) - - var want = { - bundleName: "com.example.myapplication45", - abilityName: "com.example.myapplication45.MainAbility" - } - console.log('f_test45: createWantData = ' + want) - var pasteData = pasteboard.createWantData(want); - console.log('f_test45: createWantData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test45: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test45: systemPasteboard.setPasteData promise'); - - console.log('f_test45: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test45: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test45: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test45: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test45: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_4500 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4600 - * @tc.name 打开内容变化通知功能:清除剪切板内容 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test46',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4600 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test46: systemPasteboard.clear promise'); - - console.log('f_test46: Open the infor for pasteboard content changes') - systemPasteboard.on('update', contentChanges) - - var textData = 'Hello World!'; - console.log('f_test46: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test46: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test46: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test46: systemPasteboard.setPasteData promise'); - - console.log('f_test46: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test46: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test46: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test46: Clears the pasteBoard') - systemPasteboard.clear() - - console.log('SUB_pasteBoard_function_JS_API_4600 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4700 - * @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等文本数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test47',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4700 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test47: systemPasteboard.clear promise'); - - console.log('f_test47: Close the infor for pasteboard content changes') - systemPasteboard.off('update', contentChanges) - - var textData = 'Hello World!'; - console.log('f_test47: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test47: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test47: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test47: systemPasteboard.setPasteData promise'); - - console.log('f_test47: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test47: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test47: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test47: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test47: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_4700 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4800 - * @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等html数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test48',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4800 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test48: systemPasteboard.clear promise'); - - console.log('f_test48: Close the infor for pasteboard content changes') - systemPasteboard.off('update', contentChanges) - - var htmlText = 'Hello World!' - console.log('f_test48: createHtmlData htmlText = ' + htmlText); - var pasteData = pasteboard.createHtmlData(htmlText); - console.log('f_test48: createHtmlData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test48: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test48: systemPasteboard.setPasteData promise'); - - console.log('f_test48: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test48: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test48: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test48: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test48: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_4800 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_4900 - * @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等uri数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test49',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_4900 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test49: systemPasteboard.clear promise'); - - console.log('f_test49: Close the infor for pasteboard content changes') - systemPasteboard.off('update', contentChanges) - - var uriText = 'https://www.baidu.com/' - console.log('f_test49: createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test49: createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test49: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test49: systemPasteboard.setPasteData promise'); - - console.log('f_test49: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test49: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test49: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test49: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test49: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_4900 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5000 - * @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等want数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test50',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5000 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test50: systemPasteboard.clear promise'); - - console.log('f_test50: Open the infor for pasteboard content changes') - systemPasteboard.off('update', contentChanges) - - var want = { - bundleName: "com.example.myapplication45", - abilityName: "com.example.myapplication45.MainAbility" - } - console.log('f_test50: createWantData = ' + want) - var pasteData = pasteboard.createWantData(want); - console.log('f_test50: createWantData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test50: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test50: systemPasteboard.setPasteData promise'); - - console.log('f_test50: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test50: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test50: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test50: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test50: Removes the Record') - expect(pasteData1.removeRecordAt(0) === true || pasteData1.removeRecordAt(0) === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_5000 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5100 - * @tc.name 关闭内容变化通知功能:清除剪切板内容 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test51',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5100 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test51: systemPasteboard.clear promise'); - - console.log('f_test51: Close the infor for pasteboard content changes') - systemPasteboard.off('update', contentChanges) - - var textData = 'Hello World!'; - console.log('f_test51: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test51: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test51: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test51: systemPasteboard.setPasteData promise'); - - console.log('f_test51: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test51: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test51: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test51: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test51: Clears the pasteBoard') - systemPasteboard.clear() - - console.log('SUB_pasteBoard_function_JS_API_5100 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5200 - * @tc.name 清除剪切板内的文本数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test52',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5200 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test52: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test52: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test52: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test52: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test52: systemPasteboard.setPasteData promise'); - - console.log('f_test52: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test52: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test52: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test52: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test52: Clears the pasteBoard') - systemPasteboard.clear() - - console.log('f_test52: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test52: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test52 recordCount = ' + recordCount);}) - - console.log('SUB_pasteBoard_function_JS_API_5200 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5300 - * @tc.name 清除剪切板内的uri数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test53',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5300 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test53: systemPasteboard.clear promise'); - - var uriText = 'https://www.baidu.com/' - console.log('f_test53: createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test53: createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test53: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test53: systemPasteboard.setPasteData promise'); - - console.log('f_test53: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test53: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test53: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test53: Clears the pasteBoard') - systemPasteboard.clear() - - console.log('f_test53: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test53: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test38 recordCount = ' + recordCount);}) - - console.log('SUB_pasteBoard_function_JS_API_5300 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5400 - * @tc.name 清除剪切板内的html数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test54',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5400 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test54: systemPasteboard.clear promise'); - - var htmlText = 'Hello World!' - console.log('f_test54: createHtmlData htmlText = ' + htmlText); - var pasteData = pasteboard.createHtmlData(htmlText); - console.log('f_test54: createHtmlData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test54: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test54: systemPasteboard.setPasteData promise'); - - console.log('f_test54: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test54: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test54: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test54: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test54: Clears the pasteBoard') - systemPasteboard.clear() - - console.log('f_test54: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test54: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test38 recordCount = ' + recordCount);}) - - console.log('SUB_pasteBoard_function_JS_API_5400 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5500 - * @tc.name 清除剪切板内的want数据项 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test55',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5500 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test55: systemPasteboard.clear promise'); - - var myWant = { - bundleName: "com.example.myapplication55", - abilityName: "com.example.myapplication55.MainAbility" - } - console.log('f_test01: createWantData want = ' + myWant); - var pasteData = pasteboard.createWantData(myWant); - console.log('f_test01: createWantData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test55: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test55: systemPasteboard.setPasteData promise'); - - console.log('f_test55: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test55: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test55: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test55: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test55: Clears the pasteBoard') - systemPasteboard.clear() - - console.log('f_test55: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test55: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test38 recordCount = ' + recordCount);}) - - console.log('SUB_pasteBoard_function_JS_API_5500 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5600 - * @tc.name 向剪切板内增加30条数据项,然后清除 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test56',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5600 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test56: systemPasteboard.clear promise'); - - var textData0 = 'Hello World!'; - console.log('f_test56: createPlainTextData textData = ' + textData0); - var pasteData = pasteboard.createPlainTextData(textData0); - console.log('f_test56: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - var textData = '' - for(var i = 1; i < 30; i++) - { - textData = 'Hello World' - textData = textData + i - console.log('f_test56: addTextRecord = ' + textData) - pasteData.addTextRecord(textData) - } - - console.log('f_test56: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test56: systemPasteboard.setPasteData promise'); - - console.log('f_test56: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test56: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test56: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test56: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 30).assertTrue(); - - console.log('f_test56: Clears the pasteBoard') - systemPasteboard.clear() - - console.log('f_test56: Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test56: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test38 recordCount = ' + recordCount);}) - - console.log('SUB_pasteBoard_function_JS_API_5600 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5700 - * @tc.name 向剪贴板数据各增加5条文本、uri、html数据,然后清除 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test57',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5700 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - - var textData0 = 'Hello World0' - console.log('f_test57: createPlainTextData = ' + textData0) - var pasteData = pasteboard.createPlainTextData(textData0) - - var textData = '' - for(var i = 1; i < 5; i++) - { - textData = 'Hello World' - textData = textData + i - pasteData.addTextRecord(textData) - } - - var htmlText = '' - for(var i = 0; i < 5; i++) - { - htmlText = 'Hello World!' - htmlText = htmlText + i - pasteData.addHtmlRecord(htmlText) - } - - var uriText = '' - for(var i = 0; i < 5; i++) - { - uriText = 'https://www.baidu.com/' - uriText = uriText + i - pasteData.addUriRecord(uriText) - } - - systemPasteboard.setPasteData(pasteData).then(() => { - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test57: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - systemPasteboard.getPasteData().then((data) => { - console.log('f_test57: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 15).assertTrue(); - systemPasteboard.clear() - systemPasteboard.getPasteData().then((data) => { - console.log('f_test57: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData2 = data; - var recordCount = pasteData2.getRecordCount(); - console.log('f_test38 recordCount = ' + recordCount);}) - - console.log('SUB_pasteBoard_function_JS_API_5700 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5800 - * @tc.name 向剪贴板数据增加文本数据项,查询剪贴板存在剪贴板数据 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test58',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5800 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test58: systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test58: createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test58: createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test58: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test58: systemPasteboard.setPasteData promise'); - - console.log('f_test58: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test58: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_5800 end') - done(); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_5900 - * @tc.name 向剪贴板数据增加uri数据项,查询剪贴板存在剪贴板数据 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test59',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_5900 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('systemPasteboard.clear promise'); - - var uriText = 'https://www.baidu.com/' - console.log('f_test59: createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test59: createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test59: Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test59: systemPasteboard.setPasteData promise'); - - console.log('f_test59: Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test59: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_5900 end') - done(); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6000 - * @tc.name 向剪贴板数据增加html数据项,查询剪贴板存在剪贴板数据 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test60',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6000 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test60 systemPasteboard.clear promise'); - - var htmlText = 'Hello World!' - console.log('f_test60createHtmlData htmlText = ' + htmlText); - var pasteData = pasteboard.createHtmlData(htmlText); - console.log('f_test60createHtmlData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test60Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test60systemPasteboard.setPasteData promise'); - - console.log('f_test60Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test60systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_6000 end') - done(); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6100 - * @tc.name 向剪贴板数据增加want数据项,查询剪贴板存在剪贴板数据 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test61',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6100 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test61 systemPasteboard.clear promise'); - - var myWant = { - bundleName: "com.example.myapplication8", - abilityName: "com.example.myapplication8.MainAbility" - } - console.log('f_test01: createWantData want = ' + myWant); - var pasteData = pasteboard.createWantData(myWant); - console.log('f_test01: createWantData pasteData = ' + JSON.stringify(pasteData)); - - console.log('Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('systemPasteboard.setPasteData promise'); - - console.log('Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_6100 end') - done(); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6200 - * @tc.name 向剪贴板数据各增加5条文本、uri、html,查询剪贴板存在剪贴板数据 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test62',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6200 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test62 systemPasteboard.clear promise'); - - var textData0 = 'Hello World0' - console.log('f_test62 createPlainTextData = ' + textData0) - var pasteData = pasteboard.createPlainTextData(textData0) - - var textData = '' - for(var i = 1; i < 5; i++) - { - textData = 'Hello World' - textData = textData + i - console.log('f_test62 addTextRecord = ' + textData) - pasteData.addTextRecord(textData) - } - - var htmlText = '' - for(var i = 0; i < 5; i++) - { - htmlText = 'Hello World!' - htmlText = htmlText + i - console.log('f_test62 addHtmlRecord = ' + htmlText) - pasteData.addHtmlRecord(htmlText) - } - - var uriText = '' - for(var i = 0; i < 5; i++) - { - uriText = 'https://www.baidu.com/' - uriText = uriText + i - console.log('f_test62 addUriRecord = ' + uriText) - pasteData.addUriRecord(uriText) - } - - console.log('f_test62 Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test62 systemPasteboard.setPasteData promise'); - - console.log('f_test62 Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test62 systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('SUB_pasteBoard_function_JS_API_6200 end') - done(); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6300 - * @tc.name 更新剪贴板数据,查询剪贴板存在剪贴板数据 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test63',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6300 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test63 systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test63 createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test63 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test63 systemPasteboard.setPasteData promise'); - - console.log('f_test63 Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test63 systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test63 Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test63 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - var textData1 = 'Hello World1' - console.log('f_test63 Replaces the Record = ' + textData1) - var pasteDataRecord = pasteboard.createPlainTextRecord(textData1) - pasteData1.replaceRecordAt(0, pasteDataRecord) - - console.log('f_test63 Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test63 systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue();}) - - console.log('SUB_pasteBoard_function_JS_API_6300 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6400 - * @tc.name 删除所有的剪贴板数据,查询剪贴板不存在剪贴板数据 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test64',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6400 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test64 systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test64 createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test64 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test64 Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test64 systemPasteboard.setPasteData promise'); - - console.log('f_test64 Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test64 systemPasteboard.hasPasteData promise data = ' + data); - - console.log('f_test64 Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test64 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - var recordCount = pasteData1.getRecordCount(); - console.log('f_test64 recordCount = ' + recordCount); - - console.log('f_test64 Removes the Record') - pasteData1.removeRecordAt(0) - - console.log('f_test64 Checks the number of records'); - var recordCount1 = pasteData1.getRecordCount(); - console.log('f_test64 recordCount = ' + recordCount1); - - console.log('SUB_pasteBoard_function_JS_API_6400 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6500 - * @tc.name 清除剪贴板数据,查询剪贴板不存在剪贴板数据 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test65',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6500 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test65 systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test65 createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test65 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test65 Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test65 systemPasteboard.setPasteData promise'); - - console.log('f_test65 Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test65 systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test65 Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test65 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test65 Clears the pasteBoard') - systemPasteboard.clear() - - console.log('f_test65 Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData1).then(() => { - console.log('f_test65 systemPasteboard.setPasteData promise'); - - console.log('f_test65 Checks there is no content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test65 systemPasteboard.hasPasteData promise data = ' + data); - - console.log('SUB_pasteBoard_function_JS_API_6400 end'); - done(); - }); - }); - }); - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6600 - * @tc.name 将文本数据强制转换为文本 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test66',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6600 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test66 systemPasteboard.clear promise'); - - var textData = 'Hello World!'; - console.log('f_test66 createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test66 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test66 Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test66 systemPasteboard.setPasteData promise'); - - console.log('f_test66 Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test66 systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test66 Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test66 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test66 Converts the PlainTextData to text') - var pasteDataRecord = pasteData1.getRecordAt(0) - console.info('checks pasteDataRecord.mimeType = ' + pasteDataRecord.mimeType) - - console.log('f_test66 pasteDataRecord.convertToText = ' + pasteDataRecord.convertToText); - - console.log('f_test66 SUB_pasteBoard_function_JS_API_6600 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6700 - * @tc.name 将一条含有特殊字符、中英混杂的文本数据强制转换为文本 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test67',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6700 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test67 systemPasteboard.clear promise'); - - var textData = 'Hello 中国!@#$%^&*()_+{}\?.'; - console.log('f_test67 createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test67 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test67 Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test67 systemPasteboard.setPasteData promise'); - - console.log('f_test67 Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test67 systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test67 Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test67 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test67 Converts the PlainTextData to text') - var pasteDataRecord = pasteData1.getRecordAt(0) - console.log('f_test67 pasteDataRecord.convertToText = ' + pasteDataRecord.convertToText); - - console.log('SUB_pasteBoard_function_JS_API_6700 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6800 - * @tc.name 将一条超长文本数据 (大小为301K)强制转换为文本 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test68',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6800 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test68 systemPasteboard.clear promise'); - - var textData = '' - for (var i = 0; i < 301; i++){ - textData = textData + "A"; - } - console.log('f_test68 createPlainTextData textData = ' + textData); - var pasteData = pasteboard.createPlainTextData(textData); - console.log('f_test68 createPlainTextData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test68 Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test68 systemPasteboard.setPasteData promise'); - - console.log('f_test68 Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test68 systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test68 Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test68 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test68 Converts the PlainTextData to text') - var pasteDataRecord = pasteData1.getRecordAt(0) - console.log('f_test68 pasteDataRecord.convertToText = ' + pasteDataRecord.convertToText); - - console.log('SUB_pasteBoard_function_JS_API_6800 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_6900 - * @tc.name 将uri数据强制转换为文本 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test69',0, async function (done) { - console.log('SUB_pasteBoard_function_JS_API_6900 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - console.log('f_test69 systemPasteboard.clear promise'); - - var uriText = 'https://www.baidu.com/' - console.log('f_test69 createUriData uriText = ' + uriText); - var pasteData = pasteboard.createUriData(uriText); - console.log('f_test69 createUriData pasteData = ' + JSON.stringify(pasteData)); - - console.log('f_test69 Writes PasteData to the pasteboard'); - systemPasteboard.setPasteData(pasteData).then(() => { - console.log('f_test69 systemPasteboard.setPasteData promise'); - - console.log('f_test69 Checks there is content in the pasteboard') - systemPasteboard.hasPasteData().then((data) => { - console.log('f_test69 systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - console.log('f_test69 Checks the number of records'); - systemPasteboard.getPasteData().then((data) => { - console.log('f_test69 systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - expect(pasteData1.getRecordCount() == 1).assertTrue(); - - console.log('f_test69 Converts the PlainTextData to text') - var pasteDataRecord = pasteData1.getRecordAt(0) - - pasteDataRecord.convertToText().then((data) => { - console.info('convertToText success data : ' + JSON.stringify(data)); - }).catch((error) => { - console.error('convertToText failed because ' + JSON.stringify(error)); - });; - - console.log('SUB_pasteBoard_function_JS_API_6900 end'); - done(); - }) - }); - }); - }); - }) - - /** - * @tc.number SUB_pasteBoard_function_JS_API_7000 - * @tc.name 复制文本、uri格式 - * @tc.desc Test pasteBoard API functionality. - * @tc.size : MEDIUM - * @tc.type : Function - * @tc.level : Level 0 - */ - it('pasteboard_function_test70',0, async function (done) { - console.info('SUB_pasteBoard_function_JS_API_7000 start') - - var systemPasteboard = pasteboard.getSystemPasteboard(); - systemPasteboard.clear().then(() => { - - var textData0 = 'Hello World0' - console.info('f_test70: createPlainTextData = ' + textData0) - - var pasteData = pasteboard.createPlainTextData(textData0) - console.info('f_test70: createPlainTextData = ' + JSON.stringify(pasteData)) - - var uriText = pasteboard.createUriRecord("https://www.baidu.com/"); - pasteData.addRecord(uriText); - console.info('f_test70: addRecord(uriText) = ' + pasteData) - console.info('f_test70: addRecord(uriText) = ' + JSON.stringify(pasteData)) - - - - systemPasteboard.setPasteData(pasteData).then(() => { - console.info('---------------------------->1') - systemPasteboard.hasPasteData().then((data) => { - console.info('f_test70: systemPasteboard.hasPasteData promise data = ' + data); - expect(data === true || data === false).assertTrue(); - - systemPasteboard.getPasteData().then((data) => { - console.info('f_test70: systemPasteboard.getPasteData data = ' + JSON.stringify(data)); - var pasteData1 = data; - var recordCount = pasteData1.getRecordCount(); - console.info('f_test70: recordCount=' + recordCount); - expect(pasteData1.getRecordCount() == 2).assertTrue(); - - console.info('SUB_pasteBoard_function_JS_API_7000 end'); - done(); - }) - }); - }); - }); - }) - - - - /** - * The callback function is used for pasteboard content changes - */ - function contentChanges() { - console.log('#EVENT: The content is changed in the pasteboard') - } -}); diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/element/string.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/element/string.json deleted file mode 100644 index 7f851dbb72a9b11eb99b6fd25a85d54d7a236f07..0000000000000000000000000000000000000000 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "app_name", - "value": "PasteBoardTest_js" - }, - { - "name": "mainability_description", - "value": "JS_Phone_Empty Feature Ability" - } - ] -} \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/resources/base/element/string.json b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..498677efbde065c36668727190d3613cbf278bfc --- /dev/null +++ b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/media/icon.png b/distributeddatamgr/Pasteboardjsapitest/entry/src/main/resources/base/media/icon.png similarity index 100% rename from distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/resources/base/media/icon.png rename to distributeddatamgr/Pasteboardjsapitest/entry/src/main/resources/base/media/icon.png diff --git a/distributeddatamgr/Pasteboardjsapitest/local.properties b/distributeddatamgr/Pasteboardjsapitest/local.properties deleted file mode 100644 index 6b17cb3b082c0b5530ee04e5b22afbb34af6d0ee..0000000000000000000000000000000000000000 --- a/distributeddatamgr/Pasteboardjsapitest/local.properties +++ /dev/null @@ -1,10 +0,0 @@ -# This file is automatically generated by DevEco Studio. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file should *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. -# -# For customization when using a Version Control System, please read the header note. -sdk.dir=C:/Users/lwx1095534/AppData/Local/OpenHarmony/Sdk -nodejs.dir=D:/DevEco Studio/tools/nodejs -npm.dir=D:/DevEco Studio/tools/nodejs \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/package-lock.json b/distributeddatamgr/Pasteboardjsapitest/package-lock.json deleted file mode 100644 index 48e341a0954d5f8c2accf3a6731be28e5bb9c0de..0000000000000000000000000000000000000000 --- a/distributeddatamgr/Pasteboardjsapitest/package-lock.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lockfileVersion": 1 -} diff --git a/inputmethod/BUILD.gn b/inputmethod/BUILD.gn old mode 100755 new mode 100644 diff --git a/inputmethod/InputMethodTest_ets/.idea/.deveco/project.cache.json b/inputmethod/InputMethodTest_ets/.idea/.deveco/project.cache.json deleted file mode 100644 index 9f11beeeceb5025c56c4ee6cb8fba93c7f2bae44..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/.idea/.deveco/project.cache.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "BuildOptions":{}, - "CommonInfo":{ - "project.ide.version":"3.0.0.900" - } -} \ No newline at end of file diff --git a/inputmethod/InputMethodTest_ets/.idea/.gitignore b/inputmethod/InputMethodTest_ets/.idea/.gitignore deleted file mode 100644 index 26d33521af10bcc7fd8cea344038eaaeb78d0ef5..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/inputmethod/InputMethodTest_ets/.idea/InputMethodTest_ets.iml b/inputmethod/InputMethodTest_ets/.idea/InputMethodTest_ets.iml deleted file mode 100644 index 61021940449bdc69db005bbd04a05380f5629b2c..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/.idea/InputMethodTest_ets.iml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/inputmethod/InputMethodTest_ets/.idea/modules.xml b/inputmethod/InputMethodTest_ets/.idea/modules.xml deleted file mode 100644 index 01e901c055ac4cb1d389c8922515b52fdb63b34f..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/inputmethod/InputMethodTest_ets/.idea/vcs.xml b/inputmethod/InputMethodTest_ets/.idea/vcs.xml deleted file mode 100644 index b2bdec2d71b6a5ce4ae49efc37516809c50e4d5e..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/inputmethod/InputMethodTest_ets/BUILD.gn b/inputmethod/InputMethodTest_ets/BUILD.gn index 7faeca533b02708f85b92908cf52850294ea5ea2..d651d0ccb9aeec7e481de7b5d267c36ac72dc53f 100644 --- a/inputmethod/InputMethodTest_ets/BUILD.gn +++ b/inputmethod/InputMethodTest_ets/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (c) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -9,7 +9,7 @@ # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and -# limitations under the License. +# limitations under the License. import("//test/xts/tools/build/suite.gni") @@ -21,6 +21,8 @@ ohos_js_hap_suite("ActsInputMethodEtsTest") { ":inputMethod_ets_test_assets", ] ets2abc = true + subsystem_name = "inputmethod" + part_name = "imf" certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsInputMethodEtsTest" } diff --git a/inputmethod/InputMethodTest_ets/Test.json b/inputmethod/InputMethodTest_ets/Test.json index e29cddaeec9c82359410e97adc2de9148af85fbd..e72008206b37d37b7eb4494ec6d2f008348225d0 100644 --- a/inputmethod/InputMethodTest_ets/Test.json +++ b/inputmethod/InputMethodTest_ets/Test.json @@ -3,8 +3,8 @@ "driver": { "type": "OHJSUnitTest", "test-timeout": "600000", - "bundle-name": "com.open.harmony.inputMethodtest", - "package-name": "com.open.harmony.inputMethodtest", + "bundle-name": "com.acts.inputmethodtest", + "package-name": "com.acts.inputmethodtest", "shell-timeout": "600000" }, "kits": [ diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/config.json b/inputmethod/InputMethodTest_ets/entry/src/main/config.json index 94d2d13dca7b0db66f1c1beb605e99b0e0fdc6c1..75e3d2529139888ae4fae8e14878aa22fb785696 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/config.json +++ b/inputmethod/InputMethodTest_ets/entry/src/main/config.json @@ -1,6 +1,6 @@ { "app": { - "bundleName": "com.open.harmony.inputMethodtest", + "bundleName": "com.acts.inputmethodtest", "vendor": "open", "version": { "code": 1000000, @@ -9,14 +9,14 @@ "apiVersion": { "compatible": 7, "releaseType": "Release", - "target": 7 + "target": 9 } }, "deviceConfig": {}, "module": { - "package": "com.open.harmony.inputMethodtest", + "package": "com.acts.inputmethodtest", "name": ".MyApplication", - "mainAbility": "com.open.harmony.inputMethodtest.MainAbility", + "mainAbility": "com.acts.inputmethodtest.MainAbility", "deviceType": [ "phone" ], diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets index f69b748f856166088518653604738393e4650a50..24a35d9281861cf6070f89e73b370dd50d5b5979 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets index 74c70dbbb6279894ca55356bbf23700e41600ceb..1a788d8fa2c4672e18e4efb60d7080a900892e9c 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets index 6e3410444850c140eaef02be555a5ed1229a64fe..309eb39d48f7758be858a6c6b5a23da41b9579e1 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputRequestJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputRequestJsunit.test.ets index 334750e89a4c7e4e76e4d10bf1e8352823d95c9f..6271c275190f0cf397d326f917b4bf4caa7a5c5b 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputRequestJsunit.test.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputRequestJsunit.test.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets index 682b3680f856003b86ad11097836fb9680b38612..b795d5e51891ee2d4676e60cfb0aef73941ce854 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethodEngineJsunit.test.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets index 6ba0403a045b44fec0392bec02e1c1375431c3cf..0f3956e500b2b8eaf543b88bafda2afcff5bcc4d 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/InputmethohJsunit.test.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -96,28 +96,6 @@ export default function settingUiJsunit() { done(); }); - /* - * @tc.number inputmethod_test_switchInputMethod_001 - * @tc.name Test Indicates the input method which will replace the current one. - * @tc.desc Function test - * @tc.level 2 - */ - it('inputmethod_test_switchInputMethod_001', 0, async function (done) { - console.info("************* inputmethod_test_switchInputMethod_001 Test start*************"); - let inputMethodProperty = { - packageName:"com.example.kikakeyboard", - methodId:"ServiceExtAbility" - } - inputMethod.switchInputMethod(inputMethodProperty).then((data) => { - console.info("inputmethod_test_switchInputMethod_001 data:" + data) - expect(data).assertEqual(true); - }).catch((err) => { - console.error('inputmethod_test_switchInputMethod_001 failed because ' + JSON.stringify(err)); - }); - console.info("************* inputmethod_test_switchInputMethod_001 Test end*************"); - done(); - }); - /* * @tc.number inputmethod_test_switchInputMethod_002 * @tc.name Test Indicates the input method which will replace the current one. diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets index 3f31d27d328560988fbaffeb81bd2d894d03da10..5c2842b427498dc08e7df84ba45f888f3171b526 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/List.test.ets @@ -1,5 +1,5 @@ /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestDownloadTaskJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestDownloadTaskJsunit.test.ets index 9ee14a2055f85d6d911ee113aeeddce3fde3b234..0afae8488bbd1b6bd9cb1e3bf4bbdadabe0257ba 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestDownloadTaskJsunit.test.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestDownloadTaskJsunit.test.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestJsunit.test.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestJsunit.test.ets index 2760712ed882f2792ce3ef80f3fd5f78fa192124..86dd2ce3a2f7261b0feb0dd561c9e8c5500621b6 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestJsunit.test.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/RequestJsunit.test.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/Utils.ets b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/Utils.ets index 0f4b16d766f1feeb75edd8cc84cd1448d61e569a..3210b03d69ed37b4cb7a20999a632fd67c8154eb 100644 --- a/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/Utils.ets +++ b/inputmethod/InputMethodTest_ets/entry/src/main/ets/test/Utils.ets @@ -1,6 +1,6 @@ // @ts-nocheck /** - * Copyright (c) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/inputmethod/InputMethodTest_ets/local.properties b/inputmethod/InputMethodTest_ets/local.properties deleted file mode 100644 index 6b17cb3b082c0b5530ee04e5b22afbb34af6d0ee..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/local.properties +++ /dev/null @@ -1,10 +0,0 @@ -# This file is automatically generated by DevEco Studio. -# Do not modify this file -- YOUR CHANGES WILL BE ERASED! -# -# This file should *NOT* be checked into Version Control Systems, -# as it contains information specific to your local configuration. -# -# For customization when using a Version Control System, please read the header note. -sdk.dir=C:/Users/lwx1095534/AppData/Local/OpenHarmony/Sdk -nodejs.dir=D:/DevEco Studio/tools/nodejs -npm.dir=D:/DevEco Studio/tools/nodejs \ No newline at end of file diff --git a/inputmethod/InputMethodTest_ets/package-lock.json b/inputmethod/InputMethodTest_ets/package-lock.json deleted file mode 100644 index 48e341a0954d5f8c2accf3a6731be28e5bb9c0de..0000000000000000000000000000000000000000 --- a/inputmethod/InputMethodTest_ets/package-lock.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "lockfileVersion": 1 -} diff --git a/request/BUILD.gn b/request/BUILD.gn old mode 100755 new mode 100644 index 6bea708ff4007e8111e1a38567f38e357b6da8e8..d366567d078a8fbb2357d1faff7ae84f46bf7964 --- a/request/BUILD.gn +++ b/request/BUILD.gn @@ -14,5 +14,5 @@ import("//build/ohos_var.gni") group("request") { testonly = true - deps = [ "RequestTest_js:ActsMiscservicesRequestJSApiTest" ] + deps = [ "RequestTest_ets:ActsRequestETSApiTest" ] } diff --git a/request/RequestTest_js/BUILD.gn b/request/RequestTest_ets/BUILD.gn similarity index 59% rename from request/RequestTest_js/BUILD.gn rename to request/RequestTest_ets/BUILD.gn index 79f1e29f3dfcf0f818b36505c25d0075718ce521..ef14e8bc878e0c669cf2b4371c5bda37307a259f 100644 --- a/request/RequestTest_js/BUILD.gn +++ b/request/RequestTest_ets/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (c) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -10,21 +10,30 @@ # WITHOUT 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("ActsMiscservicesRequestJSApiTest") { +import("//build/ohos.gni") +import("//test/xts/tools/build/suite.gni") +ohos_js_hap_suite("ActsRequestETSApiTest") { hap_profile = "./entry/src/main/config.json" deps = [ - ":request_js_assets", - ":request_js_resources", + ":request_ets_assets", + ":request_ets_resources", + ":request_ets_test_assets", ] + ets2abc = true + subsystem_name = "request" + part_name = "request" certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsMiscservicesRequestJSApiTest" + hap_name = "ActsRequestETSApiTest" +} + +ohos_js_assets("request_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" } -ohos_js_assets("request_js_assets") { - source_dir = "./entry/src/main/js/default" +ohos_js_assets("request_ets_test_assets") { + source_dir = "./entry/src/main/ets/TestAbility" } -ohos_resources("request_js_resources") { +ohos_resources("request_ets_resources") { sources = [ "./entry/src/main/resources" ] hap_profile = "./entry/src/main/config.json" } diff --git a/request/RequestTest_ets/Test.json b/request/RequestTest_ets/Test.json new file mode 100644 index 0000000000000000000000000000000000000000..2ea5f5cbe3c5470a9a53b66cf223298d3641667e --- /dev/null +++ b/request/RequestTest_ets/Test.json @@ -0,0 +1,24 @@ +{ + "description": "Configuration for MiscservicesRequestJSApiTest js api Tests", + "driver": { + "type": "OHJSUnitTest", + "test-timeout": "600000", + "bundle-name": "com.acts.requesttest", + "package-name": "com.acts.requesttest", + "shell-timeout": "60000" + }, + "kits": [ + { + "test-file-name": ["ActsRequestETSApiTest.hap"], + "type": "AppInstallKit", + "cleanup-apps": true + }, + { + "type": "ShellKit", + "run-command": [ + "mkdir -p /data/app/el2/100/base/com.acts.requesttest/haps/entry/cache", + "echo \"123456\" > /data/app/el2/100/base/com.acts.requesttest/haps/entry/cache/test.txt" + ] + } + ] +} \ No newline at end of file diff --git a/request/RequestTest_ets/entry/src/main/config.json b/request/RequestTest_ets/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..c69658fa4ef8c91fd18ca06c46831abd310010c1 --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/config.json @@ -0,0 +1,96 @@ +{ + "app": { + "bundleName": "com.acts.requesttest", + "vendor": "example", + "version": { + "code": 1, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "target": 9, + "releaseType": "Release" + } + }, + "deviceConfig": {}, + "module": { + "package": "com.acts.requesttest", + "name": ".MyApplication", + "mainAbility": "com.acts.requesttest.MainAbility", + "deviceType": ["phone"], + "distro": { + "deliveryWithInstall": true, + "moduleName": "entry", + "moduleType": "entry", + "installationFree": true + }, + "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" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} diff --git a/request/RequestTest_ets/entry/src/main/ets/MainAbility/app.ets b/request/RequestTest_ets/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e4e48f739b88cd4fbcc15d4e54b244d5af51d90 --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/theme/wallpaper_js/src/main/js/default/app.js b/request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets similarity index 57% rename from theme/wallpaper_js/src/main/js/default/app.js rename to request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets index 4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5..464d327c26ff4367e151c3246c2fc2aa707adb06 100644 --- a/theme/wallpaper_js/src/main/js/default/app.js +++ b/request/RequestTest_ets/entry/src/main/ets/MainAbility/pages/index.ets @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,11 +13,25 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('REQUEST ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) } -}; + .width('100%') + .height('100%') + } +} + diff --git a/request/RequestTest_ets/entry/src/main/ets/TestAbility/app.ets b/request/RequestTest_ets/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e4e48f739b88cd4fbcc15d4e54b244d5af51d90 --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/request/RequestTest_ets/entry/src/main/ets/TestAbility/pages/index.ets b/request/RequestTest_ets/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2497c3b2774b09a40f0db535735f3dbe5e6cb6e --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,50 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/request/RequestTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/request/RequestTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..07cb0b784984c6c4cc6d911c3c82643bff9df263 --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +// @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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/request/RequestTest_js/entry/src/main/js/Test/List.test.js b/request/RequestTest_ets/entry/src/main/ets/test/List.test.ets similarity index 75% rename from request/RequestTest_js/entry/src/main/js/Test/List.test.js rename to request/RequestTest_ets/entry/src/main/ets/test/List.test.ets index 8eec19a5df535ef01679f56abfe194d95ff7b72e..fe8ea65b48811646b69e486000fe6d13fa6d7a3e 100644 --- a/request/RequestTest_js/entry/src/main/js/Test/List.test.js +++ b/request/RequestTest_ets/entry/src/main/ets/test/List.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -13,4 +13,8 @@ * limitations under the License. */ -require('./UploadCallbackXTSJsunit.test.js') +import uploadRequestJsunitTest from './uploadCallbackXTSJsunitTest'; + +export default function testsuite() { + uploadRequestJsunitTest() +} \ No newline at end of file diff --git a/request/RequestTest_js/entry/src/main/js/Test/Publicfunction.js b/request/RequestTest_ets/entry/src/main/ets/test/Publicfunction.ets similarity index 83% rename from request/RequestTest_js/entry/src/main/js/Test/Publicfunction.js rename to request/RequestTest_ets/entry/src/main/ets/test/Publicfunction.ets index 7e7822e9cf4bf83ee3c1c052727faafba18aa396..20ab93843fce36355207d1e43cf1175fae5c40b3 100644 --- a/request/RequestTest_js/entry/src/main/js/Test/Publicfunction.js +++ b/request/RequestTest_ets/entry/src/main/ets/test/Publicfunction.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the 'License'); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -53,10 +53,10 @@ function getUploadConfig(fileurl){ //upload公共方法 function publicupload(UploadConfig){ - console.log(`Testupdate UploadConfig ${JSON.stringify(UploadConfig)}`) + console.info(`Testupdate UploadConfig ${JSON.stringify(UploadConfig)}`) return new Promise(function(resolve, reject) { request.upload(UploadConfig, (err, data) => { - console.log("Testupdate publiconprogress Updatetask =" + JSON.stringify(data)); + console.info("Testupdate publiconprogress Updatetask =" + JSON.stringify(data)); resolve(data); }) }) @@ -70,8 +70,8 @@ function publiconprogress(Updatetask, Type){ uploadedSize : data1, totalSize : data2 } - console.log("Testupdate publiconprogress uploadedSize =" + data1); - console.log("Testupdate publiconprogress totalSize =" + data2); + console.info("Testupdate publiconprogress uploadedSize =" + data1); + console.info("Testupdate publiconprogress totalSize =" + data2); resolve(progress); }) }) @@ -85,8 +85,8 @@ function publicoffprogress(Updatetask, Type){ uploadedSize : data1, totalSize : data2 } - console.log("Testupdate publicoffprogress uploadedSize =" + data1); - console.log("Testupdate publicoffprogress totalSize =" + data2); + console.info("Testupdate publicoffprogress uploadedSize =" + data1); + console.info("Testupdate publicoffprogress totalSize =" + data2); resolve(progress); }) }) @@ -96,7 +96,7 @@ function publicoffprogress(Updatetask, Type){ function publicon(Updatetask, Type){ return new Promise(function(resolve, reject) { Updatetask.on(Type, function(data){ - console.log("Testupdate publicon =" + data); + console.info("Testupdate publicon =" + data); resolve(data); }) }) @@ -106,7 +106,7 @@ function publicon(Updatetask, Type){ function publicoff(Updatetask, Type){ return new Promise(function(resolve, reject) { Updatetask.off(Type, function(data){ - console.log("Testupdate publicoff =" + data); + console.info("Testupdate publicoff =" + data); resolve(data); }) }) @@ -116,7 +116,7 @@ function publicoff(Updatetask, Type){ function publicremove(Updatetask, Type){ return new Promise(function(resolve, reject) { Updatetask.remove((err,data) => { - console.log("Testupdate publicremove =" + data); + console.info("Testupdate publicremove =" + data); resolve(data); }) }) diff --git a/request/RequestTest_ets/entry/src/main/ets/test/uploadCallbackXTSJsunitTest.ets b/request/RequestTest_ets/entry/src/main/ets/test/uploadCallbackXTSJsunitTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..416e28a5d31815808b12e84eccd5b1b361ffb979 --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/ets/test/uploadCallbackXTSJsunitTest.ets @@ -0,0 +1,204 @@ +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the 'License'); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an 'AS IS' BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' +import request from '@ohos.request'; +import * as pubfun from './Publicfunction.ets' + +var typeProgress = 'progress'; +var typeHeaderReceive = 'headerReceive'; +var typeFail = 'fail'; +let uploadTask; +let file7url = 'internal://cache/test.txt'; + +export default function uploadRequestJsunitTest() { + describe('UploadTest', function () { + beforeAll(function () { + console.info('beforeAll: Prerequisites at the test suite level, ' + + 'which are executed before the test suite is executed.'); + }) + beforeEach(function () { + console.info('beforeEach: Prerequisites at the test case level,' + + ' which are executed before each test case is executed.'); + }) + afterEach(function () { + console.info('afterEach: Test case-level clearance conditions, ' + + 'which are executed after each test case is executed.'); + }) + afterAll(function () { + console.info('afterAll: Test suite-level cleanup condition, ' + + 'which is executed after the test suite is executed'); + }) + + /* + * @tc.number : InitUploadtaskCallback001 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('InitUploadtaskCallback001', 0, async function (done) { + try { + console.info("Testupdate before getuploadconfig"); + let UploadConfig = pubfun.getUploadConfig(file7url) + console.info("Testupdate before upload UploadConfig = " + JSON.stringify(UploadConfig)); + console.info("Testupdate before upload"); + await pubfun.publicupload(UploadConfig).then((data) => { + console.info("Testupdate going upload uploadTask = " + data); + uploadTask = data; + expect(true).assertEqual((data != undefined) || (data != "") || (data != {})); + done(); + }).catch((err) => { + console.info("InitUploadtaskCallback001 fail 1" + JSON.stringify(err)); + expect(err).assertFail(); + done(); + }) + } catch (e) { + console.info("InitUploadtaskCallback001 fail 2" + JSON.stringify(e)); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SwitchOnProgressCallback001 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SwitchOnProgressCallback001', 0, async function (done) { + try { + pubfun.publiconprogress(uploadTask, typeProgress); + expect(true).assertEqual(0 == 0); + done(); + } catch (err) { + console.info("Testupdate SwitchOnProgressCallback001 catch err " + JSON.stringify(err)); + expect(err).assertFail(); + done(); + } + }); + + /* + * @tc.number : SwitchOffProgressCallback001 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SwitchOffProgressCallback001', 0, async function (done) { + try { + pubfun.publiconprogress(uploadTask, typeProgress); + expect(true).assertEqual(0 == 0); + + await pubfun.publicoffprogress(uploadTask, typeProgress).then((data) => { + console.info("SwitchOffProgressCallback001 data" + JSON.stringify(data)); + expect(7).assertEqual(data.totalSize); + done(); + }).catch((err) => { + console.info("SwitchOffProgressCallback001 fail 2" + JSON.stringify(err)); + expect(err).assertFail(); + done(); + }) + } catch (e) { + console.info("SwitchOffProgressCallback001 fail 3" + JSON.stringify(e)); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SwitchOnFailCallback001 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SwitchOnFailCallback001', 0, async function (done) { + try { + await pubfun.publicon(uploadTask, typeFail).then((data) => { + console.info("SwitchOnFailCallback001 data " + data); + expect(5).assertEqual(data); + done(); + }).catch((err) => { + console.info("SwitchOnFailCallback001 fail 2" + JSON.stringify(err)); + expect(err).assertFail(); + done(); + }) + } catch (e) { + console.info("SwitchOnFailCallback001 fail 3" + JSON.stringify(e)); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : SwitchOffFailCallback001 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('SwitchOffFailCallback001', 0, async function (done) { + try { + await pubfun.publicon(uploadTask, typeFail) + await pubfun.publicoff(uploadTask, typeFail).then((data) => { + console.info("SwitchOffFailCallback001 data " + data); + expect(5).assertEqual(data); + done(); + }).catch((err) => { + console.info("SwitchOffFailCallback001 fail 2" + JSON.stringify(err)); + done(); + expect(err).assertFail(); + }) + } catch (e) { + console.info("SwitchOffFailCallback001 fail 3" + JSON.stringify(e)); + expect(e).assertFail(); + done(); + } + }) + + /* + * @tc.number : RemoveCallback001 + * @tc.name : Use getEntries get the value by mixing the string key + * @tc.desc : Mixed strings value can be obtained correctly + * @tc.size : MediumTest + * @tc.type : Function + * @tc.level : Level 1 + */ + it('RemoveCallback001', 0, async function (done) { + try { + await pubfun.publicremove(uploadTask).then((data) => { + console.info("RemoveCallback001 data " + data); + expect(true).assertEqual(data); + done(); + }).catch((err) => { + console.info("RemoveCallback001 fail 2" + JSON.stringify(err)); + expect(err).assertFail(); + done(); + }) + } catch (e) { + console.info("RemoveCallback001 fail 3" + JSON.stringify(e)); + expect(e).assertFail(); + done(); + } + }) + }) +} diff --git a/request/RequestTest_ets/entry/src/main/resources/base/element/string.json b/request/RequestTest_ets/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..498677efbde065c36668727190d3613cbf278bfc --- /dev/null +++ b/request/RequestTest_ets/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/request/RequestTest_js/entry/src/main/resources/base/media/icon.png b/request/RequestTest_ets/entry/src/main/resources/base/media/icon.png similarity index 100% rename from request/RequestTest_js/entry/src/main/resources/base/media/icon.png rename to request/RequestTest_ets/entry/src/main/resources/base/media/icon.png diff --git a/request/RequestTest_js/signature/openharmony_sx.p7b b/request/RequestTest_ets/signature/openharmony_sx.p7b similarity index 100% rename from request/RequestTest_js/signature/openharmony_sx.p7b rename to request/RequestTest_ets/signature/openharmony_sx.p7b diff --git a/request/RequestTest_js/Test.json b/request/RequestTest_js/Test.json deleted file mode 100644 index 2246162fae816a90aa4b9e239cfd6f49f7d051b8..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/Test.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "description": "Configuration for MiscservicesRequestJSApiTest js api Tests", - "driver": { - "type": "JSUnitTest", - "test-timeout": "4200000", - "package": "com.example.myapplication.hmservice", - "shell-timeout": "60000" - }, - "kits": [ - { - "test-file-name": ["ActsMiscservicesRequestJSApiTest.hap"], - "type": "AppInstallKit", - "cleanup-apps": true - }, - { - "type": "ShellKit", - "run-command": [ - "mkdir -p /data/app/el2/100/base/com.example.myapplication.hmservice/haps/entry/cache", - "echo \"123456\" > /data/app/el2/100/base/com.example.myapplication.hmservice/haps/entry/cache/test.txt" - ] - } - ] -} diff --git a/request/RequestTest_js/entry/src/main/config.json b/request/RequestTest_js/entry/src/main/config.json deleted file mode 100644 index 3b09ad691ef96fe340a6a16bc6f340cc5e3a4f90..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/entry/src/main/config.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "app": { - "bundleName": "com.example.myapplication.hmservice", - "vendor": "example", - "version": { - "code": 1, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 6, - "target": 6, - "releaseType": "Beta1" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.example.myapplication.hmservice", - "name": ".MyApplication", - "mainAbility": "com.example.myapplication.hmservice.MainAbility", - "deviceType": ["phone"], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": true - }, - "abilities": [ - { - "skills": [ - { - "entities": ["entity.system.home"], - "actions": ["action.system.home"] - } - ], - "name": "com.example.myapplication.hmservice.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard", - "visible": true, - "isVisible": "true" - } - ], - "js": [ - { - "pages": ["pages/index/index"], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - } - ] - } -} diff --git a/request/RequestTest_js/entry/src/main/js/Test/UploadCallbackXTSJsunit.test.js b/request/RequestTest_js/entry/src/main/js/Test/UploadCallbackXTSJsunit.test.js deleted file mode 100644 index 8f7c4a320721dfc203c34aa99e7055150d1cd2c1..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/entry/src/main/js/Test/UploadCallbackXTSJsunit.test.js +++ /dev/null @@ -1,202 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -import request from '@ohos.request'; -import * as pubfun from './Publicfunction.js' - -var typeProgress = 'progress'; -var typeHeaderReceive = 'headerReceive'; -var typeFail = 'fail'; -let uploadTask; -let file7url = 'internal://cache/test.txt'; - -describe('UploadTest', function () { - beforeAll(function () { - console.info('beforeAll: Prerequisites at the test suite level, ' + - 'which are executed before the test suite is executed.'); - }) - beforeEach(function () { - console.info('beforeEach: Prerequisites at the test case level,' + - ' which are executed before each test case is executed.'); - }) - afterEach(function () { - console.info('afterEach: Test case-level clearance conditions, ' + - 'which are executed after each test case is executed.'); - }) - afterAll(function () { - console.info('afterAll: Test suite-level cleanup condition, ' + - 'which is executed after the test suite is executed'); - }) - - /* - * @tc.number : InitUploadtaskCallback001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('InitUploadtaskCallback001', 0, async function (done) { - try { - console.log("Testupdate before getuploadconfig"); - let UploadConfig = pubfun.getUploadConfig(file7url) - console.log("Testupdate before upload UploadConfig = " + JSON.stringify(UploadConfig)); - console.log("Testupdate before upload"); - await pubfun.publicupload(UploadConfig).then((data) => { - console.log("Testupdate going upload uploadTask = " + data); - uploadTask = data; - expect(true).assertEqual((data != undefined) || (data != "") || (data != {})); - done(); - }).catch((err) => { - console.log("InitUploadtaskCallback001 fail 1" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) - } catch (e) { - console.log("InitUploadtaskCallback001 fail 2" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) - - /* - * @tc.number : SwitchOnProgressCallback001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SwitchOnProgressCallback001', 0, async function (done) { - try { - pubfun.publiconprogress(uploadTask, typeProgress); - expect(true).assertEqual(0 == 0); - done(); - } catch (err) { - console.log("Testupdate SwitchOnProgressCallback001 catch err " + JSON.stringify(err)); - expect(err).assertFail(); - done(); - } - }); - - /* - * @tc.number : SwitchOffProgressCallback001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SwitchOffProgressCallback001', 0, async function (done) { - try { - pubfun.publiconprogress(uploadTask, typeProgress); - expect(true).assertEqual(0 == 0); - - await pubfun.publicoffprogress(uploadTask, typeProgress).then((data) => { - console.log("SwitchOffProgressCallback001 data" + JSON.stringify(data)); - expect(7).assertEqual(data.totalSize); - done(); - }).catch((err) => { - console.log("SwitchOffProgressCallback001 fail 2" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) - } catch (e) { - console.log("SwitchOffProgressCallback001 fail 3" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) - - /* - * @tc.number : SwitchOnFailCallback001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SwitchOnFailCallback001', 0, async function (done) { - try { - await pubfun.publicon(uploadTask, typeFail).then((data) => { - console.log("SwitchOnFailCallback001 data " + data); - expect(5).assertEqual(data); - done(); - }).catch((err) => { - console.log("SwitchOnFailCallback001 fail 2" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) - } catch (e) { - console.log("SwitchOnFailCallback001 fail 3" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) - - /* - * @tc.number : SwitchOffFailCallback001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('SwitchOffFailCallback001', 0, async function (done) { - try { - await pubfun.publicon(uploadTask, typeFail) - await pubfun.publicoff(uploadTask, typeFail).then((data) => { - console.log("SwitchOffFailCallback001 data " + data); - expect(5).assertEqual(data); - done(); - }).catch((err) => { - console.log("SwitchOffFailCallback001 fail 2" + JSON.stringify(err)); - done(); - expect(err).assertFail(); - }) - } catch (e) { - console.log("SwitchOffFailCallback001 fail 3" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) - - /* - * @tc.number : RemoveCallback001 - * @tc.name : Use getEntries get the value by mixing the string key - * @tc.desc : Mixed strings value can be obtained correctly - * @tc.size : MediumTest - * @tc.type : Function - * @tc.level : Level 1 - */ - it('RemoveCallback001', 0, async function (done) { - try { - await pubfun.publicremove(uploadTask).then((data) => { - console.log("RemoveCallback001 data " + data); - expect(true).assertEqual(data); - done(); - }).catch((err) => { - console.log("RemoveCallback001 fail 2" + JSON.stringify(err)); - expect(err).assertFail(); - done(); - }) - } catch (e) { - console.log("RemoveCallback001 fail 3" + JSON.stringify(e)); - expect(e).assertFail(); - done(); - } - }) -}) \ No newline at end of file diff --git a/request/RequestTest_js/entry/src/main/js/default/app.js b/request/RequestTest_js/entry/src/main/js/default/app.js deleted file mode 100644 index b98633982ee2425768385c73a97e56bf6ee92ece..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/entry/src/main/js/default/app.js +++ /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('AceApplication onCreate') - }, - onDestroy() { - console.info('AceApplication onDestroy') - }, -} diff --git a/request/RequestTest_js/entry/src/main/js/default/i18n/en-US.json b/request/RequestTest_js/entry/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/entry/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/request/RequestTest_js/entry/src/main/js/default/i18n/zh-CN.json b/request/RequestTest_js/entry/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/entry/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/request/RequestTest_js/entry/src/main/js/default/pages/index/index.css b/request/RequestTest_js/entry/src/main/js/default/pages/index/index.css deleted file mode 100644 index 5bd7567028568bd522193b2519d545ca6dcf397d..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/entry/src/main/js/default/pages/index/index.css +++ /dev/null @@ -1,46 +0,0 @@ -.container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} - -.title { - font-size: 40px; - color: #000000; - opacity: 0.9; -} - -@media screen and (device-type: tablet) and (orientation: landscape) { - .title { - font-size: 100px; - } -} - -@media screen and (device-type: wearable) { - .title { - font-size: 28px; - color: #FFFFFF; - } -} - -@media screen and (device-type: tv) { - .container { - background-image: url("/common/images/Wallpaper.png"); - background-size: cover; - background-repeat: no-repeat; - background-position: center; - } - - .title { - font-size: 100px; - color: #FFFFFF; - } -} - -@media screen and (device-type: phone) and (orientation: landscape) { - .title { - font-size: 60px; - } -} diff --git a/request/RequestTest_js/entry/src/main/js/default/pages/index/index.hml b/request/RequestTest_js/entry/src/main/js/default/pages/index/index.hml deleted file mode 100644 index f64b040a5ae394dbaa5e185e1ecd4f4556b92184..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/entry/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,5 +0,0 @@ -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/request/RequestTest_js/entry/src/main/js/default/pages/index/index.js b/request/RequestTest_js/entry/src/main/js/default/pages/index/index.js deleted file mode 100644 index f4629924c9ab7f27602773439f9a6e918a97e2f1..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/entry/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,42 +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 { Core, ExpectExtend } from 'deccjsunit/index' -import { DataDriver } from 'deccjsunit' - -export default { - data: { - title: '', - }, - onInit() { - this.title = this.$t('strings.world') - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - id: 'extend', - }) - core.addService('expect', expectExtend) - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - console.log('test start') - require('../../../Test/List.test.js') - core.execute() - this.title = this.$t('strings.bye') - }, - onReady() {}, -} diff --git a/request/RequestTest_js/entry/src/main/resources/base/element/string.json b/request/RequestTest_js/entry/src/main/resources/base/element/string.json deleted file mode 100644 index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..0000000000000000000000000000000000000000 --- a/request/RequestTest_js/entry/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "mainability_description", - "value": "JS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/theme/BUILD.gn b/theme/BUILD.gn old mode 100755 new mode 100644 index 441614e3ab4783a03e6564a3ffa1990b62440c75..163c39526d738fb0d25fe4047c457a7dc075bc1f --- a/theme/BUILD.gn +++ b/theme/BUILD.gn @@ -15,7 +15,7 @@ import("//build/ohos_var.gni") group("theme") { testonly = true deps = [ - "screenlock_js:ActsScreenLockJSApiTest", - "wallpaper_js:ActsWallpaperJSApiTest", + "screenlock_ets:ActsScreenLockETSApiTest", + "wallpaper_ets:ActsWallpaperETSApiTest", ] } diff --git a/theme/screenlock_ets/BUILD.gn b/theme/screenlock_ets/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..715afe2f991d992ca160d43daedc335179d8aa6f --- /dev/null +++ b/theme/screenlock_ets/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//test/xts/tools/build/suite.gni") +ohos_js_hap_suite("ActsScreenLockETSApiTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":screenLock_ets_assets", + ":screenLock_ets_resources", + ":screenLock_ets_test_assets", + ] + ets2abc = true + subsystem_name = "theme" + part_name = "screenlock_mgr" + certificate_profile = "./signature/openharmony_sx.p7b" + hap_name = "ActsScreenLockETSApiTest" +} + +ohos_js_assets("screenLock_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("screenLock_ets_resources") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("screenLock_ets_test_assets") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/theme/screenlock_js/Test.json b/theme/screenlock_ets/Test.json similarity index 62% rename from theme/screenlock_js/Test.json rename to theme/screenlock_ets/Test.json index 3f5461b4d990b60d755932cea9c7ab8501bdf82c..406968a98790eb06cc1bb880d63b97d6c4079abd 100644 --- a/theme/screenlock_js/Test.json +++ b/theme/screenlock_ets/Test.json @@ -1,15 +1,16 @@ { "description": "Configuration for screenlock js api Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "600000", - "package": "com.ohos.miscscreenlock", + "bundle-name": "com.acts.theme.screenlocktest", + "package-name": "com.acts.theme.screenlocktest", "shell-timeout": "600000" }, "kits": [ { "test-file-name": [ - "ActsScreenLockJSApiTest.hap" + "ActsScreenLockETSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/theme/screenlock_ets/entry/src/main/config.json b/theme/screenlock_ets/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..1ca5bf79cea07db91c1779bb38944dd60e9f9fe8 --- /dev/null +++ b/theme/screenlock_ets/entry/src/main/config.json @@ -0,0 +1,99 @@ +{ + "app": { + "bundleName": "com.acts.theme.screenlocktest", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.acts.theme.screenlocktest", + "name": ".MyApplication", + "mainAbility": "com.acts.theme.screenlocktest.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" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/theme/screenlock_ets/entry/src/main/ets/MainAbility/app.ets b/theme/screenlock_ets/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e4e48f739b88cd4fbcc15d4e54b244d5af51d90 --- /dev/null +++ b/theme/screenlock_ets/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/theme/screenlock_ets/entry/src/main/ets/MainAbility/pages/index.ets b/theme/screenlock_ets/entry/src/main/ets/MainAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..eb4afee1d15e74b4dd25ca165591798b4ba7c01e --- /dev/null +++ b/theme/screenlock_ets/entry/src/main/ets/MainAbility/pages/index.ets @@ -0,0 +1,38 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } + + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('SCREENLOCK ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } +} + diff --git a/theme/screenlock_ets/entry/src/main/ets/TestAbility/app.ets b/theme/screenlock_ets/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e4e48f739b88cd4fbcc15d4e54b244d5af51d90 --- /dev/null +++ b/theme/screenlock_ets/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/theme/screenlock_ets/entry/src/main/ets/TestAbility/pages/index.ets b/theme/screenlock_ets/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2497c3b2774b09a40f0db535735f3dbe5e6cb6e --- /dev/null +++ b/theme/screenlock_ets/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,50 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/theme/screenlock_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/theme/screenlock_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..07cb0b784984c6c4cc6d911c3c82643bff9df263 --- /dev/null +++ b/theme/screenlock_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +// @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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/app.js b/theme/screenlock_ets/entry/src/main/ets/test/List.test.ets similarity index 69% rename from distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/app.js rename to theme/screenlock_ets/entry/src/main/ets/test/List.test.ets index 4b241cccbaa71f0c5cbd9e7dc437a0feb224c7d5..fd10a4e7cd4177f4a857951272c95969096a84cb 100644 --- a/distributeddatamgr/Pasteboardjsapitest/entry/src/main/js/default/app.js +++ b/theme/screenlock_ets/entry/src/main/ets/test/List.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,11 +12,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -export default { - onCreate() { - console.info('AceApplication onCreate'); - }, - onDestroy() { - console.info('AceApplication onDestroy'); - } -}; + +import screenLockJSUnit from './screenLockTest'; +import ScreenLockPromiseTest from './screenLockPromiseTest'; + +export default function testsuite() { + screenLockJSUnit(); + ScreenLockPromiseTest() +} \ No newline at end of file diff --git a/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets b/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..0fb0fc74dae9c4188123a18a67fabc26df824976 --- /dev/null +++ b/theme/screenlock_ets/entry/src/main/ets/test/screenLockPromiseTest.ets @@ -0,0 +1,168 @@ +// @ts-nocheck +/* + * Copyright (C) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import screenLock from '@ohos.screenLock'; +import {describe, expect, it} from 'deccjsunit/index' + +const SLEEP_TIME = 1000; + +export default function ScreenLockPromiseTest(){ + describe('ScreenLockServicePromiseTest', function () { + console.info("-----------------------ScreenlockPromiseTest is starting-----------------------"); + + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + + /* + * @tc.number ScreenLock_Test_Promise_0100 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Function test + * @tc.level 0 + */ + it("ScreenLock_Test_Promise_0100", 0, async function (done) { + console.info("------------------start ScreenLock_Test_Promise_0100-------------------"); + var isScreenLocked = true; + try { + screenLock.isScreenLocked().then((data) => { + console.info("ScreenLock_Test_Promise_0100 isScreenLocked result is " + data); + expect(data == true).assertTrue() + }) + } catch (error) { + console.info("ScreenLock_Test_Promise_0100 test_setScreenLocked : error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end ScreenLock_Test_Promise_0100-------------------"); + done(); + }); + + /* + * @tc.number ScreenLock_Test_Promise_0200 + * @tc.name Set to unlocked screen, query the lock screen state is unlocked state + * @tc.desc Function test + * @tc.level 0 + */ + it("ScreenLock_Test_Promise_0200", 0, async function (done) { + console.info("------------------start ScreenLock_Test_Promise_0200-------------------"); + var isScreenLocked = false; + try { + screenLock.isScreenLocked().then((data) => { + console.info("ScreenLock_Test_Promise_0200 isScreenLocked result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("ScreenLock_Test_Promise_0200 test_setScreenLocked : error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end ScreenLock_Test_Promise_0200-------------------"); + done(); + }); + + /* + * @tc.number ScreenLock_Test_Promise_0300 + * @tc.name Query whether a password has been set, and return the password that has not been set + * @tc.desc Function test + * @tc.level 0 + */ + it("ScreenLock_Test_Promise_0300", 0, async function (done) { + console.info("------------------start ScreenLock_Test_Promise_0300-------------------"); + try { + screenLock.isSecureMode().then((data) => { + console.info("ScreenLock_Test_Promise_0300 isScreenLocked result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("ScreenLock_Test_Promise_0300 isScreenLocked TRUE: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end ScreenLock_Test_Promise_0300-------------------"); + done(); + }); + + /* + * @tc.number ScreenLock_Test_Promise_0400 + * @tc.name Request to unlock the device screen, unlock successfully + * @tc.desc Function test + * @tc.level 0 + */ + it("ScreenLock_Test_Promise_0400", 0, async function (done) { + console.info("------------------start ScreenLock_Test_Promise_0400-------------------"); + try { + screenLock.unlockScreen().then(() => { + console.info("ScreenLock_Test_Promise_0400: send unlockScreen issue success"); + }); + sleep(SLEEP_TIME); + var unlockScreenResult = 0; + var eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => { + console.info("ScreenLock_Test_Promise_0400: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + sleep(SLEEP_TIME); + screenLock.isScreenLocked().then((data) => { + console.info("ScreenLock_Test_Promise_0400: isScreenLocked result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("Screenlock_Test_1400: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end ScreenLock_Test_Promise_0400-------------------"); + done(); + }); + + /* + * @tc.number ScreenLock_Test_Promise_0500 + * @tc.name Request to unlock device screen, unlock failed + * @tc.desc Function test + * @tc.level 0 + */ + it("ScreenLock_Test_Promise_0500", 0, async function (done) { + console.info("------------------start ScreenLock_Test_Promise_0500-------------------"); + try { + screenLock.unlockScreen().then(() => { + console.info("ScreenLock_Test_Promise_0500: send unlockScreen issue success"); + }); + + sleep(SLEEP_TIME); + var unlockScreenResult = 1; + var eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => { + console.info("ScreenLock_Test_Promise_0500: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.isScreenLocked().then((data) => { + console.info("ScreenLock_Test_Promise_0500: isScreenLocked result is " + data); + expect(data == true).assertTrue(); + done(); + }); + } catch (error) { + console.info("logMessage ScreenLock_Test_Promise_0500: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end ScreenLock_Test_Promise_0500-------------------"); + done(); + }); + + }) +} diff --git a/theme/screenlock_js/src/main/js/test/screenlock_service_test.js b/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets similarity index 96% rename from theme/screenlock_js/src/main/js/test/screenlock_service_test.js rename to theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets index c09d7dc31251ce0713a7cdafab8d61961500fa19..40a5036bd8ff2d983d46bec8d6c38b1dd5abc124 100644 --- a/theme/screenlock_js/src/main/js/test/screenlock_service_test.js +++ b/theme/screenlock_ets/entry/src/main/ets/test/screenLockTest.ets @@ -1,782 +1,784 @@ -// @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 screenLock from '@ohos.screenLock'; -import {describe, expect, it} from 'deccjsunit/index' - -const INTERACTIVE_STATE_END_SLEEP = 0; -const INTERACTIVE_STATE_USERID = 2; -const INTERACTIVE_STATE_BEGIN_SLEEP = 3; -const SLEEP_TIME = 1000; - -describe('ScreenLockServiceTest', function () { - console.info("-----------------------ScreenlockTest is starting-----------------------"); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - /* - * @tc.number ScreenLock_Test_0100 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Function test - * @tc.level 0 - */ - it("ScreenLock_Test_0100", 0, async function (done) { - console.info("------------------start ScreenLock_Test_0100-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.info("ScreenLock_Test_0100 isScreenLocked's status is " + data); - expect(data == true).assertTrue(); - }); - } catch (error) { - console.info("logMessage ScreenLock_Test_0100: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end ScreenLock_Test_0100-------------------"); - done(); - }); - - /* - * @tc.number ScreenLock_Test_0200 - * @tc.name Set to unlocked screen, query the lock screen state is unlocked state - * @tc.desc Function test - * @tc.level 0 - */ - it("ScreenLock_Test_0200", 0, async function (done) { - console.info("------------------start ScreenLock_Test_0200-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.info("ScreenLock_Test_0200 isScreenLocked's status is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("logMessage ScreenLock_Test_0200: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end ScreenLock_Test_0200-------------------"); - done(); - }); - - /* - * @tc.number ScreenLock_Test_0300 - * @tc.name Query whether a password has been set, and return the password that has not been set - * @tc.desc Function test - * @tc.level 0 - */ - it("ScreenLock_Test_0300", 0, async function (done) { - console.info("------------------start ScreenLock_Test_0300-------------------"); - try { - screenLock.isSecureMode((err, data) => { - console.info("ScreenLock_Test_0300 isSecureMode's result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("logMessage ScreenLock_Test_0300: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end ScreenLock_Test_0300-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_0400 - * @tc.name Request to unlock the device screen, unlock successfully - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_0400", 0, async function (done) { - console.info("------------------start Screenlock_Test_0400-------------------"); - try { - screenLock.unlockScreen(() => { - console.info("Screenlock_Test_0400: send unlockScreen issue success"); - }); - - sleep(SLEEP_TIME); - var unlockScreenResult = 0; - var eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.info("Screenlock_Test_0400: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.isScreenLocked((err, data) => { - console.info("Screenlock_Test_0400: isScreenLocked result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("Screenlock_Test_1400: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end Screenlock_Test_0400-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_0500 - * @tc.name Request to unlock device screen, unlock failed - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_0500", 0, async function (done) { - console.info("------------------start Screenlock_Test_0500-------------------"); - try { - screenLock.unlockScreen(() => { - console.info("Screenlock_Test_0500: send unlockScreen issue success"); - }); - - sleep(SLEEP_TIME); - var unlockScreenResult = 1; - var eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.info("Screenlock_Test_0500: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.isScreenLocked((err, data) => { - console.info("Screenlock_Test_0500: isScreenLocked result is " + data); - expect(data == true).assertTrue(); - }); - } catch (error) { - console.info("logMessage Screenlock_Test_0500: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end Screenlock_Test_0500-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_2100 - * @tc.name After the systemUI is started, it is in the locked state, the lock management sends - the unlock request successfully, and the lock screen application notifies the unlock - success message - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_2100", 0, async function (done) { - console.info("------------------start Screenlock_Test_2100-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.info("Screenlock_Test_2100: isScreenLocked result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.unlockScreen(() => { - console.info("Screenlock_Test_2100: send unlockScreen issue success"); - }); - - sleep(SLEEP_TIME); - var unlockScreenResult = 0; - var eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.info("Screenlock_Test_2100: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.isScreenLocked((err, data) => { - console.info("Screenlock_Test_2100: isScreenLocked result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("Screenlock_Test_2100: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end Screenlock_Test_2100-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_2200 - * @tc.name After systemUI is started, it is currently unlocked - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_2200", 0, async function (done) { - console.info("------------------start Screenlock_Test_2200-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.info("Screenlock_Test_2200: isScreenLocked is successful, result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("logMessage Screenlock_Test_2200: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end ScreenLock_Test_2200-------------------"); - done(); - }); - - - /* - * @tc.number Screenlock_Test_2300 - * @tc.name After the systemUI is started, it is in the locked state, the lock management sends - the unlock request successfully, and the lock screen application notifies the unlock - failed message - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_2300", 0, async function (done) { - console.info("------------------start Screenlock_Test_2300-------------------"); - try { - screenLock.isScreenLocked((err, data) => { - console.log("Screenlock_Test_2300: isScreenLocked result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.unlockScreen(() => { - console.log("Screenlock_Test_2300: send unlockScreen issue success"); - }); - - sleep(SLEEP_TIME); - var unlockScreenResult = 1; - var eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { - console.log("Screenlock_Test_2300: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.isScreenLocked((err, data) => { - console.log("Screenlock_Test_2300: isScreenLocked result is " + data); - expect(data == true).assertTrue(); - }); - } catch (error) { - console.info("Screenlock_Test_2300: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end Screenlock_Test_2300-------------------"); - done(); - }); - - - /* - * @tc.number Screenlock_Test_2400 - * @tc.name Device management causes the screen to go off, and run "beginWakeUp" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_2400", 0, async function (done) { - console.log("------------------start Screenlock_Test_2400-------------------"); - try { - var eventType = 'beginWakeUp'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_2400: test_getRuntimeState beginWakeUp is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_2400: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_2400-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_2500 - * @tc.name Device management causes the screen to go off, and run "endWakeUp" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_2500", 0, async function (done) { - console.log("------------------start Screenlock_Test_2500-------------------"); - try { - var eventType = 'endWakeUp'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_2500: test_getRuntimeState endWakeUp is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_2500: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_2500-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_2600 - * @tc.name Device management causes the screen to go off, and run "beginScreenOn" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_2600", 0, async function (done) { - console.log("------------------start Screenlock_Test_2600-------------------"); - try { - var eventType = 'beginScreenOn'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_2600: test_getRuntimeState beginScreenOn is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_2600: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_2600-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_2700 - * @tc.name Device management causes the screen to go off, and run "endScreenOn" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_2700", 0, async function (done) { - console.log("------------------start Screenlock_Test_2700-------------------"); - try { - var eventType = 'beginScreenOn'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_2700: test_getRuntimeState endScreenOn is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_2700: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_2700-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_2800 - * @tc.name User causes the screen to go off, and run "beginScreenOff" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_2800", 0, async function (done) { - console.log("------------------start Screenlock_Test_2800-------------------"); - try { - var eventType = 'beginScreenOff'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_2800: test_getRuntimeState beginScreenOff is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_2800: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_2800-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_2900 - * @tc.name User causes the screen to go off, and run "endScreenOff" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_2900", 0, async function (done) { - console.log("------------------start Screenlock_Test_2900-------------------"); - try { - var eventType = 'endScreenOff'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_2900: test_getRuntimeState endScreenOff is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_2900: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_2900-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3000 - * @tc.name User causes the screen to go off, and run "unlockScreen" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3000", 0, async function (done) { - console.log("------------------start Screenlock_Test_3000-------------------"); - try { - var eventType = 'unlockScreen'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_3000: test_getRuntimeState unlockScreen is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3000: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3000-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3100 - * @tc.name User causes the screen to go off, and run "beginExitAnimation" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3100", 0, async function (done) { - console.log("------------------start Screenlock_Test_3100-------------------"); - try { - var eventType = 'beginExitAnimation'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_3100: test_getRuntimeState beginExitAnimation is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3100: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3100-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3200 - * @tc.name No operation for a long time causes the screen to go off, and run "screenlockEnabled" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3200", 0, async function (done) { - console.log("------------------start Screenlock_Test_3200-------------------"); - try { - var eventType = 'screenlockEnabled'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_3200: test_getRuntimeState screenlockEnabled is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3200: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3200-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3300 - * @tc.name No operation for a long time causes the screen to go off, and run "beginSleep" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3300", 0, async function (done) { - console.log("------------------start Screenlock_Test_3300-------------------"); - try { - var eventType = 'beginSleep'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_3300: test_getRuntimeState beginSleep is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3300: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3300-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3400 - * @tc.name No operation for a long time causes the screen to go off, and run "endSleep" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3400", 0, async function (done) { - console.log("------------------start Screenlock_Test_3400-------------------"); - try { - var eventType = 'endSleep'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_3400: test_getRuntimeState endSleep is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3400: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3400-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3500 - * @tc.name No operation for a long time causes the screen to go off, and run "changeUser" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3500", 0, async function (done) { - console.log("------------------start Screenlock_Test_3500-------------------"); - try { - var eventType = 'changeUser'; - screenLock.off(eventType, () => { - console.log("Screenlock_Test_3500: test_getRuntimeState changeUser is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3500: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3500-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3600 - * @tc.name Responding to bright screen events, and run "beginWakeUp" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3600", 0, async function (done) { - console.log("------------------start Screenlock_Test_3600-------------------"); - try { - var eventType = 'beginWakeUp'; - screenLock.on(eventType, () => { - console.log("Screenlock_Test_3600: test_getRuntimeState beginWakeUp is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3600: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3600-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3700 - * @tc.name Responding to bright screen events, and run "endWakeUp" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3700", 0, async function (done) { - console.log("------------------logMessage Screenlock_Test_3700-------------------"); - try { - var eventType = 'endWakeUp'; - screenLock.on(eventType, () => { - console.log("Screenlock_Test_3700: test_getRuntimeState endWakeUp is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3700: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3700-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3800 - * @tc.name Responding to bright screen events, and run "beginScreenOn" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3800", 0, async function (done) { - console.log("------------------start Screenlock_Test_3800-------------------"); - try { - var eventType = 'beginScreenOn'; - screenLock.on(eventType, () => { - console.log("Screenlock_Test_3800: test_getRuntimeState beginScreenOn is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3800: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3800-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_3900 - * @tc.name Responding to bright screen events, and run "endScreenOn" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_3900", 0, async function (done) { - console.log("------------------start Screenlock_Test_3900-------------------"); - try { - var eventType = 'endScreenOn'; - screenLock.on(eventType, () => { - console.log("Screenlock_Test_3900: test_getRuntimeState endScreenOn is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_3900: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_3900-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_4000 - * @tc.name Responding to bright screen events, and run "beginScreenOff" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_4000", 0, async function (done) { - console.log("------------------start Screenlock_Test_4000-------------------"); - try { - var eventType = 'beginScreenOff'; - screenLock.on(eventType, () => { - console.log("Screenlock_Test_4000: test_getRuntimeState beginScreenOff is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_4000: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_4000-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_4100 - * @tc.name Responding to bright screen events, and run "endScreenOff" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_4100", 0, async function (done) { - console.log("------------------logMessage Screenlock_Test_4100-------------------"); - try { - var eventType = 'endScreenOff'; - screenLock.on(eventType, () => { - console.log("Screenlock_Test_4100: test_getRuntimeState endScreenOff is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_4100: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_4100-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_4200 - * @tc.name Responding to bright screen events, and run "unlockScreen" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_4200", 0, async function (done) { - console.log("------------------start Screenlock_Test_4200-------------------"); - try { - var eventType = 'unlockScreen'; - screenLock.on(eventType, () => { - console.log("Screenlock_Test_4200: test_getRuntimeState unlockScreen is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_4200: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_4200-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_4300 - * @tc.name Responding to bright screen events, and run "beginExitAnimation" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_4300", 0, async function (done) { - console.log("------------------start Screenlock_Test_4300-------------------"); - try { - var eventType = 'beginExitAnimation'; - screenLock.on(eventType, () => { - console.log("Screenlock_Test_4300: test_getRuntimeState beginExitAnimation is successful" ); - }); - } catch (error) { - console.log("end Screenlock_Test_4300: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_4300-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_4400 - * @tc.name Responding to bright screen events, and run "beginSleep" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_4400", 0, async function (done) { - console.log("------------------start Screenlock_Test_4400-------------------"); - try { - var eventType = 'changeUser'; - screenLock.on(eventType, (err, data) => { - console.log("Screenlock_Test_4400: test_getRuntimeState beginSleep is successful"); - expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue(); - }); - } catch (error) { - console.log("logMessage Screenlock_Test_4400: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_4400-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_4500 - * @tc.name Responding to bright screen events, and run "endSleep" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_4500", 0, async function (done) { - console.log("------------------start Screenlock_Test_4500-------------------"); - try { - var eventType = 'endSleep'; - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4500: test_getRuntimeState endSleep is successful"); - expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue(); - }); - } catch (error) { - console.log("logMessage Screenlock_Test_4500: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_4500-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_4600 - * @tc.name Responding to bright screen events, and run "changeUser" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_4600", 0, async function (done) { - console.log("------------------start Screenlock_Test_4600-------------------"); - try { - var eventType = 'changeUser'; - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4600: test_getRuntimeState changeUser is successfuls"); - expect(data == INTERACTIVE_STATE_USERID).assertTrue(); - }); - } catch (error) { - console.log("logMessage Screenlock_Test_4600: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_4600-------------------"); - done(); - }); - - /* - * @tc.number Screenlock_Test_4700 - * @tc.name Responding to bright screen events, and run "screenlockEnabled" operate - * @tc.desc Function test - * @tc.level 0 - */ - it("Screenlock_Test_4700", 0, async function (done) { - console.log("------------------start Screenlock_Test_4700-------------------"); - try { - var eventType = 'screenlockEnabled'; - screenLock.test_getRuntimeState(eventType, (err, data) => { - console.log("Screenlock_Test_4700: test_getRuntimeState screenlockEnabled is successfuls"); - expect(data == true).assertTrue(); - }); - } catch (error) { - console.log("logMessage Screenlock_Test_4700: error = " + error); - expect(true).assertTrue(); - } - console.log("------------------end Screenlock_Test_4700-------------------"); - done(); - }); -}) \ No newline at end of file +// @ts-nocheck +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import screenLock from '@ohos.screenLock'; +import {describe, expect, it} from "hypium/index"; + +export default function screenLockJSUnit() { + const INTERACTIVE_STATE_END_SLEEP = 0; + const INTERACTIVE_STATE_USERID = 2; + const INTERACTIVE_STATE_BEGIN_SLEEP = 3; + const SLEEP_TIME = 1000; + + describe('ScreenLockServiceTest', function () { + console.info("-----------------------ScreenlockTest is starting-----------------------"); + + function sleep(numberMillis) { + var now = new Date(); + var exitTime = now.getTime() + numberMillis; + while (true) { + now = new Date(); + if (now.getTime() > exitTime) + return; + } + } + + /* + * @tc.number ScreenLock_Test_0100 + * @tc.name Set to locked screen, query the lock screen state is locked state + * @tc.desc Function test + * @tc.level 0 + */ + it("ScreenLock_Test_0100", 0, async function (done) { + console.info("------------------start ScreenLock_Test_0100-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.info("ScreenLock_Test_0100 isScreenLocked's status is " + data); + expect(data == true).assertTrue(); + }); + } catch (error) { + console.info("logMessage ScreenLock_Test_0100: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end ScreenLock_Test_0100-------------------"); + done(); + }); + + /* + * @tc.number ScreenLock_Test_0200 + * @tc.name Set to unlocked screen, query the lock screen state is unlocked state + * @tc.desc Function test + * @tc.level 0 + */ + it("ScreenLock_Test_0200", 0, async function (done) { + console.info("------------------start ScreenLock_Test_0200-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.info("ScreenLock_Test_0200 isScreenLocked's status is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("logMessage ScreenLock_Test_0200: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end ScreenLock_Test_0200-------------------"); + done(); + }); + + /* + * @tc.number ScreenLock_Test_0300 + * @tc.name Query whether a password has been set, and return the password that has not been set + * @tc.desc Function test + * @tc.level 0 + */ + it("ScreenLock_Test_0300", 0, async function (done) { + console.info("------------------start ScreenLock_Test_0300-------------------"); + try { + screenLock.isSecureMode((err, data) => { + console.info("ScreenLock_Test_0300 isSecureMode's result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("logMessage ScreenLock_Test_0300: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end ScreenLock_Test_0300-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_0400 + * @tc.name Request to unlock the device screen, unlock successfully + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_0400", 0, async function (done) { + console.info("------------------start Screenlock_Test_0400-------------------"); + try { + screenLock.unlockScreen(() => { + console.info("Screenlock_Test_0400: send unlockScreen issue success"); + }); + + sleep(SLEEP_TIME); + var unlockScreenResult = 0; + var eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { + console.info("Screenlock_Test_0400: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.isScreenLocked((err, data) => { + console.info("Screenlock_Test_0400: isScreenLocked result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("Screenlock_Test_1400: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end Screenlock_Test_0400-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_0500 + * @tc.name Request to unlock device screen, unlock failed + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_0500", 0, async function (done) { + console.info("------------------start Screenlock_Test_0500-------------------"); + try { + screenLock.unlockScreen(() => { + console.info("Screenlock_Test_0500: send unlockScreen issue success"); + }); + + sleep(SLEEP_TIME); + var unlockScreenResult = 1; + var eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { + console.info("Screenlock_Test_0500: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.isScreenLocked((err, data) => { + console.info("Screenlock_Test_0500: isScreenLocked result is " + data); + expect(data == true).assertTrue(); + }); + } catch (error) { + console.info("logMessage Screenlock_Test_0500: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end Screenlock_Test_0500-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_2100 + * @tc.name After the systemUI is started, it is in the locked state, the lock management sends + the unlock request successfully, and the lock screen application notifies the unlock + success message + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_2100", 0, async function (done) { + console.info("------------------start Screenlock_Test_2100-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.info("Screenlock_Test_2100: isScreenLocked result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.unlockScreen(() => { + console.info("Screenlock_Test_2100: send unlockScreen issue success"); + }); + + sleep(SLEEP_TIME); + var unlockScreenResult = 0; + var eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { + console.info("Screenlock_Test_2100: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.isScreenLocked((err, data) => { + console.info("Screenlock_Test_2100: isScreenLocked result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("Screenlock_Test_2100: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end Screenlock_Test_2100-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_2200 + * @tc.name After systemUI is started, it is currently unlocked + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_2200", 0, async function (done) { + console.info("------------------start Screenlock_Test_2200-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.info("Screenlock_Test_2200: isScreenLocked is successful, result is " + data); + expect(data == false).assertTrue(); + }); + } catch (error) { + console.info("logMessage Screenlock_Test_2200: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end ScreenLock_Test_2200-------------------"); + done(); + }); + + + /* + * @tc.number Screenlock_Test_2300 + * @tc.name After the systemUI is started, it is in the locked state, the lock management sends + the unlock request successfully, and the lock screen application notifies the unlock + failed message + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_2300", 0, async function (done) { + console.info("------------------start Screenlock_Test_2300-------------------"); + try { + screenLock.isScreenLocked((err, data) => { + console.log("Screenlock_Test_2300: isScreenLocked result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.unlockScreen(() => { + console.log("Screenlock_Test_2300: send unlockScreen issue success"); + }); + + sleep(SLEEP_TIME); + var unlockScreenResult = 1; + var eventType = 'unlockScreenResult'; + screenLock.sendScreenLockEvent(eventType, unlockScreenResult, (err, data) => { + console.log("Screenlock_Test_2300: sendScreenLockEvent result is " + data); + expect(data == true).assertTrue(); + }); + + sleep(SLEEP_TIME); + screenLock.isScreenLocked((err, data) => { + console.log("Screenlock_Test_2300: isScreenLocked result is " + data); + expect(data == true).assertTrue(); + }); + } catch (error) { + console.info("Screenlock_Test_2300: error = " + error); + expect(true).assertTrue(); + } + console.info("------------------end Screenlock_Test_2300-------------------"); + done(); + }); + + + /* + * @tc.number Screenlock_Test_2400 + * @tc.name Device management causes the screen to go off, and run "beginWakeUp" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_2400", 0, async function (done) { + console.log("------------------start Screenlock_Test_2400-------------------"); + try { + var eventType = 'beginWakeUp'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2400: test_getRuntimeState beginWakeUp is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_2400: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_2400-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_2500 + * @tc.name Device management causes the screen to go off, and run "endWakeUp" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_2500", 0, async function (done) { + console.log("------------------start Screenlock_Test_2500-------------------"); + try { + var eventType = 'endWakeUp'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2500: test_getRuntimeState endWakeUp is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_2500: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_2500-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_2600 + * @tc.name Device management causes the screen to go off, and run "beginScreenOn" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_2600", 0, async function (done) { + console.log("------------------start Screenlock_Test_2600-------------------"); + try { + var eventType = 'beginScreenOn'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2600: test_getRuntimeState beginScreenOn is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_2600: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_2600-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_2700 + * @tc.name Device management causes the screen to go off, and run "endScreenOn" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_2700", 0, async function (done) { + console.log("------------------start Screenlock_Test_2700-------------------"); + try { + var eventType = 'beginScreenOn'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2700: test_getRuntimeState endScreenOn is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_2700: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_2700-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_2800 + * @tc.name User causes the screen to go off, and run "beginScreenOff" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_2800", 0, async function (done) { + console.log("------------------start Screenlock_Test_2800-------------------"); + try { + var eventType = 'beginScreenOff'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2800: test_getRuntimeState beginScreenOff is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_2800: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_2800-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_2900 + * @tc.name User causes the screen to go off, and run "endScreenOff" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_2900", 0, async function (done) { + console.log("------------------start Screenlock_Test_2900-------------------"); + try { + var eventType = 'endScreenOff'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_2900: test_getRuntimeState endScreenOff is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_2900: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_2900-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3000 + * @tc.name User causes the screen to go off, and run "unlockScreen" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3000", 0, async function (done) { + console.log("------------------start Screenlock_Test_3000-------------------"); + try { + var eventType = 'unlockScreen'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3000: test_getRuntimeState unlockScreen is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3000: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3000-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3100 + * @tc.name User causes the screen to go off, and run "beginExitAnimation" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3100", 0, async function (done) { + console.log("------------------start Screenlock_Test_3100-------------------"); + try { + var eventType = 'beginExitAnimation'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3100: test_getRuntimeState beginExitAnimation is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3100: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3100-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3200 + * @tc.name No operation for a long time causes the screen to go off, and run "screenlockEnabled" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3200", 0, async function (done) { + console.log("------------------start Screenlock_Test_3200-------------------"); + try { + var eventType = 'screenlockEnabled'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3200: test_getRuntimeState screenlockEnabled is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3200: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3200-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3300 + * @tc.name No operation for a long time causes the screen to go off, and run "beginSleep" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3300", 0, async function (done) { + console.log("------------------start Screenlock_Test_3300-------------------"); + try { + var eventType = 'beginSleep'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3300: test_getRuntimeState beginSleep is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3300: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3300-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3400 + * @tc.name No operation for a long time causes the screen to go off, and run "endSleep" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3400", 0, async function (done) { + console.log("------------------start Screenlock_Test_3400-------------------"); + try { + var eventType = 'endSleep'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3400: test_getRuntimeState endSleep is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3400: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3400-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3500 + * @tc.name No operation for a long time causes the screen to go off, and run "changeUser" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3500", 0, async function (done) { + console.log("------------------start Screenlock_Test_3500-------------------"); + try { + var eventType = 'changeUser'; + screenLock.off(eventType, () => { + console.log("Screenlock_Test_3500: test_getRuntimeState changeUser is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3500: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3500-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3600 + * @tc.name Responding to bright screen events, and run "beginWakeUp" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3600", 0, async function (done) { + console.log("------------------start Screenlock_Test_3600-------------------"); + try { + var eventType = 'beginWakeUp'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_3600: test_getRuntimeState beginWakeUp is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3600: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3600-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3700 + * @tc.name Responding to bright screen events, and run "endWakeUp" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3700", 0, async function (done) { + console.log("------------------logMessage Screenlock_Test_3700-------------------"); + try { + var eventType = 'endWakeUp'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_3700: test_getRuntimeState endWakeUp is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3700: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3700-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3800 + * @tc.name Responding to bright screen events, and run "beginScreenOn" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3800", 0, async function (done) { + console.log("------------------start Screenlock_Test_3800-------------------"); + try { + var eventType = 'beginScreenOn'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_3800: test_getRuntimeState beginScreenOn is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3800: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3800-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_3900 + * @tc.name Responding to bright screen events, and run "endScreenOn" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_3900", 0, async function (done) { + console.log("------------------start Screenlock_Test_3900-------------------"); + try { + var eventType = 'endScreenOn'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_3900: test_getRuntimeState endScreenOn is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_3900: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_3900-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_4000 + * @tc.name Responding to bright screen events, and run "beginScreenOff" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_4000", 0, async function (done) { + console.log("------------------start Screenlock_Test_4000-------------------"); + try { + var eventType = 'beginScreenOff'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_4000: test_getRuntimeState beginScreenOff is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_4000: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_4000-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_4100 + * @tc.name Responding to bright screen events, and run "endScreenOff" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_4100", 0, async function (done) { + console.log("------------------logMessage Screenlock_Test_4100-------------------"); + try { + var eventType = 'endScreenOff'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_4100: test_getRuntimeState endScreenOff is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_4100: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_4100-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_4200 + * @tc.name Responding to bright screen events, and run "unlockScreen" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_4200", 0, async function (done) { + console.log("------------------start Screenlock_Test_4200-------------------"); + try { + var eventType = 'unlockScreen'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_4200: test_getRuntimeState unlockScreen is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_4200: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_4200-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_4300 + * @tc.name Responding to bright screen events, and run "beginExitAnimation" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_4300", 0, async function (done) { + console.log("------------------start Screenlock_Test_4300-------------------"); + try { + var eventType = 'beginExitAnimation'; + screenLock.on(eventType, () => { + console.log("Screenlock_Test_4300: test_getRuntimeState beginExitAnimation is successful" ); + }); + } catch (error) { + console.log("end Screenlock_Test_4300: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_4300-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_4400 + * @tc.name Responding to bright screen events, and run "beginSleep" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_4400", 0, async function (done) { + console.log("------------------start Screenlock_Test_4400-------------------"); + try { + var eventType = 'changeUser'; + screenLock.on(eventType, (err, data) => { + console.log("Screenlock_Test_4400: test_getRuntimeState beginSleep is successful"); + expect(data == INTERACTIVE_STATE_BEGIN_SLEEP).assertTrue(); + }); + } catch (error) { + console.log("logMessage Screenlock_Test_4400: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_4400-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_4500 + * @tc.name Responding to bright screen events, and run "endSleep" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_4500", 0, async function (done) { + console.log("------------------start Screenlock_Test_4500-------------------"); + try { + var eventType = 'endSleep'; + screenLock.test_getRuntimeState(eventType, (err, data) => { + console.log("Screenlock_Test_4500: test_getRuntimeState endSleep is successful"); + expect(data == INTERACTIVE_STATE_END_SLEEP).assertTrue(); + }); + } catch (error) { + console.log("logMessage Screenlock_Test_4500: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_4500-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_4600 + * @tc.name Responding to bright screen events, and run "changeUser" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_4600", 0, async function (done) { + console.log("------------------start Screenlock_Test_4600-------------------"); + try { + var eventType = 'changeUser'; + screenLock.test_getRuntimeState(eventType, (err, data) => { + console.log("Screenlock_Test_4600: test_getRuntimeState changeUser is successfuls"); + expect(data == INTERACTIVE_STATE_USERID).assertTrue(); + }); + } catch (error) { + console.log("logMessage Screenlock_Test_4600: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_4600-------------------"); + done(); + }); + + /* + * @tc.number Screenlock_Test_4700 + * @tc.name Responding to bright screen events, and run "screenlockEnabled" operate + * @tc.desc Function test + * @tc.level 0 + */ + it("Screenlock_Test_4700", 0, async function (done) { + console.log("------------------start Screenlock_Test_4700-------------------"); + try { + var eventType = 'screenlockEnabled'; + screenLock.test_getRuntimeState(eventType, (err, data) => { + console.log("Screenlock_Test_4700: test_getRuntimeState screenlockEnabled is successfuls"); + expect(data == true).assertTrue(); + }); + } catch (error) { + console.log("logMessage Screenlock_Test_4700: error = " + error); + expect(true).assertTrue(); + } + console.log("------------------end Screenlock_Test_4700-------------------"); + done(); + }); + }) +} diff --git a/theme/screenlock_ets/entry/src/main/resources/base/element/string.json b/theme/screenlock_ets/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..498677efbde065c36668727190d3613cbf278bfc --- /dev/null +++ b/theme/screenlock_ets/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/theme/screenlock_js/src/main/resources/base/media/icon.png b/theme/screenlock_ets/entry/src/main/resources/base/media/icon.png similarity index 100% rename from theme/screenlock_js/src/main/resources/base/media/icon.png rename to theme/screenlock_ets/entry/src/main/resources/base/media/icon.png diff --git a/theme/wallpaper_js/signature/openharmony_sx.p7b b/theme/screenlock_ets/signature/openharmony_sx.p7b similarity index 50% rename from theme/wallpaper_js/signature/openharmony_sx.p7b rename to theme/screenlock_ets/signature/openharmony_sx.p7b index 66b4457a8a81fb8d3356cf46d67226c850944858..9be1e98fa4c0c28ca997ed660112fa16b194f0f5 100644 Binary files a/theme/wallpaper_js/signature/openharmony_sx.p7b and b/theme/screenlock_ets/signature/openharmony_sx.p7b differ diff --git a/theme/screenlock_js/BUILD.gn b/theme/screenlock_js/BUILD.gn deleted file mode 100644 index dcd63eff70d4744ae623f2e6b0da5fab18efc7cb..0000000000000000000000000000000000000000 --- a/theme/screenlock_js/BUILD.gn +++ /dev/null @@ -1,31 +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("ActsScreenLockJSApiTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsScreenLockJSApiTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/theme/screenlock_js/src/main/config.json b/theme/screenlock_js/src/main/config.json deleted file mode 100644 index 4797774c930b1fd4d1070e43601b36f831713cac..0000000000000000000000000000000000000000 --- a/theme/screenlock_js/src/main/config.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "app": { - "bundleName": "com.ohos.miscscreenlock", - "vendor": "ohos", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 8, - "target": 8, - "releaseType": "Release" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.ohos.miscscreenlock", - "name": ".MyApplication", - "deviceType": [ - "phone", - "tablet", - "tv", - "wearable" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": "com.ohos.miscscreenlock.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - } - ] - } -} diff --git a/theme/screenlock_js/src/main/js/default/common/images/Wallpaper.png b/theme/screenlock_js/src/main/js/default/common/images/Wallpaper.png deleted file mode 100644 index 60d4841a80eb20c63de74306cb7f8350d6a85c48..0000000000000000000000000000000000000000 Binary files a/theme/screenlock_js/src/main/js/default/common/images/Wallpaper.png and /dev/null differ diff --git a/theme/screenlock_js/src/main/js/default/common/images/bg-tv.jpg b/theme/screenlock_js/src/main/js/default/common/images/bg-tv.jpg deleted file mode 100644 index 88f17e14af28db45eed4cc67cfdbbfc23de5c0ae..0000000000000000000000000000000000000000 Binary files a/theme/screenlock_js/src/main/js/default/common/images/bg-tv.jpg and /dev/null differ diff --git a/theme/screenlock_js/src/main/js/default/i18n/en-US.json b/theme/screenlock_js/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/theme/screenlock_js/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/theme/screenlock_js/src/main/js/default/i18n/zh-CN.json b/theme/screenlock_js/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/theme/screenlock_js/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/theme/screenlock_js/src/main/js/default/pages/index/index.hml b/theme/screenlock_js/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 4b91ca46b05bd693db5dbcdcd6008eed76657123..0000000000000000000000000000000000000000 --- a/theme/screenlock_js/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,19 +0,0 @@ - -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/theme/screenlock_js/src/main/js/default/pages/index/index.js b/theme/screenlock_js/src/main/js/default/pages/index/index.js deleted file mode 100644 index 50b8148231c98f440e5c15e3b6223ea6f2937e96..0000000000000000000000000000000000000000 --- a/theme/screenlock_js/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,33 +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 app from '@system.app' -import file from '@system.file' -import {Core} from 'deccjsunit/index' - -export default { - data: {title: ""}, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - require('../../../test/List.test') - core.execute() - } -} \ No newline at end of file diff --git a/theme/screenlock_js/src/main/js/test/List.test.js b/theme/screenlock_js/src/main/js/test/List.test.js deleted file mode 100644 index 2dcc2fdbf78824f2a96a2214973b818b65bba464..0000000000000000000000000000000000000000 --- a/theme/screenlock_js/src/main/js/test/List.test.js +++ /dev/null @@ -1,16 +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. - */ -require('./screenlock_service_test.js'); -require('./screenlock_service_test_promise.js'); diff --git a/theme/screenlock_js/src/main/js/test/screenlock_service_test_promise.js b/theme/screenlock_js/src/main/js/test/screenlock_service_test_promise.js deleted file mode 100644 index 7f8ad52ce011017023a90ddf3c8f56dcd3482456..0000000000000000000000000000000000000000 --- a/theme/screenlock_js/src/main/js/test/screenlock_service_test_promise.js +++ /dev/null @@ -1,166 +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 screenLock from '@ohos.screenLock'; -import {describe, expect, it} from 'deccjsunit/index' - -const SLEEP_TIME = 1000; - -describe('ScreenLockServicePromiseTest', function () { - console.info("-----------------------ScreenlockPromiseTest is starting-----------------------"); - - function sleep(numberMillis) { - var now = new Date(); - var exitTime = now.getTime() + numberMillis; - while (true) { - now = new Date(); - if (now.getTime() > exitTime) - return; - } - } - - /* - * @tc.number ScreenLock_Test_Promise_0100 - * @tc.name Set to locked screen, query the lock screen state is locked state - * @tc.desc Function test - * @tc.level 0 - */ - it("ScreenLock_Test_Promise_0100", 0, async function (done) { - console.info("------------------start ScreenLock_Test_Promise_0100-------------------"); - var isScreenLocked = true; - try { - screenLock.isScreenLocked().then((data) => { - console.info("ScreenLock_Test_Promise_0100 isScreenLocked result is " + data); - expect(data == true).assertTrue() - }) - } catch (error) { - console.info("ScreenLock_Test_Promise_0100 test_setScreenLocked : error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end ScreenLock_Test_Promise_0100-------------------"); - done(); - }); - - /* - * @tc.number ScreenLock_Test_Promise_0200 - * @tc.name Set to unlocked screen, query the lock screen state is unlocked state - * @tc.desc Function test - * @tc.level 0 - */ - it("ScreenLock_Test_Promise_0200", 0, async function (done) { - console.info("------------------start ScreenLock_Test_Promise_0200-------------------"); - var isScreenLocked = false; - try { - screenLock.isScreenLocked().then((data) => { - console.info("ScreenLock_Test_Promise_0200 isScreenLocked result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("ScreenLock_Test_Promise_0200 test_setScreenLocked : error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end ScreenLock_Test_Promise_0200-------------------"); - done(); - }); - - /* - * @tc.number ScreenLock_Test_Promise_0300 - * @tc.name Query whether a password has been set, and return the password that has not been set - * @tc.desc Function test - * @tc.level 0 - */ - it("ScreenLock_Test_Promise_0300", 0, async function (done) { - console.info("------------------start ScreenLock_Test_Promise_0300-------------------"); - try { - screenLock.isSecureMode().then((data) => { - console.info("ScreenLock_Test_Promise_0300 isScreenLocked result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("ScreenLock_Test_Promise_0300 isScreenLocked TRUE: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end ScreenLock_Test_Promise_0300-------------------"); - done(); - }); - - /* - * @tc.number ScreenLock_Test_Promise_0400 - * @tc.name Request to unlock the device screen, unlock successfully - * @tc.desc Function test - * @tc.level 0 - */ - it("ScreenLock_Test_Promise_0400", 0, async function (done) { - console.info("------------------start ScreenLock_Test_Promise_0400-------------------"); - try { - screenLock.unlockScreen().then(() => { - console.info("ScreenLock_Test_Promise_0400: send unlockScreen issue success"); - }); - sleep(SLEEP_TIME); - var unlockScreenResult = 0; - var eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => { - console.info("ScreenLock_Test_Promise_0400: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - sleep(SLEEP_TIME); - screenLock.isScreenLocked().then((data) => { - console.info("ScreenLock_Test_Promise_0400: isScreenLocked result is " + data); - expect(data == false).assertTrue(); - }); - } catch (error) { - console.info("Screenlock_Test_1400: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end ScreenLock_Test_Promise_0400-------------------"); - done(); - }); - - /* - * @tc.number ScreenLock_Test_Promise_0500 - * @tc.name Request to unlock device screen, unlock failed - * @tc.desc Function test - * @tc.level 0 - */ - it("ScreenLock_Test_Promise_0500", 0, async function (done) { - console.info("------------------start ScreenLock_Test_Promise_0500-------------------"); - try { - screenLock.unlockScreen().then(() => { - console.info("ScreenLock_Test_Promise_0500: send unlockScreen issue success"); - }); - - sleep(SLEEP_TIME); - var unlockScreenResult = 1; - var eventType = 'unlockScreenResult'; - screenLock.sendScreenLockEvent(eventType, unlockScreenResult).then((data) => { - console.info("ScreenLock_Test_Promise_0500: sendScreenLockEvent result is " + data); - expect(data == true).assertTrue(); - }); - - sleep(SLEEP_TIME); - screenLock.isScreenLocked().then((data) => { - console.info("ScreenLock_Test_Promise_0500: isScreenLocked result is " + data); - expect(data == true).assertTrue(); - done(); - }); - } catch (error) { - console.info("logMessage ScreenLock_Test_Promise_0500: error = " + error); - expect(true).assertTrue(); - } - console.info("------------------end ScreenLock_Test_Promise_0500-------------------"); - done(); - }); - -}) \ No newline at end of file diff --git a/theme/screenlock_js/src/main/resources/base/element/string.json b/theme/screenlock_js/src/main/resources/base/element/string.json deleted file mode 100644 index 6353a8a8925dc24c56859f8c4ee71d8afc19a6b0..0000000000000000000000000000000000000000 --- a/theme/screenlock_js/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "screenLock" - }, - { - "name": "mainability_description", - "value": "JS_Empty screenLock" - } - ] -} \ No newline at end of file diff --git a/theme/wallpaper_ets/BUILD.gn b/theme/wallpaper_ets/BUILD.gn new file mode 100644 index 0000000000000000000000000000000000000000..46487916ac165d2b2c8721b71c570c70934fdd7e --- /dev/null +++ b/theme/wallpaper_ets/BUILD.gn @@ -0,0 +1,39 @@ +# Copyright (c) 2022 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/ohos.gni") +import("//test/xts/tools/build/suite.gni") +ohos_js_hap_suite("ActsWallpaperETSApiTest") { + hap_profile = "./entry/src/main/config.json" + deps = [ + ":wallPaper_ets_assets", + ":wallPaper_ets_resources", + ":wallPaper_ets_test_assets", + ] + ets2abc = true + subsystem_name = "theme" + part_name = "wallpaper_mgr" + certificate_profile = "./signature/ActsWallpaperEtsAPITest.p7b" + hap_name = "ActsWallpaperETSApiTest" +} + +ohos_js_assets("wallPaper_ets_assets") { + source_dir = "./entry/src/main/ets/MainAbility" +} +ohos_js_assets("wallPaper_ets_resources") { + source_dir = "./entry/src/main/ets/TestAbility" +} +ohos_resources("wallPaper_ets_test_assets") { + sources = [ "./entry/src/main/resources" ] + hap_profile = "./entry/src/main/config.json" +} diff --git a/theme/wallpaper_js/Test.json b/theme/wallpaper_ets/Test.json similarity index 62% rename from theme/wallpaper_js/Test.json rename to theme/wallpaper_ets/Test.json index 4fb2b6f57f5a9b749abd5d35cd75276572e86a49..59199b627c2face3823043b71d3b5248a1cda554 100644 --- a/theme/wallpaper_js/Test.json +++ b/theme/wallpaper_ets/Test.json @@ -1,15 +1,16 @@ { "description": "Configuration for wallpaper js api Tests", "driver": { - "type": "JSUnitTest", + "type": "OHJSUnitTest", "test-timeout": "600000", - "package": "com.xts.wpxts", + "bundle-name": "com.acts.theme.wallpapertest", + "package-name": "com.acts.theme.wallpapertest", "shell-timeout": "600000" }, "kits": [ { "test-file-name": [ - "ActsWallpaperJSApiTest.hap" + "ActsWallpaperETSApiTest.hap" ], "type": "AppInstallKit", "cleanup-apps": true diff --git a/theme/wallpaper_ets/entry/src/main/config.json b/theme/wallpaper_ets/entry/src/main/config.json new file mode 100644 index 0000000000000000000000000000000000000000..b4f940dc87485ac1f2ef66b37eb08eca5bb883e7 --- /dev/null +++ b/theme/wallpaper_ets/entry/src/main/config.json @@ -0,0 +1,110 @@ +{ + "app": { + "bundleName": "com.acts.theme.wallpapertest", + "vendor": "open", + "version": { + "code": 1000000, + "name": "1.0.0" + }, + "apiVersion": { + "compatible": 7, + "releaseType": "Release", + "target": 9 + } + }, + "deviceConfig": {}, + "module": { + "package": "com.acts.theme.wallpapertest", + "name": ".MyApplication", + "mainAbility": "com.acts.theme.wallpapertest.MainAbility", + + "deviceType": [ + "phone", + "tablet", + "tv", + "wearable" + ], + "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" + }, + { + "orientation": "unspecified", + "visible": true, + "srcPath": "TestAbility", + "name": ".TestAbility", + "srcLanguage": "ets", + "icon": "$media:icon", + "description": "$string:TestAbility_desc", + "formsEnabled": false, + "label": "$string:TestAbility_label", + "type": "page", + "launchType": "standard" + } + ], + "reqPermissions": [ + { + "name": "ohos.permission.SET_WALLPAPER" + }, + { + "name": "ohos.permission.GET_WALLPAPER" + } + ], + "js": [ + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".MainAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + }, + { + "mode": { + "syntax": "ets", + "type": "pageAbility" + }, + "pages": [ + "pages/index" + ], + "name": ".TestAbility", + "window": { + "designWidth": 720, + "autoDesignWidth": false + } + } + ] + } +} \ No newline at end of file diff --git a/theme/wallpaper_ets/entry/src/main/ets/MainAbility/app.ets b/theme/wallpaper_ets/entry/src/main/ets/MainAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e4e48f739b88cd4fbcc15d4e54b244d5af51d90 --- /dev/null +++ b/theme/wallpaper_ets/entry/src/main/ets/MainAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/theme/screenlock_js/src/main/js/default/pages/index/index.css b/theme/wallpaper_ets/entry/src/main/ets/MainAbility/pages/index.ets similarity index 57% rename from theme/screenlock_js/src/main/js/default/pages/index/index.css rename to theme/wallpaper_ets/entry/src/main/ets/MainAbility/pages/index.ets index a6bb21f7f1df91f0b4ffdd1495a558f2e554f276..f76e64e54211411bfd8eb003a4743d730669c905 100644 --- a/theme/screenlock_js/src/main/js/default/pages/index/index.css +++ b/theme/wallpaper_ets/entry/src/main/ets/MainAbility/pages/index.ets @@ -1,5 +1,6 @@ -/* - * Copyright (C) 2021 Huawei Device Co., Ltd. +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,25 +13,26 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -.container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} -.title { - font-size: 40px; - background-color: green; - color: #000000; - opacity: 0.9; -} +@Entry +@Component +struct MyComponent { + aboutToAppear() { + } -.button{ - margin-top: 50px; - background-color: green; - font-size: 25px; - color: white; - padding: 10px; + + build() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.Center + }) { + Text('WALLPAPER ETS TEST') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + .height('100%') + } } + diff --git a/theme/wallpaper_ets/entry/src/main/ets/TestAbility/app.ets b/theme/wallpaper_ets/entry/src/main/ets/TestAbility/app.ets new file mode 100644 index 0000000000000000000000000000000000000000..2e4e48f739b88cd4fbcc15d4e54b244d5af51d90 --- /dev/null +++ b/theme/wallpaper_ets/entry/src/main/ets/TestAbility/app.ets @@ -0,0 +1,33 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' +import { Hypium } from 'hypium/index' +import testsuite from '../test/List.test' + +export default { + onCreate() { + console.info('Application onCreate') + var abilityDelegator: any + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + var abilityDelegatorArguments: any + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + console.info('start run testcase!!!') + Hypium.hypiumTest(abilityDelegator, abilityDelegatorArguments, testsuite) + }, + onDestroy() { + console.info('Application onDestroy') + }, +} \ No newline at end of file diff --git a/theme/wallpaper_ets/entry/src/main/ets/TestAbility/pages/index.ets b/theme/wallpaper_ets/entry/src/main/ets/TestAbility/pages/index.ets new file mode 100644 index 0000000000000000000000000000000000000000..b2497c3b2774b09a40f0db535735f3dbe5e6cb6e --- /dev/null +++ b/theme/wallpaper_ets/entry/src/main/ets/TestAbility/pages/index.ets @@ -0,0 +1,50 @@ +// @ts-nocheck +/** + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import router from '@system.router'; + +@Entry +@Component +struct Index { + aboutToAppear() { + console.info('TestAbility index aboutToAppear') + } + + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + Button() { + Text('next page') + .fontSize(20) + .fontWeight(FontWeight.Bold) + }.type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('35%') + .height('5%') + .onClick(()=>{ + }) + } + .width('100%') + } + .height('100%') + } + } \ No newline at end of file diff --git a/theme/wallpaper_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts b/theme/wallpaper_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts new file mode 100644 index 0000000000000000000000000000000000000000..07cb0b784984c6c4cc6d911c3c82643bff9df263 --- /dev/null +++ b/theme/wallpaper_ets/entry/src/main/ets/TestRunner/OpenHarmonyTestRunner.ts @@ -0,0 +1,78 @@ +// @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 TestRunner from '@ohos.application.testRunner' +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' + +var abilityDelegator = undefined +var abilityDelegatorArguments = undefined + +function translateParamsToString(parameters) { + const keySet = new Set([ + '-s class', '-s notClass', '-s suite', '-s itName', + '-s level', '-s testType', '-s size', '-s timeout', + '-s package' + ]) + let targetParams = ''; + for (const key in parameters) { + if (keySet.has(key)) { + targetParams += ' ' + key + ' ' + parameters[key] + } + } + return targetParams.trim() +} + +async function onAbilityCreateCallback() { + console.log('onAbilityCreateCallback'); +} + +async function addAbilityMonitorCallback(err: any) { + console.info('addAbilityMonitorCallback : ' + JSON.stringify(err)) +} + +export default class OpenHarmonyTestRunner implements TestRunner { + constructor() { + } + + onPrepare() { + console.info('OpenHarmonyTestRunner OnPrepare') + } + + onRun() { + console.log('OpenHarmonyTestRunner onRun run') + abilityDelegatorArguments = AbilityDelegatorRegistry.getArguments() + abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() + + let lMonitor = { + abilityName: testAbilityName, + onAbilityCreate: onAbilityCreateCallback, + }; + var testAbilityName = abilityDelegatorArguments.parameters['-p'] + '.MainAbility' + abilityDelegator.addAbilityMonitor(lMonitor, addAbilityMonitorCallback) + var cmd = 'aa start -d 0 -a ' + testAbilityName + ' -b ' + abilityDelegatorArguments.bundleName + cmd += ' '+translateParamsToString(abilityDelegatorArguments.parameters) + console.info('cmd : '+cmd) + abilityDelegator.executeShellCommand(cmd, + (err: any, d: any) => { + console.info('executeShellCommand : err : ' + JSON.stringify(err)); + console.info('executeShellCommand : data : ' + d.stdResult); + console.info('executeShellCommand : data : ' + d.exitCode); + }) + console.info('OpenHarmonyTestRunner onRun call abilityDelegator.getAppContext') + var context = abilityDelegator.getAppContext() + console.info('getAppContext : ' + JSON.stringify(context)) + console.info('OpenHarmonyTestRunner onRun end') + } +}; \ No newline at end of file diff --git a/theme/wallpaper_js/src/main/js/Test/List.test.js b/theme/wallpaper_ets/entry/src/main/ets/test/List.test.ets similarity index 78% rename from theme/wallpaper_js/src/main/js/Test/List.test.js rename to theme/wallpaper_ets/entry/src/main/ets/test/List.test.ets index 32f283ffaa51bfd14c0c5d5c5aaec35323176b1f..11551f27afcd509cd044a008546cec7ca9adf953 100644 --- a/theme/wallpaper_js/src/main/js/Test/List.test.js +++ b/theme/wallpaper_ets/entry/src/main/ets/test/List.test.ets @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (c) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -12,4 +12,9 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -require("./Wallpaper/WallpaperJsunit.test.js") \ No newline at end of file + +import wallpaperJSUnit from './wallpaperTest'; + +export default function testsuite() { + wallpaperJSUnit(); +} \ No newline at end of file diff --git a/theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets b/theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets new file mode 100644 index 0000000000000000000000000000000000000000..e1138aa0bcc3ac7071260887181082792316b5be --- /dev/null +++ b/theme/wallpaper_ets/entry/src/main/ets/test/wallpaperTest.ets @@ -0,0 +1,614 @@ +// @ts-nocheck +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import wallpaper from '@ohos.wallpaper' +import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' + +const WALLPAPER_SYSTEM = 0; +const WALLPAPER_LOCKSCREEN = 1; +var imageSourceSystem = '/data/service/el1/public/wallpaper/0/system/wallpaper'; +var imageSourceLockscreen = '/data/service/el1/public/wallpaper/0/lockscreen/wallpaper_lock'; + +export default function wallpaperJSUnit() { + describe('WallpaperJsunitTest', function () { + beforeAll(async function () { + console.info('beforeAll: Prerequisites at the test suite level, ' + + 'which are executed before the test suite is executed.'); + }) + beforeEach(function () { + console.info('beforeEach: Prerequisites at the test case level, ' + + 'which are executed before each test case is executed.'); + }) + afterEach(function () { + console.info('afterEach: Test case-level clearance conditions,' + + ' which are executed after each test case is executed.'); + }) + afterAll(function () { + console.info('afterAll: Test suite-level cleanup condition, ' + + 'which is executed after the test suite is executed'); + }) + + /* + * @tc.number testWALLPAPER_SYSTEM + * @tc.name Test WALLPAPER_SYSTEM value + * @tc.desc Function test + * @tc.level 0 + */ + it('testWALLPAPER_SYSTEM', 0, async function (done) { + console.info('wallpaperXTS ===> testWALLPAPER_SYSTEM : ' + + JSON.stringify(wallpaper.WallpaperType.WALLPAPER_SYSTEM)); + expect(wallpaper.WallpaperType.WALLPAPER_SYSTEM == 0).assertTrue(); + done(); + }) + + /* + * @tc.number testWALLPAPER_LOCKSCREEN + * @tc.name Test WALLPAPER_LOCKSCREEN value + * @tc.desc Function test + * @tc.level 0 + */ + it('testWALLPAPER_LOCKSCREEN', 0, async function (done) { + console.info('wallpaperXTS ===> testWALLPAPER_LOCKSCREEN : ' + + JSON.stringify(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)); + expect(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN == 1).assertTrue(); + done(); + }) + + /* + * @tc.number testGetColorsCallbackSystem101 + * @tc.name Test getColors() to obtains the wallpaper colors for the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetColorsCallbackSystem101', 0, async function (done) { + await wallpaper.getColors(WALLPAPER_SYSTEM, function (err, data) { + console.info('wallpaperXTS ===> testGetColorsCallbackSystem err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + JSON.stringify(data)); + console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][0]); + console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][1]); + console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][2]); + console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][3]); + + + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testGetColorsPromiseSystem101 + * @tc.name Test getColors() to obtains the wallpaper colors for the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetColorsPromiseSystem101', 0, async function (done) { + await wallpaper.getColors(WALLPAPER_SYSTEM).then((data) => { + console.info('wallpaperXTS ===> testGetColorsPromiseSystem data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }).catch((err) => { + console.info('wallpaperXTS ===> testGetColorsPromiseSystem err : ' + JSON.stringify(err)); + if (err) { + expect(null).assertFail(); + } + }); + done(); + }) + + /* + * @tc.number testGetColorsCallbackLock102 + * @tc.name Test getColors() to obtains the wallpaper colors for the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetColorsCallbackLock102', 0, async function (done) { + await wallpaper.getColors(WALLPAPER_LOCKSCREEN, function (err, data) { + console.info('wallpaperXTS ===> testGetColorsCallbackLock err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testGetColorsCallbackLock data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testGetColorsPromiseLock102 + * @tc.name Test getColors() to obtains the wallpaper colors for the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetColorsPromiseLock102', 0, async function (done) { + await wallpaper.getColors(WALLPAPER_LOCKSCREEN).then((data) => { + console.info('wallpaperXTS ===> testGetColorsCallbackLock data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }).catch((err) => { + console.info('wallpaperXTS ===> testGetColorsCallbackLock err : ' + JSON.stringify(err)); + if (err) { + expect(null).assertFail(); + } + }); + done(); + }) + + /* + * @tc.number testGetColorsPromiseLock102 + * @tc.name Test getId() to the ID of the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetIdCallbackSystem101', 0, async function (done) { + await wallpaper.getId(WALLPAPER_SYSTEM, function (err, data) { + console.info('wallpaperXTS ===> testGetIdCallbackSystem err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testGetIdCallbackSystem data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testGetIdPromiseSystem101 + * @tc.name Test getId() to the ID of the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetIdPromiseSystem101', 0, async function (done) { + await wallpaper.getId(WALLPAPER_SYSTEM).then((data) => { + console.info('wallpaperXTS ===> testGetIdCallbackSystem data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }).catch((err) => { + console.info('wallpaperXTS ===> testGetIdCallbackSystem err : ' + JSON.stringify(err)); + if (err) { + expect(null).assertFail(); + } + }); + done(); + }) + + /* + * @tc.number testGetIdCallbackLock102 + * @tc.name Test getId() to the ID of the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetIdCallbackLock102', 0, async function (done) { + await wallpaper.getId(WALLPAPER_LOCKSCREEN, function (err, data) { + console.info('wallpaperXTS ===> testGetIdCallbackLock err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testGetIdCallbackLock data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testGetIdPromiseLock102 + * @tc.name Test getId() to the ID of the wallpaper of the specified type. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetIdPromiseLock102', 0, async function (done) { + await wallpaper.getId(WALLPAPER_LOCKSCREEN).then((data) => { + console.info('wallpaperXTS ===> testGetIdCallbackLock data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }).catch((err) => { + console.info('wallpaperXTS ===> testGetIdCallbackLock err : ' + JSON.stringify(err)); + if (err) { + expect(null).assertFail(); + } + }); + done(); + }) + + /* + * @tc.number testGetMinHeightCallback101 + * @tc.name Test getMinHeight() to the minimum width of the wallpaper. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetMinHeightCallback101', 0, async function (done) { + await wallpaper.getMinHeight(function (err, data) { + console.info('wallpaperXTS ===> testGetMinHeightCallback err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testGetMinHeightCallback data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testGetMinHeightPromise101 + * @tc.name Test getMinHeight() to the minimum width of the wallpaper. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetMinHeightPromise101', 0, async function (done) { + await wallpaper.getMinHeight().then((data) => { + console.info('wallpaperXTS ===> testGetMinHeightPromise data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }).catch((err) => { + console.info('wallpaperXTS ===> testGetMinHeightPromise err : ' + JSON.stringify(err)); + if (err) { + expect(null).assertFail(); + } + }); + done(); + }) + + /* + * @tc.number testGetMinWidthCallback101 + * @tc.name Test getMinHeight() to the minimum width of the wallpaper. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetMinWidthCallback101', 0, async function (done) { + await wallpaper.getMinWidth(function (err, data) { + console.info('wallpaperXTS ===> testGetMinWidthCallback err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testGetMinWidthCallback data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testGetMinWidthPromise101 + * @tc.name Test getMinHeight() to the minimum width of the wallpaper. + * @tc.desc Function test + * @tc.level 0 + */ + it('testGetMinWidthPromise101', 0, async function (done) { + await wallpaper.getMinWidth().then((data) => { + console.info('wallpaperXTS ===> testGetMinWidthPromise data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }).catch((err) => { + console.info('wallpaperXTS ===> testGetMinWidthPromise err : ' + JSON.stringify(err)); + if (err) { + expect(null).assertFail(); + } + }); + done(); + }) + + /* + * @tc.number testIsChangePermittedCallback101 + * @tc.name Test isChangePermitted() to checks whether to allow the application to change the + wallpaper for the current user. + * @tc.desc Function test + * @tc.level 0 + */ + it('testIsChangePermittedCallback101', 0, async function (done) { + await wallpaper.isChangePermitted(function (err, data) { + console.info('wallpaperXTS ===> testIsChangePermittedCallback err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testIsChangePermittedCallback data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testIsChangePermittedPromise101 + * @tc.name Test isChangePermitted() to checks whether to allow the application to change the + wallpaper for the current user. + * @tc.desc Function test + * @tc.level 0 + */ + it('testIsChangePermittedPromise101', 0, async function (done) { + await wallpaper.isChangePermitted().then((data) => { + console.info('wallpaperXTS ===> testIsChangePermittedPromise data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }).catch((err) => { + console.info('wallpaperXTS ===> testIsChangePermittedPromise err : ' + JSON.stringify(err)); + if (err) { + expect(null).assertFail(); + } + }); + done(); + }) + + /* + * @tc.number testIsOperationAllowedCallback101 + * @tc.name Test isOperationAllowed() to checks whether a user is allowed to set wallpapers. + * @tc.desc Function test + * @tc.level 0 + */ + it('testIsOperationAllowedCallback101', 0, async function (done) { + await wallpaper.isOperationAllowed(function (err, data) { + console.info('wallpaperXTS ===> testIsOperationAllowedCallback err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testIsOperationAllowedCallback data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testIsOperationAllowedPromise101 + * @tc.name Test isOperationAllowed() to checks whether a user is allowed to set wallpapers. + * @tc.desc Function test + * @tc.level 0 + */ + it('testIsOperationAllowedPromise101', 0, async function (done) { + await wallpaper.isOperationAllowed().then((data) => { + console.info('wallpaperXTS ===> testIsOperationAllowedPromise data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }).catch((err) => { + console.info('wallpaperXTS ===> testIsOperationAllowedPromise err : ' + JSON.stringify(err)); + if (err) { + expect(null).assertFail(); + } + }); + done(); + }) + + /* + * @tc.number testResetCallbackSystem101 + * @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one. + * @tc.desc Function test + * @tc.level 0 + */ + it('testResetCallbackSystem101', 0, async function (done) { + await wallpaper.reset(WALLPAPER_SYSTEM, function (err, data) { + console.info('wallpaperXTS ===> testResetCallbackSystem err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testResetCallbackSystem data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testResetPromiseSystem101 + * @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one. + * @tc.desc Function test + * @tc.level 0 + */ + it('testResetPromiseSystem101', 0, async function (done) { + await wallpaper.reset(WALLPAPER_SYSTEM).then((data) => { + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + done(); + }).catch((err) => { + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number testResetCallbackLock102 + * @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one. + * @tc.desc Function test + * @tc.level 0 + */ + it('testResetCallbackLock102', 0, async function (done) { + await wallpaper.reset(WALLPAPER_LOCKSCREEN, function (err, data) { + console.info('wallpaperXTS ===> testResetCallbackLock err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testResetCallbackLock data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testResetPromiseLock102 + * @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one. + * @tc.desc Function test + * @tc.level 0 + */ + it('testResetPromiseLock102', 0, async function (done) { + await wallpaper.reset(WALLPAPER_LOCKSCREEN).then((data) => { + console.info('wallpaperXTS ===> testResetPromiseLock data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + done(); + }).catch((err) => { + console.info('wallpaperXTS ===> testResetPromiseLock--- err : ' + JSON.stringify(err)); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number testSetWallpaperURLPromiseLock104 + * @tc.name Test setPixelMap() to sets a wallpaper of the specified type based on the uri path from a + JPEG or PNG file or the pixel map of a PNG file. + * @tc.desc Function test + * @tc.level 0 + */ + it('testSetWallpaperURLPromiseLock104', 0, async function (done) { + await wallpaper.setWallpaper(imageSourceLockscreen, WALLPAPER_LOCKSCREEN).then((data) => { + console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + done(); + }).catch((err) => { + console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock err : ' + JSON.stringify(err)); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number testSetWallpaperURLCallbackSystem103 + * @tc.name Test setWallpaper() to sets a wallpaper of the specified type based on the uri path from a + JPEG or PNG file or the pixel map of a PNG file. + * @tc.desc Function test + * @tc.level 0 + */ + it('testSetWallpaperURLCallbackSystem103', 0, async function (done) { + await wallpaper.setWallpaper(imageSourceSystem, WALLPAPER_SYSTEM, function (err, data) { + console.info('wallpaperXTS ===> testSetWallpaperURLCallbackSystem err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testSetWallpaperURLCallbackSystem data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }); + done(); + }) + + /* + * @tc.number testSetWallpaperURLPromiseSystem103 + * @tc.name Test setWallpaper() to sets a wallpaper of the specified type based on the uri path from a + JPEG or PNG file or the pixel map of a PNG file. + * @tc.desc Function test + * @tc.level 0 + */ + it('testSetWallpaperURLPromiseSystem103', 0, function (done) { + if(true) { + expect(true).assertTrue(); + done(); + return; + } + wallpaper.setWallpaper(imageSourceSystem, WALLPAPER_SYSTEM).then((data) => { + console.info('wallpaperXTS ===> testSetWallpaperURLPromiseSystem data : ' + JSON.stringify(data)); + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + done(); + }).catch((err) => { + console.info('wallpaperXTS ===> testSetWallpaperURLPromiseSystem err : ' + JSON.stringify(err)); + expect(true).assertTrue(); + done(); + }); + }) + + /* + * @tc.number testSetWallpaperURLCallbackLock104 + * @tc.name Test setWallpaper() to sets a wallpaper of the specified type based on the uri path from a + JPEG or PNG file or the pixel map of a PNG file. + * @tc.desc Function test + * @tc.level 0 + */ + it('testSetWallpaperURLCallbackLock104', 0, async function (done) { + await wallpaper.setWallpaper(imageSourceLockscreen, WALLPAPER_LOCKSCREEN, function (err, data) { + console.info('wallpaperXTS ===> testSetWallpaperURLCallbackLock err : ' + JSON.stringify(err)); + console.info('wallpaperXTS ===> testSetWallpaperURLCallbackLock data : ' + JSON.stringify(data)); + if (err) { + expect(null).assertFail(); + } + if ((data != undefined) && (data != null) && (data != '')) { + expect(true).assertTrue(); + } + }); + done(); + }) + + /* + * @tc.number testOnCallback101 + * @tc.name Test on_colorChange to registers a listener for wallpaper color changes to + receive notifications about the changes. + * @tc.desc Function test + * @tc.level 0 + */ + it('testOnCallback101', 0, async function (done) { + await wallpaper.on('colorChange', function (colors, wallpaperType) { + console.info('wallpaperXTS ===> testOnCallback colors : ' + JSON.stringify(colors)); + console.info('wallpaperXTS ===> testOnCallback wallpaperType : ' + JSON.stringify(wallpaperType)); + if ((colors != undefined) && (colors != null) && (colors != '')) { + expect(true).assertTrue(); + } + if ((wallpaperType != undefined) && (wallpaperType != null) && (wallpaperType != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + + /* + * @tc.number testOffCallback101 + * @tc.name Test on_colorChange to registers a listener for wallpaper color changes to + receive notifications about the changes. + * @tc.desc Function test + * @tc.level 0 + */ + it('testOffCallback101', 0, async function (done) { + await wallpaper.off('colorChange', function (colors, wallpaperType) { + console.info('wallpaperXTS ===> testOffCallback colors : ' + JSON.stringify(colors)); + console.info('wallpaperXTS ===> testOffCallback wallpaperType : ' + JSON.stringify(wallpaperType)); + if ((colors != undefined) && (colors != null) && (colors != '')) { + expect(true).assertTrue(); + } + if ((wallpaperType != undefined) && (wallpaperType != null) && (wallpaperType != '')) { + expect(true).assertTrue(); + } + }) + done(); + }) + }) +} diff --git a/theme/wallpaper_ets/entry/src/main/resources/base/element/string.json b/theme/wallpaper_ets/entry/src/main/resources/base/element/string.json new file mode 100644 index 0000000000000000000000000000000000000000..498677efbde065c36668727190d3613cbf278bfc --- /dev/null +++ b/theme/wallpaper_ets/entry/src/main/resources/base/element/string.json @@ -0,0 +1,20 @@ +{ + "string": [ + { + "name": "entry_MainAbility", + "value": "entry_MainAbility" + }, + { + "name": "description_mainability", + "value": "ETS_Empty Ability" + }, + { + "name": "TestAbility_desc", + "value": "description" + }, + { + "name": "TestAbility_label", + "value": "label" + } + ] +} \ No newline at end of file diff --git a/theme/wallpaper_js/src/main/resources/base/media/icon.png b/theme/wallpaper_ets/entry/src/main/resources/base/media/icon.png similarity index 100% rename from theme/wallpaper_js/src/main/resources/base/media/icon.png rename to theme/wallpaper_ets/entry/src/main/resources/base/media/icon.png diff --git a/theme/screenlock_js/signature/openharmony_sx.p7b b/theme/wallpaper_ets/signature/ActsWallpaperEtsAPITest.p7b similarity index 51% rename from theme/screenlock_js/signature/openharmony_sx.p7b rename to theme/wallpaper_ets/signature/ActsWallpaperEtsAPITest.p7b index 66b4457a8a81fb8d3356cf46d67226c850944858..ee7d66c3f07a361051fd687bef57669195da824c 100644 Binary files a/theme/screenlock_js/signature/openharmony_sx.p7b and b/theme/wallpaper_ets/signature/ActsWallpaperEtsAPITest.p7b differ diff --git a/theme/wallpaper_js/BUILD.gn b/theme/wallpaper_js/BUILD.gn deleted file mode 100644 index fe9e4c3d89d9b1b244245ee6fc7d43fe0249e2b7..0000000000000000000000000000000000000000 --- a/theme/wallpaper_js/BUILD.gn +++ /dev/null @@ -1,31 +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("ActsWallpaperJSApiTest") { - hap_profile = "./src/main/config.json" - deps = [ - ":hjs_demo_js_assets", - ":hjs_demo_resources", - ] - certificate_profile = "./signature/openharmony_sx.p7b" - hap_name = "ActsWallpaperJSApiTest" -} -ohos_js_assets("hjs_demo_js_assets") { - source_dir = "./src/main/js/default" -} -ohos_resources("hjs_demo_resources") { - sources = [ "./src/main/resources" ] - hap_profile = "./src/main/config.json" -} diff --git a/theme/wallpaper_js/src/main/config.json b/theme/wallpaper_js/src/main/config.json deleted file mode 100644 index 6e7f3b17cbe2214f43819a798e53fca6fabbd027..0000000000000000000000000000000000000000 --- a/theme/wallpaper_js/src/main/config.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "app": { - "bundleName": "com.xts.wpxts", - "vendor": "xts", - "version": { - "code": 1000000, - "name": "1.0.0" - }, - "apiVersion": { - "compatible": 8, - "target": 8, - "releaseType": "Release" - } - }, - "deviceConfig": {}, - "module": { - "package": "com.xts.wpxts", - "name": ".MyApplication", - "deviceType": [ - "phone", - "tablet", - "tv", - "wearable" - ], - "distro": { - "deliveryWithInstall": true, - "moduleName": "entry", - "moduleType": "entry", - "installationFree": false - }, - "abilities": [ - { - "skills": [ - { - "entities": [ - "entity.system.home" - ], - "actions": [ - "action.system.home" - ] - } - ], - "visible": true, - "name": "com.xts.wpxts.MainAbility", - "icon": "$media:icon", - "description": "$string:mainability_description", - "label": "$string:entry_MainAbility", - "type": "page", - "launchType": "standard" - } - ], - "reqPermissions": [ - { - "name": "ohos.permission.SET_WALLPAPER" - }, - { - "name": "ohos.permission.GET_WALLPAPER" - }, - { - "name": "ohos.permission.READ_USER_STORAGE" - } - ], - "js": [ - { - "pages": [ - "pages/index/index" - ], - "name": "default", - "window": { - "designWidth": 720, - "autoDesignWidth": true - } - } - ] - } -} diff --git a/theme/wallpaper_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js b/theme/wallpaper_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js deleted file mode 100644 index b1378b8adacf19a2fcace3d037318f0930f39bc1..0000000000000000000000000000000000000000 --- a/theme/wallpaper_js/src/main/js/Test/Wallpaper/WallpaperJsunit.test.js +++ /dev/null @@ -1,611 +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 {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' -import wallpaper from '@ohos.wallpaper' - -const WALLPAPER_SYSTEM = 0; -const WALLPAPER_LOCKSCREEN = 1; -var imageSourceSystem = '/data/service/el1/public/wallpaper/0/system/wallpaper'; -var imageSourceLockscreen = '/data/service/el1/public/wallpaper/0/lockscreen/wallpaper_lock'; - -describe('WallpaperJsunitTest', function () { - beforeAll(async function () { - console.info('beforeAll: Prerequisites at the test suite level, ' + - 'which are executed before the test suite is executed.'); - }) - beforeEach(function () { - console.info('beforeEach: Prerequisites at the test case level, ' + - 'which are executed before each test case is executed.'); - }) - afterEach(function () { - console.info('afterEach: Test case-level clearance conditions,' + - ' which are executed after each test case is executed.'); - }) - afterAll(function () { - console.info('afterAll: Test suite-level cleanup condition, ' + - 'which is executed after the test suite is executed'); - }) - - /* - * @tc.number testWALLPAPER_SYSTEM - * @tc.name Test WALLPAPER_SYSTEM value - * @tc.desc Function test - * @tc.level 0 - */ - it('testWALLPAPER_SYSTEM', 0, async function (done) { - console.info('wallpaperXTS ===> testWALLPAPER_SYSTEM : ' + - JSON.stringify(wallpaper.WallpaperType.WALLPAPER_SYSTEM)); - expect(wallpaper.WallpaperType.WALLPAPER_SYSTEM == 0).assertTrue(); - done(); - }) - - /* - * @tc.number testWALLPAPER_LOCKSCREEN - * @tc.name Test WALLPAPER_LOCKSCREEN value - * @tc.desc Function test - * @tc.level 0 - */ - it('testWALLPAPER_LOCKSCREEN', 0, async function (done) { - console.info('wallpaperXTS ===> testWALLPAPER_LOCKSCREEN : ' + - JSON.stringify(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN)); - expect(wallpaper.WallpaperType.WALLPAPER_LOCKSCREEN == 1).assertTrue(); - done(); - }) - - /* - * @tc.number testGetColorsCallbackSystem101 - * @tc.name Test getColors() to obtains the wallpaper colors for the wallpaper of the specified type. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetColorsCallbackSystem101', 0, async function (done) { - await wallpaper.getColors(WALLPAPER_SYSTEM, function (err, data) { - console.info('wallpaperXTS ===> testGetColorsCallbackSystem err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + JSON.stringify(data)); - console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][0]); - console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][1]); - console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][2]); - console.info('wallpaperXTS ===> testGetColorsCallbackSystem data : ' + data[0][3]); - - - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testGetColorsPromiseSystem101 - * @tc.name Test getColors() to obtains the wallpaper colors for the wallpaper of the specified type. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetColorsPromiseSystem101', 0, async function (done) { - await wallpaper.getColors(WALLPAPER_SYSTEM).then((data) => { - console.info('wallpaperXTS ===> testGetColorsPromiseSystem data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('wallpaperXTS ===> testGetColorsPromiseSystem err : ' + JSON.stringify(err)); - if (err) { - expect(null).assertFail(); - } - }); - done(); - }) - - /* - * @tc.number testGetColorsCallbackLock102 - * @tc.name Test getColors() to obtains the wallpaper colors for the wallpaper of the specified type. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetColorsCallbackLock102', 0, async function (done) { - await wallpaper.getColors(WALLPAPER_LOCKSCREEN, function (err, data) { - console.info('wallpaperXTS ===> testGetColorsCallbackLock err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testGetColorsCallbackLock data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testGetColorsPromiseLock102 - * @tc.name Test getColors() to obtains the wallpaper colors for the wallpaper of the specified type. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetColorsPromiseLock102', 0, async function (done) { - await wallpaper.getColors(WALLPAPER_LOCKSCREEN).then((data) => { - console.info('wallpaperXTS ===> testGetColorsCallbackLock data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('wallpaperXTS ===> testGetColorsCallbackLock err : ' + JSON.stringify(err)); - if (err) { - expect(null).assertFail(); - } - }); - done(); - }) - - /* - * @tc.number testGetColorsPromiseLock102 - * @tc.name Test getId() to the ID of the wallpaper of the specified type. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetIdCallbackSystem101', 0, async function (done) { - await wallpaper.getId(WALLPAPER_SYSTEM, function (err, data) { - console.info('wallpaperXTS ===> testGetIdCallbackSystem err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testGetIdCallbackSystem data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testGetIdPromiseSystem101 - * @tc.name Test getId() to the ID of the wallpaper of the specified type. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetIdPromiseSystem101', 0, async function (done) { - await wallpaper.getId(WALLPAPER_SYSTEM).then((data) => { - console.info('wallpaperXTS ===> testGetIdCallbackSystem data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('wallpaperXTS ===> testGetIdCallbackSystem err : ' + JSON.stringify(err)); - if (err) { - expect(null).assertFail(); - } - }); - done(); - }) - - /* - * @tc.number testGetIdCallbackLock102 - * @tc.name Test getId() to the ID of the wallpaper of the specified type. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetIdCallbackLock102', 0, async function (done) { - await wallpaper.getId(WALLPAPER_LOCKSCREEN, function (err, data) { - console.info('wallpaperXTS ===> testGetIdCallbackLock err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testGetIdCallbackLock data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testGetIdPromiseLock102 - * @tc.name Test getId() to the ID of the wallpaper of the specified type. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetIdPromiseLock102', 0, async function (done) { - await wallpaper.getId(WALLPAPER_LOCKSCREEN).then((data) => { - console.info('wallpaperXTS ===> testGetIdCallbackLock data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('wallpaperXTS ===> testGetIdCallbackLock err : ' + JSON.stringify(err)); - if (err) { - expect(null).assertFail(); - } - }); - done(); - }) - - /* - * @tc.number testGetMinHeightCallback101 - * @tc.name Test getMinHeight() to the minimum width of the wallpaper. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetMinHeightCallback101', 0, async function (done) { - await wallpaper.getMinHeight(function (err, data) { - console.info('wallpaperXTS ===> testGetMinHeightCallback err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testGetMinHeightCallback data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testGetMinHeightPromise101 - * @tc.name Test getMinHeight() to the minimum width of the wallpaper. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetMinHeightPromise101', 0, async function (done) { - await wallpaper.getMinHeight().then((data) => { - console.info('wallpaperXTS ===> testGetMinHeightPromise data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('wallpaperXTS ===> testGetMinHeightPromise err : ' + JSON.stringify(err)); - if (err) { - expect(null).assertFail(); - } - }); - done(); - }) - - /* - * @tc.number testGetMinWidthCallback101 - * @tc.name Test getMinHeight() to the minimum width of the wallpaper. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetMinWidthCallback101', 0, async function (done) { - await wallpaper.getMinWidth(function (err, data) { - console.info('wallpaperXTS ===> testGetMinWidthCallback err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testGetMinWidthCallback data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testGetMinWidthPromise101 - * @tc.name Test getMinHeight() to the minimum width of the wallpaper. - * @tc.desc Function test - * @tc.level 0 - */ - it('testGetMinWidthPromise101', 0, async function (done) { - await wallpaper.getMinWidth().then((data) => { - console.info('wallpaperXTS ===> testGetMinWidthPromise data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('wallpaperXTS ===> testGetMinWidthPromise err : ' + JSON.stringify(err)); - if (err) { - expect(null).assertFail(); - } - }); - done(); - }) - - /* - * @tc.number testIsChangePermittedCallback101 - * @tc.name Test isChangePermitted() to checks whether to allow the application to change the - wallpaper for the current user. - * @tc.desc Function test - * @tc.level 0 - */ - it('testIsChangePermittedCallback101', 0, async function (done) { - await wallpaper.isChangePermitted(function (err, data) { - console.info('wallpaperXTS ===> testIsChangePermittedCallback err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testIsChangePermittedCallback data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testIsChangePermittedPromise101 - * @tc.name Test isChangePermitted() to checks whether to allow the application to change the - wallpaper for the current user. - * @tc.desc Function test - * @tc.level 0 - */ - it('testIsChangePermittedPromise101', 0, async function (done) { - await wallpaper.isChangePermitted().then((data) => { - console.info('wallpaperXTS ===> testIsChangePermittedPromise data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('wallpaperXTS ===> testIsChangePermittedPromise err : ' + JSON.stringify(err)); - if (err) { - expect(null).assertFail(); - } - }); - done(); - }) - - /* - * @tc.number testIsOperationAllowedCallback101 - * @tc.name Test isOperationAllowed() to checks whether a user is allowed to set wallpapers. - * @tc.desc Function test - * @tc.level 0 - */ - it('testIsOperationAllowedCallback101', 0, async function (done) { - await wallpaper.isOperationAllowed(function (err, data) { - console.info('wallpaperXTS ===> testIsOperationAllowedCallback err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testIsOperationAllowedCallback data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testIsOperationAllowedPromise101 - * @tc.name Test isOperationAllowed() to checks whether a user is allowed to set wallpapers. - * @tc.desc Function test - * @tc.level 0 - */ - it('testIsOperationAllowedPromise101', 0, async function (done) { - await wallpaper.isOperationAllowed().then((data) => { - console.info('wallpaperXTS ===> testIsOperationAllowedPromise data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }).catch((err) => { - console.info('wallpaperXTS ===> testIsOperationAllowedPromise err : ' + JSON.stringify(err)); - if (err) { - expect(null).assertFail(); - } - }); - done(); - }) - - /* - * @tc.number testResetCallbackSystem101 - * @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one. - * @tc.desc Function test - * @tc.level 0 - */ - it('testResetCallbackSystem101', 0, async function (done) { - await wallpaper.reset(WALLPAPER_SYSTEM, function (err, data) { - console.info('wallpaperXTS ===> testResetCallbackSystem err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testResetCallbackSystem data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testResetPromiseSystem101 - * @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one. - * @tc.desc Function test - * @tc.level 0 - */ - it('testResetPromiseSystem101', 0, async function (done) { - wallpaper.reset(WALLPAPER_SYSTEM).then((data) => { - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - done(); - }).catch((err) => { - expect(true).assertTrue(); - done(); - }); - }) - - /* - * @tc.number testResetCallbackLock102 - * @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one. - * @tc.desc Function test - * @tc.level 0 - */ - it('testResetCallbackLock102', 0, async function (done) { - await wallpaper.reset(WALLPAPER_LOCKSCREEN, function (err, data) { - console.info('wallpaperXTS ===> testResetCallbackLock err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testResetCallbackLock data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testResetPromiseLock102 - * @tc.name Test reset() to removes a wallpaper of the specified type and restores the default one. - * @tc.desc Function test - * @tc.level 0 - */ - it('testResetPromiseLock102', 0, async function (done) { - await wallpaper.reset(WALLPAPER_LOCKSCREEN).then((data) => { - console.info('wallpaperXTS ===> testResetPromiseLock data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - done(); - }).catch((err) => { - console.info('wallpaperXTS ===> testResetPromiseLock--- err : ' + JSON.stringify(err)); - expect(true).assertTrue(); - done(); - }); - }) - - /* - * @tc.number testSetWallpaperURLPromiseLock104 - * @tc.name Test setPixelMap() to sets a wallpaper of the specified type based on the uri path from a - JPEG or PNG file or the pixel map of a PNG file. - * @tc.desc Function test - * @tc.level 0 - */ - it('testSetWallpaperURLPromiseLock104', 0, async function (done) { - await wallpaper.setWallpaper(imageSourceLockscreen, WALLPAPER_LOCKSCREEN).then((data) => { - console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - done(); - }).catch((err) => { - console.info('wallpaperXTS ===> testSetWallpaperURLPromiseLock err : ' + JSON.stringify(err)); - expect(true).assertTrue(); - done(); - }); - }) - - /* - * @tc.number testSetWallpaperURLCallbackSystem103 - * @tc.name Test setWallpaper() to sets a wallpaper of the specified type based on the uri path from a - JPEG or PNG file or the pixel map of a PNG file. - * @tc.desc Function test - * @tc.level 0 - */ - it('testSetWallpaperURLCallbackSystem103', 0, async function (done) { - await wallpaper.setWallpaper(imageSourceSystem, WALLPAPER_SYSTEM, function (err, data) { - console.info('wallpaperXTS ===> testSetWallpaperURLCallbackSystem err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testSetWallpaperURLCallbackSystem data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }); - done(); - }) - - /* - * @tc.number testSetWallpaperURLPromiseSystem103 - * @tc.name Test setWallpaper() to sets a wallpaper of the specified type based on the uri path from a - JPEG or PNG file or the pixel map of a PNG file. - * @tc.desc Function test - * @tc.level 0 - */ - it('testSetWallpaperURLPromiseSystem103', 0, function (done) { - if(true) { - expect(true).assertTrue(); - done(); - return; - } - wallpaper.setWallpaper(imageSourceSystem, WALLPAPER_SYSTEM).then((data) => { - console.info('wallpaperXTS ===> testSetWallpaperURLPromiseSystem data : ' + JSON.stringify(data)); - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - done(); - }).catch((err) => { - console.info('wallpaperXTS ===> testSetWallpaperURLPromiseSystem err : ' + JSON.stringify(err)); - expect(true).assertTrue(); - done(); - }); - }) - - /* - * @tc.number testSetWallpaperURLCallbackLock104 - * @tc.name Test setWallpaper() to sets a wallpaper of the specified type based on the uri path from a - JPEG or PNG file or the pixel map of a PNG file. - * @tc.desc Function test - * @tc.level 0 - */ - it('testSetWallpaperURLCallbackLock104', 0, async function (done) { - await wallpaper.setWallpaper(imageSourceLockscreen, WALLPAPER_LOCKSCREEN, function (err, data) { - console.info('wallpaperXTS ===> testSetWallpaperURLCallbackLock err : ' + JSON.stringify(err)); - console.info('wallpaperXTS ===> testSetWallpaperURLCallbackLock data : ' + JSON.stringify(data)); - if (err) { - expect(null).assertFail(); - } - if ((data != undefined) && (data != null) && (data != '')) { - expect(true).assertTrue(); - } - }); - done(); - }) - - /* - * @tc.number testOnCallback101 - * @tc.name Test on_colorChange to registers a listener for wallpaper color changes to - receive notifications about the changes. - * @tc.desc Function test - * @tc.level 0 - */ - it('testOnCallback101', 0, async function (done) { - await wallpaper.on('colorChange', function (colors, wallpaperType) { - console.info('wallpaperXTS ===> testOnCallback colors : ' + JSON.stringify(colors)); - console.info('wallpaperXTS ===> testOnCallback wallpaperType : ' + JSON.stringify(wallpaperType)); - if ((colors != undefined) && (colors != null) && (colors != '')) { - expect(true).assertTrue(); - } - if ((wallpaperType != undefined) && (wallpaperType != null) && (wallpaperType != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) - - /* - * @tc.number testOffCallback101 - * @tc.name Test on_colorChange to registers a listener for wallpaper color changes to - receive notifications about the changes. - * @tc.desc Function test - * @tc.level 0 - */ - it('testOffCallback101', 0, async function (done) { - await wallpaper.off('colorChange', function (colors, wallpaperType) { - console.info('wallpaperXTS ===> testOffCallback colors : ' + JSON.stringify(colors)); - console.info('wallpaperXTS ===> testOffCallback wallpaperType : ' + JSON.stringify(wallpaperType)); - if ((colors != undefined) && (colors != null) && (colors != '')) { - expect(true).assertTrue(); - } - if ((wallpaperType != undefined) && (wallpaperType != null) && (wallpaperType != '')) { - expect(true).assertTrue(); - } - }) - done(); - }) -}) diff --git a/theme/wallpaper_js/src/main/js/default/common/images/Wallpaper.png b/theme/wallpaper_js/src/main/js/default/common/images/Wallpaper.png deleted file mode 100644 index 60d4841a80eb20c63de74306cb7f8350d6a85c48..0000000000000000000000000000000000000000 Binary files a/theme/wallpaper_js/src/main/js/default/common/images/Wallpaper.png and /dev/null differ diff --git a/theme/wallpaper_js/src/main/js/default/common/images/bg-tv.jpg b/theme/wallpaper_js/src/main/js/default/common/images/bg-tv.jpg deleted file mode 100644 index 88f17e14af28db45eed4cc67cfdbbfc23de5c0ae..0000000000000000000000000000000000000000 Binary files a/theme/wallpaper_js/src/main/js/default/common/images/bg-tv.jpg and /dev/null differ diff --git a/theme/wallpaper_js/src/main/js/default/i18n/en-US.json b/theme/wallpaper_js/src/main/js/default/i18n/en-US.json deleted file mode 100644 index e63c70d978a3a53be988388c87182f81785e170c..0000000000000000000000000000000000000000 --- a/theme/wallpaper_js/src/main/js/default/i18n/en-US.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "Hello", - "world": "World" - } -} \ No newline at end of file diff --git a/theme/wallpaper_js/src/main/js/default/i18n/zh-CN.json b/theme/wallpaper_js/src/main/js/default/i18n/zh-CN.json deleted file mode 100644 index de6ee5748322f44942c1b003319d8e66c837675f..0000000000000000000000000000000000000000 --- a/theme/wallpaper_js/src/main/js/default/i18n/zh-CN.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "strings": { - "hello": "您好", - "world": "世界" - } -} \ No newline at end of file diff --git a/theme/wallpaper_js/src/main/js/default/pages/index/index.css b/theme/wallpaper_js/src/main/js/default/pages/index/index.css deleted file mode 100644 index a55e7142ee316f771692297c5a43b9a788720df7..0000000000000000000000000000000000000000 --- a/theme/wallpaper_js/src/main/js/default/pages/index/index.css +++ /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. - */ -.container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 100%; -} - -.title { - font-size: 40px; - color: #000000; - opacity: 0.9; -} - -@media screen and (device-type: tablet) and (orientation: landscape) { - .title { - font-size: 100px; - } -} - -@media screen and (device-type: wearable) { - .title { - font-size: 28px; - color: #FFFFFF; - } -} - -@media screen and (device-type: tv) { - .container { - background-image: url("/common/images/Wallpaper.png"); - background-size: cover; - background-repeat: no-repeat; - background-position: center; - } - - .title { - font-size: 100px; - color: #FFFFFF; - } -} - -@media screen and (device-type: phone) and (orientation: landscape) { - .title { - font-size: 60px; - } -} diff --git a/theme/wallpaper_js/src/main/js/default/pages/index/index.hml b/theme/wallpaper_js/src/main/js/default/pages/index/index.hml deleted file mode 100644 index 2de473acd4107f67baf13a849b2d0302cea12058..0000000000000000000000000000000000000000 --- a/theme/wallpaper_js/src/main/js/default/pages/index/index.hml +++ /dev/null @@ -1,19 +0,0 @@ - -
- - {{ $t('strings.hello') }} {{ title }} - -
diff --git a/theme/wallpaper_js/src/main/js/default/pages/index/index.js b/theme/wallpaper_js/src/main/js/default/pages/index/index.js deleted file mode 100644 index dc0e1186d2aae4fe33cd39b75ffd7b61b7efcea1..0000000000000000000000000000000000000000 --- a/theme/wallpaper_js/src/main/js/default/pages/index/index.js +++ /dev/null @@ -1,42 +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 {Core, ExpectExtend} from 'deccjsunit/index' - -export default { - data: { - title: "" - }, - onInit() { - this.title = this.$t('strings.world'); - }, - onShow() { - console.info('onShow finish') - const core = Core.getInstance() - const expectExtend = new ExpectExtend({ - 'id': 'extend' - }) - core.addService('expect', expectExtend) - core.init() - const configService = core.getDefaultService('config') - configService.setConfig(this) - console.log("test start") - require('../../../Test/List.test.js') - core.execute() - this.title = this.$t('strings.start'); - console.log("test end") - }, - onReady() { - } -} diff --git a/theme/wallpaper_js/src/main/resources/base/element/string.json b/theme/wallpaper_js/src/main/resources/base/element/string.json deleted file mode 100644 index 0bae6bd40f7360d5d818998221b199d3ec0f69c0..0000000000000000000000000000000000000000 --- a/theme/wallpaper_js/src/main/resources/base/element/string.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "string": [ - { - "name": "entry_MainAbility", - "value": "entry_MainAbility" - }, - { - "name": "mainability_description", - "value": "JS_Empty Ability" - } - ] -} \ No newline at end of file diff --git a/time/BUILD.gn b/time/BUILD.gn old mode 100755 new mode 100644 index 49d9a1c979ba6daf141e980bd9b945e2a01766ac..6b834079bf0a5403315d04c8a2bc9537c8690272 --- a/time/BUILD.gn +++ b/time/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (C) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at diff --git a/time/TimeTest_js/BUILD.gn b/time/TimeTest_js/BUILD.gn old mode 100755 new mode 100644 index ed1bbe5fcf31ae6a150d09bd8bbc1bd63d11349a..ba6ee6dd954308dfc0ddf79023bf14f333769d98 --- a/time/TimeTest_js/BUILD.gn +++ b/time/TimeTest_js/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (C) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -19,6 +19,8 @@ ohos_js_hap_suite("ActsTimeJSApiTest") { ":hjs_demo_js_assets", ":hjs_demo_resources", ] + subsystem_name = "time" + part_name = "time_service" certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsTimeJSApiTest" } diff --git a/time/TimeTest_js/Test.json b/time/TimeTest_js/Test.json old mode 100755 new mode 100644 index 9b33ba5bebe1f8fbd7f8fd0ce52e99691ab1e250..162af643177b27e2244915014d50dc5d2d171d9a --- a/time/TimeTest_js/Test.json +++ b/time/TimeTest_js/Test.json @@ -3,7 +3,7 @@ "driver": { "type": "JSUnitTest", "test-timeout": "600000", - "package": "ohos.acts.miscservices.timer", + "package": "ohos.acts.time.timetest", "shell-timeout": "600000" }, "kits": [ diff --git a/time/TimeTest_js/signature/openharmony_sx.p7b b/time/TimeTest_js/signature/openharmony_sx.p7b old mode 100755 new mode 100644 diff --git a/time/TimeTest_js/src/main/config.json b/time/TimeTest_js/src/main/config.json old mode 100755 new mode 100644 index e8b1e6715ef5b88a81713724ff8225d32199447d..4774a07e7ae122d7d5fc3b2a46ea79d12f1625cf --- a/time/TimeTest_js/src/main/config.json +++ b/time/TimeTest_js/src/main/config.json @@ -1,19 +1,19 @@ { "app": { - "bundleName": "ohos.acts.miscservices.timer", + "bundleName": "ohos.acts.time.timetest", "vendor": "acts", "version": { "code": 1000000, "name": "1.0.0" }, "apiVersion": { - "compatible": 4, - "target": 5 + "compatible": 7, + "target": 9 } }, "deviceConfig": {}, "module": { - "package": "ohos.acts.miscservices.timer", + "package": "ohos.acts.time.timetest", "name": ".MyApplication", "deviceType": [ "phone" @@ -46,7 +46,7 @@ ] } ], - "name": "ohos.acts.miscservices.timer.MainAbility", + "name": "ohos.acts.time.timetest.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", diff --git a/time/TimeTest_js/src/main/js/default/app.js b/time/TimeTest_js/src/main/js/default/app.js old mode 100755 new mode 100644 index ffc56f10680b6d4065e6af0f764850ea915d48e9..3f33c9fae0b3eb6b9a41b5d33a2ffa7e2d0d7d51 --- a/time/TimeTest_js/src/main/js/default/app.js +++ b/time/TimeTest_js/src/main/js/default/app.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/time/TimeTest_js/src/main/js/default/i18n/en-US.json b/time/TimeTest_js/src/main/js/default/i18n/en-US.json old mode 100755 new mode 100644 diff --git a/time/TimeTest_js/src/main/js/default/i18n/zh-CN.json b/time/TimeTest_js/src/main/js/default/i18n/zh-CN.json old mode 100755 new mode 100644 diff --git a/time/TimeTest_js/src/main/js/default/pages/index/index.css b/time/TimeTest_js/src/main/js/default/pages/index/index.css old mode 100755 new mode 100644 diff --git a/time/TimeTest_js/src/main/js/default/pages/index/index.hml b/time/TimeTest_js/src/main/js/default/pages/index/index.hml old mode 100755 new mode 100644 diff --git a/time/TimeTest_js/src/main/js/default/pages/index/index.js b/time/TimeTest_js/src/main/js/default/pages/index/index.js old mode 100755 new mode 100644 index b322cafacae644bcb3097d3f61a619e8059c501b..eaac6fc987c8174e69676a9ef662ba069931387a --- a/time/TimeTest_js/src/main/js/default/pages/index/index.js +++ b/time/TimeTest_js/src/main/js/default/pages/index/index.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/time/TimeTest_js/src/main/js/default/test/List.test.js b/time/TimeTest_js/src/main/js/default/test/List.test.js old mode 100755 new mode 100644 index 73a1578832846d4352ea23240d3671e097ff9d76..5120a0a6a544098739b6250a5fb86d0f4527f055 --- a/time/TimeTest_js/src/main/js/default/test/List.test.js +++ b/time/TimeTest_js/src/main/js/default/test/List.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js b/time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js index ec0c614cf6d2c878b0282fd7be11ffe09c0d754c..49f2a4656dbf23ae8bc4b01b72aa4d2dd3c85bea 100644 --- a/time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js +++ b/time/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/time/TimeTest_js/src/main/js/default/test/Time.test.js b/time/TimeTest_js/src/main/js/default/test/Time.test.js index 9485271cc1b659b9dd8d282d4a64bc119ac30247..568653a6ea0a60410ed716b50210e1132a674532 100644 --- a/time/TimeTest_js/src/main/js/default/test/Time.test.js +++ b/time/TimeTest_js/src/main/js/default/test/Time.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/time/TimeTest_js/src/main/resources/base/element/string.json b/time/TimeTest_js/src/main/resources/base/element/string.json old mode 100755 new mode 100644 diff --git a/time/TimeTest_js/src/main/resources/base/media/icon.png b/time/TimeTest_js/src/main/resources/base/media/icon.png old mode 100755 new mode 100644 diff --git a/time/TimerTest_js/BUILD.gn b/time/TimerTest_js/BUILD.gn index a8563d62feee66cc097ddfdd79e41f816b2c288c..68ce95cbfb3710bc82c6eec1a65377bd94875373 100644 --- a/time/TimerTest_js/BUILD.gn +++ b/time/TimerTest_js/BUILD.gn @@ -1,4 +1,4 @@ -# Copyright (C) 2021 Huawei Device Co., Ltd. +# Copyright (C) 2022 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at @@ -19,6 +19,8 @@ ohos_js_hap_suite("ActsTimerJSApiTest") { ":hjs_demo_js_assets", ":hjs_demo_resources", ] + subsystem_name = "time" + part_name = "time_service" certificate_profile = "./signature/openharmony_sx.p7b" hap_name = "ActsTimerJSApiTest" } diff --git a/time/TimerTest_js/Test.json b/time/TimerTest_js/Test.json index d2d2cf2383fcec1f1155636761b4ccff7280d927..5a5cf5fb5eecb8d35cdb06a8d547925cfffc7197 100644 --- a/time/TimerTest_js/Test.json +++ b/time/TimerTest_js/Test.json @@ -3,7 +3,7 @@ "driver": { "type": "JSUnitTest", "test-timeout": "600000", - "package": "ohos.acts.miscservices.timer", + "package": "ohos.acts.time.timertest", "shell-timeout": "600000" }, "kits": [ diff --git a/time/TimerTest_js/src/main/config.json b/time/TimerTest_js/src/main/config.json index a3a99cf06dcf43255b67835cbdf81712d4f27895..2c4c85a2e5ed4258c4e136d0d4bbea417a6f079a 100644 --- a/time/TimerTest_js/src/main/config.json +++ b/time/TimerTest_js/src/main/config.json @@ -1,19 +1,19 @@ { "app": { - "bundleName": "ohos.acts.miscservices.timer", + "bundleName": "ohos.acts.time.timertest", "vendor": "acts", "version": { "code": 1000000, "name": "1.0.0" }, "apiVersion": { - "compatible": 4, - "target": 5 + "compatible": 7, + "target": 9 } }, "deviceConfig": {}, "module": { - "package": "ohos.acts.miscservices.timer", + "package": "ohos.acts.time.timertest", "name": ".MyApplication", "deviceType": [ "phone" @@ -36,7 +36,7 @@ ] } ], - "name": "ohos.acts.miscservices.timer.MainAbility", + "name": "ohos.acts.time.timertest.MainAbility", "icon": "$media:icon", "description": "$string:mainability_description", "label": "$string:app_name", diff --git a/time/TimerTest_js/src/main/js/default/app.js b/time/TimerTest_js/src/main/js/default/app.js index 2b1123aba50aa93c918c68213fb66542e2264948..564b7cb972324e0ae905c2597f6e99ab7c6ad951 100644 --- a/time/TimerTest_js/src/main/js/default/app.js +++ b/time/TimerTest_js/src/main/js/default/app.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/time/TimerTest_js/src/main/js/default/pages/index/index.js b/time/TimerTest_js/src/main/js/default/pages/index/index.js index 876dee977f2afcf38af5c986e8201f3760232611..ea4ed5e4d6507dde6112f8501a68d24c6bd5aca4 100644 --- a/time/TimerTest_js/src/main/js/default/pages/index/index.js +++ b/time/TimerTest_js/src/main/js/default/pages/index/index.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/time/TimerTest_js/src/main/js/default/test/List.test.js b/time/TimerTest_js/src/main/js/default/test/List.test.js index a5ebce1d42d595b4101412bef07864e80c8ce660..859f6c6d813adc8b8489234477358caf51ece81c 100644 --- a/time/TimerTest_js/src/main/js/default/test/List.test.js +++ b/time/TimerTest_js/src/main/js/default/test/List.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/time/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js b/time/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js index edf585c5bf14d45a664f27483bdff8a93db77703..31cb446444ee12728d93083757ab6d037c6c30d3 100644 --- a/time/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js +++ b/time/TimerTest_js/src/main/js/default/test/SystemTimerJsunit.test.js @@ -1,5 +1,5 @@ /* - * Copyright (C) 2021 Huawei Device Co., Ltd. + * Copyright (C) 2022 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at