Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
542c6d96
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看板
提交
542c6d96
编写于
7月 25, 2023
作者:
Y
yangbo
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix rename
Signed-off-by:
N
yangbo
<
yangbo258@huawei.com
>
上级
40dc8cc7
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
30 addition
and
21 deletion
+30
-21
multimedia/photoAccess/common.ts
multimedia/photoAccess/common.ts
+0
-2
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AbsAlbum/checkAttr.ets
...hotoAccess/entry/src/main/ets/test/AbsAlbum/checkAttr.ets
+8
-1
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets
...ccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets
+14
-2
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/publicApiTestWithSystemApi.ets
...em/entry/src/main/ets/test/publicApiTestWithSystemApi.ets
+8
-16
未找到文件。
multimedia/photoAccess/common.ts
浏览文件 @
542c6d96
...
...
@@ -216,9 +216,7 @@ export function checkSystemAlbum(expect, testNum, album, expectedSubType) : void
expect
(
album
.
albumType
).
assertEqual
(
albumType
.
SYSTEM
);
expect
(
album
.
albumSubtype
).
assertEqual
(
expectedSubType
);
expect
(
album
.
albumName
).
assertEqual
(
''
);
expect
(
album
.
coverUri
).
assertEqual
(
''
);
expect
(
album
.
albumUri
!==
''
).
assertEqual
(
true
);
expect
(
album
.
count
).
assertEqual
(
0
);
}
catch
(
error
)
{
console
.
info
(
`Failed to delete all user albums! error:
${
error
}
`
);
throw
error
;
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/AbsAlbum/checkAttr.ets
浏览文件 @
542c6d96
...
...
@@ -21,7 +21,8 @@ import {
fetchOption
,
getFileAsset
,
getAlbumId
,
photoKeys
photoKeys
,
albumKeys
}
from
'../../../../../../../common'
export
default
function
checkAlbumAttrTest
()
{
...
...
@@ -39,6 +40,12 @@ export default function checkAlbumAttrTest () {
const
fetchOps
=
fetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'01.jpg'
);
const
asset
=
await
getFileAsset
(
testNum
,
fetchOps
);
await
album
.
addAssets
([
asset
]);
const
fetchAlbumOps
=
fetchOption
(
testNum
,
albumKeys
.
URI
,
album
.
albumUri
);
const
fetchResult
=
await
helper
.
getAlbums
(
albumType
.
USER
,
albumSubtype
.
USER_GENERIC
,
fetchAlbumOps
);
const
newAlbum
=
await
fetchResult
.
getFirstObject
();
console
.
info
(
`${testNum} count: ${newAlbum.count}, coverUri: ${newAlbum.coverUri}`
)
expect
(
newAlbum
.
count
)
.
assertEqual
(
1
);
expect
(
newAlbum
.
coverUri
)
.
assertEqual
(
asset
.
uri
);
done
();
}
catch
(
error
)
{
console
.
info
(
`${testNum} failed; error: ${error}`
);
...
...
multimedia/photoAccess/photoAccess/entry/src/main/ets/test/PhotoAsset/commitModify.ets
浏览文件 @
542c6d96
...
...
@@ -28,6 +28,7 @@ export default function commitModifyTest () {
async
function
commitModifyCallback
(
done
,
testNum
,
fetchOps
,
newTitle
)
{
try
{
const
asset
=
await
getFileAsset
(
testNum
,
fetchOps
);
const
uri
=
asset
.
uri
;
const
oldTitle
:
photoAccessHelper
.
MemberType
=
asset
.
get
(
photoKeys
.
TITLE
)
.
toString
();
console
.
info
(
`${testNum} oldTitle: ${oldTitle}`
);
asset
.
set
(
photoKeys
.
TITLE
,
newTitle
);
...
...
@@ -38,6 +39,10 @@ export default function commitModifyTest () {
console
.
info
(
`${testNum} err: ${err}`
);
expect
(
false
)
.
assertTrue
();
}
else
{
const
option
=
photoFetchOption
(
testNum
,
photoKeys
.
URI
,
uri
);
const
newAsset
=
await
getFileAsset
(
testNum
,
option
);
const
title
:
photoAccessHelper
.
MemberType
=
newAsset
.
get
(
photoKeys
.
TITLE
)
.
toString
();
expect
(
title
)
.
assertEqual
(
newTitle
);
asset
.
set
(
photoKeys
.
TITLE
,
oldTitle
.
toString
());
await
asset
.
commitModify
();
}
...
...
@@ -76,10 +81,17 @@ export default function commitModifyTest () {
async
function
commitModifyPromise
(
done
,
testNum
,
fetchOps
,
newTitle
)
{
try
{
const
asset
=
await
getFileAsset
(
testNum
,
fetchOps
);
const
uri
=
asset
.
uri
;
const
oldTitle
:
photoAccessHelper
.
MemberType
=
asset
.
get
(
photoKeys
.
TITLE
);
console
.
info
(
`${testNum} oldTitle: ${typeof oldTitle}`
);
asset
.
set
(
photoKeys
.
TITLE
,
newTitle
);
await
asset
.
commitModify
();
const
option
=
photoFetchOption
(
testNum
,
photoKeys
.
URI
,
uri
);
const
newAsset
=
await
getFileAsset
(
testNum
,
option
);
const
title
:
photoAccessHelper
.
MemberType
=
newAsset
.
get
(
photoKeys
.
TITLE
)
.
toString
();
expect
(
title
)
.
assertEqual
(
newTitle
);
asset
.
set
(
photoKeys
.
TITLE
,
oldTitle
.
toString
());
await
asset
.
commitModify
();
done
();
...
...
@@ -133,7 +145,7 @@ export default function commitModifyTest () {
const
testNum
=
'photoAsset_commitModify_callback_001'
;
const
fetchOps
=
photoFetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'modifyCb02.jpg'
);
let
newTitle
=
''
;
for
(
let
i
=
0
;
i
<
8
4
;
i
++
)
{
for
(
let
i
=
0
;
i
<
8
3
;
i
++
)
{
newTitle
+=
'一'
;
}
await
commitModifyCallback
(
done
,
testNum
,
fetchOps
,
newTitle
);
...
...
@@ -257,7 +269,7 @@ export default function commitModifyTest () {
const
testNum
=
'photoAsset_commitModify_callback_008'
;
const
fetchOps
=
photoFetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'modifyCb02.mp4'
);
let
newTitle
=
''
;
for
(
let
i
=
0
;
i
<
8
4
;
i
++
)
{
for
(
let
i
=
0
;
i
<
8
3
;
i
++
)
{
newTitle
+=
'三'
;
}
await
commitModifyCallback
(
done
,
testNum
,
fetchOps
,
newTitle
);
...
...
multimedia/photoAccess/photoAccessSystem/entry/src/main/ets/test/publicApiTestWithSystemApi.ets
浏览文件 @
542c6d96
...
...
@@ -418,17 +418,17 @@ export default function publicApiTestWithSystemApiTest () {
await
fileAsset
.
close
(
fd
);
await
helper
.
deleteAssets
([
fileAsset
.
uri
]);
let
trashAlbumList
=
await
helper
.
getAlbums
(
albumType
.
SYSTEM
,
albumSubtype
.
TRASH
);
console
.
info
(
`${testNum} trashAlbumList: ${trashAlbumList.getCount()}`
);
let
trashAlbum
=
await
trashAlbumList
.
getFirstObject
();
const
fetchOps
=
fetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
testFileName
);
let
trashFetchResult
=
await
trashAlbum
.
getAssets
(
fetchOps
);
console
.
info
(
`${testNum} trashFetchResult: ${trashFetchResult.getCount()}`
);
const
trashFileAsset
=
await
trashFetchResult
.
getFirstObject
();
let
count
=
0
;
await
sleep
(
550
);
helper
.
registerChange
(
trashFileAsset
.
uri
,
false
,
async
(
changeData
)
=>
{
count
++
;
console
.
info
(
`${testNum} changeData: ${JSON.stringify(changeData)}`
);
expect
(
false
)
.
assertTrue
();
done
();
});
await
sleep
(
550
);
helper
.
unRegisterChange
(
trashFileAsset
.
uri
);
...
...
@@ -621,7 +621,7 @@ export default function publicApiTestWithSystemApiTest () {
await
sleep
(
550
);
let
trashAlbumList
=
await
helper
.
getAlbums
(
albumType
.
SYSTEM
,
albumSubtype
.
TRASH
);
let
trashAlbum
=
await
trashAlbumList
.
getFirstObject
();
const
fetchOps1
=
fetchOption
(
testNum
,
photoKeys
.
DISPLAY_NAME
,
'off14.jpg'
)
const
fetchOps1
=
fetchOption
(
testNum
,
photoKeys
.
URI
,
asset
.
uri
)
let
trashFetchResult
=
await
trashAlbum
.
getAssets
(
fetchOps1
);
let
trashFileAsset
=
await
trashFetchResult
.
getFirstObject
();
await
trashAlbum
.
recoverAssets
([
trashFileAsset
]);
...
...
@@ -954,9 +954,9 @@ export default function publicApiTestWithSystemApiTest () {
break
;
}
});
await
sleep
(
550
);
let
testCount
=
0
;
// 1
await
sleep
(
550
);
testCount
++
;
console
.
info
(
`${testNum} testCount: ${testCount}`
);
let
albumName
=
testNum
+
Date
.
now
();
...
...
@@ -1096,23 +1096,15 @@ export default function publicApiTestWithSystemApiTest () {
let
asset
=
await
getFileAsset
(
testNum
,
fetchOps
);
await
sleep
(
550
);
//notify times lessthan 32 in 500ms
let
i
=
0
;
uri
=
DEFAULT_PHOTO_URI
;
helper
.
registerChange
(
DEFAULT_PHOTO_URI
,
true
,
async
(
changeData
)
=>
{
listenCount
++
;
console
.
info
(
`${testNum} i: ${i}, listenCount: ${listenCount}`
);
if
(
listenCount
>
1
)
{
if
(
i
<=
32
)
{
expect
(
listenCount
-
1
)
.
assertEqual
(
1
);
}
else
{
expect
(
listenCount
-
1
)
.
assertEqual
(
Math
.
ceil
(
i
/
32
))
}
console
.
info
(
`${testNum} changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
asset
.
uri
);
listenCount
--
;
}
expect
(
i
>
1
)
.
assertTrue
()
console
.
info
(
`${testNum} changeData: ${JSON.stringify(changeData)}`
);
expect
(
changeData
.
type
)
.
assertEqual
(
NOTIFY_UPDATE
);
expect
(
changeData
.
uris
[
0
])
.
assertEqual
(
asset
.
uri
);
});
await
sleep
(
550
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录