Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
7056046d
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看板
未验证
提交
7056046d
编写于
10月 24, 2022
作者:
O
openharmony_ci
提交者:
Gitee
10月 24, 2022
浏览文件
操作
浏览文件
下载
差异文件
!5993 【3.1-Release】【xts】fix asset[]
Merge pull request !5993 from yangbo/3.1-release_1020
上级
8780f1fc
8bc055c9
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
270 addition
and
172 deletion
+270
-172
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAsset2.test.js
...iaLibrary_js_standard/src/main/js/test/fileAsset2.test.js
+9
-31
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAssetCallBack2.test.js
...y_js_standard/src/main/js/test/fileAssetCallBack2.test.js
+9
-31
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAssetPromise2.test.js
...ry_js_standard/src/main/js/test/fileAssetPromise2.test.js
+9
-31
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestCallBack.test.js
...ary_js_standard/src/main/js/test/fileTestCallBack.test.js
+0
-12
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestPromise.test.js
...rary_js_standard/src/main/js/test/fileTestPromise.test.js
+0
-12
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/filekeyTestCallBack.test.js
..._js_standard/src/main/js/test/filekeyTestCallBack.test.js
+121
-28
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/filekeyTestPromise.test.js
...y_js_standard/src/main/js/test/filekeyTestPromise.test.js
+122
-27
未找到文件。
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAsset2.test.js
浏览文件 @
7056046d
...
...
@@ -17,29 +17,7 @@ import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
function
printAttr
(
asset
)
{
for
(
const
key
in
asset
)
{
console
.
info
(
`
${
key
}
: asset[key]`
);
}
}
function
checkAttrs
(
done
,
asset
,
tNum
)
{
let
passed
=
true
;
for
(
const
key
in
asset
)
{
if
(
asset
[
key
]
==
undefined
)
{
passed
=
false
;
break
;
}
}
if
(
passed
)
{
console
.
info
(
`FileAsset checkAttrs
${
tNum
}
passed`
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
`FileAsset checkAttrs
${
tNum
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
}
function
sleep
(
time
){
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
...
...
@@ -323,8 +301,8 @@ describe('fileAsset2.test.js', async function () {
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
001
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
catch
(
error
)
{
console
.
info
(
'
FileAsset checkAttr 001 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
...
...
@@ -345,8 +323,8 @@ describe('fileAsset2.test.js', async function () {
const
fetchFileResult
=
await
media
.
getFileAssets
(
videosfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
002
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
catch
(
error
)
{
console
.
info
(
'
FileAsset checkAttr 002 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
...
...
@@ -367,8 +345,8 @@ describe('fileAsset2.test.js', async function () {
const
fetchFileResult
=
await
media
.
getFileAssets
(
audiosfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
003
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
catch
(
error
)
{
console
.
info
(
'
FileAsset checkAttr 003 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
...
...
@@ -390,8 +368,8 @@ describe('fileAsset2.test.js', async function () {
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
allTypefetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
004
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
catch
(
error
)
{
console
.
info
(
'
FileAsset checkAttr 003 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
...
...
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAssetCallBack2.test.js
浏览文件 @
7056046d
...
...
@@ -17,29 +17,7 @@ import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
function
printAttr
(
asset
)
{
for
(
const
key
in
asset
)
{
console
.
info
(
`
${
key
}
: asset[key]`
);
}
}
function
checkAttrs
(
done
,
asset
,
tNum
)
{
let
passed
=
true
;
for
(
const
key
in
asset
)
{
if
(
asset
[
key
]
==
undefined
)
{
passed
=
false
;
break
;
}
}
if
(
passed
)
{
console
.
info
(
`FileAsset checkAttrs
${
tNum
}
passed`
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
`FileAsset checkAttrs
${
tNum
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
}
function
sleep
(
time
){
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
...
...
@@ -347,8 +325,8 @@ describe('fileAssetCallBack2.test.js', async function () {
expect
(
false
).
assertTrue
();
done
();
}
else
{
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
001
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
});
}
catch
(
error
)
{
...
...
@@ -374,8 +352,8 @@ describe('fileAssetCallBack2.test.js', async function () {
expect
(
false
).
assertTrue
();
done
();
}
else
{
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
002
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
});
}
catch
(
error
)
{
...
...
@@ -401,8 +379,8 @@ describe('fileAssetCallBack2.test.js', async function () {
expect
(
false
).
assertTrue
();
done
();
}
else
{
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
003
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
});
}
catch
(
error
)
{
...
...
@@ -430,8 +408,8 @@ describe('fileAssetCallBack2.test.js', async function () {
expect
(
false
).
assertTrue
();
done
();
}
else
{
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
004
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
});
...
...
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileAssetPromise2.test.js
浏览文件 @
7056046d
...
...
@@ -17,29 +17,7 @@ import mediaLibrary from '@ohos.multimedia.mediaLibrary';
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
'
deccjsunit/index
'
;
function
printAttr
(
asset
)
{
for
(
const
key
in
asset
)
{
console
.
info
(
`
${
key
}
: asset[key]`
);
}
}
function
checkAttrs
(
done
,
asset
,
tNum
)
{
let
passed
=
true
;
for
(
const
key
in
asset
)
{
if
(
asset
[
key
]
==
undefined
)
{
passed
=
false
;
break
;
}
}
if
(
passed
)
{
console
.
info
(
`FileAsset checkAttrs
${
tNum
}
passed`
);
expect
(
true
).
assertTrue
();
done
();
}
else
{
console
.
info
(
`FileAsset checkAttrs
${
tNum
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
}
function
sleep
(
time
){
for
(
let
t
=
Date
.
now
();
Date
.
now
()
-
t
<=
time
;);
}
...
...
@@ -323,8 +301,8 @@ describe('fileAssetPromise2.test.js', async function () {
const
fetchFileResult
=
await
media
.
getFileAssets
(
imagesfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
001
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
catch
(
error
)
{
console
.
info
(
'
FileAsset checkAttr 001 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
...
...
@@ -345,8 +323,8 @@ describe('fileAssetPromise2.test.js', async function () {
const
fetchFileResult
=
await
media
.
getFileAssets
(
videosfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
002
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
catch
(
error
)
{
console
.
info
(
'
FileAsset checkAttr 002 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
...
...
@@ -367,8 +345,8 @@ describe('fileAssetPromise2.test.js', async function () {
const
fetchFileResult
=
await
media
.
getFileAssets
(
audiosfetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
003
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
catch
(
error
)
{
console
.
info
(
'
FileAsset checkAttr 003 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
...
...
@@ -390,8 +368,8 @@ describe('fileAssetPromise2.test.js', async function () {
const
album
=
albumList
[
0
];
const
fetchFileResult
=
await
album
.
getFileAssets
(
allTypefetchOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
printAttr
(
asset
);
checkAttrs
(
done
,
asset
,
'
004
'
);
expect
(
true
).
assertTrue
(
);
done
(
);
}
catch
(
error
)
{
console
.
info
(
'
FileAsset checkAttr 003 failed, message =
'
+
error
);
expect
(
false
).
assertTrue
();
...
...
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestCallBack.test.js
浏览文件 @
7056046d
...
...
@@ -41,18 +41,6 @@ let filesfetchOp = {
selectionArgs
:
[
fileType
.
toString
(),
'
Documents/
'
],
};
function
checkAssetAttr
(
done
,
attr
,
testNum
,
asset
,
checkType
)
{
if
(
checkType
&&
asset
[
attr
]
!=
checkType
)
{
console
.
info
(
`ASSET_CALLBACK getFileAssets
${
testNum
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
else
if
(
asset
[
attr
]
==
undefined
)
{
console
.
info
(
`ASSET_CALLBACK getFileAssets
${
testNum
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
}
let
path
;
let
presetAsset
;
let
displayName
;
...
...
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/fileTestPromise.test.js
浏览文件 @
7056046d
...
...
@@ -41,18 +41,6 @@ let filesfetchOp = {
selectionArgs
:
[
fileType
.
toString
(),
'
Documents/
'
],
};
function
checkAssetAttr
(
done
,
attr
,
testNum
,
asset
,
checkType
)
{
if
(
checkType
&&
asset
[
attr
]
!=
checkType
)
{
console
.
info
(
`ASSET_PROMISE getFileAssets
${
testNum
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
else
if
(
asset
[
attr
]
==
undefined
)
{
console
.
info
(
`ASSET_PROMISE getFileAssets
${
testNum
}
failed`
);
expect
(
false
).
assertTrue
();
done
();
}
}
let
path
;
let
presetAsset
;
let
displayName
;
...
...
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/filekeyTestCallBack.test.js
浏览文件 @
7056046d
...
...
@@ -64,18 +64,7 @@ const filekeys = {
dateTaken
:
'
DATE_TAKEN
'
,
}
async
function
getFileAssetsBy
(
done
,
type
)
{
let
assetOp
=
imagesfetchOp
if
(
type
==
'
audioAlbum
'
||
type
==
'
artist
'
||
type
==
'
duration
'
)
{
assetOp
=
audiosfetchOp
}
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
[
filekeys
[
type
]]
+
'
= ?
'
,
selectionArgs
:
[
asset
[
type
]
+
''
],
};
async
function
getFileAssetsBy
(
done
,
Op
,
type
)
{
try
{
media
.
getFileAssets
(
Op
,
async
(
err
,
fetchFileResult
)
=>
{
if
(
fetchFileResult
==
undefined
)
{
...
...
@@ -116,7 +105,14 @@ describe('filekeyTestPromise.test.js', async function () {
*/
it
(
'
test_fileKey_001
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
parent
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
PARENT
+
'
= ?
'
,
selectionArgs
:
[
asset
.
parent
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
parent
'
);
});
/**
...
...
@@ -128,7 +124,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_002
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
mimeType
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
MIME_TYPE
+
'
= ?
'
,
selectionArgs
:
[
asset
.
mimeType
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
mimeType
'
);
});
/**
...
...
@@ -140,7 +143,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_003
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
size
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
SIZE
+
'
= ?
'
,
selectionArgs
:
[
asset
.
size
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
size
'
);
});
/**
...
...
@@ -152,8 +162,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_004
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
dateAdded
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
DATE_ADDED
+
'
= ?
'
,
selectionArgs
:
[
asset
.
dateAdded
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
dateAdded
'
);
});
/**
...
...
@@ -165,7 +181,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_005
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
dateModified
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
DATE_MODIFIED
+
'
= ?
'
,
selectionArgs
:
[
asset
.
dateModified
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
dateModified
'
);
});
/**
...
...
@@ -177,7 +200,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_006
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
dateTaken
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
DATE_TAKEN
+
'
= ?
'
,
selectionArgs
:
[
asset
.
dateTaken
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
dateTaken
'
);
});
/**
...
...
@@ -189,7 +219,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_007
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
title
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
TITLE
+
'
= ?
'
,
selectionArgs
:
[
asset
.
title
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
title
'
);
});
/**
...
...
@@ -201,7 +238,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_008
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
duration
'
);
let
assetOp
=
audiosfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
DURATION
+
'
= ?
'
,
selectionArgs
:
[
asset
.
duration
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
duration
'
);
});
/**
...
...
@@ -213,7 +257,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_009
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
width
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
WIDTH
+
'
= ?
'
,
selectionArgs
:
[
asset
.
width
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
width
'
);
});
/**
...
...
@@ -225,7 +276,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_010
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
height
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
HEIGHT
+
'
= ?
'
,
selectionArgs
:
[
asset
.
height
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
height
'
);
});
/**
...
...
@@ -237,7 +295,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_011
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
orientation
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
ORIENTATION
+
'
= ?
'
,
selectionArgs
:
[
asset
.
orientation
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
orientation
'
);
});
/**
...
...
@@ -249,7 +314,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_012
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
albumId
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
ALBUM_ID
+
'
= ?
'
,
selectionArgs
:
[
asset
.
albumId
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
albumId
'
);
});
/**
...
...
@@ -261,7 +333,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_0013
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
albumName
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
ALBUM_NAME
+
'
= ?
'
,
selectionArgs
:
[
asset
.
albumName
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
albumName
'
);
});
/**
...
...
@@ -273,7 +352,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_0014
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
artist
'
);
let
assetOp
=
audiosfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
ARTIST
+
'
= ?
'
,
selectionArgs
:
[
asset
.
artist
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
artist
'
);
});
/**
...
...
@@ -285,6 +371,13 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_0015
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
audioAlbum
'
);
let
assetOp
=
audiosfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
AUDIOALBUM
+
'
= ?
'
,
selectionArgs
:
[
asset
.
audioAlbum
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
audioAlbum
'
);
});
});
multimedia/medialibrary/mediaLibrary_js_standard/src/main/js/test/filekeyTestPromise.test.js
浏览文件 @
7056046d
...
...
@@ -64,17 +64,8 @@ const filekeys = {
dateTaken
:
'
DATE_TAKEN
'
,
}
async
function
getFileAssetsBy
(
done
,
type
)
{
let
assetOp
=
imagesfetchOp
if
(
type
==
'
audioAlbum
'
||
type
==
'
artist
'
||
type
==
'
duration
'
)
{
assetOp
=
audiosfetchOp
}
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
[
filekeys
[
type
]]
+
'
= ?
'
,
selectionArgs
:
[
asset
[
type
]
+
''
],
};
async
function
getFileAssetsBy
(
done
,
Op
,
type
)
{
try
{
let
fetchFileResult
=
await
media
.
getFileAssets
(
Op
);
...
...
@@ -105,7 +96,14 @@ describe('filekeyTestPromise.test.js', async function () {
*/
it
(
'
test_fileKey_001
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
parent
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
PARENT
+
'
= ?
'
,
selectionArgs
:
[
asset
.
parent
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
parent
'
);
});
/**
...
...
@@ -117,7 +115,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_002
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
mimeType
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
MIME_TYPE
+
'
= ?
'
,
selectionArgs
:
[
asset
.
mimeType
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
mimeType
'
);
});
/**
...
...
@@ -129,7 +134,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_003
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
size
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
SIZE
+
'
= ?
'
,
selectionArgs
:
[
asset
.
size
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
size
'
);
});
/**
...
...
@@ -141,8 +153,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_004
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
dateAdded
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
DATE_ADDED
+
'
= ?
'
,
selectionArgs
:
[
asset
.
dateAdded
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
dateAdded
'
);
});
/**
...
...
@@ -154,7 +172,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_005
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
dateModified
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
DATE_MODIFIED
+
'
= ?
'
,
selectionArgs
:
[
asset
.
dateModified
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
dateModified
'
);
});
/**
...
...
@@ -166,7 +191,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_006
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
dateTaken
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
DATE_TAKEN
+
'
= ?
'
,
selectionArgs
:
[
asset
.
dateTaken
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
dateTaken
'
);
});
/**
...
...
@@ -178,7 +210,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_007
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
title
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
TITLE
+
'
= ?
'
,
selectionArgs
:
[
asset
.
title
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
title
'
);
});
/**
...
...
@@ -190,7 +229,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_008
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
duration
'
);
let
assetOp
=
audiosfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
DURATION
+
'
= ?
'
,
selectionArgs
:
[
asset
.
duration
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
duration
'
);
});
/**
...
...
@@ -202,7 +248,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_009
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
width
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
WIDTH
+
'
= ?
'
,
selectionArgs
:
[
asset
.
width
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
width
'
);
});
/**
...
...
@@ -214,7 +267,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_010
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
height
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
HEIGHT
+
'
= ?
'
,
selectionArgs
:
[
asset
.
height
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
height
'
);
});
/**
...
...
@@ -226,7 +286,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_011
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
orientation
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
ORIENTATION
+
'
= ?
'
,
selectionArgs
:
[
asset
.
orientation
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
orientation
'
);
});
/**
...
...
@@ -238,7 +305,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_012
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
albumId
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
ALBUM_ID
+
'
= ?
'
,
selectionArgs
:
[
asset
.
albumId
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
albumId
'
);
});
/**
...
...
@@ -250,7 +324,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_0013
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
albumName
'
);
let
assetOp
=
imagesfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
ALBUM_NAME
+
'
= ?
'
,
selectionArgs
:
[
asset
.
albumName
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
albumName
'
);
});
/**
...
...
@@ -262,7 +343,14 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_0014
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
artist
'
);
let
assetOp
=
audiosfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
ARTIST
+
'
= ?
'
,
selectionArgs
:
[
asset
.
artist
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
artist
'
);
});
/**
...
...
@@ -274,6 +362,13 @@ describe('filekeyTestPromise.test.js', async function () {
* @tc.level : Level 0
*/
it
(
'
test_fileKey_0015
'
,
0
,
async
function
(
done
)
{
getFileAssetsBy
(
done
,
'
audioAlbum
'
);
let
assetOp
=
audiosfetchOp
const
fetchFileResult
=
await
media
.
getFileAssets
(
assetOp
);
const
asset
=
await
fetchFileResult
.
getFirstObject
();
let
Op
=
{
selections
:
mediaLibrary
.
FileKey
.
AUDIOALBUM
+
'
= ?
'
,
selectionArgs
:
[
asset
.
audioAlbum
+
''
],
};
getFileAssetsBy
(
done
,
Op
,
'
audioAlbum
'
);
});
});
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录