Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
7f542d85
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看板
提交
7f542d85
编写于
9月 15, 2022
作者:
L
liangzhenyu123
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
接口用例覆盖;问题用例整改
Signed-off-by:
N
liangzhenyu123
<
liangzhenyu6@huawei.com
>
上级
b6347d95
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
523 addition
and
391 deletion
+523
-391
distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets
...Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets
+2
-0
distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardSupportBinaryData.test.ets
...ry/src/main/ets/test/PasteBoardSupportBinaryData.test.ets
+147
-0
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js
...est/hap/src/main/js/test/PreferencesPromiseJsunit.test.js
+374
-391
未找到文件。
distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/List.test.ets
浏览文件 @
7f542d85
...
@@ -15,7 +15,9 @@
...
@@ -15,7 +15,9 @@
import pasteBoardJEtsunitTest from './PasteBoardEtsunitTest';
import pasteBoardJEtsunitTest from './PasteBoardEtsunitTest';
import pasteBoardTest from './PasteBoeadPixelMapJsunit.test';
import pasteBoardTest from './PasteBoeadPixelMapJsunit.test';
import pasteBoardSupportBinaryDataTest from './PasteBoardSupportBinaryData.test';
export default function testsuite() {
export default function testsuite() {
pasteBoardSupportBinaryDataTest()
pasteBoardJEtsunitTest()
pasteBoardJEtsunitTest()
pasteBoardTest()
pasteBoardTest()
}
}
\ No newline at end of file
distributeddatamgr/Pasteboardjsapitest/entry/src/main/ets/test/PasteBoardSupportBinaryData.test.ets
0 → 100644
浏览文件 @
7f542d85
/*
* Copyright (C) 2021 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the 'License');
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an 'AS IS' BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from '@ohos/hypium'
import pasteboard from '@ohos.pasteboard'
export default function pasteBoardSupportBinaryDataTest(){
describe('pasteBoardSupportBinaryDataTest', function() {
console.info('start################################start');
/**
* @tc.number SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0100
* @tc.name Create pasteData use binary parameter
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0100', 0, async function (done) {
console.info("SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0100 start")
var systemPasteBoard = pasteboard.getSystemPasteboard();
await systemPasteBoard.clear().then(async () => {
var pasteData = undefined;
console.info("systemPasteBoard clear data success")
var dataUri = new ArrayBuffer(256)
pasteData = pasteboard.createData("text/uri",dataUri)
var addUri = new ArrayBuffer(128)
pasteData.addRecord("text/uri", addUri)
var recordUri = new ArrayBuffer(96)
var pasteDataRecord = pasteboard.createRecord("text/uri", recordUri)
pasteData.addRecord(pasteDataRecord)
await systemPasteBoard.setPasteData(pasteData).then(async () => {
console.info("Set pastedata success")
await systemPasteBoard.hasPasteData().then(async (data) => {
console.info("Check pastedata has data success, result: " + data)
expect(data).assertTrue();
await systemPasteBoard.getPasteData().then(async (data) => {
console.info("Get paste data success")
expect(data.getRecordCount()).assertEqual(3)
})
})
})
})
done();
})
/**
* @tc.number SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0200
* @tc.name Create pasteData use binary parameter
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0200', 0, async function (done) {
console.info("SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0200 start")
var systemPasteBoard = pasteboard.getSystemPasteboard();
await systemPasteBoard.clear().then(async () => {
var pasteData = undefined;
console.info("systemPasteBoard clear data success")
var dataHtml = new ArrayBuffer(256)
pasteData = pasteboard.createData("text/html",dataHtml)
var addHtml = new ArrayBuffer(128)
pasteData.addRecord("text/html", addHtml)
var recordHtml = new ArrayBuffer(64)
var pasteDataRecord = pasteboard.createRecord("text/html", recordHtml)
pasteData.addRecord(pasteDataRecord)
await systemPasteBoard.setPasteData(pasteData).then(async () => {
console.info("set pastedata success")
await systemPasteBoard.hasPasteData().then(async (data) => {
console.info("Check pastedata has data success, result: " + data)
expect(data).assertTrue();
await systemPasteBoard.getPasteData().then(async (data) => {
console.info("get paste data success")
expect(data.getRecordCount()).assertEqual(3)
})
})
})
})
done();
})
/**
* @tc.number SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0300
* @tc.name Create pasteData use binary parameter
* @tc.desc Test pasteBoard API functionality.
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 2
*/
it('SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0300', 0, async function (done) {
console.info("SUB_PASTEBOARD_BINARY_FUNCTION_ETS_TEST_0300 start")
var systemPasteBoard = pasteboard.getSystemPasteboard();
await systemPasteBoard.clear().then(async () => {
console.info("systemPasteBoard clear data success")
var pasteData = undefined
var pasteRecord = undefined;
var dataHtml = new ArrayBuffer(256)
pasteData = pasteboard.createData("x".repeat(1025),dataHtml)
expect(pasteData).assertEqual(undefined)
pasteData = pasteboard.createData("x".repeat(1024),dataHtml)
expect(pasteData != undefined).assertTrue();
var addHtml = new ArrayBuffer(128)
pasteData.addRecord("x".repeat(1025),dataHtml)
expect(pasteData.getRecordCount()).assertEqual(1)
pasteData.addRecord("x".repeat(1024),dataHtml)
expect(pasteData.getRecordCount()).assertEqual(2)
var recordHtml = new ArrayBuffer(64)
pasteRecord = pasteboard.createRecord("x".repeat(1025),dataHtml)
expect(pasteRecord).assertEqual(undefined);
pasteRecord = pasteboard.createRecord("x".repeat(1024),dataHtml)
expect(pasteRecord != undefined).assertTrue();;
pasteData.addRecord(pasteRecord)
await systemPasteBoard.setPasteData(pasteData).then(async () => {
console.info("set pastedata success")
await systemPasteBoard.hasPasteData().then(async (data) => {
console.info("Check pastedata has data success, result: " + data)
expect(data).assertTrue();
await systemPasteBoard.getPasteData().then(async (data) => {
console.info("get paste data success")
expect(data.getRecordCount()).assertEqual(3)
})
})
})
})
done();
})
console.info('end################################end');
});
}
distributeddatamgr/preferencesjstest/hap/src/main/js/test/PreferencesPromiseJsunit.test.js
浏览文件 @
7f542d85
...
@@ -29,7 +29,7 @@ var mPreferences;
...
@@ -29,7 +29,7 @@ var mPreferences;
var
context
;
var
context
;
export
default
function
preferencesPromiseTest
(){
export
default
function
preferencesPromiseTest
(){
describe
(
'
preferencesPromiseTest
'
,
function
()
{
describe
(
'
preferencesPromiseTest
'
,
function
()
{
beforeAll
(
async
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
'
beforeAll
'
)
console
.
info
(
'
beforeAll
'
)
context
=
featureAbility
.
getContext
()
context
=
featureAbility
.
getContext
()
...
@@ -357,17 +357,14 @@ describe('preferencesPromiseTest', function () {
...
@@ -357,17 +357,14 @@ describe('preferencesPromiseTest', function () {
* @tc.desc put boolean promise interface test
* @tc.desc put boolean promise interface test
*/
*/
it
(
'
testPreferencesPutBoolean0121
'
,
0
,
async
function
(
done
)
{
it
(
'
testPreferencesPutBoolean0121
'
,
0
,
async
function
(
done
)
{
const
promise
=
mPreferences
.
put
(
KEY_TEST_BOOLEAN_ELEMENT
,
true
);
await
mPreferences
.
clear
();
promise
.
then
(
async
(
ret
)
=>
{
let
promise
=
mPreferences
.
put
(
KEY_TEST_BOOLEAN_ELEMENT
,
true
);
await
promise
;
let
per
=
await
mPreferences
.
get
(
KEY_TEST_BOOLEAN_ELEMENT
,
false
);
let
per
=
await
mPreferences
.
get
(
KEY_TEST_BOOLEAN_ELEMENT
,
false
);
expect
(
true
).
assertEqual
(
per
);
expect
(
true
).
assertEqual
(
per
);
await
mPreferences
.
flush
();
await
mPreferences
.
flush
();
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_BOOLEAN_ELEMENT
,
false
);
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_BOOLEAN_ELEMENT
,
false
);
expect
(
true
).
assertEqual
(
per2
);
expect
(
true
).
assertEqual
(
per2
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
done
();
})
})
...
@@ -377,17 +374,14 @@ describe('preferencesPromiseTest', function () {
...
@@ -377,17 +374,14 @@ describe('preferencesPromiseTest', function () {
* @tc.desc put float promise interface test
* @tc.desc put float promise interface test
*/
*/
it
(
'
testPreferencesPutFloat0131
'
,
0
,
async
function
(
done
)
{
it
(
'
testPreferencesPutFloat0131
'
,
0
,
async
function
(
done
)
{
await
mPreferences
.
clear
();
const
promise
=
mPreferences
.
put
(
KEY_TEST_FLOAT_ELEMENT
,
4.0
);
const
promise
=
mPreferences
.
put
(
KEY_TEST_FLOAT_ELEMENT
,
4.0
);
promise
.
then
(
async
(
ret
)
=>
{
await
promise
;
let
per
=
await
mPreferences
.
get
(
KEY_TEST_FLOAT_ELEMENT
,
0.0
);
let
per
=
await
mPreferences
.
get
(
KEY_TEST_FLOAT_ELEMENT
,
0.0
);
expect
(
4.0
).
assertEqual
(
per
);
expect
(
4.0
).
assertEqual
(
per
);
await
mPreferences
.
flush
();
await
mPreferences
.
flush
();
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_FLOAT_ELEMENT
,
0.0
);
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_FLOAT_ELEMENT
,
0.0
);
expect
(
4.0
).
assertEqual
(
per2
);
expect
(
4.0
).
assertEqual
(
per2
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
done
();
})
})
...
@@ -397,17 +391,14 @@ describe('preferencesPromiseTest', function () {
...
@@ -397,17 +391,14 @@ describe('preferencesPromiseTest', function () {
* @tc.desc put int promise interface test
* @tc.desc put int promise interface test
*/
*/
it
(
'
testPreferencesPutInt0141
'
,
0
,
async
function
(
done
)
{
it
(
'
testPreferencesPutInt0141
'
,
0
,
async
function
(
done
)
{
const
promise
=
mPreferences
.
put
(
KEY_TEST_INT_ELEMENT
,
4
);
await
mPreferences
.
clear
();
promise
.
then
(
async
(
ret
)
=>
{
let
promise
=
mPreferences
.
put
(
KEY_TEST_INT_ELEMENT
,
4
);
await
promise
;
let
per
=
await
mPreferences
.
get
(
KEY_TEST_INT_ELEMENT
,
0
);
let
per
=
await
mPreferences
.
get
(
KEY_TEST_INT_ELEMENT
,
0
);
expect
(
4
).
assertEqual
(
per
);
expect
(
4
).
assertEqual
(
per
);
await
mPreferences
.
flush
();
await
mPreferences
.
flush
();
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_INT_ELEMENT
,
0
);
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_INT_ELEMENT
,
0
);
expect
(
4
).
assertEqual
(
per2
);
expect
(
4
).
assertEqual
(
per2
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
done
();
})
})
...
@@ -417,17 +408,13 @@ describe('preferencesPromiseTest', function () {
...
@@ -417,17 +408,13 @@ describe('preferencesPromiseTest', function () {
* @tc.desc put long promise interface test
* @tc.desc put long promise interface test
*/
*/
it
(
'
testPreferencesPutLong0151
'
,
0
,
async
function
(
done
)
{
it
(
'
testPreferencesPutLong0151
'
,
0
,
async
function
(
done
)
{
cons
t
promise
=
mPreferences
.
put
(
KEY_TEST_LONG_ELEMENT
,
4
);
le
t
promise
=
mPreferences
.
put
(
KEY_TEST_LONG_ELEMENT
,
4
);
promise
.
then
(
async
(
ret
)
=>
{
await
promise
;
let
per
=
await
mPreferences
.
get
(
KEY_TEST_LONG_ELEMENT
,
0
);
let
per
=
await
mPreferences
.
get
(
KEY_TEST_LONG_ELEMENT
,
0
);
expect
(
4
).
assertEqual
(
per
);
expect
(
4
).
assertEqual
(
per
);
await
mPreferences
.
flush
();
await
mPreferences
.
flush
();
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_LONG_ELEMENT
,
0
);
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_LONG_ELEMENT
,
0
);
expect
(
4
).
assertEqual
(
per2
);
expect
(
4
).
assertEqual
(
per2
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
done
();
})
})
...
@@ -437,17 +424,13 @@ describe('preferencesPromiseTest', function () {
...
@@ -437,17 +424,13 @@ describe('preferencesPromiseTest', function () {
* @tc.desc put String promise interface test
* @tc.desc put String promise interface test
*/
*/
it
(
'
testPreferencesPutString0161
'
,
0
,
async
function
(
done
)
{
it
(
'
testPreferencesPutString0161
'
,
0
,
async
function
(
done
)
{
cons
t
promise
=
mPreferences
.
put
(
KEY_TEST_STRING_ELEMENT
,
''
);
le
t
promise
=
mPreferences
.
put
(
KEY_TEST_STRING_ELEMENT
,
''
);
promise
.
then
(
async
(
ret
)
=>
{
await
promise
;
let
per
=
await
mPreferences
.
get
(
KEY_TEST_STRING_ELEMENT
,
"
defaultvalue
"
)
let
per
=
await
mPreferences
.
get
(
KEY_TEST_STRING_ELEMENT
,
"
defaultvalue
"
)
expect
(
''
).
assertEqual
(
per
);
expect
(
''
).
assertEqual
(
per
);
await
mPreferences
.
flush
();
await
mPreferences
.
flush
();
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_STRING_ELEMENT
,
"
defaultvalue
"
)
let
per2
=
await
mPreferences
.
get
(
KEY_TEST_STRING_ELEMENT
,
"
defaultvalue
"
)
expect
(
''
).
assertEqual
(
per2
);
expect
(
''
).
assertEqual
(
per2
);
}).
catch
((
err
)
=>
{
expect
(
null
).
assertFail
();
});
await
promise
;
done
();
done
();
})
})
...
@@ -458,7 +441,7 @@ describe('preferencesPromiseTest', function () {
...
@@ -458,7 +441,7 @@ describe('preferencesPromiseTest', function () {
*/
*/
it
(
'
testPreferencesGetDefValue00162
'
,
0
,
async
function
(
done
)
{
it
(
'
testPreferencesGetDefValue00162
'
,
0
,
async
function
(
done
)
{
await
mPreferences
.
clear
();
await
mPreferences
.
clear
();
cons
t
promise
=
mPreferences
.
get
(
KEY_TEST_BOOLEAN_ELEMENT
,
true
);
le
t
promise
=
mPreferences
.
get
(
KEY_TEST_BOOLEAN_ELEMENT
,
true
);
promise
.
then
((
ret
)
=>
{
promise
.
then
((
ret
)
=>
{
expect
(
true
).
assertEqual
(
ret
);
expect
(
true
).
assertEqual
(
ret
);
}).
catch
((
err
)
=>
{
}).
catch
((
err
)
=>
{
...
@@ -467,5 +450,5 @@ describe('preferencesPromiseTest', function () {
...
@@ -467,5 +450,5 @@ describe('preferencesPromiseTest', function () {
await
promise
;
await
promise
;
done
();
done
();
})
})
})
})
}
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录