Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
a4e61b8b
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,发现更多精彩内容 >>
未验证
提交
a4e61b8b
编写于
2月 25, 2023
作者:
范
范晓兵
提交者:
Gitee
2月 25, 2023
1
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
【mediaLibrary】【master】mediaLibrary_getThumbnail 补充异常场景用例
Signed-off-by:
N
范晓兵
<
fanxiaobing2@huawei.com
>
上级
12d9fbe2
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
658 addition
and
28 deletion
+658
-28
multimedia/medialibrary/mediaLibrary_getThumbnail/entry/src/main/ets/test/getThumbnailCallback.test.ets
...ail/entry/src/main/ets/test/getThumbnailCallback.test.ets
+339
-14
multimedia/medialibrary/mediaLibrary_getThumbnail/entry/src/main/ets/test/getThumbnailPromise.test.ets
...nail/entry/src/main/ets/test/getThumbnailPromise.test.ets
+319
-14
未找到文件。
multimedia/medialibrary/mediaLibrary_getThumbnail/entry/src/main/ets/test/getThumbnailCallback.test.ets
浏览文件 @
a4e61b8b
/*
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022
-2023
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
import
mediaLibrary
from
"@ohos.multimedia.mediaLibrary"
;
import
mediaLibrary
from
"@ohos.multimedia.mediaLibrary"
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
"deccjsunit/index"
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
"deccjsunit/index"
;
import
fileio
from
"@ohos.fileio"
;
import
image
from
"@ohos.multimedia.image"
;
import
image
from
"@ohos.multimedia.image"
;
import
{
import
{
...
@@ -29,8 +30,12 @@ import {
...
@@ -29,8 +30,12 @@ import {
}
from
"../../../../../../common"
;
}
from
"../../../../../../common"
;
export
default
function
getThumbnailCallback
(
abilityContext
)
{
export
default
function
getThumbnailCallback
(
abilityContext
)
{
describe
(
"getThumbnailCallback"
,
function
()
{
describe
(
"getThumbnailCallback"
,
function
()
{
console
.
info
(
'MediaLibraryTest:getMediaLibrary IN'
);
image
.
createPixelMap
(
new
ArrayBuffer
(
4096
),
{
size
:
{
height
:
1
,
width
:
2
}
})
.
then
((
pixelmap
)
=>
{});
image
.
createPixelMap
(
new
ArrayBuffer
(
4096
),
{
size
:
{
height
:
1
,
width
:
2
}
})
.
then
((
pixelmap
)
=>
{});
const
media
=
mediaLibrary
.
getMediaLibrary
(
abilityContext
);
const
media
=
mediaLibrary
.
getMediaLibrary
(
abilityContext
);
console
.
info
(
'MediaLibraryTest:getMediaLibrary OUT'
);
let
fileKeyObj
=
mediaLibrary
.
FileKey
;
beforeAll
(
async
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
"beforeAll case"
);
console
.
info
(
"beforeAll case"
);
await
getPermission
(
null
,
abilityContext
);
await
getPermission
(
null
,
abilityContext
);
...
@@ -47,6 +52,32 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -47,6 +52,32 @@ export default function getThumbnailCallback(abilityContext) {
console
.
info
(
"afterAll case"
);
console
.
info
(
"afterAll case"
);
});
});
function
fetchThumbnailOps
(
id
){
return
{
selections
:
fileKeyObj
.
ID
+
'= ? AND '
+
'lcd is not null'
+
' AND '
+
'thumbnail is not null'
,
selectionArgs
:
[
id
+
''
],
};
}
function
fetchOpsNew
(
path
,
type
){
return
{
selections
:
fileKeyObj
.
RELATIVE_PATH
+
'= ? AND '
+
fileKeyObj
.
MEDIA_TYPE
+
'=?'
,
selectionArgs
:
[
path
,
type
.
toString
()],
order
:
fileKeyObj
.
DATE_ADDED
,
};
}
function
checkCount
(
done
,
testNum
,
count
){
console
.
info
(
'${testNum}::count:${count}'
);
if
(
count
<=
0
){
console
.
info
(
'${testNum}::resources is empty'
);
expect
(
false
)
.
assertTrue
();
done
();
return
false
;
}
return
true
;
}
async
function
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
)
{
async
function
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
)
{
try
{
try
{
let
fetchFileResult
=
await
media
.
getFileAssets
(
dOp
);
let
fetchFileResult
=
await
media
.
getFileAssets
(
dOp
);
...
@@ -114,6 +145,30 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -114,6 +145,30 @@ export default function getThumbnailCallback(abilityContext) {
}
}
}
}
async
function
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
)
{
try
{
let
fetchFileResult
=
await
media
.
getFileAssets
(
dOp
);
let
count
=
fetchFileResult
.
getCount
();
if
(
!
checkCount
(
done
,
testNum
,
count
))
return
;
let
asset
=
await
fetchFileResult
.
getFirstObject
();
asset
.
getThumbnail
(
size
,
async
(
err
,
pixelmap
)
=>
{
expect
(
false
)
.
assertTrue
();
done
();
});
}
catch
(
error
)
{
console
.
info
(
`${testNum}:: error :${error}`
);
expect
(
true
)
.
assertTrue
();
done
();
}
}
async
function
copyFile
(
fd1
,
fd2
){
let
stat
=
await
fileio
.
fstat
(
fd1
);
let
buf
=
new
ArrayBuffer
(
stat
.
size
);
await
fileio
.
read
(
fd1
,
buf
);
await
fileio
.
write
(
fd2
,
buf
);
}
// ------------------------------ image type start -----------------------
// ------------------------------ image type start -----------------------
/**
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_01
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_01
...
@@ -181,9 +236,9 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -181,9 +236,9 @@ export default function getThumbnailCallback(abilityContext) {
* @tc.desc : getThumbnail(image) by { width: 0, height: 0 }
* @tc.desc : getThumbnail(image) by { width: 0, height: 0 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_05"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_05"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_05"
;
let
dOp
=
fetchOps
(
testNum
,
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
{
width
:
0
,
height
:
0
};
let
size
=
{
width
:
0
,
height
:
0
};
...
@@ -196,9 +251,9 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -196,9 +251,9 @@ export default function getThumbnailCallback(abilityContext) {
* @tc.desc : getThumbnail(image) by { width: -128, height: -128 }
* @tc.desc : getThumbnail(image) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_06"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_06"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_001_06"
;
let
dOp
=
fetchOps
(
testNum
,
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
{
width
:
-
128
,
height
:
-
128
};
let
size
=
{
width
:
-
128
,
height
:
-
128
};
...
@@ -219,6 +274,96 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -219,6 +274,96 @@ export default function getThumbnailCallback(abilityContext) {
let
size
=
{
width
:
1024
,
height
:
1024
};
let
size
=
{
width
:
1024
,
height
:
1024
};
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
});
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by 1
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_03"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_03"
;
let
dOp
=
fetchOpsNew
(
'Pictures/Thumbnail/'
,
IMAGE_TYPE
);
let
size
=
1
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by 'str'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_04"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_04"
;
let
dOp
=
fetchOpsNew
(
'Pictures/Thumbnail/'
,
IMAGE_TYPE
);
let
size
=
"str"
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_05"
;
let
dOp
=
fetchOpsNew
(
'Pictures/Thumbnail/'
,
IMAGE_TYPE
);
let
size
=
true
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_06"
;
let
dOp
=
fetchOpsNew
(
'Pictures/Thumbnail/'
,
IMAGE_TYPE
);
let
size
=
false
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by null
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_07"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_07"
;
let
dOp
=
fetchOpsNew
(
'Pictures/Thumbnail/'
,
IMAGE_TYPE
);
let
size
=
null
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_08
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by {width: 99999, height: 99999}
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_08"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_001_08"
;
let
dOp
=
fetchOpsNew
(
'Pictures/Thumbnail/'
,
IMAGE_TYPE
);
let
size
=
{
width
:
99999
,
height
:
99999
};
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
// ------------------------------image type end--------------------------
// ------------------------------image type end--------------------------
// ------------------------------video type start -----------------------
// ------------------------------video type start -----------------------
...
@@ -288,9 +433,9 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -288,9 +433,9 @@ export default function getThumbnailCallback(abilityContext) {
* @tc.desc : getThumbnail(video) by { width: 0, height: 0 }
* @tc.desc : getThumbnail(video) by { width: 0, height: 0 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_05"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_05"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_05"
;
let
dOp
=
fetchOps
(
testNum
,
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
{
width
:
0
,
height
:
0
};
let
size
=
{
width
:
0
,
height
:
0
};
...
@@ -303,9 +448,9 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -303,9 +448,9 @@ export default function getThumbnailCallback(abilityContext) {
* @tc.desc : getThumbnail(video) by { width: -128, height: -128 }
* @tc.desc : getThumbnail(video) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_06"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_06"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_002_06"
;
let
dOp
=
fetchOps
(
testNum
,
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
{
width
:
-
128
,
height
:
-
128
};
let
size
=
{
width
:
-
128
,
height
:
-
128
};
...
@@ -326,6 +471,96 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -326,6 +471,96 @@ export default function getThumbnailCallback(abilityContext) {
let
size
=
{
width
:
1024
,
height
:
1024
};
let
size
=
{
width
:
1024
,
height
:
1024
};
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
});
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by 1
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_03"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_03"
;
let
dOp
=
fetchOpsNew
(
'Videos/Thumbnail/'
,
VIDEO_TYPE
);
let
size
=
1
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by 'str'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_04"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_04"
;
let
dOp
=
fetchOpsNew
(
'Videos/Thumbnail/'
,
VIDEO_TYPE
);
let
size
=
'str'
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_05"
;
let
dOp
=
fetchOpsNew
(
'Videos/Thumbnail/'
,
VIDEO_TYPE
);
let
size
=
true
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_06"
;
let
dOp
=
fetchOpsNew
(
'Videos/Thumbnail/'
,
VIDEO_TYPE
);
let
size
=
false
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by null
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_07"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_07"
;
let
dOp
=
fetchOpsNew
(
'Videos/Thumbnail/'
,
VIDEO_TYPE
);
let
size
=
null
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_08
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by {width: 99999, height: 99999}
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_08"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_002_08"
;
let
dOp
=
fetchOpsNew
(
'Videos/Thumbnail/'
,
VIDEO_TYPE
);
let
size
=
{
width
:
99999
,
height
:
99999
};
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
// ------------------------------video type end--------------------------
// ------------------------------video type end--------------------------
// ------------------------------audio type start -----------------------
// ------------------------------audio type start -----------------------
...
@@ -395,9 +630,9 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -395,9 +630,9 @@ export default function getThumbnailCallback(abilityContext) {
* @tc.desc : getThumbnail(audio) by { width: 0, height: 0 }
* @tc.desc : getThumbnail(audio) by { width: 0, height: 0 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_05"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_05"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_05"
;
let
dOp
=
fetchOps
(
testNum
,
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
{
width
:
0
,
height
:
0
};
let
size
=
{
width
:
0
,
height
:
0
};
...
@@ -410,9 +645,9 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -410,9 +645,9 @@ export default function getThumbnailCallback(abilityContext) {
* @tc.desc : getThumbnail(audio) by { width: -128, height: -128 }
* @tc.desc : getThumbnail(audio) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_06"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_06"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_CALLBACK_003_06"
;
let
dOp
=
fetchOps
(
testNum
,
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
{
width
:
-
128
,
height
:
-
128
};
let
size
=
{
width
:
-
128
,
height
:
-
128
};
...
@@ -433,6 +668,96 @@ export default function getThumbnailCallback(abilityContext) {
...
@@ -433,6 +668,96 @@ export default function getThumbnailCallback(abilityContext) {
let
size
=
{
width
:
1024
,
height
:
1024
};
let
size
=
{
width
:
1024
,
height
:
1024
};
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
});
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by 1
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_03"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_03"
;
let
dOp
=
fetchOpsNew
(
'Audios/Thumbnail/'
,
AUDIO_TYPE
);
let
size
=
1
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by 'str'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_04"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_04"
;
let
dOp
=
fetchOpsNew
(
'Audios/Thumbnail/'
,
AUDIO_TYPE
);
let
size
=
'str'
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_05"
;
let
dOp
=
fetchOpsNew
(
'Audios/Thumbnail/'
,
AUDIO_TYPE
);
let
size
=
true
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_06"
;
let
dOp
=
fetchOpsNew
(
'Audios/Thumbnail/'
,
AUDIO_TYPE
);
let
size
=
false
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by null
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_07"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_07"
;
let
dOp
=
fetchOpsNew
(
'Audios/Thumbnail/'
,
AUDIO_TYPE
);
let
size
=
null
;
await
testGetThumbnailTypeError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_08
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by {width: 99999, height: 99999}
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_08"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_ERROR_CALLBACK_003_08"
;
let
dOp
=
fetchOpsNew
(
'Audios/Thumbnail/'
,
AUDIO_TYPE
);
let
size
=
{
width
:
99999
,
height
:
99999
};
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
// ------------------------------audio type end--------------------------
// ------------------------------audio type end--------------------------
});
});
}
}
\ No newline at end of file
multimedia/medialibrary/mediaLibrary_getThumbnail/entry/src/main/ets/test/getThumbnailPromise.test.ets
浏览文件 @
a4e61b8b
/*
/*
* Copyright (C) 2022 Huawei Device Co., Ltd.
* Copyright (C) 2022
-2023
Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* You may obtain a copy of the License at
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
import
mediaLibrary
from
"@ohos.multimedia.mediaLibrary"
;
import
mediaLibrary
from
"@ohos.multimedia.mediaLibrary"
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
"deccjsunit/index"
;
import
{
describe
,
beforeAll
,
beforeEach
,
afterEach
,
afterAll
,
it
,
expect
}
from
"deccjsunit/index"
;
import
fileio
from
'@ohos.fileio'
;
import
image
from
"@ohos.multimedia.image"
;
import
image
from
"@ohos.multimedia.image"
;
import
{
import
{
sleep
,
sleep
,
...
@@ -29,7 +30,11 @@ import {
...
@@ -29,7 +30,11 @@ import {
export
default
function
getThumbnailPromise
(
abilityContext
)
{
export
default
function
getThumbnailPromise
(
abilityContext
)
{
describe
(
"getThumbnailPromise"
,
function
()
{
describe
(
"getThumbnailPromise"
,
function
()
{
image
.
createPixelMap
(
new
ArrayBuffer
(
4096
),
{
size
:
{
height
:
1
,
width
:
2
}
})
.
then
((
pixelmap
)
=>
{});
image
.
createPixelMap
(
new
ArrayBuffer
(
4096
),
{
size
:
{
height
:
1
,
width
:
2
}
})
.
then
((
pixelmap
)
=>
{});
console
.
info
(
'MediaLibraryTest : getMediaLibrary IN'
);
const
media
=
mediaLibrary
.
getMediaLibrary
(
abilityContext
);
const
media
=
mediaLibrary
.
getMediaLibrary
(
abilityContext
);
console
.
info
(
'MediaLibraryTest : getMediaLibrary OUT'
);
let
fileKeyObj
=
mediaLibrary
.
FileKey
;
beforeAll
(
async
function
()
{
beforeAll
(
async
function
()
{
console
.
info
(
"beforeAll case"
);
console
.
info
(
"beforeAll case"
);
});
});
...
@@ -44,6 +49,32 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -44,6 +49,32 @@ export default function getThumbnailPromise(abilityContext) {
console
.
info
(
"afterAll case"
);
console
.
info
(
"afterAll case"
);
});
});
function
fetchThumbnailOps
(
id
){
return
{
selections
:
fileKeyObj
.
ID
+
'= ? AND '
+
'lcd is not null'
+
' AND '
+
'thumbnail is not null'
,
selectionArgs
:
[
id
+
''
],
};
}
function
fetchOpsNew
(
path
,
type
){
return
{
selections
:
fileKeyObj
.
RELATIVE_PATH
+
'= ? AND '
+
fileKeyObj
.
MEDIA_TYPE
+
'=?'
,
selectionArgs
:
[
path
,
type
.
toString
()],
order
:
fileKeyObj
.
DATE_ADDED
,
};
}
function
checkCount
(
done
,
testNum
,
count
){
console
.
info
(
'${testNum}::count:${count}'
);
if
(
count
<=
0
){
console
.
info
(
'${testNum}::resources is empty'
);
expect
(
false
)
.
assertTrue
();
done
();
return
false
;
}
return
true
;
}
async
function
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
)
{
async
function
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
)
{
try
{
try
{
let
fetchFileResult
=
await
media
.
getFileAssets
(
dOp
);
let
fetchFileResult
=
await
media
.
getFileAssets
(
dOp
);
...
@@ -99,6 +130,13 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -99,6 +130,13 @@ export default function getThumbnailPromise(abilityContext) {
}
}
}
}
async
function
copyFile
(
fd1
,
fd2
){
let
stat
=
await
fileio
.
fstat
(
fd1
);
let
buf
=
new
ArrayBuffer
(
stat
.
size
);
await
fileio
.
read
(
fd1
,
buf
);
await
fileio
.
write
(
fd2
,
buf
);
}
// ------------------------------ image type start -----------------------
// ------------------------------ image type start -----------------------
/**
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_01
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_01
...
@@ -166,9 +204,9 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -166,9 +204,9 @@ export default function getThumbnailPromise(abilityContext) {
* @tc.desc : getThumbnail(image) by { width: 1024, height: 1024 }
* @tc.desc : getThumbnail(image) by { width: 1024, height: 1024 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_05"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_05"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_05"
;
let
dOp
=
fetchOps
(
testNum
,
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
{
width
:
0
,
height
:
0
};
let
size
=
{
width
:
0
,
height
:
0
};
...
@@ -181,9 +219,9 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -181,9 +219,9 @@ export default function getThumbnailPromise(abilityContext) {
* @tc.desc : getThumbnail(image) by { width: -128, height: -128 }
* @tc.desc : getThumbnail(image) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_06"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_06"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_001_06"
;
let
dOp
=
fetchOps
(
testNum
,
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
{
width
:
-
128
,
height
:
-
128
};
let
size
=
{
width
:
-
128
,
height
:
-
128
};
...
@@ -203,6 +241,95 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -203,6 +241,95 @@ export default function getThumbnailPromise(abilityContext) {
let
size
=
{
width
:
1024
,
height
:
1024
};
let
size
=
{
width
:
1024
,
height
:
1024
};
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
});
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by 1
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_03"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_03"
;
let
dOp
=
fetchOpsNew
(
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
1
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by 'str'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_04"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_04"
;
let
dOp
=
fetchOpsNew
(
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
"str"
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_05"
;
let
dOp
=
fetchOpsNew
(
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
true
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_06"
;
let
dOp
=
fetchOpsNew
(
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
false
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by null
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_07"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_07"
;
let
dOp
=
fetchOpsNew
(
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
null
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_08
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(image) by { width: 99999, height: 99999 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_08"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_001_08"
;
let
dOp
=
fetchOpsNew
(
"Pictures/Thumbnail/"
,
IMAGE_TYPE
);
let
size
=
{
width
:
99999
,
height
:
99999
};
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
// ------------------------------image type end--------------------------
// ------------------------------image type end--------------------------
// ------------------------------video type start -----------------------
// ------------------------------video type start -----------------------
...
@@ -272,9 +399,9 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -272,9 +399,9 @@ export default function getThumbnailPromise(abilityContext) {
* @tc.desc : getThumbnail(video) by { width: 0, height: 0 }
* @tc.desc : getThumbnail(video) by { width: 0, height: 0 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_05"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_05"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_05"
;
let
dOp
=
fetchOps
(
testNum
,
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
{
width
:
0
,
height
:
0
};
let
size
=
{
width
:
0
,
height
:
0
};
...
@@ -287,9 +414,9 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -287,9 +414,9 @@ export default function getThumbnailPromise(abilityContext) {
* @tc.desc : getThumbnail(video) by { width: -128, height: -128 }
* @tc.desc : getThumbnail(video) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_06"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_06"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_002_06"
;
let
dOp
=
fetchOps
(
testNum
,
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
{
width
:
-
128
,
height
:
-
128
};
let
size
=
{
width
:
-
128
,
height
:
-
128
};
...
@@ -310,6 +437,95 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -310,6 +437,95 @@ export default function getThumbnailPromise(abilityContext) {
let
size
=
{
width
:
1024
,
height
:
1024
};
let
size
=
{
width
:
1024
,
height
:
1024
};
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
});
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by 1
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_03"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_03"
;
let
dOp
=
fetchOpsNew
(
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
1
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by 'str'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_04"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_04"
;
let
dOp
=
fetchOpsNew
(
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
"str"
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_05"
;
let
dOp
=
fetchOpsNew
(
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
true
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_06"
;
let
dOp
=
fetchOpsNew
(
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
false
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by null
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_07"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_07"
;
let
dOp
=
fetchOpsNew
(
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
null
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_08
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(video) by { width: 99999, height: 99999 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_08"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_002_08"
;
let
dOp
=
fetchOpsNew
(
"Videos/Thumbnail/"
,
VIDEO_TYPE
);
let
size
=
{
width
:
99999
,
height
:
99999
};
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
// ------------------------------video type end--------------------------
// ------------------------------video type end--------------------------
// ------------------------------audio type start -----------------------
// ------------------------------audio type start -----------------------
...
@@ -379,9 +595,9 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -379,9 +595,9 @@ export default function getThumbnailPromise(abilityContext) {
* @tc.desc : getThumbnail(audio) by { width: 0, height: 0 }
* @tc.desc : getThumbnail(audio) by { width: 0, height: 0 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_05"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_05"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_05"
;
let
dOp
=
fetchOps
(
testNum
,
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
{
width
:
0
,
height
:
0
};
let
size
=
{
width
:
0
,
height
:
0
};
...
@@ -394,9 +610,9 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -394,9 +610,9 @@ export default function getThumbnailPromise(abilityContext) {
* @tc.desc : getThumbnail(audio) by { width: -128, height: -128 }
* @tc.desc : getThumbnail(audio) by { width: -128, height: -128 }
* @tc.size : MEDIUM
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.type : Function
* @tc.level : Level
0
* @tc.level : Level
3
*/
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_06"
,
0
,
async
function
(
done
)
{
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_06"
;
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_003_06"
;
let
dOp
=
fetchOps
(
testNum
,
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
dOp
=
fetchOps
(
testNum
,
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
{
width
:
-
128
,
height
:
-
128
};
let
size
=
{
width
:
-
128
,
height
:
-
128
};
...
@@ -417,6 +633,95 @@ export default function getThumbnailPromise(abilityContext) {
...
@@ -417,6 +633,95 @@ export default function getThumbnailPromise(abilityContext) {
let
size
=
{
width
:
1024
,
height
:
1024
};
let
size
=
{
width
:
1024
,
height
:
1024
};
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
await
testGetThumbnail
(
done
,
testNum
,
dOp
,
size
);
});
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_03
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by 1
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_03"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_03"
;
let
dOp
=
fetchOpsNew
(
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
1
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_04
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by 'str'
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_04"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_04"
;
let
dOp
=
fetchOpsNew
(
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
"str"
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_05
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by true
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_05"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_05"
;
let
dOp
=
fetchOpsNew
(
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
true
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_06
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by false
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_06"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_06"
;
let
dOp
=
fetchOpsNew
(
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
false
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_07
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by null
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_07"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_07"
;
let
dOp
=
fetchOpsNew
(
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
null
;
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
/**
* @tc.number : SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_08
* @tc.name : getThumbnail
* @tc.desc : getThumbnail(audio) by { width: 99999, height: 99999 }
* @tc.size : MEDIUM
* @tc.type : Function
* @tc.level : Level 3
*/
it
(
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_08"
,
3
,
async
function
(
done
)
{
let
testNum
=
"SUB_MEDIA_MEDIALIBRARY_GETTHUMBNAIL_PROMISE_ERROR_003_08"
;
let
dOp
=
fetchOpsNew
(
"Audios/Thumbnail/"
,
AUDIO_TYPE
);
let
size
=
{
width
:
99999
,
height
:
99999
};
await
testGetThumbnailError
(
done
,
testNum
,
dOp
,
size
);
});
// ------------------------------audio type end--------------------------
// ------------------------------audio type end--------------------------
});
});
}
}
\ No newline at end of file
鸿蒙社区
@harmonycommunity
mentioned in commit
70f01f3d
·
3月 01, 2023
mentioned in commit
70f01f3d
mentioned in commit 70f01f3d5fd3240f7bc1e24d1c98b51434bae517
开关提交列表
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录