Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
99a62067
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
99a62067
编写于
9月 16, 2022
作者:
O
openharmony_ci
提交者:
Gitee
9月 16, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5456 mediaLibrary xts fix default param
Merge pull request !5456 from caochuan/mediaLibrary
上级
884ea032
3930ac91
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
34 addition
and
12 deletion
+34
-12
multimedia/medialibrary/common.js
multimedia/medialibrary/common.js
+32
-12
multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets
...et/entry/src/main/ets/test/fileAssetTestCallback.test.ets
+1
-0
multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets
...set/entry/src/main/ets/test/fileAssetTestPromise.test.ets
+1
-0
未找到文件。
multimedia/medialibrary/common.js
浏览文件 @
99a62067
...
...
@@ -36,11 +36,18 @@ const FILE_TYPE = mediaLibrary.MediaType.FILE;
const
FILEKEY
=
mediaLibrary
.
FileKey
;
const
{
RELATIVE_PATH
,
ALBUM_NAME
,
MEDIA_TYPE
}
=
FILEKEY
const
sleep
=
async
function
sleep
(
times
=
10
)
{
await
new
Promise
(
res
=>
setTimeout
(
res
,
times
));
}
const
allFetchOp
=
function
(
others
=
{})
{
const
sleep
=
async
function
sleep
(
times
)
{
if
(
!
times
)
{
times
=
10
;
}
await
new
Promise
((
res
)
=>
setTimeout
(
res
,
times
));
};
const
allFetchOp
=
function
(
others
)
{
if
(
!
others
)
{
others
=
{};
}
return
{
selections
:
''
,
selectionArgs
:
[],
...
...
@@ -48,7 +55,10 @@ const allFetchOp = function (others = {}) {
};
}
const
fetchOps
=
function
(
testNum
,
path
,
type
,
others
=
{})
{
const
fetchOps
=
function
(
testNum
,
path
,
type
,
others
)
{
if
(
!
others
)
{
others
=
{};
}
let
ops
=
{
selections
:
FILEKEY
.
RELATIVE_PATH
+
'
= ? AND
'
+
FILEKEY
.
MEDIA_TYPE
+
'
=?
'
,
selectionArgs
:
[
path
,
type
.
toString
()],
...
...
@@ -84,8 +94,10 @@ const fileIdFetchOps = function (testNum, id) {
return
ops
;
};
const
albumFetchOps
=
function
(
testNum
,
path
,
albumName
,
type
,
others
=
{
order
:
FILEKEY
.
DATE_ADDED
+
"
DESC
"
,
})
{
const
albumFetchOps
=
function
(
testNum
,
path
,
albumName
,
type
,
others
)
{
if
(
!
others
)
{
others
=
{
order
:
FILEKEY
.
DATE_ADDED
+
"
DESC
"
,
};
}
let
ops
=
{
selections
:
RELATIVE_PATH
+
'
= ? AND
'
+
ALBUM_NAME
+
'
= ? AND
'
+
MEDIA_TYPE
+
'
= ?
'
,
selectionArgs
:
[
path
,
albumName
,
type
.
toString
()],
...
...
@@ -96,8 +108,10 @@ const albumFetchOps = function (testNum, path, albumName, type,
}
// albums of two resource types
const
albumTwoTypesFetchOps
=
function
(
testNum
,
paths
,
albumName
,
types
,
others
=
{
order
:
FILEKEY
.
DATE_ADDED
+
"
DESC
"
,
})
{
const
albumTwoTypesFetchOps
=
function
(
testNum
,
paths
,
albumName
,
types
,
others
)
{
if
(
!
others
)
{
others
=
{
order
:
FILEKEY
.
DATE_ADDED
+
"
DESC
"
};
}
try
{
let
ops
=
{
selections
:
'
(
'
+
RELATIVE_PATH
+
'
= ? or
'
+
...
...
@@ -116,7 +130,10 @@ const albumTwoTypesFetchOps = function (testNum, paths, albumName, types,
}
// albums of three resource types
const
albumThreeTypesFetchOps
=
function
(
testNum
,
paths
,
albumName
,
types
,
others
=
{
order
:
FILEKEY
.
DATE_ADDED
,
})
{
const
albumThreeTypesFetchOps
=
function
(
testNum
,
paths
,
albumName
,
types
,
others
)
{
if
(
!
others
)
{
others
=
{
order
:
FILEKEY
.
DATE_ADDED
+
"
DESC
"
};
}
try
{
let
ops
=
{
selections
:
'
(
'
+
RELATIVE_PATH
+
'
= ? or
'
+
...
...
@@ -181,9 +198,12 @@ const checkAlbumsCount = function (done, testNum, albumList, expectCount) {
return
albumsCount
==
expectCount
;
}
const
getPermission
=
async
function
(
name
=
'
ohos.acts.multimedia.mediaLibrary
'
)
{
const
getPermission
=
async
function
(
name
)
{
if
(
!
name
)
{
name
=
"
ohos.acts.multimedia.mediaLibrary
"
;
}
console
.
info
(
'
getPermission start
'
,
name
)
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.acts.multimedia.mediaLibrary
'
,
0
,
100
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
name
,
0
,
100
);
let
tokenID
=
appInfo
.
accessTokenId
;
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
let
result1
=
await
atManager
.
grantUserGrantedPermission
(
tokenID
,
"
ohos.permission.MEDIA_LOCATION
"
,
1
);
...
...
multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestCallback.test.ets
浏览文件 @
99a62067
...
...
@@ -77,6 +77,7 @@ export default function fileAssetTestCallbackTest(abilityContext) {
console.info(`fd1:${fd1},fd:${fd}`)
await asset.close(fd);
await asset1.close(fd1);
await sleep(50);
let newFetchFileResult = await media.getFileAssets(fileIdFetchOps(testNum, asset.id));
let checkAssetCountPass = await checkAssetsCount(done, testNum, newFetchFileResult, 1);
if (!checkAssetCountPass) return;
...
...
multimedia/medialibrary/mediaLibrary_fileAsset/entry/src/main/ets/test/fileAssetTestPromise.test.ets
浏览文件 @
99a62067
...
...
@@ -71,6 +71,7 @@ export default function fileAssetTestPromiseTest(abilityContext) {
console.info(`fd1:${fd1},fd:${fd}`)
await asset.close(fd);
await asset1.close(fd1);
await sleep(50);
let newFetchFileResult = await media.getFileAssets(fileIdFetchOps(testNum, asset.id));
checkAssetCountPass = await checkAssetsCount(done, testNum, newFetchFileResult, 1);
if (!checkAssetCountPass) return;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录