Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
f0ae84cc
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f0ae84cc
编写于
3月 18, 2022
作者:
高
高曦
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
MISC用例整改
Signed-off-by:
N
高曦
<
gaoxi785@huawei.com
>
上级
ca551e00
变更
32
隐藏空白更改
内联
并排
Showing
32 changed file
with
4376 addition
and
79 deletion
+4376
-79
miscservices/BUILD.gn
miscservices/BUILD.gn
+2
-0
miscservices/InputMethodTest_ets/BUILD.gn
miscservices/InputMethodTest_ets/BUILD.gn
+32
-0
miscservices/InputMethodTest_ets/Test.json
miscservices/InputMethodTest_ets/Test.json
+18
-0
miscservices/InputMethodTest_ets/entry/src/main/config.json
miscservices/InputMethodTest_ets/entry/src/main/config.json
+72
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets
...nputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets
+22
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets
...odTest_ets/entry/src/main/ets/MainAbility/pages/index.ets
+64
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets
...odTest_ets/entry/src/main/ets/MainAbility/pages/input.ets
+45
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/InputmethodEngineJsunit.test.ets
...ain/ets/MainAbility/test/InputmethodEngineJsunit.test.ets
+490
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/InputmethohJsunit.test.ets
.../src/main/ets/MainAbility/test/InputmethohJsunit.test.ets
+80
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/List.test.ets
...est_ets/entry/src/main/ets/MainAbility/test/List.test.ets
+21
-0
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/Utils.ets
...hodTest_ets/entry/src/main/ets/MainAbility/test/Utils.ets
+118
-0
miscservices/InputMethodTest_ets/entry/src/main/resources/base/element/string.json
...est_ets/entry/src/main/resources/base/element/string.json
+24
-0
miscservices/InputMethodTest_ets/entry/src/main/resources/base/media/icon.png
...thodTest_ets/entry/src/main/resources/base/media/icon.png
+0
-0
miscservices/InputMethodTest_ets/signature/openharmony_sx.p7b
...services/InputMethodTest_ets/signature/openharmony_sx.p7b
+0
-0
miscservices/PasteBoardTest_js/BUILD.gn
miscservices/PasteBoardTest_js/BUILD.gn
+31
-0
miscservices/PasteBoardTest_js/Test.json
miscservices/PasteBoardTest_js/Test.json
+18
-0
miscservices/PasteBoardTest_js/signature/openharmony_sx.p7b
miscservices/PasteBoardTest_js/signature/openharmony_sx.p7b
+0
-0
miscservices/PasteBoardTest_js/src/main/config.json
miscservices/PasteBoardTest_js/src/main/config.json
+60
-0
miscservices/PasteBoardTest_js/src/main/js/default/app.js
miscservices/PasteBoardTest_js/src/main/js/default/app.js
+23
-0
miscservices/PasteBoardTest_js/src/main/js/default/i18n/en-US.json
...ces/PasteBoardTest_js/src/main/js/default/i18n/en-US.json
+6
-0
miscservices/PasteBoardTest_js/src/main/js/default/i18n/zh-CN.json
...ces/PasteBoardTest_js/src/main/js/default/i18n/zh-CN.json
+6
-0
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.css
...steBoardTest_js/src/main/js/default/pages/index/index.css
+9
-0
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.hml
...steBoardTest_js/src/main/js/default/pages/index/index.hml
+5
-0
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.js
...asteBoardTest_js/src/main/js/default/pages/index/index.js
+48
-0
miscservices/PasteBoardTest_js/src/main/js/default/test/List.test.js
...s/PasteBoardTest_js/src/main/js/default/test/List.test.js
+16
-0
miscservices/PasteBoardTest_js/src/main/js/default/test/PasteBoardJsunit.test.js
...Test_js/src/main/js/default/test/PasteBoardJsunit.test.js
+3146
-0
miscservices/PasteBoardTest_js/src/main/resources/base/element/string.json
...eBoardTest_js/src/main/resources/base/element/string.json
+12
-0
miscservices/PasteBoardTest_js/src/main/resources/base/media/icon.png
.../PasteBoardTest_js/src/main/resources/base/media/icon.png
+0
-0
miscservices/RequestTest_js/signature/openharmony_sx.p7b
miscservices/RequestTest_js/signature/openharmony_sx.p7b
+0
-0
miscservices/TimeTest_js/signature/openharmony_sx.p7b
miscservices/TimeTest_js/signature/openharmony_sx.p7b
+0
-0
miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js
...Test_js/src/main/js/default/test/SystemTimeJsunit.test.js
+8
-79
miscservices/TimerTest_js/signature/openharmony_sx.p7b
miscservices/TimerTest_js/signature/openharmony_sx.p7b
+0
-0
未找到文件。
miscservices/BUILD.gn
浏览文件 @
f0ae84cc
...
...
@@ -15,6 +15,8 @@ import("//build/ohos_var.gni")
group("miscservices") {
testonly = true
deps = [
"InputMethodTest_ets:inputMethod_ets_test",
"PasteBoardTest_js:pasteboard_js_test",
"RequestTest_js:miscservices_request_js_test",
"TimeTest_js:time_js_test",
"TimerTest_js:timer_js_test",
...
...
miscservices/InputMethodTest_ets/BUILD.gn
0 → 100644
浏览文件 @
f0ae84cc
# Copyright (c) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT 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("inputMethod_ets_test") {
hap_profile = "./entry/src/main/config.json"
deps = [
":inputMethod_ets_assets",
":inputMethod_ets_resources",
]
ets2abc = true
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "InputMethodEtsTest"
}
ohos_js_assets("inputMethod_ets_assets") {
source_dir = "./entry/src/main/ets/MainAbility"
}
ohos_resources("inputMethod_ets_resources") {
sources = [ "./entry/src/main/resources" ]
hap_profile = "./entry/src/main/config.json"
}
miscservices/InputMethodTest_ets/Test.json
0 → 100644
浏览文件 @
f0ae84cc
{
"description"
:
"Configuration for inputMethod Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"600000"
,
"package"
:
"com.open.harmony.inputMethodtest"
,
"shell-timeout"
:
"60000"
},
"kits"
:
[
{
"test-file-name"
:
[
"InputMethodEtsTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
miscservices/InputMethodTest_ets/entry/src/main/config.json
0 → 100644
浏览文件 @
f0ae84cc
{
"app"
:
{
"bundleName"
:
"com.open.harmony.inputMethodtest"
,
"vendor"
:
"open"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
7
,
"releaseType"
:
"Release"
,
"target"
:
7
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"com.open.harmony.inputMethodtest"
,
"name"
:
".MyApplication"
,
"mainAbility"
:
"com.open.harmony.inputMethodtest.MainAbility"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
,
"installationFree"
:
false
},
"abilities"
:
[
{
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"orientation"
:
"unspecified"
,
"visible"
:
true
,
"srcPath"
:
"MainAbility"
,
"name"
:
".MainAbility"
,
"srcLanguage"
:
"ets"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:description_mainability"
,
"formsEnabled"
:
false
,
"label"
:
"$string:entry_MainAbility"
,
"type"
:
"page"
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"mode"
:
{
"syntax"
:
"ets"
,
"type"
:
"pageAbility"
},
"pages"
:
[
"pages/index"
,
"pages/input"
],
"name"
:
".MainAbility"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/app.ets
0 → 100644
浏览文件 @
f0ae84cc
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default {
onCreate() {
console.info('Application onCreate')
},
onDestroy() {
console.info('Application onDestroy')
},
}
\ No newline at end of file
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/index.ets
0 → 100644
浏览文件 @
f0ae84cc
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import file from '@system.file';
import {Core, ExpectExtend, InstrumentLog, ReportExtend} from "deccjsunit/index.ets";
import testsuite from "../test/List.test.ets";
import featureAbility from "@ohos.ability.featureAbility";
@Entry
@Component
struct MyComponent {
aboutToAppear() {
console.info("start run testcase!!!!")
featureAbility.getWant()
.then((Want) => {
const core = Core.getInstance();
const expectExtend = new ExpectExtend({
'id': 'extend'
});
core.addService('expect', expectExtend);
const reportExtend = new ReportExtend(file);
core.addService('report', reportExtend);
core.init();
core.subscribeEvent('task', reportExtend);
const configService = core.getDefaultService('config');
console.info('parameters---->' + JSON.stringify(Want.parameters));
configService.setConfig(Want.parameters);
testsuite();
core.execute();
console.info('Operation successful. Data: ' + JSON.stringify(Want));
})
.catch((error) => {
console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
}
build() {
Flex({
direction: FlexDirection.Column,
alignItems: ItemAlign.Center,
justifyContent: FlexAlign.Center
}) {
Text('ACE ETS TEST')
.fontSize(50)
.fontWeight(FontWeight.Bold)
}
.width('100%')
.height('100%')
}
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/pages/input.ets
0 → 100644
浏览文件 @
f0ae84cc
// @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.
*/
@Entry
@Component
struct TextInputTest {
@State text: string = '';
build() {
Column() {
TextInput({ placeholder: 'input your word' })
.type(InputType.Normal)
.key('TextInput')
.placeholderColor(Color.Blue)
.placeholderFont({ size: 40, weight: FontWeight.Normal, family: "sans-serif", style: FontStyle.Normal })
.enterKeyType(EnterKeyType.Search)
.caretColor(Color.Green)
.height(60)
.fontSize(30)
.fontWeight(FontWeight.Bold)
.fontFamily("cursive")
.fontStyle(FontStyle.Italic)
.fontColor(Color.Red)
.maxLength(20)
.onChange((value: string) => {
this.text = value
})
Text(this.text)
}
}
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/InputmethodEngineJsunit.test.ets
0 → 100644
浏览文件 @
f0ae84cc
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import inputMethodEngine from '@ohos.inputMethodEngine';
import Utils from './Utils';
import router from '@system.router';
import events_emitter from '@ohos.events.emitter';
export default function inputMethodEngineJsunit() {
describe('appInfoTest', function () {
var mKeyboardDelegate = null;
var inputMethodEngineObject = inputMethodEngine.getInputMethodEngine();
var textInputClient = null;
var kbController = null;
console.log("************* inputMethodEngine Test start*************");
beforeEach(async function (done) {
let options = {
uri: 'pages/input',
}
try {
router.clear();
let pages = router.getState();
if (!("input" == pages.name)) {
let result = await router.push(options);
await Utils.sleep(1000);
}
} catch (err) {
console.error("push input page error: " + err);
}
done();
});
afterEach(async function () {
console.log("inputMethodEngine afterEach start:" + inputMethodEngineObject);
await Utils.sleep(1000);
});
it('inputMethodEngine_test_000', 0, async function (done) {
inputMethodEngineObject.on('inputStart', (kbController, textInputClient) => {
console.log("inputMethodEngine beforeEach inputStart:" + JSON.stringify(kbController));
console.log("inputMethodEngine beforeEach inputStart:" + JSON.stringify(textInputClient));
textInputClient = textInputClient;
kbController = kbController;
});
inputMethodEngineObject.on('keyboardShow', (err) => {
console.log("inputMethodEngine beforeEach keyboardShow:" + err);
});
inputMethodEngineObject.on('keyboardHide', (err) => {
console.log("inputMethodEngine beforeEach keyboardHide:" + err);
});
mKeyboardDelegate = inputMethodEngine.createKeyboardDelegate();
mKeyboardDelegate.on('keyDown', (keyEvent) => {
console.log("inputMethodEngine beforeEach keyDown:" + keyEvent);
expect(keyEvent.keyCode).assertEqual('1');
});
mKeyboardDelegate.on('keyUp', (keyEvent) => {
console.log("inputMethodEngine beforeEach keyUp:" + keyEvent.keyCode);
expect(keyEvent.keyCode).assertEqual('1');
});
mKeyboardDelegate.on('cursorContextChange', (x, y, height) => {
console.log("inputMethodEngine beforeEach cursorContextChange x:" + x);
console.log("inputMethodEngine beforeEach cursorContextChange y:" + y);
console.log("inputMethodEngine beforeEach cursorContextChange height:" + height);
});
mKeyboardDelegate.on('selectionChange', (oldBegin, oldEnd, newBegin, newEnd) => {
console.log("inputMethodEngine beforeEach selectionChange oldBegin:" + oldBegin);
console.log("inputMethodEngine beforeEach selectionChange oldEnd:" + oldEnd);
console.log("inputMethodEngine beforeEach selectionChange newBegin:" + newBegin);
console.log("inputMethodEngine beforeEach selectionChange newEnd:" + newEnd);
});
mKeyboardDelegate.on('textChange', (text) => {
console.log("inputMethodEngine beforeEach textChange:" + text);
});
done();
});
it('inputMethodEngine_test_001', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_UNSPECIFIED;
console.log("inputMethodEngine_test_001 result:" + keyType);
expect(keyType).assertEqual(0);
done();
});
it('inputMethodEngine_test_002', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_GO;
console.log("inputMethodEngine_test_002 result:" + keyType);
expect(keyType).assertEqual(2);
done();
});
it('inputMethodEngine_test_003', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEARCH;
console.log("inputMethodEngine_test_003 result:" + keyType);
expect(keyType).assertEqual(3);
done();
});
it('inputMethodEngine_test_004', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_SEND;
console.log("inputMethodEngine_test_004 result:" + keyType);
expect(keyType).assertEqual(4);
done();
});
it('inputMethodEngine_test_005', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_NEXT;
console.log("inputMethodEngine_test_005 result:" + keyType);
expect(keyType).assertEqual(5);
done();
});
it('inputMethodEngine_test_006', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_DONE;
console.log("inputMethodEngine_test_006 result:" + keyType);
expect(keyType).assertEqual(6);
done();
});
it('inputMethodEngine_test_007', 0, async function (done) {
let keyType = inputMethodEngine.ENTER_KEY_TYPE_PREVIOUS;
console.log("inputMethodEngine_test_007 result:" + keyType);
expect(keyType).assertEqual(7);
done();
});
it('inputMethodEngine_test_008', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_NULL;
console.log("inputMethodEngine_test_008 result:" + keyType);
expect(keyType).assertEqual(-1);
done();
});
it('inputMethodEngine_test_009', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_TEXT;
console.log("inputMethodEngine_test_009 result:" + keyType);
expect(keyType).assertEqual(0);
done();
});
it('inputMethodEngine_test_010', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_NUMBER;
console.log("inputMethodEngine_test_010 result:" + keyType);
expect(keyType).assertEqual(2);
done();
});
it('inputMethodEngine_test_011', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_PHONE;
console.log("inputMethodEngine_test_011 result:" + keyType);
expect(keyType).assertEqual(3);
done();
});
it('inputMethodEngine_test_012', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_DATETIME;
console.log("inputMethodEngine_test_012 result:" + keyType);
expect(keyType).assertEqual(4);
done();
});
it('inputMethodEngine_test_013', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_EMAIL;
console.log("inputMethodEngine_test_013 result:" + keyType);
expect(keyType).assertEqual(5);
done();
});
it('inputMethodEngine_test_014', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_URI;
console.log("inputMethodEngine_test_014 result:" + keyType);
expect(keyType).assertEqual(6);
done();
});
it('inputMethodEngine_test_015', 0, async function (done) {
let keyType = inputMethodEngine.PATTERN_PASSWORD;
console.log("inputMethodEngine_test_015 result:" + keyType);
expect(keyType).assertEqual(7);
done();
});
it('inputMethodEngine_test_016', 0, async function (done) {
let keyType = inputMethodEngine.FLAG_SELECTING;
console.log("inputMethodEngine_test_016 result:" + keyType);
expect(keyType).assertEqual(2);
done();
});
it('inputMethodEngine_test_017', 0, async function (done) {
let keyType = inputMethodEngine.FLAG_SINGLE_LINE;
console.log("inputMethodEngine_test_017 result:" + keyType);
expect(keyType).assertEqual(1);
done();
});
it('inputMethodEngine_test_018', 0, async function (done) {
let keyType = inputMethodEngine.DISPLAY_MODE_PART;
console.log("inputMethodEngine_test_018 result:" + keyType);
expect(keyType).assertEqual(0);
done();
});
it('inputMethodEngine_test_019', 0, async function (done) {
let keyType = inputMethodEngine.DISPLAY_MODE_FULL;
console.log("inputMethodEngine_test_019 result:" + keyType);
expect(keyType).assertEqual(1);
done();
});
it('inputMethodEngine_test_020', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_ASCII;
console.log("inputMethodEngine_test_020 result:" + keyType);
expect(keyType).assertEqual(20);
done();
});
it('inputMethodEngine_test_021', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_NONE;
console.log("inputMethodEngine_test_021 result:" + keyType);
expect(keyType).assertEqual(0);
done();
});
it('inputMethodEngine_test_022', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_AUTO_CAP_CHARACTERS;
console.log("inputMethodEngine_test_022 result:" + keyType);
expect(keyType).assertEqual(2);
done();
});
it('inputMethodEngine_test_023', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_AUTO_CAP_SENTENCES;
console.log("inputMethodEngine_test_023 result:" + keyType);
expect(keyType).assertEqual(8);
done();
});
it('inputMethodEngine_test_024', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_AUTO_WORDS;
console.log("inputMethodEngine_test_024 result:" + keyType);
expect(keyType).assertEqual(4);
done();
});
it('inputMethodEngine_test_025', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_MULTI_LINE;
console.log("inputMethodEngine_test_025 result:" + keyType);
expect(keyType).assertEqual(1);
done();
});
it('inputMethodEngine_test_026', 0, async function (done) {
let keyType = inputMethodEngine.OPTION_NO_FULLSCREEN;
console.log("inputMethodEngine_test_026 result:" + keyType);
expect(keyType).assertEqual(10);
done();
});
it('inputMethodEngine_test_027', 0, async function (done) {
let rect = await Utils.getComponentRect('TextInput')
console.info("[inputMethodEngine_test_027] rectInfo is " + JSON.stringify(rect));
let x_value = rect.left + (rect.right - rect.left) / 10
let y_value = rect.top + (rect.bottom - rect.top) / 10
console.info("[inputMethodEngine_test_027] onTouch location is: " + "[x]=== " + x_value + " [y]===" + y_value);
let point: TouchObject = {
id: 1,
x: x_value,
y: y_value,
type: TouchType.Move,
}
console.info('[inputMethodEngine_test_027] testSendTouchEvent ' + sendTouchEvent(point));
await Utils.sleep(1000)
console.info('[inputMethodEngine_test_027] END');
done();
});
it('inputMethodEngine_test_028', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.sendKeyFunction(0, (value) => {
console.log("inputMethodEngine_test_028 textInputClient sendKeyFunction:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_029', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.sendKeyFunction(0);
promise.then(res => {
console.info("inputMethodEngine_test_029 listInputMethod promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_029 listInputMethod promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_030', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.deleteForward(1, (value) => {
console.log("inputMethodEngine_test_030 deleteForward:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_031', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.deleteForward(1);
promise.then(res => {
console.info("inputMethodEngine_test_031 deleteForward promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_031 deleteForward promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_032', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.deleteBackward(1, (value) => {
console.log("inputMethodEngine_test_032 deleteBackward:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_033', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.deleteBackward(1);
promise.then(res => {
console.info("inputMethodEngine_test_033 deleteBackward promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_033 deleteBackward promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_034', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.InsertText('test', (value) => {
console.log("inputMethodEngine_test_034 InsertText:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_035', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.InsertText('test');
promise.then(res => {
console.info("inputMethodEngine_test_035 InsertText promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_035 InsertText promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_036', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.getForward(1, (value) => {
console.log("inputMethodEngine_test_036 getForward:" + value);
expect(value).assertEqual(true);
});
}
done();
});
it('inputMethodEngine_test_037', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.getForward(1);
promise.then(res => {
console.info("inputMethodEngine_test_037 getForward promise result-----" + JSON.stringify(res));
expect(res).assertEqual(true);
}).catch(err => {
console.info("inputMethodEngine_test_037 getForward promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_038', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
textInputClient.getEditorAttribute(1, (editorAttribute) => {
console.log("inputMethodEngine_test_036 getEditorAttribute:" + value);
expect(editorAttribute.inputPattern).assertEqual(1);
expect(editorAttribute.enterKeyType).assertEqual(1);
});
}
done();
});
it('inputMethodEngine_test_039', 0, async function (done) {
if (textInputClient == null) {
expect(textInputClient == null).assertEqual(true);
} else {
let promise = textInputClient.getEditorAttribute();
promise.then(res => {
console.info("inputMethodEngine_test_037 getEditorAttribute promise result-----" + JSON.stringify(res));
expect(res.inputPattern).assertEqual(1);
expect(res.enterKeyType).assertEqual(1);
}).catch(err => {
console.info("inputMethodEngine_test_037 getEditorAttribute promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
it('inputMethodEngine_test_040', 0, async function (done) {
if (kbController == null) {
expect(kbController == null).assertEqual(true);
} else {
kbController.hideKeyboard(() => {
console.log("inputMethodEngine_test_040 hideKeyboard:" + value);
expect(1 == 1).assertTrue();
});
}
done();
});
it('inputMethodEngine_test_041', 0, async function (done) {
if (kbController == null) {
expect(kbController == null).assertEqual(true);
} else {
let promise = kbController.hideKeyboard();
promise.then(res => {
console.info("inputMethodEngine_test_037 hideKeyboard promise result-----" + JSON.stringify(res));
expect(1 == 1).assertTrue();
}).catch(err => {
console.info("inputMethodEngine_test_037 hideKeyboard promise error----" + JSON.stringify(err));
expect().assertFail();
});
}
done();
});
})
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/InputmethohJsunit.test.ets
0 → 100644
浏览文件 @
f0ae84cc
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from "deccjsunit/index.ets";
import inputmeth from '@ohos.inputmethod';
export default function settingUiJsunit() {
describe('appInfoTest', function () {
console.log("************* settings Test start*************");
it('inputmethoh_test_001', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting();
console.log("inputmethoh_test_001 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.listInputMethod((arr) => {
console.info("inputmethoh_test_001 listInputMethod result---" + JSON.stringify(arr));
expect(1==1).assertTrue();
});
done();
});
it('inputmethoh_test_002', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting();
console.log("inputmethoh_test_002 result:" + JSON.stringify(inputMethodSetting));
let promise = inputMethodSetting.listInputMethod();
console.info("inputmethoh_test_002 listInputMethod result---" + JSON.stringify(promise));
let obj = promise[0];
console.info("inputmethoh_test_002 listInputMethod obj---" + JSON.stringify(obj));
expect(obj.packageName=='com.example.kikakeyboard').assertTrue();
expect(obj.methodId=='ServiceExtAbility').assertTrue();
done();
});
it('inputmethoh_test_003', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting();
console.log("inputmethoh_test_003 result:" + JSON.stringify(inputMethodSetting));
inputMethodSetting.displayOptionalInputMethod(() => {
console.info("inputmethoh_test_003 displayOptionalInputMethod---");
});
done();
});
it('inputmethoh_test_004', 0, async function (done) {
let inputMethodSetting = inputmeth.getInputMethodSetting();
console.log("inputmethoh_test_004 result:" + JSON.stringify(inputMethodSetting));
let promise = inputMethodSetting.displayOptionalInputMethod();
console.info("inputmethoh_test_004 displayOptionalInputMethod result---" + JSON.stringify(promise));
expect(promise).assertEqual(undefined)
done();
});
it('inputmethoh_test_005', 0, async function (done) {
let inputMethodCtrl = inputmeth.getInputMethodController();
console.log("inputmethoh_test_005 result:" + JSON.stringify(inputMethodCtrl));
inputMethodCtrl.stopInput((res) => {
console.info("inputmethoh_test_005 stopInput result----" + res);
});
done();
});
it('inputmethoh_test_006', 0, async function (done) {
let inputMethodCtrl = inputmeth.getInputMethodController();
console.log("inputmethoh_test_006 result:" + JSON.stringify(inputMethodCtrl));
let promise = inputMethodCtrl.stopInput();
console.info("inputmethoh_test_006 inputMethodCtrl stopInput result---" + JSON.stringify(promise));
expect(promise).assertEqual(true)
done();
});
})
}
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/List.test.ets
0 → 100644
浏览文件 @
f0ae84cc
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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 inputmethohJsunit from './InputmethohJsunit.test.ets';
import inputmethodEngineJsunit from './InputmethodEngineJsunit.test.ets';
export default function testsuite() {
inputmethohJsunit();
inputmethodEngineJsunit();
}
\ No newline at end of file
miscservices/InputMethodTest_ets/entry/src/main/ets/MainAbility/test/Utils.ets
0 → 100644
浏览文件 @
f0ae84cc
// @ts-nocheck
/**
* Copyright (c) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export default class Utils {
static rect_left;
static rect_top;
static rect_right;
static rect_bottom;
static rect_value;
static sleep(time) {
return new Promise((resolve, reject) => {
setTimeout(() => {
resolve()
}, time)
}).then(() => {
console.info(`sleep ${time} over...`)
})
}
static getComponentRect(key) {
let strJson = getInspectorByKey(key);
let obj = JSON.parse(strJson);
console.info("[getInspectorByKey] current component obj is: " + JSON.stringify(obj));
let rectInfo = JSON.parse('[' + obj.$rect + ']')
console.info("[getInspectorByKey] rectInfo is: " + rectInfo);
this.rect_left = JSON.parse('[' + rectInfo[0] + ']')[0]
this.rect_top = JSON.parse('[' + rectInfo[0] + ']')[1]
this.rect_right = JSON.parse('[' + rectInfo[1] + ']')[0]
this.rect_bottom = JSON.parse('[' + rectInfo[1] + ']')[1]
return this.rect_value = {
"left": this.rect_left, "top": this.rect_top, "right": this.rect_right, "bottom": this.rect_bottom
}
}
static async swipe(downX, downY, upX, upY, steps) {
console.info('start to swipe')
this.drags(downX, downY, upX, upY, steps, false)
}
static async drag(downX, downY, upX, upY, steps) {
console.info('start to drag')
this.drags(downX, downY, upX, upY, steps, true)
}
static async drags(downX, downY, upX, upY, steps, drag) {
var xStep;
var yStep;
var swipeSteps;
var ret;
xStep = 0;
yStep = 0;
ret = false;
swipeSteps = steps;
if (swipeSteps == 0) {
swipeSteps = 1;
}
xStep = (upX - downX) / swipeSteps;
yStep = (upY - downY) / swipeSteps;
console.info('move step is: ' + 'xStep: ' + xStep + ' yStep: ' + yStep)
var downPonit: TouchObject = {
id: 1,
x: downX,
y: downY,
type: TouchType.Down,
}
console.info('down touch started: ' + JSON.stringify(downPonit))
sendTouchEvent(downPonit);
console.info('start to move')
if (drag) {
await this.sleep(500)
}
for (var i = 1;i <= swipeSteps; i++) {
var movePoint: TouchObject = {
id: 1,
x: downX + (xStep * i),
y: downY + (yStep * i),
type: TouchType.Move
}
console.info('move touch started: ' + JSON.stringify(movePoint))
ret = sendTouchEvent(movePoint)
if (ret == false) {
break;
}
await this.sleep(5)
}
console.info('start to up')
if (drag) {
await this.sleep(100)
}
var upPoint: TouchObject = {
id: 1,
x: upX,
y: upY,
type: TouchType.Up,
}
console.info('up touch started: ' + JSON.stringify(upPoint))
sendTouchEvent(upPoint)
await this.sleep(500)
}
}
miscservices/InputMethodTest_ets/entry/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
f0ae84cc
{
"string"
:
[
{
"name"
:
"entry_MainAbility"
,
"value"
:
"entry_MainAbility"
},
{
"name"
:
"description_mainability"
,
"value"
:
"ETS_Empty Ability"
},
{
"name"
:
"string_hello"
,
"value"
:
"Hello"
},
{
"name"
:
"string_world"
,
"value"
:
"World"
},
{
"name"
:
"message_arrive"
,
"value"
:
"We will arrive at %s."
}
]
}
\ No newline at end of file
miscservices/InputMethodTest_ets/entry/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
f0ae84cc
6.6 KB
miscservices/InputMethodTest_ets/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
f0ae84cc
文件已添加
miscservices/PasteBoardTest_js/BUILD.gn
0 → 100644
浏览文件 @
f0ae84cc
# Copyright (C) 2021 Huawei Device Co., Ltd.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT 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("pasteboard_js_test") {
hap_profile = "./src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
]
certificate_profile = "./signature/openharmony_sx.p7b"
hap_name = "ActsPasteBoardJSApiTest"
}
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"
}
miscservices/PasteBoardTest_js/Test.json
0 → 100644
浏览文件 @
f0ae84cc
{
"description"
:
"Configuration for PasteBoard js api Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"180000"
,
"package"
:
"ohos.acts.miscservices.pasteboard"
,
"shell-timeout"
:
"180000"
},
"kits"
:
[
{
"test-file-name"
:
[
"ActsPasteBoardJSApiTest.hap"
],
"type"
:
"AppInstallKit"
,
"cleanup-apps"
:
true
}
]
}
miscservices/PasteBoardTest_js/signature/openharmony_sx.p7b
0 → 100644
浏览文件 @
f0ae84cc
文件已添加
miscservices/PasteBoardTest_js/src/main/config.json
0 → 100644
浏览文件 @
f0ae84cc
{
"app"
:
{
"bundleName"
:
"ohos.acts.miscservices.pasteboard"
,
"vendor"
:
"acts"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"target"
:
5
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"ohos.acts.miscservices.pasteboard"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
],
"distro"
:
{
"deliveryWithInstall"
:
true
,
"moduleName"
:
"entry"
,
"moduleType"
:
"entry"
},
"abilities"
:
[
{
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
"entity.system.home"
],
"actions"
:
[
"action.system.home"
]
}
],
"name"
:
"ohos.acts.miscservices.pasteboard.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"launchType"
:
"standard"
}
],
"js"
:
[
{
"pages"
:
[
"pages/index/index"
],
"name"
:
"default"
,
"window"
:
{
"designWidth"
:
720
,
"autoDesignWidth"
:
false
}
}
]
}
}
miscservices/PasteBoardTest_js/src/main/js/default/app.js
0 → 100644
浏览文件 @
f0ae84cc
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
'
);
}
};
miscservices/PasteBoardTest_js/src/main/js/default/i18n/en-US.json
0 → 100644
浏览文件 @
f0ae84cc
{
"strings"
:
{
"hello"
:
"Hello"
,
"world"
:
"World"
}
}
\ No newline at end of file
miscservices/PasteBoardTest_js/src/main/js/default/i18n/zh-CN.json
0 → 100644
浏览文件 @
f0ae84cc
{
"strings"
:
{
"hello"
:
"您好"
,
"world"
:
"世界"
}
}
\ No newline at end of file
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.css
0 → 100644
浏览文件 @
f0ae84cc
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.hml
0 → 100644
浏览文件 @
f0ae84cc
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.js
0 → 100644
浏览文件 @
f0ae84cc
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
{
Core
,
ExpectExtend
}
from
'
deccjsunit/index
'
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.addService('report', instrumentLog)
core
.
init
()
// core.subscribeEvent('spec', instrumentLog)
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const
configService
=
core
.
getDefaultService
(
'
config
'
)
configService
.
setConfig
(
this
)
require
(
'
../../test/List.test
'
)
core
.
execute
()
},
onReady
()
{
},
}
miscservices/PasteBoardTest_js/src/main/js/default/test/List.test.js
0 → 100644
浏览文件 @
f0ae84cc
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT 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
(
'
./PasteBoardJsunit.test.js
'
)
\ No newline at end of file
miscservices/PasteBoardTest_js/src/main/js/default/test/PasteBoardJsunit.test.js
0 → 100644
浏览文件 @
f0ae84cc
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT 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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryText
(),
textData
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_PLAIN
),
true
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_PLAIN
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0100 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
var
textData
=
''
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_PLAIN
),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0200 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
var
textData
=
'
Hello 中国!@#$%^&*()_+{}
\
?.
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryText
(),
textData
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_PLAIN
),
true
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_PLAIN
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0300 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
var
textData
=
''
for
(
var
i
=
0
;
i
<
(
300
*
1024
);
i
++
){
textData
=
textData
+
"
A
"
;
}
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryText
(),
textData
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_PLAIN
),
true
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_PLAIN
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0400 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
var
textData
=
''
var
textData300
=
''
for
(
var
i
=
0
;
i
<
(
301
*
1024
);
i
++
){
textData
=
textData
+
"
A
"
;
if
(
299
==
i
)
{
textData300
=
textData
}
}
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryText
(),
textData300
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_PLAIN
),
true
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_PLAIN
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0500 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
createHtmlData =
'
+
htmlText
)
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryHtml
(),
htmlText
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_HTML MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_HTML
),
true
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_HTML
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0600 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
htmlText
=
''
console
.
log
(
'
createHtmlData =
'
+
htmlText
)
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_HTML MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_HTML
),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0700 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
htmlText
=
'
Hello 中国!@#$%^&*()_+{}
\
?.
'
console
.
log
(
'
createHtmlData =
'
+
htmlText
)
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryHtml
(),
htmlText
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_HTML MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_HTML
),
true
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_HTML
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0800 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
createUriData =
'
+
uriText
)
var
pasteData
=
pasteboard
.
createUriData
(
uriText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryUri
(),
uriText
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_URI MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_URI
),
true
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_URI
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0900 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
uriText
=
''
console
.
log
(
'
createUriData =
'
+
uriText
)
var
pasteData
=
pasteboard
.
createUriData
(
uriText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_URI MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_URI
),
false
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_URI
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1000 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
uriText
=
'
Hello 中国!@#$%^&*()_+{}
\
?.
'
console
.
log
(
'
createUriData =
'
+
uriText
)
var
pasteData
=
pasteboard
.
createUriData
(
uriText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryUri
(),
uriText
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_URI MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_URI
),
true
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_URI
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1100 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
want
=
new
Want
()
console
.
log
(
'
createWantData =
'
+
want
)
var
pasteData
=
pasteboard
.
createWantData
(
want
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
deepEqual
(
pasteData
.
getPrimaryWant
(),
want
)
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_WANT MIME type of data
'
)
assert
.
equal
(
pasteData
.
hasMimeType
(
MIMETYPE_TEXT_WANT
),
true
)
assert
.
equal
(
pasteData
.
getPrimaryMimeType
(),
MIMETYPE_TEXT_WANT
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1200 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1300 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
addTextRecord =
'
+
textData1
)
pasteData
.
addTextRecord
(
textData1
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData0
)
assert
.
equal
(
pasteData
.
getRecordAt
(
1
).
plainText
,
textData1
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1400 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
15
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
15
)
console
.
log
(
'
Checks the pasteboard content
'
)
for
(
var
i
=
0
;
i
<
15
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
assert
.
equal
(
pasteData
.
getRecordAt
(
i
).
plainText
,
textData
)
}
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1500 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
30
)
console
.
log
(
'
Checks the pasteboard content
'
)
for
(
var
i
=
0
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
assert
.
equal
(
pasteData
.
getRecordAt
(
i
).
plainText
,
textData
)
}
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1600 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
31
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
30
)
console
.
log
(
'
Checks the pasteboard content
'
)
for
(
var
i
=
0
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
assert
.
equal
(
pasteData
.
getRecordAt
(
i
).
plainText
,
textData
)
}
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1700 end
'
);
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1800
* @tc.name Adds PlainText,HtmlText,UriText,WantText
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test18
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
addHtmlRecord =
'
+
htmlText
)
pasteData
.
addHtmlRecord
(
htmlText
)
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
addUriRecord =
'
+
uriText
)
pasteData
.
addUriRecord
(
uriText
)
var
wantText
=
new
Want
()
console
.
log
(
'
addWantRecord =
'
+
wantText
)
pasteData
.
addWantRecord
(
wantText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
4
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData
)
assert
.
equal
(
pasteData
.
getRecordAt
(
1
).
htmlText
,
htmlText
)
assert
.
equal
(
pasteData
.
getRecordAt
(
2
).
uri
,
uriText
)
assert
.
deepEqual
(
pasteData
.
getRecordAt
(
3
).
want
,
wantText
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1800 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1900 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
createHtmlData =
'
+
htmlText
)
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2000 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
createUriData =
'
+
uriText
)
var
pasteData
=
pasteboard
.
createUriData
(
uriText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2100 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
want
=
new
Want
()
console
.
log
(
'
createWantData =
'
+
want
)
var
pasteData
=
pasteboard
.
createWantData
(
want
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2200 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
var
textData
=
''
for
(
var
i
=
0
;
i
<
(
300
*
1024
);
i
++
){
textData
=
textData
+
"
A
"
;
}
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2300 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
30
)
for
(
var
i
=
0
;
i
<
30
;
i
++
)
{
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
}
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2400 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
Replaces the Record =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2500 end
'
);
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2600
* @tc.name Deletes 文本、uri、html、want records
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test26
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
htmlText0
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
addHtmlRecord =
'
+
htmlText0
)
pasteData
.
addHtmlRecord
(
htmlText0
)
var
wantText0
=
new
Want
()
console
.
log
(
'
addWantRecord =
'
+
wantText0
)
pasteData
.
addWantRecord
(
wantText0
)
var
uriText0
=
'
https://www.baidu.com/
'
console
.
log
(
'
addUriRecord =
'
+
uriText0
)
pasteData
.
addUriRecord
(
uriText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
4
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
1
),
true
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
2
),
true
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
3
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2600 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
Replaces the PlainText =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData1
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2700 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
htmlText0
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
addHtmlRecord =
'
+
htmlText0
)
pasteData
.
addHtmlRecord
(
htmlText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
var
htmlText1
=
'
<html><head></head><body>Hello World 1</body></html>
'
console
.
log
(
'
Replaces the htmlText =
'
+
htmlText1
)
pasteDataRecord
=
pasteboard
.
createHtmlTextRecord
(
htmlText1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
1
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
1
).
htmlText
,
htmlText1
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2800 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
uriText0
=
'
https://www.baidu.com/
'
console
.
log
(
'
addUriRecord =
'
+
uriText0
)
pasteData
.
addUriRecord
(
uriText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
var
uriText1
=
'
https://www.baidu.com/1
'
console
.
log
(
'
Replaces the uriText =
'
+
uriText1
)
pasteDataRecord
=
pasteboard
.
createUriRecord
(
uriText1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
1
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
1
).
uri
,
uriText1
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2900 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
wantText0
=
new
Want
()
console
.
log
(
'
addWantRecord =
'
+
wantText0
)
pasteData
.
addWantRecord
(
wantText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
var
wantText1
=
new
Want
()
console
.
log
(
'
Replaces the wantText =
'
+
wantText1
)
pasteDataRecord
=
pasteboard
.
createWantRecord
(
wantText1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
deepEqual
(
pasteData
.
getRecordAt
(
1
).
want
,
wantText1
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3000 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
''
for
(
var
i
=
0
;
i
<
(
300
*
1024
);
i
++
)
{
textData0
=
textData0
+
"
A
"
;
}
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
Replaces the PlainText =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData1
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3100 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3200 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
addTextRecord =
'
+
textData1
)
pasteData
.
addTextRecord
(
textData1
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3300 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
15
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
15
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3400 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
30
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3500 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
31
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
30
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3600 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
Replaces the PlainText =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3700 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Clears the pasteboard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3800 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Sets the Property
'
)
var
pasteDataProperty
=
pasteData
.
getProperty
()
console
.
log
(
'
timestamp =
'
+
pasteDataProperty
.
timestamp
)
pasteDataProperty
.
additions
[
"
one
"
]
=
"
Hello
"
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the Property
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
pasteDataProperty
=
pasteData
.
getProperty
()
console
.
log
(
'
timestamp =
'
+
pasteDataProperty
.
timestamp
)
assert
.
equal
(
pasteDataProperty
.
additions
[
"
one
"
],
"
Hello
"
)
assert
.
equal
(
pasteDataProperty
.
mimeTypes
[
0
],
MIMETYPE_TEXT_PLAIN
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3900 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Sets the Property
'
)
var
pasteDataProperty
=
pasteData
.
getProperty
()
console
.
log
(
'
timestamp =
'
+
pasteDataProperty
.
timestamp
)
pasteDataProperty
.
tag
=
"
Test
"
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the Property
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
pasteDataProperty
=
pasteData
.
getProperty
()
console
.
log
(
'
timestamp =
'
+
pasteDataProperty
.
timestamp
)
assert
.
equal
(
pasteDataProperty
.
tag
,
"
Test
"
)
assert
.
equal
(
pasteDataProperty
.
tag
,
pasteData
.
getTag
())
assert
.
equal
(
pasteDataProperty
.
mimeTypes
[
0
],
MIMETYPE_TEXT_PLAIN
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4000 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
Checks the Property
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
pasteDataProperty
=
pasteData
.
getProperty
()
console
.
log
(
'
timestamp =
'
+
pasteDataProperty
.
timestamp
)
assert
.
equal
(
pasteDataProperty
.
tag
,
""
)
assert
.
equal
(
pasteDataProperty
.
mimeTypes
.
length
,
0
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4100 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
Replaces the PlainText =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4200 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
htmlText0
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
addHtmlRecord =
'
+
htmlText0
)
pasteData
.
addHtmlRecord
(
htmlText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
var
htmlText1
=
'
<html><head></head><body>Hello World 1</body></html>
'
console
.
log
(
'
Replaces the htmlText =
'
+
htmlText1
)
pasteDataRecord
=
pasteboard
.
createHtmlTextRecord
(
htmlText1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
1
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
1
).
htmlText
,
htmlText1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4300 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
uriText0
=
'
https://www.baidu.com/
'
console
.
log
(
'
addUriRecord =
'
+
uriText0
)
pasteData
.
addUriRecord
(
uriText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
var
uriText1
=
'
https://www.baidu.com/1
'
console
.
log
(
'
Replaces the uriText =
'
+
uriText1
)
pasteDataRecord
=
pasteboard
.
createUriRecord
(
uriText1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
1
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
1
).
uri
,
uriText1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4400 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
wantText0
=
new
Want
()
console
.
log
(
'
addWantRecord =
'
+
wantText0
)
pasteData
.
addWantRecord
(
wantText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
var
wantText1
=
new
Want
()
console
.
log
(
'
Replaces the wantText =
'
+
wantText1
)
pasteDataRecord
=
pasteboard
.
createWantRecord
(
wantText1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
deepEqual
(
pasteData
.
getRecordAt
(
1
).
want
,
wantText1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4500 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
Replaces the PlainText =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4600 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Closes the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
Replaces the PlainText =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4700 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Closes the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
htmlText0
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
addHtmlRecord =
'
+
htmlText0
)
pasteData
.
addHtmlRecord
(
htmlText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
var
htmlText1
=
'
<html><head></head><body>Hello World 1</body></html>
'
console
.
log
(
'
Replaces the htmlText =
'
+
htmlText1
)
pasteDataRecord
=
pasteboard
.
createHtmlTextRecord
(
htmlText1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
1
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
1
).
htmlText
,
htmlText1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4800 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Closes the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
uriText0
=
'
https://www.baidu.com/
'
console
.
log
(
'
addUriRecord =
'
+
uriText0
)
pasteData
.
addUriRecord
(
uriText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
var
uriText1
=
'
https://www.baidu.com/1
'
console
.
log
(
'
Replaces the uriText =
'
+
uriText1
)
pasteDataRecord
=
pasteboard
.
createUriRecord
(
uriText1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
1
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
1
).
uri
,
uriText1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4900 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Closes the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
wantText0
=
new
Want
()
console
.
log
(
'
addWantRecord =
'
+
wantText0
)
pasteData
.
addWantRecord
(
wantText0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
var
wantText1
=
new
Want
()
console
.
log
(
'
Replaces the wantText =
'
+
wantText1
)
pasteDataRecord
=
pasteboard
.
createWantRecord
(
wantText1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
2
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
deepEqual
(
pasteData
.
getRecordAt
(
1
).
want
,
wantText1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5000 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
console
.
log
(
'
Closes the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
contentChanges
)
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
Replaces the PlainText =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getRecordAt
(
0
).
plainText
,
textData1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5100 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryText
(),
textData
)
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5200 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
createUriData =
'
+
uriText
)
var
pasteData
=
pasteboard
.
createUriData
(
uriText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryUri
(),
uriText
)
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5300 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
createHtmlData =
'
+
htmlText
)
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryHtml
(),
htmlText
)
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5400 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
want
=
new
Want
()
console
.
log
(
'
createWantData =
'
+
want
)
var
pasteData
=
pasteboard
.
createWantData
(
want
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Checks the pasteboard content
'
)
assert
.
equal
(
pasteData
.
getPrimaryWant
(),
want
)
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5500 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
30
)
console
.
log
(
'
Checks the pasteboard content
'
)
for
(
var
i
=
0
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
assert
.
equal
(
pasteData
.
getRecordAt
(
i
).
plainText
,
textData
)
}
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5600 end
'
);
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5700
* @tc.name 向剪贴板数据各增加5条文本、uri、html、want数据,然后清除
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test57
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
5
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
var
htmlText
=
''
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
htmlText
=
htmlText
+
i
console
.
log
(
'
addHtmlRecord =
'
+
htmlText
)
pasteData
.
addHtmlRecord
(
htmlText
)
}
var
uriText
=
''
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
uriText
=
'
https://www.baidu.com/
'
uriText
=
uriText
+
i
console
.
log
(
'
addUriRecord =
'
+
uriText
)
pasteData
.
addUriRecord
(
uriText
)
}
var
wantText
=
new
Want
()
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
wantText
=
new
Want
()
console
.
log
(
'
addWantRecord =
'
+
wantText
)
pasteData
.
addWantRecord
(
wantText
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
20
)
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5700 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5800 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
createUriData =
'
+
uriText
)
var
pasteData
=
pasteboard
.
createUriData
(
uriText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5900 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
createHtmlData =
'
+
htmlText
)
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6000 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
want
=
new
Want
()
console
.
log
(
'
createWantData =
'
+
want
)
var
pasteData
=
pasteboard
.
createWantData
(
want
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6100 end
'
);
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6200
* @tc.name 向剪贴板数据各增加5条文本、uri、html、want数据,查询剪贴板存在剪贴板数据
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test62
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World0
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
5
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
var
htmlText
=
''
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
htmlText
=
htmlText
+
i
console
.
log
(
'
addHtmlRecord =
'
+
htmlText
)
pasteData
.
addHtmlRecord
(
htmlText
)
}
var
uriText
=
''
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
uriText
=
'
https://www.baidu.com/
'
uriText
=
uriText
+
i
console
.
log
(
'
addUriRecord =
'
+
uriText
)
pasteData
.
addUriRecord
(
uriText
)
}
var
wantText
=
new
Want
()
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
wantText
=
new
Want
()
console
.
log
(
'
addWantRecord =
'
+
wantText
)
pasteData
.
addWantRecord
(
wantText
)
}
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6200 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData0
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
var
textData1
=
'
Hello World1
'
console
.
log
(
'
Replaces the PlainText =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
assert
.
equal
(
pasteData
.
replaceRecordAt
(
0
,
pasteDataRecord
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6300 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Removes the Record
'
)
assert
.
equal
(
pasteData
.
removeRecordAt
(
0
),
true
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6400 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
0
)
console
.
log
(
'
Checks there is no content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
false
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6500 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello World!
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Converts the PlainTextData to text
'
)
var
pasteDataRecord
=
pasteData
.
getRecordAt
(
0
)
assert
.
equal
(
pasteDataRecord
.
convertToText
(),
textData
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6600 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
'
Hello 中国!@#$%^&*()_+{}
\
?.
'
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Converts the PlainTextData to text
'
)
var
pasteDataRecord
=
pasteData
.
getRecordAt
(
0
)
assert
.
equal
(
pasteDataRecord
.
convertToText
(),
textData
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6700 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
textData
=
''
var
textData300
=
''
for
(
var
i
=
0
;
i
<
(
301
*
1024
);
i
++
){
textData
=
textData
+
"
A
"
;
if
(
299
==
i
)
{
textData300
=
textData
}
}
console
.
log
(
'
createPlainTextData =
'
+
textData
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Converts the PlainTextData to text
'
)
var
pasteDataRecord
=
pasteData
.
getRecordAt
(
0
)
assert
.
equal
(
pasteDataRecord
.
convertToText
(),
textData300
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6800 end
'
);
})
/**
* @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
()
=>
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
()
systemPasteboard
.
on
(
contentChanges
)
systemPasteboard
.
clear
()
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
createUriData =
'
+
uriText
)
var
pasteData
=
pasteboard
.
createUriData
(
uriText
)
console
.
log
(
'
Writes PasteData to the pasteboard
'
)
systemPasteboard
.
setPasteData
(
pasteData
)
console
.
log
(
'
Checks there is content in the pasteboard
'
)
assert
.
equal
(
systemPasteboard
.
hasPasteData
(),
true
)
console
.
log
(
'
Checks the number of records
'
)
pasteData
=
systemPasteboard
.
getPasteData
()
assert
.
equal
(
pasteData
.
getRecordCount
(),
1
)
console
.
log
(
'
Converts the uri to text
'
)
var
pasteDataRecord
=
pasteData
.
getRecordAt
(
0
)
assert
.
equal
(
pasteDataRecord
.
convertToText
(),
uriText
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6900 end
'
);
})
/**
* The callback function is used for pasteboard content changes
*/
function
contentChanges
()
{
console
.
log
(
'
#EVENT: The content is changed in the pasteboard
'
)
}
})
miscservices/PasteBoardTest_js/src/main/resources/base/element/string.json
0 → 100644
浏览文件 @
f0ae84cc
{
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"JstimeTest"
},
{
"name"
:
"mainability_description"
,
"value"
:
"JS_Phone_Empty Feature Ability"
}
]
}
\ No newline at end of file
miscservices/PasteBoardTest_js/src/main/resources/base/media/icon.png
0 → 100644
浏览文件 @
f0ae84cc
6.6 KB
miscservices/RequestTest_js/signature/openharmony_sx.p7b
浏览文件 @
f0ae84cc
无法预览此类型文件
miscservices/TimeTest_js/signature/openharmony_sx.p7b
浏览文件 @
f0ae84cc
无法预览此类型文件
miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js
浏览文件 @
f0ae84cc
...
...
@@ -613,12 +613,12 @@ describe('TimeTest', function() {
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
var
resGetTime
=
systemTime
.
getCurrentTime
()
var
resGetTime
=
systemTime
.
getCurrentTime
(
true
)
console
.
log
(
'
GetTime =
'
+
resGetTime
)
assert
.
equal
(
resGetTime
,
time
)
sleep
(
5000
).
then
(()
=>
{
resGetTime
=
systemTime
.
getCurrentTime
();
resGetTime
=
systemTime
.
getCurrentTime
(
true
);
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
(
time
+
6000
)
&&
resGetTime
>=
(
time
+
5000
));
...
...
@@ -641,12 +641,12 @@ describe('TimeTest', function() {
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
var
resGetTime
=
systemTime
.
getCurrentTime
()
var
resGetTime
=
systemTime
.
getCurrentTime
(
true
)
console
.
log
(
'
GetTime =
'
+
resGetTime
)
assert
.
equal
(
resGetTime
,
time
)
sleep
(
5000
).
then
(()
=>
{
resGetTime
=
systemTime
.
getCurrentTime
();
resGetTime
=
systemTime
.
getCurrentTime
(
true
);
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
(
time
+
6000
)
&&
resGetTime
>=
(
time
+
5000
));
...
...
@@ -669,12 +669,12 @@ describe('TimeTest', function() {
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
var
resGetTime
=
systemTime
.
getCurrentTime
()
var
resGetTime
=
systemTime
.
getCurrentTime
(
true
)
console
.
log
(
'
GetTime =
'
+
resGetTime
)
assert
.
equal
(
resGetTime
,
time
)
sleep
(
5000
).
then
(()
=>
{
resGetTime
=
systemTime
.
getCurrentTime
();
resGetTime
=
systemTime
.
getCurrentTime
(
true
);
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
(
time
+
6000
)
&&
resGetTime
>=
(
time
+
5000
));
...
...
@@ -684,7 +684,7 @@ describe('TimeTest', function() {
/**
* @tc.number SUB_systemTime_setTime_JS_API_0400
* @tc.name Test systemTime.setTime time =
Number.MAX_VALUE/2, getCurrentTimeNs
* @tc.name Test systemTime.setTime time =
-1
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
...
...
@@ -692,37 +692,12 @@ describe('TimeTest', function() {
*/
it
(
'
systemTime_setTime_test4
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0400 start
'
)
var
time
=
Number
.
MAX_VALUE
/
2
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
sleep
(
5000
).
then
(()
=>
{
var
resGetTime
=
systemTime
.
getCurrentTimeNs
();
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
((
time
+
6000
)
*
1000000
)
&&
resGetTime
>=
((
time
+
5000
)
*
1000000
));
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0400 end
'
);
})
})
/**
* @tc.number SUB_systemTime_setTime_JS_API_0500
* @tc.name Test systemTime.setTime time = -1
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTime_test5
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0500 start
'
)
var
time
=
-
1
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0
5
00 end
'
);
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0
4
00 end
'
);
})
/**
...
...
@@ -1047,29 +1022,6 @@ describe('TimeTest', function() {
})
})
/**
* @tc.number SUB_systemTime_getRealActiveTimeNs_JS_API_0100
* @tc.name Test systemTime.getRealActiveTimeNs
* @tc.desc Test systemTime_getRealActiveTimeNs API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_getRealActiveTimeNs_test1
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_getRealActiveTimeNs_JS_API_0100 start
'
)
var
resGetTime0
=
systemTime
.
getRealActiveTimeNs
()
console
.
log
(
'
GetTime0 =
'
+
resGetTime0
)
sleep
(
5000
).
then
(()
=>
{
var
resGetTime1
=
systemTime
.
getRealActiveTimeNs
();
console
.
log
(
'
GetTime1 =
'
+
resGetTime1
);
assert
.
equal
(
resGetTime1
<=
(
resGetTime0
+
6000
*
1000000
)
&&
resGetTime1
>=
(
resGetTime0
+
5000
*
1000000
));
console
.
log
(
'
SUB_systemTime_getRealActiveTimeNs_JS_API_0100 end
'
);
})
})
/**
* @tc.number SUB_systemTime_getRealTime_JS_API_0100
* @tc.name Test systemTime.getRealTime
...
...
@@ -1093,29 +1045,6 @@ describe('TimeTest', function() {
})
})
/**
* @tc.number SUB_systemTime_getRealTimeNs_JS_API_0100
* @tc.name Test systemTime.getRealTimeNs
* @tc.desc Test systemTime_getRealTimeNs API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_getRealTimeNs_test1
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_getRealTimeNs_JS_API_0100 start
'
)
var
resGetTime0
=
systemTime
.
getRealTimeNs
()
console
.
log
(
'
GetTime0 =
'
+
resGetTime0
)
sleep
(
5000
).
then
(()
=>
{
var
resGetTime1
=
systemTime
.
getRealTimeNs
();
console
.
log
(
'
GetTime1 =
'
+
resGetTime1
);
assert
.
equal
(
resGetTime1
<=
(
resGetTime0
+
6000
*
1000000
)
&&
resGetTime1
>=
(
resGetTime0
+
5000
*
1000000
));
console
.
log
(
'
SUB_systemTime_getRealTimeNs_JS_API_0100 end
'
);
})
})
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
));
}
...
...
miscservices/TimerTest_js/signature/openharmony_sx.p7b
浏览文件 @
f0ae84cc
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录