Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
e3851ff2
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看板
未验证
提交
e3851ff2
编写于
4月 25, 2022
作者:
O
openharmony_ci
提交者:
Gitee
4月 25, 2022
浏览文件
操作
浏览文件
下载
差异文件
!2906 修改剪贴板和定时服务用
Merge pull request !2906 from liulinna/OpenHarmony-3.1-Release
上级
f316b279
63c8b419
变更
21
隐藏空白更改
内联
并排
Showing
21 changed file
with
4490 addition
and
3916 deletion
+4490
-3916
miscservices/BUILD.gn
miscservices/BUILD.gn
+1
-1
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.css
...steBoardTest_js/src/main/js/default/pages/index/index.css
+0
-9
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.hml
...steBoardTest_js/src/main/js/default/pages/index/index.hml
+0
-5
miscservices/PasteBoardTest_js/src/main/js/default/test/PasteBoardJsunit.test.js
...Test_js/src/main/js/default/test/PasteBoardJsunit.test.js
+0
-3153
miscservices/TimeTest_js/src/main/js/default/pages/index/index.js
...ices/TimeTest_js/src/main/js/default/pages/index/index.js
+1
-0
miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.Pertest.js
...t_js/src/main/js/default/test/SystemTimeJsunit.Pertest.js
+10
-4
miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js
...Test_js/src/main/js/default/test/SystemTimeJsunit.test.js
+813
-721
miscservices/actspasteboardjsapitest/BUILD.gn
miscservices/actspasteboardjsapitest/BUILD.gn
+4
-4
miscservices/actspasteboardjsapitest/Test.json
miscservices/actspasteboardjsapitest/Test.json
+3
-3
miscservices/actspasteboardjsapitest/entry/src/main/config.json
...rvices/actspasteboardjsapitest/entry/src/main/config.json
+8
-7
miscservices/actspasteboardjsapitest/entry/src/main/js/default/app.js
.../actspasteboardjsapitest/entry/src/main/js/default/app.js
+0
-1
miscservices/actspasteboardjsapitest/entry/src/main/js/default/i18n/en-US.json
...eboardjsapitest/entry/src/main/js/default/i18n/en-US.json
+0
-0
miscservices/actspasteboardjsapitest/entry/src/main/js/default/i18n/zh-CN.json
...eboardjsapitest/entry/src/main/js/default/i18n/zh-CN.json
+0
-0
miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.css
...jsapitest/entry/src/main/js/default/pages/index/index.css
+24
-0
miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.hml
...jsapitest/entry/src/main/js/default/pages/index/index.hml
+20
-0
miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.js
...djsapitest/entry/src/main/js/default/pages/index/index.js
+4
-7
miscservices/actspasteboardjsapitest/entry/src/main/js/default/test/List.test.js
...oardjsapitest/entry/src/main/js/default/test/List.test.js
+0
-0
miscservices/actspasteboardjsapitest/entry/src/main/js/default/test/PasteBoardJsunit.test.js
...t/entry/src/main/js/default/test/PasteBoardJsunit.test.js
+3601
-0
miscservices/actspasteboardjsapitest/entry/src/main/js/resources/base/element/string.json
...test/entry/src/main/js/resources/base/element/string.json
+1
-1
miscservices/actspasteboardjsapitest/entry/src/main/js/resources/base/media/icon.png
...jsapitest/entry/src/main/js/resources/base/media/icon.png
+0
-0
miscservices/actspasteboardjsapitest/signature/openharmony_sx.p7b
...ices/actspasteboardjsapitest/signature/openharmony_sx.p7b
+0
-0
未找到文件。
miscservices/BUILD.gn
浏览文件 @
e3851ff2
...
...
@@ -16,9 +16,9 @@ group("miscservices") {
testonly = true
deps = [
"InputMethodTest_ets:ActsInputMethodEtsTest",
"PasteBoardTest_js:ActsPasteBoardJSApiTest",
"RequestTest_js:ActsMiscservicesRequestJSApiTest",
# "TimeTest_js:ActsTimeJSApiTest",
"TimerTest_js:ActsTimerJSApiTest",
"actspasteboardjsapitest:ActsPasteBoardJSApiTest",
]
}
miscservices/PasteBoardTest_js/src/main/js/default/pages/index/index.css
已删除
100644 → 0
浏览文件 @
f316b279
.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
已删除
100644 → 0
浏览文件 @
f316b279
<div class="container">
<text class="title">
{{ $t('strings.hello') }} {{ title }}
</text>
</div>
miscservices/PasteBoardTest_js/src/main/js/default/test/PasteBoardJsunit.test.js
已删除
100644 → 0
浏览文件 @
f316b279
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT 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
*
1
);
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
*
1
);
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
(
'
Checks the MIME types of all content on the pasteboard
'
)
var
getMimeTypesArray
=
pasteData
.
getMimeTypes
()
assert
.
equal
(
getMimeTypesArray
[
0
],
MIMETYPE_TEXT_PLAIN
)
assert
.
equal
(
getMimeTypesArray
[
1
],
MIMETYPE_TEXT_HTML
)
assert
.
equal
(
getMimeTypesArray
[
2
],
MIMETYPE_TEXT_URI
)
assert
.
equal
(
getMimeTypesArray
[
3
],
MIMETYPE_TEXT_WANT
)
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
*
1
);
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
*
1
);
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
*
1
);
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/TimeTest_js/src/main/js/default/pages/index/index.js
浏览文件 @
e3851ff2
...
...
@@ -40,6 +40,7 @@ export default {
// core.subscribeEvent('suite', instrumentLog)
// core.subscribeEvent('task', instrumentLog)
const
configService
=
core
.
getDefaultService
(
'
config
'
)
this
.
timeout
=
30000
configService
.
setConfig
(
this
)
require
(
'
../../test/List.test
'
)
...
...
miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.Pertest.js
浏览文件 @
e3851ff2
...
...
@@ -30,14 +30,17 @@ describe('TimeTest', function() {
*/
it
(
'
systemTime_setTime_test1
'
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTime_JS_API_0100 start
"
);
systemTime
.
setTime
(
152600
,
(
err
,
data
)
=>
{
// callback形式调用异步接口
if
(
err
)
{
systemTime
.
setTime
(
66666666
,
(
err
,
data
)
=>
{
// callback形式调用异步接口
if
(
(
typeof
err
!==
'
undefined
'
)
&&
(
err
.
code
!==
0
)
)
{
console
.
error
(
'
SetTime failed because
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
return
;
}
console
.
info
(
'
SetTime success data :
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
();
done
();
return
;
});
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0100 end
'
);
})
...
...
@@ -52,14 +55,17 @@ describe('TimeTest', function() {
*/
it
(
'
systemTime_setTimezone_test1
'
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0100 start
"
);
systemTime
.
setTimezone
(
'
A
nadyr, Russia
'
,
(
err
,
data
)
=>
{
// callback形式调用异步接口
if
(
err
)
{
systemTime
.
setTimezone
(
'
A
sia/Shanghai
'
,
(
err
,
data
)
=>
{
// callback形式调用异步接口
if
(
(
typeof
err
!==
'
undefined
'
)
&&
(
err
.
code
!==
0
)
)
{
console
.
error
(
'
setTimezone failed because
'
+
JSON
.
stringify
(
err
));
expect
().
assertFail
();
done
();
return
;
}
console
.
info
(
'
setTimezone success data :
'
+
JSON
.
stringify
(
data
));
expect
(
true
).
assertTrue
();
done
();
return
;
});
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0100 end
'
);
})
...
...
miscservices/TimeTest_js/src/main/js/default/test/SystemTimeJsunit.test.js
浏览文件 @
e3851ff2
...
...
@@ -14,99 +14,123 @@
*/
// @ts-nocheck
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
systemTime
from
'
@ohos.systemtime
'
describe
(
'
TimeTest
'
,
function
()
{
console
.
log
(
'
start################################start
'
);
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
,
}
from
"
deccjsunit/index
"
;
import
systemTime
from
"
@ohos.systemtime
"
;
describe
(
"
TimeTest
"
,
function
()
{
console
.
log
(
"
start################################start
"
);
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0100
* @tc.name Test systemTime.setTimezone timezone = 'An
adyr, Russia
'
* @tc.name Test systemTime.setTimezone timezone = 'An
tarctica/McMurdo
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test1
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0100 start
'
)
var
timezone
=
'
Anadyr, Russia
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0100 end
'
);
})
it
(
"
systemTime_setTimezone_test1
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0100 start
"
);
var
timezone
=
"
Antarctica/McMurdo
"
;
console
.
log
(
"
f_test1: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test1: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test1: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0100 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0200
* @tc.name Test systemTime.setTimezone timezone = '
Honiara, SolomonIsland
s'
* @tc.name Test systemTime.setTimezone timezone = '
America/Argentina/Buenos_Aire
s'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test2
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0200 start
'
)
var
timezone
=
'
Honiara, SolomonIslands
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0200 end
'
);
})
it
(
"
systemTime_setTimezone_test2
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0200 start
"
);
var
timezone
=
"
America/Argentina/Buenos_Aires
"
;
console
.
log
(
"
f_test2: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test2: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test2: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0200 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0300
* @tc.name Test systemTime.setTimezone timezone = '
Melbourne, Australia
'
* @tc.name Test systemTime.setTimezone timezone = '
Australia/Sydney
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test3
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0300 start
'
)
var
timezone
=
'
Melbourne, Australia
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0300 end
'
);
})
it
(
"
systemTime_setTimezone_test3
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0300 start
"
);
var
timezone
=
"
Australia/Sydney
"
;
console
.
log
(
"
f_test3: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test3: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test3: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0300 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0400
* @tc.name Test systemTime.setTimezone timezone = '
Tokyo, Japan
'
* @tc.name Test systemTime.setTimezone timezone = '
America/Noronha
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test4
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0400 start
'
)
var
timezone
=
'
Tokyo, Japan
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0400 end
'
);
})
it
(
"
systemTime_setTimezone_test4
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0400 start
"
);
var
timezone
=
"
America/Noronha
"
;
console
.
log
(
"
f_test4: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test4: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test4: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0400 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0500
* @tc.name Test systemTime.setTimezone timezone = 'Beijing, China'
...
...
@@ -115,517 +139,595 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test5
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0500 start
'
)
var
timezone
=
'
Beijing, China
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0500 end
'
);
})
it
(
"
systemTime_setTimezone_test5
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0500 start
"
);
var
timezone
=
"
America/St_Johns
"
;
console
.
log
(
"
f_test5: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test5: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test5: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0500 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0600
* @tc.name Test systemTime.setTimezone timezone = '
Jakarta, Indonesi
a'
* @tc.name Test systemTime.setTimezone timezone = '
Africa/Kinshas
a'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test6
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0600 start
'
)
var
timezone
=
'
Jakarta, Indonesia
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0600 end
'
);
})
it
(
"
systemTime_setTimezone_test6
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0600 start
"
);
var
timezone
=
"
Africa/Kinshasa
"
;
console
.
log
(
"
f_test6: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test6: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test6: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0600 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0700
* @tc.name Test systemTime.setTimezone timezone = '
Dhaka, Bangladesh
'
* @tc.name Test systemTime.setTimezone timezone = '
America/Santiago
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test7
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0700 start
'
)
var
timezone
=
'
Dhaka, Bangladesh
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0700 end
'
);
})
it
(
"
systemTime_setTimezone_test7
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0700 start
"
);
var
timezone
=
"
America/Santiago
"
;
console
.
log
(
"
f_test7: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test7: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test7: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0700 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0800
* @tc.name Test systemTime.setTimezone timezone = '
Tashkent, Uzbekistan
'
* @tc.name Test systemTime.setTimezone timezone = '
Asia/Shanghai
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test8
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0800 start
'
)
var
timezone
=
'
Tashkent, Uzbekistan
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0800 end
'
);
})
it
(
"
systemTime_setTimezone_test8
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0800 start
"
);
var
timezone
=
"
Asia/Shanghai
"
;
console
.
log
(
"
f_test8: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test8: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test8: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0800 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_0900
* @tc.name Test systemTime.setTimezone timezone = '
Dubai, U.A.E.
'
* @tc.name Test systemTime.setTimezone timezone = '
Asia/Nicosia
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test9
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0900 start
'
)
var
timezone
=
'
Dubai, U.A.E.
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_0900 end
'
);
})
it
(
"
systemTime_setTimezone_test9
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0900 start
"
);
var
timezone
=
"
Asia/Nicosia
"
;
console
.
log
(
"
f_test9: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test9: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test9: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_0900 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1000
* @tc.name Test systemTime.setTimezone timezone = '
Moscow, Russia
'
* @tc.name Test systemTime.setTimezone timezone = '
Europe/Berlin
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test10
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1000 start
'
)
var
timezone
=
'
Moscow, Russia
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1000 end
'
);
})
it
(
"
systemTime_setTimezone_test10
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1000 start
"
);
var
timezone
=
"
Europe/Berlin
"
;
console
.
log
(
"
f_test10: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test10: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test10: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1000 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1100
* @tc.name Test systemTime.setTimezone timezone = '
Brussels, Belgium
'
* @tc.name Test systemTime.setTimezone timezone = '
America/Guayaquil
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test11
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1100 start
'
)
var
timezone
=
'
Brussels, Belgium
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1100 end
'
);
})
it
(
"
systemTime_setTimezone_test11
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1100 start
"
);
var
timezone
=
"
America/Guayaquil
"
;
console
.
log
(
"
f_test11: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test11: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test11: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1100 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1200
* @tc.name Test systemTime.setTimezone timezone = '
London, Englan
d'
* @tc.name Test systemTime.setTimezone timezone = '
Europe/Madri
d'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test12
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1200 start
'
)
var
timezone
=
'
London, England
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1200 end
'
);
})
it
(
"
systemTime_setTimezone_test12
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1200 start
"
);
var
timezone
=
"
Europe/Madrid
"
;
console
.
log
(
"
f_test12: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test12: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test12: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1200 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1300
* @tc.name Test systemTime.setTimezone timezone = '
Accra, Ghana
'
* @tc.name Test systemTime.setTimezone timezone = '
Pacific/Pohnpei
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test13
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1300 start
'
)
var
timezone
=
'
Accra, Ghana
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1300 end
'
);
})
it
(
"
systemTime_setTimezone_test13
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1300 start
"
);
var
timezone
=
"
Pacific/Pohnpei
"
;
console
.
log
(
"
f_test13: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test13: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test13: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1300 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1400
* @tc.name Test systemTime.setTimezone timezone = '
Praia, CaboVerde
'
* @tc.name Test systemTime.setTimezone timezone = '
America/Godthab
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test14
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1400 start
'
)
var
timezone
=
'
Praia, CaboVerde
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1400 end
'
);
})
it
(
"
systemTime_setTimezone_test14
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1400 start
"
);
var
timezone
=
"
America/Godthab
"
;
console
.
log
(
"
f_test14: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test14: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test14: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1400 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1500
* @tc.name Test systemTime.setTimezone timezone = '
Nuuk, Greenland
'
* @tc.name Test systemTime.setTimezone timezone = '
Asia/Jakarta
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test15
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1500 start
'
)
var
timezone
=
'
Nuuk, Greenland
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1500 end
'
);
})
it
(
"
systemTime_setTimezone_test15
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1500 start
"
);
var
timezone
=
"
Asia/Jakarta
"
;
console
.
log
(
"
f_test15: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test15: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test15: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1500 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1600
* @tc.name Test systemTime.setTimezone timezone = '
Buenos Aires, Argentin
a'
* @tc.name Test systemTime.setTimezone timezone = '
Pacific/Taraw
a'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test16
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1600 start
'
)
var
timezone
=
'
Buenos Aires, Argentina
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1600 end
'
);
})
it
(
"
systemTime_setTimezone_test16
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1600 start
"
);
var
timezone
=
"
Pacific/Tarawa
"
;
console
.
log
(
"
f_test16: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test16: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test16: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1600 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1700
* @tc.name Test systemTime.setTimezone timezone = '
New York, U.S.A.
'
* @tc.name Test systemTime.setTimezone timezone = '
Asia/Almaty
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test17
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1700 start
'
)
var
timezone
=
'
New York, U.S.A.
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1700 end
'
);
})
it
(
"
systemTime_setTimezone_test17
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1700 start
"
);
var
timezone
=
"
Asia/Almaty
"
;
console
.
log
(
"
f_test17: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test17: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test17: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1700 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1800
* @tc.name Test systemTime.setTimezone timezone = '
Mexico City, Mexic
o'
* @tc.name Test systemTime.setTimezone timezone = '
Pacific/Majur
o'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test18
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1800 start
'
)
var
timezone
=
'
Mexico City, Mexico
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1800 end
'
);
})
it
(
"
systemTime_setTimezone_test18
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1800 start
"
);
var
timezone
=
"
Pacific/Majuro
"
;
console
.
log
(
"
f_test18: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test18: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test18: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1800 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_1900
* @tc.name Test systemTime.setTimezone timezone = '
Guatemala City, Guatemala
'
* @tc.name Test systemTime.setTimezone timezone = '
Asia/Ulaanbaatar
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test19
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1900 start
'
)
var
timezone
=
'
Guatemala City, Guatemala
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_1900 end
'
);
})
it
(
"
systemTime_setTimezone_test19
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1900 start
"
);
var
timezone
=
"
Asia/Ulaanbaatar
"
;
console
.
log
(
"
f_test19: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test19: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test19: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_1900 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_2000
* @tc.name Test systemTime.setTimezone timezone = '
Los Angeles, U.S.A.
'
* @tc.name Test systemTime.setTimezone timezone = '
America/Mexico_City
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test20
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2000 start
'
)
var
timezone
=
'
Los Angeles, U.S.A.
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2000 end
'
);
})
it
(
"
systemTime_setTimezone_test20
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2000 start
"
);
var
timezone
=
"
America/Mexico_City
"
;
console
.
log
(
"
f_test20: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test20: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test20: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2000 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_2100
* @tc.name Test systemTime.setTimezone timezone = 'A
nchorage, U.S.A.
'
* @tc.name Test systemTime.setTimezone timezone = 'A
sia/Kuala_Lumpur
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test20
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2000 start
'
)
var
timezone
=
'
Anchorage, U.S.A.
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2000 end
'
);
})
it
(
"
systemTime_setTimezone_test21
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2100 start
"
);
var
timezone
=
"
Asia/Kuala_Lumpur
"
;
console
.
log
(
"
f_test21: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test21: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test21: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2100 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_2200
* @tc.name Test systemTime.setTimezone timezone = '
Adak, U.S.A.
'
* @tc.name Test systemTime.setTimezone timezone = '
Pacific/Auckland
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test22
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2200 start
'
)
var
timezone
=
'
Adak, U.S.A.
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2200 end
'
);
})
it
(
"
systemTime_setTimezone_test22
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2200 start
"
);
var
timezone
=
"
Pacific/Auckland
"
;
console
.
log
(
"
f_test22: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test22: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test22: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2200 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_2300
* @tc.name Test systemTime.setTimezone timezone = '
Honolulu, U.S.A.
'
* @tc.name Test systemTime.setTimezone timezone = '
Pacific/Tahiti
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test23
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2300 start
'
)
var
timezone
=
'
Honolulu, U.S.A.
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2300 end
'
);
})
it
(
"
systemTime_setTimezone_test23
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2300 start
"
);
var
timezone
=
"
Pacific/Tahiti
"
;
console
.
log
(
"
f_test23: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test23: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test23: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2300 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_2400
* @tc.name Test systemTime.setTimezone timezone = '
Alofi, Niue
'
* @tc.name Test systemTime.setTimezone timezone = '
Pacific/Port_Moresby
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test24
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2400 start
'
)
var
timezone
=
'
Alofi, Niue
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2400 end
'
);
})
it
(
"
systemTime_setTimezone_test24
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2400 start
"
);
var
timezone
=
"
Pacific/Port_Moresby
"
;
console
.
log
(
"
f_test24: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test24: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test24: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2400 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_2500
* @tc.name Test systemTime.setTimezone timezone = '
Baker Island, U.S.A.
'
* @tc.name Test systemTime.setTimezone timezone = '
Asia/Gaza
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test25
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2500 start
'
)
var
timezone
=
'
Baker Island, U.S.A.
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2500 end
'
);
})
it
(
"
systemTime_setTimezone_test25
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2500 start
"
);
var
timezone
=
"
Asia/Gaza
"
;
console
.
log
(
"
f_test25: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test25: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test25: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2500 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTimezone_JS_API_2600
* @tc.name Test systemTime.setTimezone timezone = '
XXXX, Asia
'
* @tc.name Test systemTime.setTimezone timezone = '
Europe/Lisbon
'
* @tc.desc Test systemTime_setTimezone API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTimezone_test26
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2600 start
'
)
var
timezone
=
'
Baker Island, U.S.A.
'
console
.
log
(
'
setTimezone =
'
+
timezone
)
systemTime
.
setTimezone
(
timezone
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
setTimezone = XXXX, Asia
'
)
systemTime
.
setTimezone
(
'
XXXX, Asia
'
)
var
resGetTimeZone
=
systemTime
.
getTimeZone
()
console
.
log
(
'
GetTimezone =
'
+
resGetTimeZone
)
assert
.
equal
(
resGetTimeZone
,
timezone
)
console
.
log
(
'
SUB_systemTime_setTimezone_JS_API_2600 end
'
);
})
/**
it
(
"
systemTime_setTimezone_test26
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2600 start
"
);
var
timezone
=
"
Europe/Lisbon
"
;
console
.
log
(
"
f_test26: setTimezone =
"
+
timezone
);
systemTime
.
setTimezone
(
timezone
).
then
(()
=>
{
console
.
log
(
"
f_test26: setTimezone promise
"
);
systemTime
.
getTimezone
().
then
((
data
)
=>
{
console
.
log
(
"
f_test26: getTimezone data =
"
+
data
);
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTimezone_JS_API_2600 end
"
);
done
();
});
});
});
/**
* @tc.number SUB_systemTime_setTime_JS_API_0100
* @tc.name Test systemTime.setTime time =
0
* @tc.name Test systemTime.setTime time =
123235423411
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTime_test1
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0100 start
'
)
var
time
=
0
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
var
resGetTime
=
systemTime
.
getCurrentTime
(
true
)
console
.
log
(
'
GetTime =
'
+
resGetTime
)
assert
.
equal
(
resGetTime
,
time
)
sleep
(
5000
).
then
(()
=>
{
resGetTime
=
systemTime
.
getCurrentTime
(
true
);
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
(
time
+
6000
)
&&
resGetTime
>=
(
time
+
5000
));
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0100 end
'
);
})
})
it
(
"
systemTime_setTime_test1
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTime_JS_API_0100 start1
"
);
var
time
=
123235423411
;
console
.
log
(
"
f_setTime1: setTime =
"
+
time
);
systemTime
.
setTime
(
time
).
then
(()
=>
{
console
.
log
(
"
f_setTime1: setTime promise
"
);
systemTime
.
getCurrentTime
(
true
).
then
((
data
)
=>
{
console
.
log
(
"
f_setTime1: getCurrentTime data =
"
+
data
);
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTime_JS_API_0100 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setTime_JS_API_0200
* @tc.name Test systemTime.setTime time = 1
...
...
@@ -634,73 +736,74 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTime_test2
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0200 start
'
)
var
time
=
1
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
var
resGetTime
=
systemTime
.
getCurrentTime
(
true
)
console
.
log
(
'
GetTime =
'
+
resGetTime
)
assert
.
equal
(
resGetTime
,
time
)
sleep
(
5000
).
then
(()
=>
{
resGetTime
=
systemTime
.
getCurrentTime
(
true
);
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
(
time
+
6000
)
&&
resGetTime
>=
(
time
+
5000
));
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0200 end
'
);
})
})
it
(
"
systemTime_setTime_test2
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTime_JS_API_0200 start
"
);
var
time
=
1
;
console
.
log
(
"
f_setTime2: setTime =
"
+
time
);
systemTime
.
setTime
(
time
).
then
(()
=>
{
console
.
log
(
"
f_setTime2: setTime promise
"
);
systemTime
.
getCurrentTime
(
true
).
then
((
data
)
=>
{
console
.
log
(
"
f_setTime2: getCurrentTime data =
"
+
data
);
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTime_JS_API_0200 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setTime_JS_API_0300
* @tc.name Test systemTime.setTime time =
Number.MAX_VALUE/2
* @tc.name Test systemTime.setTime time =
115230
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTime_test3
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0300 start
'
)
var
time
=
Number
.
MAX_VALUE
/
2
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
var
resGetTime
=
systemTime
.
getCurrentTime
(
true
)
console
.
log
(
'
GetTime =
'
+
resGetTime
)
assert
.
equal
(
resGetTime
,
time
)
sleep
(
5000
).
then
(()
=>
{
resGetTime
=
systemTime
.
getCurrentTime
(
true
);
console
.
log
(
'
GetTime =
'
+
resGetTime
);
assert
.
equal
(
resGetTime
<=
(
time
+
6000
)
&&
resGetTime
>=
(
time
+
5000
));
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0300 end
'
);
})
})
it
(
"
systemTime_setTime_test3
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTime_JS_API_0300 start
"
);
var
time
=
115230
;
console
.
log
(
"
f_setTime3: setTime =
"
+
time
);
systemTime
.
setTime
(
time
).
then
(()
=>
{
console
.
log
(
"
f_setTime3: setTime promise
"
);
systemTime
.
getCurrentTime
(
true
).
then
((
data
)
=>
{
console
.
log
(
"
f_setTime3: getCurrentTime data =
"
+
data
);
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTime_JS_API_0300 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setTime_JS_API_0400
* @tc.name Test systemTime.setTime
time = -1
* @tc.name Test systemTime.setTime
time = 6666666
* @tc.desc Test systemTime_setTime API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setTime_test4
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0400 start
'
)
var
time
=
-
1
console
.
log
(
'
setTime =
'
+
time
)
systemTime
.
setTime
(
time
)
console
.
log
(
'
SUB_systemTime_setTime_JS_API_0400 end
'
);
})
/**
it
(
"
systemTime_setTime_test4
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setTime_JS_API_0400 start
"
);
var
time
=
118666
;
console
.
log
(
"
f_setTime4: setTime =
"
+
time
);
systemTime
.
setTime
(
time
).
then
(()
=>
{
console
.
log
(
"
f_setTime4: setTime promise
"
);
systemTime
.
getCurrentTime
(
true
).
then
((
data
)
=>
{
console
.
log
(
"
f_setTime4: getCurrentTime data =
"
+
data
);
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setTime_JS_API_0400 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0100
* @tc.name Test systemTime.setDate date = new Date()
* @tc.desc Test systemTime_setDate API functionality.
...
...
@@ -708,20 +811,23 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test1
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0100 start
'
)
var
date
=
new
Date
()
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0100 end
'
);
})
it
(
"
systemTime_setDate_test1
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0100 start
"
);
var
date
=
new
Date
();
console
.
log
(
"
f_setDate1: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate1: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate1: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0100 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0200
* @tc.name Test systemTime.setDate date = new Date(2022,1,1)
...
...
@@ -730,20 +836,23 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test2
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0200 start
'
)
var
date
=
new
Date
(
2022
,
1
,
1
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0200 end
'
);
})
it
(
"
systemTime_setDate_test2
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0200 startaa
"
);
var
date
=
new
Date
(
2022
,
1
,
1
);
console
.
log
(
"
f_setDate2: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate2: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate2: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0200 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0300
* @tc.name Test systemTime.setDate date = new Date(2022,1,15)
...
...
@@ -752,20 +861,23 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test3
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0300 start
'
)
var
date
=
new
Date
(
2022
,
1
,
15
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0300 end
'
);
})
it
(
"
systemTime_setDate_test3
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0300 startaa
"
);
var
date
=
new
Date
(
2022
,
1
,
15
);
console
.
log
(
"
f_setDate3: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate3: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate3: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0300 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0400
* @tc.name Test systemTime.setDate date = new Date(2022,1,31)
...
...
@@ -774,129 +886,122 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test4
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0400 start
'
)
var
date
=
new
Date
(
2022
,
1
,
31
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0400 end
'
);
})
it
(
"
systemTime_setDate_test4
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0400 start
"
);
var
date
=
new
Date
(
2022
,
1
,
31
);
console
.
log
(
"
f_setDate4: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate4: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate4: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0400 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0500
* @tc.name Test systemTime.setDate date = new Date(2022,
1,32
)
* @tc.name Test systemTime.setDate date = new Date(2022,
2,1
)
* @tc.desc Test systemTime_setDate API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test5
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0500 start
'
)
var
date
=
new
Date
(
2022
,
1
,
31
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
setDate = new Date(2022,1,32)
'
)
systemTime
.
setDate
(
new
Date
(
2022
,
1
,
32
))
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0500 end
'
);
})
it
(
"
systemTime_setDate_test5
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0500 start
"
);
var
date
=
new
Date
(
2022
,
2
,
1
);
console
.
log
(
"
f_setDate5: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate5: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate5: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0500 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0600
* @tc.name Test systemTime.setDate date = new Date(2022,2,2
9
)
* @tc.name Test systemTime.setDate date = new Date(2022,2,2
8
)
* @tc.desc Test systemTime_setDate API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test6
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0600 start
'
)
var
date
=
new
Date
(
2022
,
1
,
31
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
setDate = new Date(2022,2,29)
'
)
systemTime
.
setDate
(
new
Date
(
2022
,
2
,
29
))
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0600 end
'
);
})
it
(
"
systemTime_setDate_test6
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0600 start
"
);
var
date
=
new
Date
(
2022
,
2
,
28
);
console
.
log
(
"
f_setDate6: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate6: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate6: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0600 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0700
* @tc.name Test systemTime.setDate date = new Date(2040,2,2
9
)
* @tc.name Test systemTime.setDate date = new Date(2040,2,2
8
)
* @tc.desc Test systemTime_setDate API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test7
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0700 start
'
)
var
date
=
new
Date
(
2040
,
2
,
29
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0700 end
'
);
})
it
(
"
systemTime_setDate_test7
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0700 start
"
);
var
date
=
new
Date
(
2040
,
2
,
29
);
console
.
log
(
"
f_setDate7: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate7: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate7: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0700 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0800
* @tc.name Test systemTime.setDate date = new Date(2040,2,
30
)
* @tc.name Test systemTime.setDate date = new Date(2040,2,
29
)
* @tc.desc Test systemTime_setDate API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test8
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0800 start
'
)
var
date
=
new
Date
(
2022
,
1
,
31
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
setDate = new Date(2040,2,30)
'
)
systemTime
.
setDate
(
new
Date
(
2040
,
2
,
30
))
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0800 end
'
);
})
it
(
"
systemTime_setDate_test8
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0800 start
"
);
var
date
=
new
Date
(
2040
,
2
,
29
);
console
.
log
(
"
f_setDate8: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate8: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate8: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0800 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_0900
* @tc.name Test systemTime.setDate date = new Date(2022,6,30)
...
...
@@ -905,49 +1010,48 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test9
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0900 start
'
)
var
date
=
new
Date
(
2022
,
6
,
30
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_0900 end
'
);
})
/**
it
(
"
systemTime_setDate_test9
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0900 start
"
);
var
date
=
new
Date
(
2022
,
6
,
30
);
console
.
log
(
"
f_setDate9: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate9: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate9: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_0900 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_1000
* @tc.name Test systemTime.setDate date = new Date(2022,
6
,31)
* @tc.name Test systemTime.setDate date = new Date(2022,
7
,31)
* @tc.desc Test systemTime_setDate API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test10
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_1000 start
'
)
var
date
=
new
Date
(
2022
,
1
,
31
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
setDate = new Date(2022,6,31)
'
)
systemTime
.
setDate
(
new
Date
(
2022
,
6
,
31
))
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_1000 end
'
);
})
it
(
"
systemTime_setDate_test10
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_1000 start
"
);
var
date
=
new
Date
(
2022
,
7
,
31
);
console
.
log
(
"
f_setDate10: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate10: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate10: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_1000 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_1100
* @tc.name Test systemTime.setDate date = new Date(2022,12,31)
...
...
@@ -956,20 +1060,23 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test11
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_1100 start
'
)
var
date
=
new
Date
(
2022
,
12
,
31
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_1100 end
'
);
})
it
(
"
systemTime_setDate_test11
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_1100 start
"
);
var
date
=
new
Date
(
2022
,
12
,
31
);
console
.
log
(
"
f_setDate11: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate11: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate11: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_1100 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_setDate_JS_API_1200
* @tc.name Test systemTime.setDate date = new Date(2022,13,1)
...
...
@@ -978,28 +1085,24 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_setDate_test12
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_setDate_JS_API_1200 start
'
)
var
date
=
new
Date
(
2022
,
1
,
31
)
console
.
log
(
'
setDate =
'
+
date
)
systemTime
.
setDate
(
date
)
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
setDate = new Date(2022,13,1)
'
)
systemTime
.
setDate
(
new
Date
(
2022
,
13
,
1
))
var
resGetDate
=
systemTime
.
getDate
()
console
.
log
(
'
GetDate =
'
+
resGetDate
)
assert
.
deepEqual
(
resGetDate
,
date
)
console
.
log
(
'
SUB_systemTime_setDate_JS_API_1200 end
'
);
})
/**
it
(
"
systemTime_setDate_test12
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_setDate_JS_API_1200 start
"
);
var
date
=
new
Date
(
2022
,
13
,
1
);
console
.
log
(
"
f_setDate12: setDate =
"
+
date
.
toLocaleDateString
());
systemTime
.
setDate
(
date
).
then
(()
=>
{
console
.
log
(
"
f_setDate12: setDate promise
"
);
systemTime
.
getDate
().
then
((
data
)
=>
{
console
.
log
(
"
f_setDate12: getDate data =
"
+
data
.
toLocaleDateString
());
});
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_setDate_JS_API_1200 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_getRealActiveTime_JS_API_0100
* @tc.name Test systemTime.getRealActiveTime
* @tc.desc Test systemTime_getRealActiveTime API functionality.
...
...
@@ -1007,22 +1110,18 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_getRealActiveTime_test1
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_getRealActiveTime_JS_API_0100 start
'
)
var
resGetTime0
=
systemTime
.
getRealActiveTime
()
console
.
log
(
'
GetTime0 =
'
+
resGetTime0
)
sleep
(
5000
).
then
(()
=>
{
var
resGetTime1
=
systemTime
.
getRealActiveTime
();
console
.
log
(
'
GetTime1 =
'
+
resGetTime1
);
assert
.
equal
(
resGetTime1
<=
(
resGetTime0
+
6000
)
&&
resGetTime1
>=
(
resGetTime0
+
5000
));
console
.
log
(
'
SUB_systemTime_getRealActiveTime_JS_API_0100 end
'
);
})
})
/**
it
(
"
systemTime_getRealActiveTime_test1
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_getRealActiveTime_JS_API_0100 start
"
);
systemTime
.
getRealActiveTime
().
then
((
data
)
=>
{
console
.
log
(
"
f_ActiveTime1: getRealActiveTime data =
"
+
data
);
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_getRealActiveTime_JS_API_0100 end
"
);
done
();
});
/**
* @tc.number SUB_systemTime_getRealTime_JS_API_0100
* @tc.name Test systemTime.getRealTime
* @tc.desc Test systemTime_getRealTime API functionality.
...
...
@@ -1030,22 +1129,15 @@ describe('TimeTest', function() {
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
systemTime_getRealTime_test1
'
,
0
,
async
()
=>
{
console
.
log
(
'
SUB_systemTime_getRealTime_JS_API_0100 start
'
)
var
resGetTime0
=
systemTime
.
getRealTime
()
console
.
log
(
'
GetTime0 =
'
+
resGetTime0
)
sleep
(
5000
).
then
(()
=>
{
var
resGetTime1
=
systemTime
.
getRealTime
();
console
.
log
(
'
GetTime1 =
'
+
resGetTime1
);
assert
.
equal
(
resGetTime1
<=
(
resGetTime0
+
6000
)
&&
resGetTime1
>=
(
resGetTime0
+
5000
));
console
.
log
(
'
SUB_systemTime_getRealTime_JS_API_0100 end
'
);
})
})
function
sleep
(
time
)
{
return
new
Promise
((
resolve
)
=>
setTimeout
(
resolve
,
time
));
}
})
\ No newline at end of file
it
(
"
systemTime_getRealTime_test1
"
,
0
,
async
function
(
done
)
{
console
.
log
(
"
SUB_systemTime_getRealTime_JS_API_0100 start
"
);
systemTime
.
getRealTime
().
then
((
data
)
=>
{
console
.
log
(
"
f_RealTime1: getRealTime data =
"
+
data
);
});
expect
(
true
).
assertTrue
();
console
.
log
(
"
SUB_systemTime_getRealTime_JS_API_0100 end
"
);
done
();
});
});
\ No newline at end of file
miscservices/
PasteBoardTest_js
/BUILD.gn
→
miscservices/
actspasteboardjsapitest
/BUILD.gn
浏览文件 @
e3851ff2
...
...
@@ -14,7 +14,7 @@
import("//test/xts/tools/build/suite.gni")
ohos_js_hap_suite("ActsPasteBoardJSApiTest") {
hap_profile = "./src/main/config.json"
hap_profile = "./
entry/
src/main/config.json"
deps = [
":hjs_demo_js_assets",
":hjs_demo_resources",
...
...
@@ -23,9 +23,9 @@ ohos_js_hap_suite("ActsPasteBoardJSApiTest") {
hap_name = "ActsPasteBoardJSApiTest"
}
ohos_js_assets("hjs_demo_js_assets") {
source_dir = "./src/main/js/default"
source_dir = "./
entry/
src/main/js/default"
}
ohos_resources("hjs_demo_resources") {
sources = [ "./
src/main
/resources" ]
hap_profile = "./src/main/config.json"
sources = [ "./
entry/src/main/js
/resources" ]
hap_profile = "./
entry/
src/main/config.json"
}
miscservices/
PasteBoardTest_js
/Test.json
→
miscservices/
actspasteboardjsapitest
/Test.json
浏览文件 @
e3851ff2
...
...
@@ -2,9 +2,9 @@
"description"
:
"Configuration for PasteBoard js api Tests"
,
"driver"
:
{
"type"
:
"JSUnitTest"
,
"test-timeout"
:
"180000"
,
"package"
:
"
ohos.acts.miscservices
.pasteboard"
,
"shell-timeout"
:
"180000"
"test-timeout"
:
"180000
0
"
,
"package"
:
"
com.open.harmony
.pasteboard"
,
"shell-timeout"
:
"180000
0
"
},
"kits"
:
[
{
...
...
miscservices/
PasteBoardTest_js
/src/main/config.json
→
miscservices/
actspasteboardjsapitest/entry
/src/main/config.json
浏览文件 @
e3851ff2
{
"app"
:
{
"bundleName"
:
"
ohos.acts.miscservices
.pasteboard"
,
"vendor"
:
"
acts
"
,
"bundleName"
:
"
com.open.harmony
.pasteboard"
,
"vendor"
:
"
open
"
,
"version"
:
{
"code"
:
1000000
,
"name"
:
"1.0.0"
},
"apiVersion"
:
{
"compatible"
:
4
,
"releaseType"
:
"Beta1"
,
"target"
:
5
}
},
"deviceConfig"
:
{},
"module"
:
{
"package"
:
"
ohos.acts.miscservices
.pasteboard"
,
"package"
:
"
com.open.harmony
.pasteboard"
,
"name"
:
".MyApplication"
,
"deviceType"
:
[
"phone"
...
...
@@ -25,7 +26,6 @@
},
"abilities"
:
[
{
"visible"
:
true
,
"skills"
:
[
{
"entities"
:
[
...
...
@@ -36,12 +36,13 @@
]
}
],
"name"
:
"
ohos.acts.miscservices
.pasteboard.MainAbility"
,
"name"
:
"
com.open.harmony
.pasteboard.MainAbility"
,
"icon"
:
"$media:icon"
,
"description"
:
"$string:mainability_description"
,
"label"
:
"$string:app_name"
,
"type"
:
"page"
,
"launchType"
:
"standard"
"launchType"
:
"standard"
,
"visible"
:
true
}
],
"js"
:
[
...
...
@@ -57,4 +58,4 @@
}
]
}
}
}
\ No newline at end of file
miscservices/
PasteBoardTest_js
/src/main/js/default/app.js
→
miscservices/
actspasteboardjsapitest/entry
/src/main/js/default/app.js
浏览文件 @
e3851ff2
...
...
@@ -12,7 +12,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export
default
{
onCreate
()
{
console
.
info
(
'
AceApplication onCreate
'
);
...
...
miscservices/
PasteBoardTest_js
/src/main/js/default/i18n/en-US.json
→
miscservices/
actspasteboardjsapitest/entry
/src/main/js/default/i18n/en-US.json
浏览文件 @
e3851ff2
文件已移动
miscservices/
PasteBoardTest_js
/src/main/js/default/i18n/zh-CN.json
→
miscservices/
actspasteboardjsapitest/entry
/src/main/js/default/i18n/zh-CN.json
浏览文件 @
e3851ff2
文件已移动
miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.css
0 → 100644
浏览文件 @
e3851ff2
/*
* Copyright (c) 2022 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
.container
{
flex-direction
:
column
;
justify-content
:
center
;
align-items
:
center
;
}
.title
{
font-size
:
100px
;
}
miscservices/actspasteboardjsapitest/entry/src/main/js/default/pages/index/index.hml
0 → 100644
浏览文件 @
e3851ff2
<!--
Copyright (c) 2022 Huawei Device Co., Ltd.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="container">
<text class="title">
{{ title }}
</text>
</div>
miscservices/
PasteBoardTest_js
/src/main/js/default/pages/index/index.js
→
miscservices/
actspasteboardjsapitest/entry
/src/main/js/default/pages/index/index.js
浏览文件 @
e3851ff2
...
...
@@ -12,15 +12,14 @@
* 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
'
import
{
Core
,
ExpectExtend
}
from
'
deccjsunit
'
const
injectRef
=
Object
.
getPrototypeOf
(
global
)
||
global
injectRef
.
regeneratorRuntime
=
require
(
'
@babel/runtime/regenerator
'
)
export
default
{
data
:
{
title
:
""
title
:
''
},
onInit
()
{
this
.
title
=
this
.
$t
(
'
strings.world
'
);
...
...
@@ -32,11 +31,7 @@ export default {
'
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
)
...
...
@@ -45,4 +40,6 @@ export default {
},
onReady
()
{
},
onBackPress
(){
}
}
miscservices/
PasteBoardTest_js
/src/main/js/default/test/List.test.js
→
miscservices/
actspasteboardjsapitest/entry
/src/main/js/default/test/List.test.js
浏览文件 @
e3851ff2
文件已移动
miscservices/actspasteboardjsapitest/entry/src/main/js/default/test/PasteBoardJsunit.test.js
0 → 100644
浏览文件 @
e3851ff2
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// @ts-nocheck
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
import
pasteboard
from
'
@ohos.pasteboard
'
describe
(
'
PasteBoardTest
'
,
function
()
{
console
.
log
(
'
start################################start
'
);
/**
* @tc.number SUB_pasteBoard_function_JS_API_0100
* @tc.name Adds PlainTextData
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test1
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test1: stemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test1: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test1: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test1: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test1: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test1: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test1: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test1: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test1: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test1: Checks the pasteboard content
'
);
var
primaryText
=
pasteData1
.
getPrimaryText
()
console
.
log
(
'
f_test1: primaryText =
'
+
primaryText
);
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data
'
+
pasteboard
.
MIMETYPE_TEXT_PLAIN
);
console
.
log
(
'
f_test1: getPrimaryMimeType =
'
+
pasteData1
.
getPrimaryMimeType
());
console
.
log
(
'
f_test1: SUB_pasteBoard_function_JS_API_0100 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_0200
* @tc.name Adds PlainTextData = ''
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test2
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
f_test2: SUB_pasteBoard_function_JS_API_0200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test2: systemPasteboard.clear promise
'
);
var
textData
=
''
;
console
.
log
(
'
f_test2: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test2: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test2: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test2: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test2: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test2: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test2: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
var
recordCount
=
pasteData1
.
getRecordCount
();
console
.
log
(
'
f_test2: recordCount=
'
+
recordCount
);
expect
(
recordCount
==
1
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0200 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_0300
* @tc.name Adds PlainTextData = 'Hello 中国!@#$%^&*()_+{}\?.'
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test3
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
f_test3: SUB_pasteBoard_function_JS_API_0300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test3: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello 中国!@#$%^&*()_+{}
\
?.
'
;
console
.
log
(
'
f_test3: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test3: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test3: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test3: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test3: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test3: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test3: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test3: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test3: Checks the pasteboard content
'
);
var
primaryText
=
pasteData1
.
getPrimaryText
()
console
.
log
(
'
f_test3: primaryText =
'
+
primaryText
);
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data
'
+
pasteboard
.
MIMETYPE_TEXT_PLAIN
);
expect
(
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_PLAIN
)
===
true
||
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_PLAIN
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0300 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_0400
* @tc.name Adds 300K PlainTextData
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test4
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test4: systemPasteboard.clear promise
'
);
var
textData
=
''
for
(
var
i
=
0
;
i
<
300
;
i
++
){
textData
=
textData
+
"
A
"
;
}
console
.
log
(
'
f_test4: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test4: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test4: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test4: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test4: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test4: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test4: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test4: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test4: Checks the pasteboard content
'
);
var
primaryText
=
pasteData1
.
getPrimaryText
()
console
.
log
(
'
f_test4: primaryText =
'
+
primaryText
);
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data
'
+
pasteboard
.
MIMETYPE_TEXT_PLAIN
);
expect
(
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_PLAIN
)
===
true
||
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_PLAIN
)
===
false
).
assertTrue
();
expect
(
pasteData1
.
getPrimaryMimeType
()
==
pasteboard
.
MIMETYPE_TEXT_PLAIN
).
assertTrue
();
console
.
log
(
'
f_test4: SUB_pasteBoard_function_JS_API_0400 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_0500
* @tc.name Adds 301K PlainTextData
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test5
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test5: systemPasteboard.clear promise
'
);
var
textData
=
''
for
(
var
i
=
0
;
i
<
301
;
i
++
){
textData
=
textData
+
"
A
"
;
}
console
.
log
(
'
f_test5: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test5: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test5: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test5: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test5: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test5: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test5: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test5: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test5: Checks the pasteboard content
'
);
var
primaryText
=
pasteData1
.
getPrimaryText
()
console
.
log
(
'
f_test5: primaryText =
'
+
primaryText
);
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_PLAIN MIME type of data
'
+
pasteboard
.
MIMETYPE_TEXT_PLAIN
);
expect
(
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_PLAIN
)
===
true
||
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_PLAIN
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0500 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_0600
* @tc.name Adds htmlText
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test6
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test6: systemPasteboard.clear promise
'
);
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
f_test6: createHtmlData htmlText =
'
+
htmlText
);
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
);
console
.
log
(
'
f_test6: createHtmlData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test6: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test6: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test6: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test6: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test6: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test6: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_HTML MIME type of data
'
+
pasteboard
.
MIMETYPE_TEXT_HTML
);
expect
(
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_HTML
)
===
true
||
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_HTML
)
===
false
).
assertTrue
();
console
.
log
(
'
f_test6: getPrimaryMimeType =
'
+
pasteData1
.
getPrimaryMimeType
());
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0600 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_0700
* @tc.name Adds htmlText = ''
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test7
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
f_test7: SUB_pasteBoard_function_JS_API_0700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test7: systemPasteboard.clear promise
'
);
var
htmlText
=
''
console
.
log
(
'
f_test7: createHtmlData htmlText =
'
+
htmlText
);
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
);
console
.
log
(
'
f_test7: createHtmlData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test7: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test7: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test7: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test7: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test7: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0700 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_0800
* @tc.name Adds htmlText = 'Hello 中国!@#$%^&*()_+{}\?.'
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test8
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test8: systemPasteboard.clear promise
'
);
var
htmlText
=
'
Hello 中国!@#$%^&*()_+{}
\
?.
'
console
.
log
(
'
f_test8: createHtmlData htmlText =
'
+
htmlText
);
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
);
console
.
log
(
'
f_test8: createHtmlData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test8: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test8: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test8: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test8: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test8: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test8: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_HTML MIME type of data
'
+
pasteboard
.
MIMETYPE_TEXT_HTML
);
expect
(
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_HTML
)
===
true
||
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_HTML
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0800 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_0900
* @tc.name Adds uriText
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test9
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test9: systemPasteboard.clear promise
'
);
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test9: createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test9: createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test9: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test9: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test9: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test9: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test9: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test9: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_URI MIME type of data
'
+
pasteboard
.
MIMETYPE_TEXT_URI
);
expect
(
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_URI
)
===
true
||
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_URI
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_0900 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1000
* @tc.name Adds uriText = ''
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test10
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test10: systemPasteboard.clear promise
'
);
var
uriText
=
''
console
.
log
(
'
f_test10: createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test10: createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test10: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test10: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test10: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test10: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test10: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test10: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1000 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1100
* @tc.name Set uriText = 'Hello //'
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test11
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test11: systemPasteboard.clear promise
'
);
var
uriText
=
'
Hello//
'
console
.
log
(
'
f_test11: createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test11: createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test11: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test11: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test11: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test11: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test11: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test11: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_URI MIME type of data
'
+
pasteboard
.
MIMETYPE_TEXT_URI
);
expect
(
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_URI
)
===
true
||
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_URI
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1100 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1200
* @tc.name Adds want
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test12
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test12: systemPasteboard.clear promise
'
);
var
want
=
{
bundleName
:
"
com.example.myapplication8
"
,
abilityName
:
"
com.example.myapplication8.MainAbility
"
}
console
.
log
(
'
f_test12: createWantData want =
'
+
want
);
var
pasteData
=
pasteboard
.
createWantData
(
want
);
console
.
log
(
'
f_test12: createWantData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test12: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test12: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test12: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test12: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test12: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test12: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
Checks there is a MIMETYPE_TEXT_WANT MIME type of data
'
+
pasteboard
.
MIMETYPE_TEXT_WANT
);
expect
(
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_WANT
)
===
true
||
pasteData1
.
hasMimeType
(
pasteboard
.
MIMETYPE_TEXT_WANT
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1200 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1300
* @tc.name Adds one record(s)
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test13
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test13: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test13: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test13: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test13: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test13: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test13: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test13: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test13: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test13: Checks the pasteboard content
'
);
var
recordText
=
pasteData1
.
getRecordAt
(
0
).
plainText
console
.
log
(
'
f_test13: recordText =
'
+
recordText
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1300 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1400
* @tc.name Adds 2 record(s)
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test14
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test14: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World!
'
;
console
.
log
(
'
f_test14: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test14: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData1
=
'
Hello World1
'
console
.
log
(
'
f_test14: addTextRecord =
'
+
textData1
)
pasteData
.
addTextRecord
(
textData1
)
console
.
log
(
'
f_test14: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test14: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test14: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test14: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test14: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test14: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
2
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1400 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1500
* @tc.name Adds 15 record(s)
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test15
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test15: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World!
'
;
console
.
log
(
'
f_test15: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test15: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData
=
''
for
(
var
i
=
1
;
i
<
15
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
f_test15: addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
f_test15: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test15: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test15: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test15: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test15: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test15: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
15
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1500 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1600
* @tc.name Adds 30 record(s)
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test16
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test16: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World!
'
;
console
.
log
(
'
f_test16: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test16: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData
=
''
for
(
var
i
=
1
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
f_test16: addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
f_test16: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test16: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test16: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test16: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test16: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test16: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
30
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1600 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1700
* @tc.name Adds 31 record(s)
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test17
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test17: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World!
'
;
console
.
log
(
'
f_test17: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test17: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData
=
''
for
(
var
i
=
1
;
i
<
31
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
f_test17: addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
f_test17: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test17: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test17: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test17: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test17: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test17: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
var
recordCount
=
pasteData1
.
getRecordCount
()
console
.
log
(
'
f_test17: recordCount =
'
+
recordCount
);
expect
(
pasteData1
.
getRecordCount
()
==
31
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1700 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1800
* @tc.name Adds PlainText,HtmlText,UriText
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test18
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test18: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test18: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test18: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
f_test18: addHtmlRecord =
'
+
htmlText
)
pasteData
.
addHtmlRecord
(
htmlText
)
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test18: addUriRecord =
'
+
uriText
)
pasteData
.
addUriRecord
(
uriText
)
console
.
log
(
'
f_test18: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test18: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test18: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test18: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test18: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test18: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
3
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1800 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_1900
* @tc.name Delete one PlainTextData
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test19
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test19: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test19: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test19: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test19: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test19: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test19: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test19: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test19: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test19: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test19: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
f_test19: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData1
).
then
(()
=>
{
console
.
log
(
'
f_test19: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test19: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test19: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test19: recordCount =
'
+
recordCount
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_1900 end
'
);
done
();
});
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2000
* @tc.name Delete one htmlText
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test20
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test20: systemPasteboard.clear promise
'
);
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
f_test20: createHtmlData htmlText =
'
+
htmlText
);
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
);
console
.
log
(
'
f_test20: createHtmlData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test20: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test20: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test20: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test20: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test20: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test20: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test20: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
f_test20: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData1
).
then
(()
=>
{
console
.
log
(
'
f_test20: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test20: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test20: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test20: recordCount =
'
+
recordCount
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2000 end
'
);
done
();
});
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2100
* @tc.name Delete one uriText
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test21
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test21: systemPasteboard.clear promise
'
);
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test21: createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test21: createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test21: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test21: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test21: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test21: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test21: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test21: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test21: f_test21: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
f_test21: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData1
).
then
(()
=>
{
console
.
log
(
'
f_test21: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test21: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test21: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test21: recordCount =
'
+
recordCount
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2100 end
'
);
done
();
});
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2200
* @tc.name Delete one want
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test22
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test22: systemPasteboard.clear promise
'
);
var
want
=
{
bundleName
:
"
com.example.myapplication8
"
,
abilityName
:
"
com.example.myapplication8.MainAbility
"
}
console
.
log
(
'
f_test22: createWantData =
'
+
want
)
var
pasteData
=
pasteboard
.
createWantData
(
want
);
console
.
log
(
'
f_test22: createWantData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test22: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test22: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test22: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test22: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test22: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test22: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test22: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
f_test22: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData1
).
then
(()
=>
{
console
.
log
(
'
f_test22: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test22: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test22: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test22: recordCount =
'
+
recordCount
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2200 end
'
);
done
();
});
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2300
* @tc.name Deletes 300K PlainTextData
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test23
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test23: systemPasteboard.clear promise
'
);
var
textData
=
''
for
(
var
i
=
0
;
i
<
300
;
i
++
){
textData
=
textData
+
"
A
"
;
}
console
.
log
(
'
f_test23: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test23: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test23: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test23: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test23: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test23: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test23: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test23: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test23: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
f_test23: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData1
).
then
(()
=>
{
console
.
log
(
'
f_test23: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test23: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test23: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test23: recordCount =
'
+
recordCount
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2300 end
'
);
done
();
});
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2400
* @tc.name Deletes 30 record(s)
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test24
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test24: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World
'
console
.
log
(
'
f_test24: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test24: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData
=
''
for
(
var
i
=
1
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
pasteData
.
addTextRecord
(
textData
)
}
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test24: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test24: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test24: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
30
).
assertTrue
();
console
.
log
(
'
f_test24: Removes the Record
'
)
for
(
var
i
=
0
;
i
<
30
;
i
++
)
{
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
}
systemPasteboard
.
setPasteData
(
pasteData1
).
then
(()
=>
{
console
.
log
(
'
f_test24: systemPasteboard.setPasteData promise
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test24: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test24: recordCount =
'
+
recordCount
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2400 end
'
);
done
();
});
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2500
* @tc.name Deletes replaced record
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test25
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test25: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test25: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test25: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test25: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test25: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test25: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test25: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test25: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test25: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
var
textData1
=
'
Hello World1
'
console
.
log
(
'
f_test25: Replaces the Record =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
var
replace
=
pasteData1
.
replaceRecordAt
(
0
,
pasteDataRecord
);
console
.
log
(
'
f_test25: replace =
'
+
replace
)
console
.
log
(
'
f_test25: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
f_test25: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData1
).
then
(()
=>
{
console
.
log
(
'
f_test25: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test25: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test25: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test25: recordCount =
'
+
recordCount
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2500 end
'
);
done
();
});
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2600
* @tc.name Deletes 文本、uri、html
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test26
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test26: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test26: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test26: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
f_test26: addHtmlRecord =
'
+
htmlText
)
pasteData
.
addHtmlRecord
(
htmlText
)
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test26: addUriRecord =
'
+
uriText
)
pasteData
.
addUriRecord
(
uriText
)
console
.
log
(
'
f_test26: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test26: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test26: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test26: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test26: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test26: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
3
).
assertTrue
();
console
.
log
(
'
f_test26: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
f_test26: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData1
).
then
(()
=>
{
console
.
log
(
'
f_test26: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test26: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test26: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test26: recordCount =
'
+
recordCount
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2600 end
'
);
done
();
});
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2700
* @tc.name Replaces 文本 record
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test27
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test27: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test27: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test27: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test27: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test27: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test27: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test27: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test27: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test27: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
var
textData1
=
'
Hello World1
'
console
.
log
(
'
f_test27: Replaces the Record =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
var
replace
=
pasteData1
.
replaceRecordAt
(
0
,
pasteDataRecord
);
console
.
log
(
'
f_test27: replace =
'
+
replace
)
console
.
log
(
'
f_test27: Checks the pasteboard content
'
);
var
primaryText
=
pasteData1
.
getPrimaryText
();
console
.
log
(
'
f_test27: primaryText =
'
+
primaryText
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2700 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2800
* @tc.name Replaces htmlText record
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test28
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test28: systemPasteboard.clear promise
'
);
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
f_test28: createHtmlData htmlText =
'
+
htmlText
);
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
);
console
.
log
(
'
f_test28: createHtmlData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test28: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test28: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test28: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test28: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test28: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test28: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
var
htmlText1
=
'
<html><head></head><body>Hello World 1</body></html>
'
console
.
log
(
'
f_test28: Replaces the htmlText =
'
+
htmlText1
)
var
pasteDataRecord
=
pasteboard
.
createHtmlTextRecord
(
htmlText1
)
var
replace
=
pasteData1
.
replaceRecordAt
(
0
,
pasteDataRecord
);
console
.
log
(
'
f_test28: replace =
'
+
replace
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2800 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_2900
* @tc.name Replaces uri record
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test29
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test29: systemPasteboard.clear promise
'
);
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test29: createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test29: createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test29: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test29: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test29: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test29: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test29: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test29: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
var
uriText1
=
'
https://www.baidu.com/1
'
console
.
log
(
'
f_test29: Replaces the uriText =
'
+
uriText1
)
var
pasteDataRecord
=
pasteboard
.
createUriRecord
(
uriText1
)
var
replace
=
pasteData1
.
replaceRecordAt
(
0
,
pasteDataRecord
);
console
.
log
(
'
f_test29: replace =
'
+
replace
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_2900 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3000
* @tc.name Replaces want record
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test30
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test30: systemPasteboard.clear promise
'
);
var
wantText0
=
{
bundleName
:
"
com.example.myapplication3
"
,
abilityName
:
"
com.example.myapplication3.MainAbility
"
}
console
.
log
(
'
f_test30: createWantData want =
'
+
wantText0
);
var
pasteData
=
pasteboard
.
createWantData
(
wantText0
);
console
.
log
(
'
f_test30: createWantData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test30: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test30: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test30: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test30: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test30: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test30: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
var
wantText1
=
{
bundleName
:
"
com.example.myapplication30
"
,
abilityName
:
"
com.example.myapplication30.MainAbility
"
}
console
.
log
(
'
f_test30: Replaces the wantText =
'
+
wantText1
)
var
pasteDataRecord
=
pasteboard
.
createWantRecord
(
wantText1
)
var
replace
=
pasteData1
.
replaceRecordAt
(
0
,
pasteDataRecord
);
console
.
log
(
'
f_test30: replace =
'
+
replace
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3000 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3100
* @tc.name Replaces 300k文本 record
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test31
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test31: systemPasteboard.clear promise
'
);
var
textData
=
''
for
(
var
i
=
0
;
i
<
300
;
i
++
){
textData
=
textData
+
"
A
"
;
}
console
.
log
(
'
f_test31: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test31: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test31: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test31: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test31: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test31: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test31: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test31: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
var
textData1
=
'
Hello World1
'
console
.
log
(
'
f_test31: Replaces the Record =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
var
replace
=
pasteData1
.
replaceRecordAt
(
0
,
pasteDataRecord
);
console
.
log
(
'
f_test31: replace =
'
+
replace
)
console
.
log
(
'
f_test31: Checks the pasteboard content
'
);
var
primaryText
=
pasteData1
.
getPrimaryText
();
console
.
log
(
'
f_test31: primaryText =
'
+
primaryText
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3100 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3200
* @tc.name Adds one record(s), gets record count
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test32
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test32: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test32: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test32: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test32: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test32: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test32: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test32: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test32: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3200 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3300
* @tc.name Adds 2 record(s), gets record count
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test33
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test33: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World!
'
;
console
.
log
(
'
f_test33: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test33: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData
=
''
for
(
var
i
=
1
;
i
<
2
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
f_test33: addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
f_test33: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test33: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test33: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test33: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test33: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test33: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
2
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3300 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3400
* @tc.name Adds 15 record(s), gets record count
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test34
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test34: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World!
'
;
console
.
log
(
'
f_test34: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test34: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData
=
''
for
(
var
i
=
1
;
i
<
15
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
f_test34: addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
f_test34: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test34: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test34: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test34: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test34: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test34: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
15
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3400 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3500
* @tc.name Adds 30 record(s), gets record count
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test35
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test35: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World!
'
;
console
.
log
(
'
f_test35: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test35: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData
=
''
for
(
var
i
=
1
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
f_test35: addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
f_test35: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test35: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test35: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test35: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test35: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test35: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
30
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3500 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3600
* @tc.name Adds 31 record(s), gets record count
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test36
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test36: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World!
'
;
console
.
log
(
'
f_test36: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test36: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData
=
''
for
(
var
i
=
1
;
i
<
31
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
f_test36: addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
f_test36: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test36: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test36: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test36: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test36: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test36: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
31
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3600 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3700
* @tc.name Replaces one record, gets record count
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test37
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test37: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test37: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test37: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test37: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test37: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test37: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test37: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test37: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test37: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
var
textData1
=
'
Hello World1
'
console
.
log
(
'
f_test37: Replaces the Record =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
var
replace
=
pasteData1
.
replaceRecordAt
(
0
,
pasteDataRecord
);
console
.
log
(
'
f_test37: replace =
'
+
replace
)
console
.
log
(
'
f_test37: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test37: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
expect
(
pasteData2
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3700 end
'
);
done
();
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3800
* @tc.name Clears pasteBoard, gets record count
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test38
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test38: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test38: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test38: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test38: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test38: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test38: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test38: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test38: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test38: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test38: Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
f_test38: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test38: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test38 recordCount =
'
+
recordCount
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3800 end
'
);
done
();
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_3900
* @tc.name Adds Property
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test39
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test39: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test39: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test39: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test39: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test39: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test39: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test39: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test39: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test39: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test39: Sets the Property
'
)
var
pasteDataProperty
=
pasteData1
.
getProperty
()
console
.
log
(
'
f_test39: timestamp =
'
+
pasteDataProperty
.
timestamp
)
pasteDataProperty
.
additions
[
"
one
"
]
=
"
Hello
"
console
.
log
(
'
f_test39: Checks the Property
'
)
var
pasteDataProperty1
=
pasteData1
.
getProperty
()
console
.
log
(
'
f_test39: timestamp =
'
+
pasteDataProperty1
.
timestamp
)
console
.
log
(
'
f_test39: additions =
'
+
pasteDataProperty1
.
additions
[
"
one
"
])
console
.
log
(
'
SUB_pasteBoard_function_JS_API_3900 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4000
* @tc.name Set Property's tags
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test40
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test40: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test40: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test40: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test40: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test40: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test40: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test40: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test40: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test40: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test40: Sets the Property
'
)
var
pasteDataProperty
=
pasteData1
.
getProperty
()
console
.
log
(
'
f_test40: timestamp =
'
+
pasteDataProperty
.
timestamp
)
pasteDataProperty
.
additions
[
"
one
"
]
=
"
Hello
"
pasteDataProperty
.
tag
=
"
Test
"
console
.
log
(
'
f_test40: Checks the Property
'
)
var
pasteDataProperty1
=
pasteData1
.
getProperty
()
console
.
log
(
'
f_test40: timestamp =
'
+
pasteDataProperty1
.
timestamp
)
console
.
log
(
'
f_test40: additions =
'
+
pasteDataProperty1
.
additions
[
"
one
"
])
console
.
log
(
'
f_test40: tag =
'
+
pasteDataProperty1
.
tag
)
console
.
log
(
'
f_test40: getTag =
'
+
pasteData1
.
getTag
())
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4000 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4100
* @tc.name Clears pasteBoard and check property
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test41
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test41: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test41: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test41: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test41: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test41: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test41: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test41: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test41: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test41: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test41: Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
f_test41: Checks the Property
'
)
var
pasteDataProperty1
=
pasteData1
.
getProperty
()
console
.
log
(
'
f_test41: timestamp =
'
+
pasteDataProperty1
.
timestamp
)
console
.
log
(
'
f_test41: tag =
'
+
pasteDataProperty1
.
tag
)
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4100 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4200
* @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等文本数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test42
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test42: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test42: Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
'
update
'
,
contentChanges
)
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test42: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test42: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test42: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test42: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test42: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test42: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test42: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test42: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test42: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4200 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4300
* @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等html数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test43
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test43: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test43: Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
'
update
'
,
contentChanges
)
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
f_test43: createHtmlData htmlText =
'
+
htmlText
);
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
);
console
.
log
(
'
f_test43: createHtmlData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test43: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test43: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test43: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test43: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test43: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test43: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test43: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4300 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4400
* @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等uri数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test44
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test44: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test44: Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
'
update
'
,
contentChanges
)
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test44: createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test44: createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test44: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test44: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test44: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test44: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test44: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test44: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test44: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4400 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4500
* @tc.name 打开内容变化通知功能:向剪贴板数据增加、删除等want数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test45
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test45: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test45: Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
'
update
'
,
contentChanges
)
var
want
=
{
bundleName
:
"
com.example.myapplication45
"
,
abilityName
:
"
com.example.myapplication45.MainAbility
"
}
console
.
log
(
'
f_test45: createWantData =
'
+
want
)
var
pasteData
=
pasteboard
.
createWantData
(
want
);
console
.
log
(
'
f_test45: createWantData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test45: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test45: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test45: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test45: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test45: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test45: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test45: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4500 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4600
* @tc.name 打开内容变化通知功能:清除剪切板内容
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test46
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test46: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test46: Open the infor for pasteboard content changes
'
)
systemPasteboard
.
on
(
'
update
'
,
contentChanges
)
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test46: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test46: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test46: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test46: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test46: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test46: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test46: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test46: Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4600 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4700
* @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等文本数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test47
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test47: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test47: Close the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
'
update
'
,
contentChanges
)
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test47: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test47: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test47: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test47: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test47: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test47: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test47: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test47: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test47: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4700 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4800
* @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等html数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test48
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test48: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test48: Close the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
'
update
'
,
contentChanges
)
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
f_test48: createHtmlData htmlText =
'
+
htmlText
);
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
);
console
.
log
(
'
f_test48: createHtmlData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test48: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test48: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test48: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test48: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test48: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test48: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test48: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4800 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_4900
* @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等uri数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test49
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test49: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test49: Close the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
'
update
'
,
contentChanges
)
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test49: createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test49: createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test49: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test49: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test49: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test49: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test49: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test49: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test49: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_4900 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5000
* @tc.name 关闭内容变化通知功能:向剪贴板数据增加、删除等want数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test50
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test50: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test50: Open the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
'
update
'
,
contentChanges
)
var
want
=
{
bundleName
:
"
com.example.myapplication45
"
,
abilityName
:
"
com.example.myapplication45.MainAbility
"
}
console
.
log
(
'
f_test50: createWantData =
'
+
want
)
var
pasteData
=
pasteboard
.
createWantData
(
want
);
console
.
log
(
'
f_test50: createWantData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test50: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test50: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test50: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test50: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test50: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test50: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test50: Removes the Record
'
)
expect
(
pasteData1
.
removeRecordAt
(
0
)
===
true
||
pasteData1
.
removeRecordAt
(
0
)
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5000 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5100
* @tc.name 关闭内容变化通知功能:清除剪切板内容
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test51
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test51: systemPasteboard.clear promise
'
);
console
.
log
(
'
f_test51: Close the infor for pasteboard content changes
'
)
systemPasteboard
.
off
(
'
update
'
,
contentChanges
)
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test51: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test51: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test51: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test51: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test51: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test51: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test51: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test51: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test51: Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5100 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5200
* @tc.name 清除剪切板内的文本数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test52
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test52: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test52: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test52: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test52: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test52: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test52: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test52: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test52: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test52: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test52: Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
f_test52: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test52: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test52 recordCount =
'
+
recordCount
);})
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5200 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5300
* @tc.name 清除剪切板内的uri数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test53
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test53: systemPasteboard.clear promise
'
);
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test53: createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test53: createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test53: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test53: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test53: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test53: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test53: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test53: Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
f_test53: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test53: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test38 recordCount =
'
+
recordCount
);})
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5300 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5400
* @tc.name 清除剪切板内的html数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test54
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test54: systemPasteboard.clear promise
'
);
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
f_test54: createHtmlData htmlText =
'
+
htmlText
);
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
);
console
.
log
(
'
f_test54: createHtmlData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test54: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test54: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test54: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test54: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test54: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test54: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test54: Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
f_test54: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test54: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test38 recordCount =
'
+
recordCount
);})
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5400 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5500
* @tc.name 清除剪切板内的want数据项
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test55
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test55: systemPasteboard.clear promise
'
);
var
myWant
=
{
bundleName
:
"
com.example.myapplication55
"
,
abilityName
:
"
com.example.myapplication55.MainAbility
"
}
console
.
log
(
'
f_test01: createWantData want =
'
+
myWant
);
var
pasteData
=
pasteboard
.
createWantData
(
myWant
);
console
.
log
(
'
f_test01: createWantData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test55: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test55: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test55: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test55: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test55: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test55: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test55: Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
f_test55: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test55: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test38 recordCount =
'
+
recordCount
);})
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5500 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5600
* @tc.name 向剪切板内增加30条数据项,然后清除
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test56
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test56: systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World!
'
;
console
.
log
(
'
f_test56: createPlainTextData textData =
'
+
textData0
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
);
console
.
log
(
'
f_test56: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
var
textData
=
''
for
(
var
i
=
1
;
i
<
30
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
f_test56: addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
console
.
log
(
'
f_test56: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test56: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test56: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test56: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test56: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test56: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
30
).
assertTrue
();
console
.
log
(
'
f_test56: Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
f_test56: Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test56: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test38 recordCount =
'
+
recordCount
);})
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5600 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5700
* @tc.name 向剪贴板数据各增加5条文本、uri、html数据,然后清除
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test57
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
var
textData0
=
'
Hello World0
'
console
.
log
(
'
f_test57: createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
5
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
pasteData
.
addTextRecord
(
textData
)
}
var
htmlText
=
''
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
htmlText
=
htmlText
+
i
pasteData
.
addHtmlRecord
(
htmlText
)
}
var
uriText
=
''
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
uriText
=
'
https://www.baidu.com/
'
uriText
=
uriText
+
i
pasteData
.
addUriRecord
(
uriText
)
}
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test57: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test57: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
15
).
assertTrue
();
systemPasteboard
.
clear
()
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test57: systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData2
=
data
;
var
recordCount
=
pasteData2
.
getRecordCount
();
console
.
log
(
'
f_test38 recordCount =
'
+
recordCount
);})
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5700 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5800
* @tc.name 向剪贴板数据增加文本数据项,查询剪贴板存在剪贴板数据
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test58
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test58: systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test58: createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test58: createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test58: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test58: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test58: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test58: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5800 end
'
)
done
();
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_5900
* @tc.name 向剪贴板数据增加uri数据项,查询剪贴板存在剪贴板数据
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test59
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
systemPasteboard.clear promise
'
);
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test59: createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test59: createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test59: Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test59: systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test59: Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test59: systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_5900 end
'
)
done
();
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6000
* @tc.name 向剪贴板数据增加html数据项,查询剪贴板存在剪贴板数据
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test60
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6000 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test60 systemPasteboard.clear promise
'
);
var
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
console
.
log
(
'
f_test60createHtmlData htmlText =
'
+
htmlText
);
var
pasteData
=
pasteboard
.
createHtmlData
(
htmlText
);
console
.
log
(
'
f_test60createHtmlData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test60Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test60systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test60Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test60systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6000 end
'
)
done
();
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6100
* @tc.name 向剪贴板数据增加want数据项,查询剪贴板存在剪贴板数据
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test61
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6100 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test61 systemPasteboard.clear promise
'
);
var
myWant
=
{
bundleName
:
"
com.example.myapplication8
"
,
abilityName
:
"
com.example.myapplication8.MainAbility
"
}
console
.
log
(
'
f_test01: createWantData want =
'
+
myWant
);
var
pasteData
=
pasteboard
.
createWantData
(
myWant
);
console
.
log
(
'
f_test01: createWantData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6100 end
'
)
done
();
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6200
* @tc.name 向剪贴板数据各增加5条文本、uri、html,查询剪贴板存在剪贴板数据
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test62
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6200 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test62 systemPasteboard.clear promise
'
);
var
textData0
=
'
Hello World0
'
console
.
log
(
'
f_test62 createPlainTextData =
'
+
textData0
)
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData0
)
var
textData
=
''
for
(
var
i
=
1
;
i
<
5
;
i
++
)
{
textData
=
'
Hello World
'
textData
=
textData
+
i
console
.
log
(
'
f_test62 addTextRecord =
'
+
textData
)
pasteData
.
addTextRecord
(
textData
)
}
var
htmlText
=
''
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
htmlText
=
'
<html><head></head><body>Hello World!</body></html>
'
htmlText
=
htmlText
+
i
console
.
log
(
'
f_test62 addHtmlRecord =
'
+
htmlText
)
pasteData
.
addHtmlRecord
(
htmlText
)
}
var
uriText
=
''
for
(
var
i
=
0
;
i
<
5
;
i
++
)
{
uriText
=
'
https://www.baidu.com/
'
uriText
=
uriText
+
i
console
.
log
(
'
f_test62 addUriRecord =
'
+
uriText
)
pasteData
.
addUriRecord
(
uriText
)
}
console
.
log
(
'
f_test62 Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test62 systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test62 Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test62 systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6200 end
'
)
done
();
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6300
* @tc.name 更新剪贴板数据,查询剪贴板存在剪贴板数据
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test63
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6300 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test63 systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test63 createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test63 createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test63 systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test63 Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test63 systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test63 Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test63 systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
var
textData1
=
'
Hello World1
'
console
.
log
(
'
f_test63 Replaces the Record =
'
+
textData1
)
var
pasteDataRecord
=
pasteboard
.
createPlainTextRecord
(
textData1
)
pasteData1
.
replaceRecordAt
(
0
,
pasteDataRecord
)
console
.
log
(
'
f_test63 Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test63 systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();})
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6300 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6400
* @tc.name 删除所有的剪贴板数据,查询剪贴板不存在剪贴板数据
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test64
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6400 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test64 systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test64 createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test64 createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test64 Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test64 systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test64 Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test64 systemPasteboard.hasPasteData promise data =
'
+
data
);
console
.
log
(
'
f_test64 Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test64 systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
var
recordCount
=
pasteData1
.
getRecordCount
();
console
.
log
(
'
f_test64 recordCount =
'
+
recordCount
);
console
.
log
(
'
f_test64 Removes the Record
'
)
pasteData1
.
removeRecordAt
(
0
)
console
.
log
(
'
f_test64 Checks the number of records
'
);
var
recordCount1
=
pasteData1
.
getRecordCount
();
console
.
log
(
'
f_test64 recordCount =
'
+
recordCount1
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6400 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6500
* @tc.name 清除剪贴板数据,查询剪贴板不存在剪贴板数据
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test65
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6500 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test65 systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test65 createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test65 createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test65 Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test65 systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test65 Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test65 systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test65 Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test65 systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test65 Clears the pasteBoard
'
)
systemPasteboard
.
clear
()
console
.
log
(
'
f_test65 Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData1
).
then
(()
=>
{
console
.
log
(
'
f_test65 systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test65 Checks there is no content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test65 systemPasteboard.hasPasteData promise data =
'
+
data
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6400 end
'
);
done
();
});
});
});
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6600
* @tc.name 将文本数据强制转换为文本
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test66
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6600 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test66 systemPasteboard.clear promise
'
);
var
textData
=
'
Hello World!
'
;
console
.
log
(
'
f_test66 createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test66 createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test66 Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test66 systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test66 Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test66 systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test66 Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test66 systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test66 Converts the PlainTextData to text
'
)
var
pasteDataRecord
=
pasteData1
.
getRecordAt
(
0
)
console
.
log
(
'
f_test66 pasteDataRecord.convertToText =
'
+
pasteDataRecord
.
convertToText
);
console
.
log
(
'
f_test66 SUB_pasteBoard_function_JS_API_6600 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6700
* @tc.name 将一条含有特殊字符、中英混杂的文本数据强制转换为文本
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test67
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6700 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test67 systemPasteboard.clear promise
'
);
var
textData
=
'
Hello 中国!@#$%^&*()_+{}
\
?.
'
;
console
.
log
(
'
f_test67 createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test67 createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test67 Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test67 systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test67 Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test67 systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test67 Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test67 systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test67 Converts the PlainTextData to text
'
)
var
pasteDataRecord
=
pasteData1
.
getRecordAt
(
0
)
console
.
log
(
'
f_test67 pasteDataRecord.convertToText =
'
+
pasteDataRecord
.
convertToText
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6700 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6800
* @tc.name 将一条超长文本数据 (大小为301K)强制转换为文本
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test68
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6800 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test68 systemPasteboard.clear promise
'
);
var
textData
=
''
for
(
var
i
=
0
;
i
<
301
;
i
++
){
textData
=
textData
+
"
A
"
;
}
console
.
log
(
'
f_test68 createPlainTextData textData =
'
+
textData
);
var
pasteData
=
pasteboard
.
createPlainTextData
(
textData
);
console
.
log
(
'
f_test68 createPlainTextData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test68 Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test68 systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test68 Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test68 systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test68 Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test68 systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test68 Converts the PlainTextData to text
'
)
var
pasteDataRecord
=
pasteData1
.
getRecordAt
(
0
)
console
.
log
(
'
f_test68 pasteDataRecord.convertToText =
'
+
pasteDataRecord
.
convertToText
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6800 end
'
);
done
();
})
});
});
});
})
/**
* @tc.number SUB_pasteBoard_function_JS_API_6900
* @tc.name 将uri数据强制转换为文本
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 0
*/
it
(
'
pasteboard_function_test69
'
,
0
,
async
function
(
done
)
{
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6900 start
'
)
var
systemPasteboard
=
pasteboard
.
getSystemPasteboard
();
systemPasteboard
.
clear
().
then
(()
=>
{
console
.
log
(
'
f_test69 systemPasteboard.clear promise
'
);
var
uriText
=
'
https://www.baidu.com/
'
console
.
log
(
'
f_test69 createUriData uriText =
'
+
uriText
);
var
pasteData
=
pasteboard
.
createUriData
(
uriText
);
console
.
log
(
'
f_test69 createUriData pasteData =
'
+
JSON
.
stringify
(
pasteData
));
console
.
log
(
'
f_test69 Writes PasteData to the pasteboard
'
);
systemPasteboard
.
setPasteData
(
pasteData
).
then
(()
=>
{
console
.
log
(
'
f_test69 systemPasteboard.setPasteData promise
'
);
console
.
log
(
'
f_test69 Checks there is content in the pasteboard
'
)
systemPasteboard
.
hasPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test69 systemPasteboard.hasPasteData promise data =
'
+
data
);
expect
(
data
===
true
||
data
===
false
).
assertTrue
();
console
.
log
(
'
f_test69 Checks the number of records
'
);
systemPasteboard
.
getPasteData
().
then
((
data
)
=>
{
console
.
log
(
'
f_test69 systemPasteboard.getPasteData data =
'
+
JSON
.
stringify
(
data
));
var
pasteData1
=
data
;
expect
(
pasteData1
.
getRecordCount
()
==
1
).
assertTrue
();
console
.
log
(
'
f_test69 Converts the PlainTextData to text
'
)
var
pasteDataRecord
=
pasteData1
.
getRecordAt
(
0
)
console
.
log
(
'
f_test69 pasteDataRecord.convertToText =
'
+
pasteDataRecord
.
convertToText
);
console
.
log
(
'
SUB_pasteBoard_function_JS_API_6900 end
'
);
done
();
})
});
});
});
})
/**
* 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
→
miscservices/
actspasteboardjsapitest/entry/src/main/js
/resources/base/element/string.json
浏览文件 @
e3851ff2
...
...
@@ -2,7 +2,7 @@
"string"
:
[
{
"name"
:
"app_name"
,
"value"
:
"
JstimeTest
"
"value"
:
"
PasteBoardTest_js
"
},
{
"name"
:
"mainability_description"
,
...
...
miscservices/
PasteBoardTest_js/src/main
/resources/base/media/icon.png
→
miscservices/
actspasteboardjsapitest/entry/src/main/js
/resources/base/media/icon.png
浏览文件 @
e3851ff2
文件已移动
miscservices/
PasteBoardTest_js
/signature/openharmony_sx.p7b
→
miscservices/
actspasteboardjsapitest
/signature/openharmony_sx.p7b
浏览文件 @
e3851ff2
文件已移动
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录